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.*
|
||||
|
||||
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
|
||||
|
@ -6,31 +6,34 @@
|
||||
import static net.sourceforge.filebot.WebServices.*
|
||||
|
||||
|
||||
def fetchBanner(dir, series, bannerType, bannerType2, season = null) {
|
||||
def name = "$series $bannerType ${season ? 'S'+season : 'all'} $bannerType2".space('.')
|
||||
|
||||
def fetchBanner(outputDir, outputName, series, bannerType, bannerType2, season = null) {
|
||||
// select and fetch banner
|
||||
def banner = TheTVDB.getBanner(series, bannerType, bannerType2, season, Locale.ENGLISH)
|
||||
if (banner == null) {
|
||||
println "Banner not found: $name"
|
||||
return;
|
||||
println "Banner not found: $outputName"
|
||||
return null
|
||||
}
|
||||
|
||||
println "Fetching $name"
|
||||
banner.url.saveAs(new File(dir, name + "." + banner.extension))
|
||||
def output = new File(outputDir, outputName + "." + banner.extension)
|
||||
println "SaveAs $output"
|
||||
return banner.url.saveAs(output)
|
||||
}
|
||||
|
||||
|
||||
def fetchSeriesBanners(dir, series, seasons) {
|
||||
println "Fetch banners for $series / Season $seasons"
|
||||
|
||||
// fetch series banner
|
||||
fetchBanner(dir, series, "series", "graphical")
|
||||
// fetch series banner, fanart, posters, etc
|
||||
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
|
||||
seasons.each { s ->
|
||||
fetchBanner(dir, series, "season", "season", s)
|
||||
fetchBanner(dir, series, "season", "seasonwide", s)
|
||||
fetchBanner(dir, "folder-S${s.pad(2)}", series, "season", "season", s)
|
||||
fetchBanner(dir, "banner-S${s.pad(2)}", series, "season", "seasonwide", s)
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,6 +45,11 @@ args.eachMediaFolder() { dir ->
|
||||
def seriesName = detectSeriesName(videoFiles)
|
||||
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)
|
||||
if (options.isEmpty()) {
|
||||
println "TV Series not found: $seriesName"
|
||||
|
Loading…
Reference in New Issue
Block a user