Page 1 of 1

Regarding AMC, CLI, and overrides

Posted: 29 Mar 2014, 10:42
by Hornet
This sort of crosses a few categories, so hopefully it makes sense to deal with under the common denominator, which is the CLI.

I'm running filebot on torrents after they're finished, and there's some python beforehand to sort the files into other directories so I can target say eg /anime with entirely different rules to /films. So far so good.


The problem comes when certain episodes are mismatched; I can't see how to use overrides from the CLI. As this is a general script, targetting via --filter or --q are out, and the override method is only groovy-based. I'm very much wanting to avoid forking the AMC script into a local copy if possible.

So, the questions this situation presents; is it possible to specify an override file list, like the csv mappings, from the CLI only?
If not, can one 'extend' the AMC script, rather than having to make and manually sync a local copy? Ideally without hackarounds like automated diffmerging etc.

(On the topic of linux & updates, is the only method to get automatic updates via the ubuntu app store? Not all of us run ubuntu.)


For specifics, a log snippet from a strict match on an awkward file:

Input: /volatile/torrents/__finished/anime/[UTW]_Chuunibyou_demo_Koi_ga_Shitai!_Ren_Lite_-_01_[D23D8BC7]/[UTW]_Chuunibyou_demo_Koi_ga_Shitai!_Ren_Lite_-_02_[34F0B200].mkv
Group: [anime:chuunibyou demo koi ga shitai ren] => [[UTW]_Chuunibyou_demo_Koi_ga_Shitai!_Ren_Lite_-_02_[34F0B200].mkv]
Rename episodes using [AniDB]
Auto-detected query: [Chuunibyou demo Koi ga Shitai Ren]
Exception: Multiple options: Force auto-select requires non-strict matching: [Chuunibyou demo Koi ga Shitai! Ren, Chuunibyou demo Koi ga Shitai!, Takanashi Rikka Kai: Gekijouban Chuunibyou demo Koi ga Shitai!]


A non-strict:
[TEST] Rename [/volatile/torrents/__finished/anime/[UTW]_Chuunibyou_demo_Koi_ga_Shitai!_Ren_Lite_-_01_[D23D8BC7]/[UTW]_Chuunibyou_demo_Koi_ga_Shitai!_Ren_Lite_-_02_[34F0B200].mkv] to [/home/codex/Anime/Love, Chunibyo and Other Delusions! Heart Throb/Love, Chunibyo and Other Delusions! Heart Throb - 02 - Dolphin Ring Striker.mkv]

...and clearly that's picked precisely the wrong one, and thus it's gone to hell in a handcart. I realise it's a contrived example - Ren Lite is hardly worth adding to XBMC - but it does show the point well enough I hope.


Thanks for the excellent program, incredibly useful.

Re: Regarding AMC, CLI, and overrides

Posted: 29 Mar 2014, 11:35
by rednoah
1.
You can fork the whole repo on GitHub, and then there should be an easy to merge my updates into your fork once in a while.

2.
Yes. But you're welcome to make and maintain a package for whatever distro you're using.

If you just wanna grab the latest jar you can easily to it like this:
https://sourceforge.net/p/filebot/code/ ... filebot.sh

3.
Actually it's not clear at all. :D Which one should it have picked? :?

Original file is Chuunibyou demo Koi ga Shitai! Ren and it gets renamed to Love, Chunibyo and Other Delusions! Heart Throb which is the correct match.

In any case, you can always specifically exclude matches with --filter:

Code: Select all

--filter "!(n =~ /Heart Throb/)"
You can define filters quite generically and this one example will only affect shows that contain this specific substring.

Re: Regarding AMC, CLI, and overrides

Posted: 29 Mar 2014, 12:17
by Hornet
Cheers for the quick reply.

1: I see... sort of what I was fearing then, just online rather than local. Will try extra hard to avoid needing to modify the script in that case.

2: Damn. I'll have to look into options then, although hopefully you're not likely to introduce script/version incompatibilities lightly.

3: That's a bit of a trick question to be fair, as the answer is actually none of the options. They're the 'lite' episodes for Ren, which are sort of extras in a way. Filesize for each is tiny, about 15mb. This is why I was questing after a literal override system, that could take say the series token, look it up in a keyed array (or csv) and spit out the preferred title. Most of the time this would just be for cosmetic preference, eg your DS9 example ( http://www.filebot.net/forums/viewtopic.php?f=5&t=182 ).

It's possible that the csv clause could work on the command line, but I can't seem to get it to do so, with a test on a simple film:

filebot -script fn:amc --output "/home/codex/Films/" --action test -extract -r -non-strict "/volatile/torrents/__finished/films/" --def 'movieFormat=/home/codex/Films/{csv(":/home/hornet/scripts/film-overrides.csv").get(n) ?: n} ({y})/{n} ({y}){" CD$pi"}{".$lang"}' minFileSize=10 artwork=n deleteAfterExtract=y excludeList=/home/hornet/.filebot/film-exceptions5.txt --log-file /home/hornet/.filebot/logs/film.2014-03.txt
Locking /home/hornet/.filebot/logs/film.2014-03.txt
Parameter: movieFormat = /home/codec/Films/{csv(":/home/hornet/scripts/film-overrides.csv").get(n) ?: n} ({y})/{n} ({y}){" CD$pi"}{".$lang"}
Parameter: minFileSize = 10
Parameter: artwork = n
Parameter: deleteAfterExtract = y
Parameter: excludeList = /home/hornet/.filebot/film-exceptions5.txt
Argument: /volatile/torrents/__finished/films
Input: /volatile/torrents/__finished/films/Devil.2010.720p.BrRip.x264.BOKUTOX.YIFY.mp4
Devil.2010.720p.BrRip.x264.BOKUTOX.YIFY.mp4 [series: null, movie: Devil (2010)]
Group: [tvs:null, mov:devil 2010, anime:null] => [Devil.2010.720p.BrRip.x264.BOKUTOX.YIFY.mp4]
Rename movies using [TheMovieDB]
Auto-detect movie from context: [/volatile/torrents/__finished/films/Devil.2010.720p.BrRip.x264.BOKUTOX.YIFY.mp4]
[TEST] Rename [/volatile/torrents/__finished/films/Devil.2010.720p.BrRip.x264.BOKUTOX.YIFY.mp4] to [/home/codex/Films/Devil (2010)/Devil (2010).mp4]


To give it a range of fuel, the CSV is:
'Devil','Deviltest'
'Devil (2010)','Devil alternate (2010)'
'devil 2010','Devil last alternate 2010'
'Foo','Bar'

The question I suppose then, assuming it is possible to use the function in this way, is what is the 'n' that is queried against the csv - is it post-cleanup, raw, or...?

Thanks again.

Re: Regarding AMC, CLI, and overrides

Posted: 29 Mar 2014, 12:36
by rednoah
1.
So it's not the AniDB at all then. Then you need to ignore it.

You can add an ignore pattern like this:

Code: Select all

--def ignore=Ren.Lite
However, files smaller than 50 MB or shorter than 10 min are ignored by default. So this shouldn't be an issue normally.


2.
{n} is the series title as specified in the database for your chosen language, in your case the English title. Or if you need it you can use {primaryTitle} to get the Japanese-Romanized series name.

Again the format only allows you to format the match. There is no way you can set a specifics shows to be used for specific files.

Re: Regarding AMC, CLI, and overrides

Posted: 30 Mar 2014, 07:03
by Hornet
I see, thanks again.

I'm now trying to use the csv method as a formatting tool as outlined, but it seems unable to find matches. Could you please verify what format it expects the file to be in?

If I'm reading things correctly, it should look for 'Blue Submarine No.6' in the CSV file, yet even with three different line formats, it seems unable to match and relabel them. I realise ; isn't usually csv, however it was used in your example so I threw it in at the end just in case. This is just a test with a simple filename, usually I'd be wanting to relabel things much more drastically. As you can see from the log, the output title is still the full 'Blue Submarine No.6' returned by anidb, which is precisely the title & spacing used in the csv file.

CSV file:
'Blue Submarine No.6','Blue Submarine'
"Blue Submarine No.6","Blue Submarine"
Blue Submarine No.6;Blue Submarine

Details:

filebot -script fn:amc --output '/home/codex/Anime/' --action test -extract -r -non-strict '/volatile/torrents/__finished/anime/' --def "animeFormat=/home/codex/Anime/{(csv(':/home/hornet/scripts/anime-overrides.csv').get(n) ?: n).replace(':',' -').replaceAll(/[?]/, '')}/{(csv(':/home/hornet/scripts/anime-overrides.csv').get(n) ?: n).replace(':',' -').replaceAll(/[?]/, '')} - {episode.special ? "S"+special.pad(2) : absolute.pad(2)} - {t.replace(':',' -').replaceAll(/[?]/, '')}{' '+vc}{'-'+ac+']'}" order=airdate minFileSize=10 artwork=n deleteAfterExtract=y excludeList=/home/hornet/.filebot/anime-exceptions.txt --log-file /home/hornet/.filebot/logs/anime.14-03.txt
Locking /home/hornet/.filebot/logs/anime.14-03.txt
Parameter: animeFormat = /home/codex/Anime/{(csv(':/home/hornet/scripts/anime-overrides.csv').get(n) ?: n).replace(':',' -').replaceAll(/[?]/, '')}/{(csv(':/home/hornet/scripts/anime-overrides.csv').get(n) ?: n).replace(':',' -').replaceAll(/[?]/, '')} - {episode.special ? S+special.pad(2) : absolute.pad(2)} - {t.replace(':',' -').replaceAll(/[?]/, '')}{' '+vc}{'-'+ac+']'}
Parameter: order = airdate
Parameter: minFileSize = 10
Parameter: artwork = n
Parameter: deleteAfterExtract = y
Parameter: excludeList = /home/hornet/.filebot/anime-exceptions.txt
Argument: /volatile/torrents/__finished/anime
Input: /volatile/torrents/__finished/anime/[OZC] Blue Submarine No. 6 [Blu-Ray 720p]/[OZC] Blue Submarine No. 6 E04 'Minasoko' [Blu-Ray 720p].mkv
Input: /volatile/torrents/__finished/anime/[OZC] Blue Submarine No. 6 [Blu-Ray 720p]/[OZC] Blue Submarine No. 6 E03 'Hearts' [Blu-Ray 720p].mkv
Input: /volatile/torrents/__finished/anime/[OZC] Blue Submarine No. 6 [Blu-Ray 720p]/[OZC] Blue Submarine No. 6 E01 'Blues' [Blu-Ray 720p].mkv
Input: /volatile/torrents/__finished/anime/[OZC] Blue Submarine No. 6 [Blu-Ray 720p]/[OZC] Blue Submarine No. 6 E02 'Pilots' [Blu-Ray 720p].mkv
Group: [anime:blue submarine no 6] => [[OZC] Blue Submarine No. 6 E04 'Minasoko' [Blu-Ray 720p].mkv, [OZC] Blue Submarine No. 6 E03 'Hearts' [Blu-Ray 720p].mkv, [OZC] Blue Submarine No. 6 E01 'Blues' [Blu-Ray 720p].mkv, [OZC] Blue Submarine No. 6 E02 'Pilots' [Blu-Ray 720p].mkv]
Rename episodes using [AniDB]
Auto-detected query: [Blue Submarine No 6, Blue Submarine 6]
Fetching episode data for [Ao no 6-gou]
Fetching episode data for [Submarine Super 99]
[TEST] Rename [/volatile/torrents/__finished/anime/[OZC] Blue Submarine No. 6 [Blu-Ray 720p]/[OZC] Blue Submarine No. 6 E01 'Blues' [Blu-Ray 720p].mkv] to [/home/codex/Anime/Blue Submarine No.6/Blue Submarine No.6 - 01 - Blues x264-AAC].mkv]
[TEST] Rename [/volatile/torrents/__finished/anime/[OZC] Blue Submarine No. 6 [Blu-Ray 720p]/[OZC] Blue Submarine No. 6 E02 'Pilots' [Blu-Ray 720p].mkv] to [/home/codex/Anime/Blue Submarine No.6/Blue Submarine No.6 - 02 - Pilots x264-AAC].mkv]
[TEST] Rename [/volatile/torrents/__finished/anime/[OZC] Blue Submarine No. 6 [Blu-Ray 720p]/[OZC] Blue Submarine No. 6 E03 'Hearts' [Blu-Ray 720p].mkv] to [/home/codex/Anime/Blue Submarine No.6/Blue Submarine No.6 - 03 - Hearts x264-AAC].mkv]
[TEST] Rename [/volatile/torrents/__finished/anime/[OZC] Blue Submarine No. 6 [Blu-Ray 720p]/[OZC] Blue Submarine No. 6 E04 'Minasoko' [Blu-Ray 720p].mkv] to [/home/codex/Anime/Blue Submarine No.6/Blue Submarine No.6 - 04 - Minasoko x264-AAC].mkv]
Processed 4 files
Saving report as /home/hornet/.filebot/reports/AMC [2014-03-30 07h53m] [OZC] Blue Submarine No. 6 [Blu-Ray 720p].html
Done ヾ(@⌒ー⌒@)ノ

Thanks again.

Re: Regarding AMC, CLI, and overrides

Posted: 30 Mar 2014, 07:08
by rednoah
Since when do paths start with colon?

Code: Select all

:/home/hornet/scripts/anime-overrides.csv
You could just do this and see the Map it's reading in:

Code: Select all

{csv('/home/hornet/scripts/anime-overrides.csv')}

Re: Regarding AMC, CLI, and overrides

Posted: 30 Mar 2014, 07:28
by Hornet
Typical - too focussed on the details and missed the bloody obvious. Thanks yet again.

It seems to remap now, looking for entry;definition - which isn't really CSV? Given a file with three lines in varying formats, it always picks the ; one, regardless of position within the file. Not really a major problem, but it's just as well I put that version in to cover all the bases.

I'm unsure how to run the snippet you posted though, in a standalone groovy file it won't run it, and on the CLI it prints an empty string (probably array/object -> string failure).

Cheers.

(edited for clarity)

Re: Regarding AMC, CLI, and overrides

Posted: 30 Mar 2014, 07:44
by Hornet
Hang about, stop press. Without the ; entry, it will print mappings when used directly; {'Blue Submarine No.6','Blue Submarinea'=null, Blue Submarine No.6,Blue Submarineb=null}. However it only seems to rename when the ; version is used in the CSV, it won't map if the file looks like:

Blue Submarine No.6,Blue Submarinex
'Blue Submarine No.6','Blue Submarinea'
"Blue Submarine No.6","Blue Submarineb"

but adding this then matches:
Blue Submarine No.6;Blue Submarinec

Not sure if this is intended behaviour? Certainly not standard CSV, but works nonetheless.

Re: Regarding AMC, CLI, and overrides

Posted: 30 Mar 2014, 11:17
by Hornet
In related news, you seem to have an interesting bug/'feature' when a folder called Episodes is passed, even as a parent as an argument. Observe:

Parameter: seriesFormat = Episodes/{n}/{episode.special ? "Special" : "Season "+s.pad(2)}/{n} - {episode.special ? "S00E"+special.pad(2) : s00e00} - {t.replaceAll(/[`?]/, "'").replaceAll(/[!?.]+$/).replacePart(', Part $1')}{".$lang"}
Parameter: order = airdate
Parameter: minFileSize = 10
Parameter: artwork = n
Parameter: deleteAfterExtract = y
Parameter: excludeList = /home/hornet/.filebot/episodes-exceptions-test.txt
Argument: /volatile/torrents/__finished/episodes
Input: /volatile/torrents/__finished/episodes/QI.10x10.(HDTV-x264-FTP).mkv
Group: [tvs:episodes] => [QI.10x10.(HDTV-x264-FTP).mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [Episodes]
Fetching episode data for [Episodes]
[TEST] Rename [/volatile/torrents/__finished/episodes/QI.10x10.(HDTV-x264-FTP).mkv] to [/home/codex/Episodes/Episodes/Episodes/Season 01/Episodes - S01E01 - Episode One.mkv]
Processed 1 files
Saving report as /home/hornet/.filebot/reports/AMC [2014-03-30 12h08m] QI.10x10.(HDTV-x264-FTP).html
Done ヾ(@⌒ー⌒@)ノ

^ partly my fault but that was a real WTF. test and proof below:

Parameter: seriesFormat = /{n}/{episode.special ? "Special" : "Season "+s.pad(2)}/{n} - {episode.special ? "S00E"+special.pad(2) : s00e00} - {t.replaceAll(/[`?]/, "'").replaceAll(/[!?.]+$/).replacePart(', Part $1')}{".$lang"}
Parameter: order = airdate
Parameter: minFileSize = 10
Parameter: artwork = n
Parameter: deleteAfterExtract = y
Parameter: excludeList = /home/hornet/.filebot/episodes-exceptions-test.txt
Argument: /volatile/torrents/__finished/episodes
Input: /volatile/torrents/__finished/episodes/QI.10x10.(HDTV-x264-FTP).mkv
Group: [tvs:episodes] => [QI.10x10.(HDTV-x264-FTP).mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [Episodes]
Fetching episode data for [Episodes]
[TEST] Rename [/volatile/torrents/__finished/episodes/QI.10x10.(HDTV-x264-FTP).mkv] to [/Episodes/Season 01/Episodes - S01E01 - Episode One.mkv]
Processed 1 files
Saving report as /home/hornet/.filebot/reports/AMC [2014-03-30 12h09m] QI.10x10.(HDTV-x264-FTP).html
Done ヾ(@⌒ー⌒@)ノ

Parameter: seriesFormat = /{n}/{episode.special ? "Special" : "Season "+s.pad(2)}/{n} - {episode.special ? "S00E"+special.pad(2) : s00e00} - {t.replaceAll(/[`?]/, "'").replaceAll(/[!?.]+$/).replacePart(', Part $1')}{".$lang"}
Parameter: order = airdate
Parameter: minFileSize = 10
Parameter: artwork = n
Parameter: deleteAfterExtract = y
Parameter: excludeList = /home/hornet/.filebot/episodes-exceptions-test.txt
Argument: /volatile/torrents/__finished/tveps
Input: /volatile/torrents/__finished/tveps/QI.10x10.(HDTV-x264-FTP).mkv
Group: [tvs:qi] => [QI.10x10.(HDTV-x264-FTP).mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [QI]
Fetching episode data for [QI]
Fetching episode data for [QI (2012)]
[TEST] Rename [/volatile/torrents/__finished/tveps/QI.10x10.(HDTV-x264-FTP).mkv] to [/QI/Season 10/QI - S10E10 - Jungles.mkv]
Processed 1 files
Saving report as /home/hornet/.filebot/reports/AMC [2014-03-30 12h11m] QI.10x10.(HDTV-x264-FTP).html
Done ヾ(@⌒ー⌒@)ノ

Re: Regarding AMC, CLI, and overrides

Posted: 30 Mar 2014, 12:25
by rednoah
Bad luck for you that someone decided to name their new TV Show "Episodes", just call your Episodes folder "TV Shows" instead.

@see http://thetvdb.com/?id=123581&tab=series