AMC: User-defined Filename to Series Mapping
Posted: 15 Sep 2014, 13:39
I really like how quick and easy FileBot is, EXCEPT when I had to resolve a series look-up conflict. The non-strict switch wasn't doing it for me since I got some false positives, so I decided to add a way to explicitly say what file name maps to what show without having to execute multiple runs of AMC.
New Usage Option:
The rest of the usage is the same as normal AMC.
https://github.com/jwyant/scripts/blob/devel/amc.groovy
Added new command-line switch - mapfile
Added logic to filter on show based on file-name for multiple entries in the same AMC pass.
I'm unsure how well this works on Windows since I look for a beginning "/" before the actual filename to filter out mid-filename matches.
The mapfile format is "filter from the start of the filename";"TVDB Series Name"
Example mapfile:
I would certainly be nice if I could map directly to a specific tvdbid, but I have not figured that out yet. Also, I just started playing with Groovy as of yesterday, so please excuse any ugly code...
New Usage Option:
Code: Select all
filebot --def mapfile=/path/to/mapfile.txt
https://github.com/jwyant/scripts/blob/devel/amc.groovy
Added new command-line switch - mapfile
Code: Select all
// user-defined show mapping
def fileMappings = tryQuietly{ csv(mapfile) }
Code: Select all
def dest = null
fileMappings.each{ fileMapping, showMapping ->
if (dest == null) { dest = rename(file: files.findAll{ it =~ /(?i:\/${fileMapping})/}, query: "${showMapping}", format: config.format, db: config.db) }
}
// if it's still null (we've exhausted all exceptions), just do a normal match
if (dest == null) { dest = rename(file: files, format: config.format, db: config.db) }
The mapfile format is "filter from the start of the filename";"TVDB Series Name"
Example mapfile:
Code: Select all
Louie;Louie (2010)
Top.Gear;Top Gear