From d4b378e93647831c51c6aa2119a6dd8dd0db8658 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 1 Apr 2012 11:12:33 +0000 Subject: [PATCH] * support --conflict option in artwork.* scripts --- website/scripts/artwork.tmdb.groovy | 8 +++++++- website/scripts/artwork.tvdb.groovy | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/website/scripts/artwork.tmdb.groovy b/website/scripts/artwork.tmdb.groovy index c4d8d15f..93ba78fe 100644 --- a/website/scripts/artwork.tmdb.groovy +++ b/website/scripts/artwork.tmdb.groovy @@ -54,13 +54,19 @@ def fetchMovieArtworkAndNfo(movieDir, movie) { args.eachMediaFolder { dir -> + // fetch only missing artwork by default + if (_args.conflict == "skip" && dir.hasFile{it =~ /movie.nfo$/} && dir.hasFile{it =~ /folder.jpg$/} && dir.hasFile{it =~ /backdrop.jpg$/}) { + println "Skipping $dir" + return + } + def videos = dir.listFiles{ it.isVideo() } def query = _args.query ?: dir.name def options = TheMovieDB.searchMovie(query, _args.locale) if (options.isEmpty()) { println "Movie not found: $query" - return null + return } // sort by relevance diff --git a/website/scripts/artwork.tvdb.groovy b/website/scripts/artwork.tvdb.groovy index 56e4504a..441832be 100644 --- a/website/scripts/artwork.tvdb.groovy +++ b/website/scripts/artwork.tvdb.groovy @@ -89,6 +89,12 @@ def fetchSeriesBannersAndNfo(seriesDir, seasonDir, series, season) { args.eachMediaFolder { dir -> + // fetch only missing artwork by default + if (_args.conflict == "skip" && dir.hasFile{it =~ /tvshow.nfo$/} && dir.hasFile{it =~ /folder.jpg$/} && dir.hasFile{it =~ /banner.jpg$/}) { + println "Skipping $dir" + return + } + def videos = dir.listFiles{ it.isVideo() } def query = _args.query ?: detectSeriesName(videos, _args.locale) @@ -102,7 +108,7 @@ args.eachMediaFolder { dir -> def options = TheTVDB.search(query, _args.locale) if (options.isEmpty()) { println "TV Series not found: $query" - return null + return } // sort by relevance @@ -114,7 +120,7 @@ args.eachMediaFolder { dir -> // maybe require user input if (options.size() != 1 && !_args.nonStrict && !java.awt.GraphicsEnvironment.headless) { series = javax.swing.JOptionPane.showInputDialog(null, "Please select TV Show:", dir.path, 3, null, options.toArray(), series); - if (series == null) return null + if (series == null) return } // auto-detect structure