Page 1 of 1

[SNIPPET] Override / Hardcode Series Names

Posted: 15 Jul 2012, 09:03
by rednoah
If you're not happy with the data you get from your chosen database, you can just make the expression format engine do what you want. There's lots of ways to do this.

Let's say we prefer acronyms for these shows:
Deep Space 9 => DS9
How I Met Your Mother => HIMYM

1. Hardcode the name

Code: Select all

DS9 {sxe} {t}
2. Pattern matching

Code: Select all

{n.match('Deep Space 9':'DS9','How I Met Your Mother':'HIMYM') ?: n}
3. Replace string

Code: Select all

n.replace('Deep Space 9','DS9').replace('How I Met Your Mother','HIMYM')
4. Mappings from a CSV file

Code: Select all

{csv('/path/to/names.csv').get(n) ?: n}
e.g. /path/to/names.csv

Code: Select all

Deep Space 9;DS9
How I Met Your Mother;HIMYM
... or anything else you can come up with! ;)


BTW If you just wanna modify the original string you can do just that, e.g.

"The IT Crowd (UK)" => "The IT Crowd"

Code: Select all

{n.replaceTrailingBrackets()}
"Deep Space 9" => "DS9"

Code: Select all

{n.acronym()}

Re: [SNIPPET] Override/Hardcode Series Names

Posted: 24 Feb 2017, 04:52
by xflak
So I just updated filebot, and relative path references I used in my old code stopped working

Code: Select all

{csv('list.csv').get(n) ?: n}
to get it to work I had to replace the relative path with the absolute path

Code: Select all

{csv('C:/Program Files/FileBot/list.csv').get(n) ?: n}
Not a huge deal, but wanted to report in case it can either get rolled back and\or just to notify other potentially having the same issue

Thanks.

Re: [SNIPPET] Override/Hardcode Series Names

Posted: 24 Feb 2017, 07:33
by rednoah
Relative paths passed to csv(...) are now expected to be relative to your $HOME directory.

Re: [SNIPPET] Override / Hardcode Series Names

Posted: 24 Jul 2017, 01:52
by garyleecn
so how do I integrate it with AMC?

Re: [SNIPPET] Override / Hardcode Series Names

Posted: 24 Jul 2017, 04:33
by rednoah
You pass in your own format. The amc manual has a section on how to use custom formats.

Re: [SNIPPET] Override / Hardcode Series Names

Posted: 16 Sep 2018, 17:42
by Matt
How do you force Series + season ?
Examples:
Overlord III -> Overlord S3
Owarimonogatari -> Monogatari Series S11