mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 08:48:51 -05:00
* simplify banner naming
This commit is contained in:
parent
4be0846a53
commit
e638a4f28f
@ -47,7 +47,7 @@ String.metaClass.hasExtension = { String... ext -> hasExtension(delegate, ext) }
|
|||||||
import static net.sourceforge.filebot.web.WebRequest.*
|
import static net.sourceforge.filebot.web.WebRequest.*
|
||||||
|
|
||||||
URL.metaClass.parseHtml = { new XmlParser(false, false).parseText(getXmlString(getHtmlDocument(delegate))) };
|
URL.metaClass.parseHtml = { new XmlParser(false, false).parseText(getXmlString(getHtmlDocument(delegate))) };
|
||||||
URL.metaClass.saveAs = { f -> writeFile(fetch(delegate), f) }
|
URL.metaClass.saveAs = { f -> writeFile(fetch(delegate), f); f.absolutePath }
|
||||||
|
|
||||||
|
|
||||||
// Shell helper
|
// Shell helper
|
||||||
|
@ -6,31 +6,34 @@
|
|||||||
import static net.sourceforge.filebot.WebServices.*
|
import static net.sourceforge.filebot.WebServices.*
|
||||||
|
|
||||||
|
|
||||||
def fetchBanner(dir, series, bannerType, bannerType2, season = null) {
|
def fetchBanner(outputDir, outputName, series, bannerType, bannerType2, season = null) {
|
||||||
def name = "$series $bannerType ${season ? 'S'+season : 'all'} $bannerType2".space('.')
|
|
||||||
|
|
||||||
// select and fetch banner
|
// select and fetch banner
|
||||||
def banner = TheTVDB.getBanner(series, bannerType, bannerType2, season, Locale.ENGLISH)
|
def banner = TheTVDB.getBanner(series, bannerType, bannerType2, season, Locale.ENGLISH)
|
||||||
if (banner == null) {
|
if (banner == null) {
|
||||||
println "Banner not found: $name"
|
println "Banner not found: $outputName"
|
||||||
return;
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
println "Fetching $name"
|
def output = new File(outputDir, outputName + "." + banner.extension)
|
||||||
banner.url.saveAs(new File(dir, name + "." + banner.extension))
|
println "SaveAs $output"
|
||||||
|
return banner.url.saveAs(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def fetchSeriesBanners(dir, series, seasons) {
|
def fetchSeriesBanners(dir, series, seasons) {
|
||||||
println "Fetch banners for $series / Season $seasons"
|
println "Fetch banners for $series / Season $seasons"
|
||||||
|
|
||||||
// fetch series banner
|
// fetch series banner, fanart, posters, etc
|
||||||
fetchBanner(dir, series, "series", "graphical")
|
fetchBanner(dir, "folder", series, "poster", "680x1000")
|
||||||
|
fetchBanner(dir, "banner", series, "series", "graphical")
|
||||||
|
|
||||||
|
// fetch highest resolution fanart
|
||||||
|
["1920x1080", "1280x720"].findResult{ bannerType2 -> fetchBanner(dir, "fanart", series, "fanart", bannerType2) }
|
||||||
|
|
||||||
// fetch season banners
|
// fetch season banners
|
||||||
seasons.each { s ->
|
seasons.each { s ->
|
||||||
fetchBanner(dir, series, "season", "season", s)
|
fetchBanner(dir, "folder-S${s.pad(2)}", series, "season", "season", s)
|
||||||
fetchBanner(dir, series, "season", "seasonwide", s)
|
fetchBanner(dir, "banner-S${s.pad(2)}", series, "season", "seasonwide", s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,6 +45,11 @@ args.eachMediaFolder() { dir ->
|
|||||||
def seriesName = detectSeriesName(videoFiles)
|
def seriesName = detectSeriesName(videoFiles)
|
||||||
def seasons = videoFiles.findResults { guessEpisodeNumber(it)?.season }.unique()
|
def seasons = videoFiles.findResults { guessEpisodeNumber(it)?.season }.unique()
|
||||||
|
|
||||||
|
if (seriesName == null) {
|
||||||
|
println "Failed to detect series name from files -> Query by ${dir.name} instead"
|
||||||
|
seriesName = dir.name
|
||||||
|
}
|
||||||
|
|
||||||
def options = TheTVDB.search(seriesName)
|
def options = TheTVDB.search(seriesName)
|
||||||
if (options.isEmpty()) {
|
if (options.isEmpty()) {
|
||||||
println "TV Series not found: $seriesName"
|
println "TV Series not found: $seriesName"
|
||||||
|
Loading…
Reference in New Issue
Block a user