From 6b8e47d5318209234c821aed1cdee4bba0035da0 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 2 Nov 2011 08:26:25 +0000 Subject: [PATCH] * beautify sample-script --- website/data/shell/rsam.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/website/data/shell/rsam.groovy b/website/data/shell/rsam.groovy index 769c698f..44555317 100644 --- a/website/data/shell/rsam.groovy +++ b/website/data/shell/rsam.groovy @@ -1,20 +1,22 @@ +// filebot -script "http://filebot.sourceforge.net/data/shell/rsam.groovy" + import net.sourceforge.filebot.similarity.* -def lang = Locale.ENGLISH def isMatch(a, b) { new NameSimilarityMetric().getSimilarity(a, b) > 0.9 } /* * Rename anime, tv shows or movies (assuming each folder represents one item) */ args.eachMediaFolder { dir -> - def n = dir.getName() + def n = dir.name + def lang = Locale.ENGLISH [ [db:anidb, query:{ anidb.search(n, lang).find{ isMatch(it, n) } }], [db:thetvdb, query:{ thetvdb.search(n, lang).find{ isMatch(it, n) } }], [db:themoviedb, query:{ themoviedb.searchMovie(n, lang).find{ isMatch(it, n) } }] ].find { def match = it.query() - if (match) { rename(folder:dir, db:it.db.getName(), query:match.getName()) } + if (match) { rename(folder:dir, db:it.db.name, query:match.name) } return match } }