2011-12-27 13:54:25 -05:00
|
|
|
// filebot -script "http://filebot.sf.net/scripts/rsam.groovy" <options> <folder>
|
2011-11-02 04:26:25 -04:00
|
|
|
|
2011-12-22 14:36:31 -05:00
|
|
|
|
|
|
|
def isMatch(a, b) { similarity(a, b) > 0.9 }
|
2011-10-30 12:55:32 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Rename anime, tv shows or movies (assuming each folder represents one item)
|
|
|
|
*/
|
|
|
|
args.eachMediaFolder { dir ->
|
2011-11-02 04:26:25 -04:00
|
|
|
def n = dir.name
|
2012-01-05 00:30:22 -05:00
|
|
|
|
|
|
|
[ [db:anidb, query:{ anidb.search(n, _args.locale).find{ isMatch(it, n) } }],
|
|
|
|
[db:thetvdb, query:{ thetvdb.search(n, _args.locale).find{ isMatch(it, n) } }],
|
|
|
|
[db:themoviedb, query:{ themoviedb.searchMovie(n, _args.locale).find{ isMatch(it, n) } }]
|
2011-10-30 12:55:32 -04:00
|
|
|
].find {
|
|
|
|
def match = it.query()
|
2011-11-02 04:26:25 -04:00
|
|
|
if (match) { rename(folder:dir, db:it.db.name, query:match.name) }
|
2011-10-30 12:55:32 -04:00
|
|
|
return match
|
|
|
|
}
|
|
|
|
}
|