Page 1 of 1

Is there a way to get the country for tv shows?

Posted: 15 Oct 2014, 08:19
by DevXen
Is there a way to get the country/code for the tv show. I.E. (US), (UK), (AU), Etc

Sometimes the same show is done in different countries,
Masterchef, Wilfred, Being Human, Etc. and I'd like to differentiate between them.

I wasn't able to find Anything in the help, or forums on here, Though looking through RegEx help
I found that I could match the Country code if it's in the filename with:

Code: Select all

however with the .upperInitial(). and lowerTrail(). it makes it (Us) and i was unable to find a way to convert it to (US)

So I was thinking, if there was a way to fetch that Binding, I could just insert it on it's own./, and it wouldn't rely on it being in the filename of each file.

Thank you for your help,


Re: Is there a way to get the country for tv shows?

Posted: 15 Oct 2014, 09:03
by rednoah
The country code is usually part of the name {n} and maybe there's some extra useful info in the extended info map {info}.

You can definitely match the code from the filename {fn} if available, but you'll most likely get false positives. I'd match it from the series name {n}.

replace 'Us' with 'US', or do a replaceAll /(?i)us|uk|etc/ { it.upper() }, there is so many ways to do it, so I'd need examples to see what you want so I can find the most elegant solution.

Re: Is there a way to get the country for tv shows?

Posted: 15 Oct 2014, 21:53
by DevXen
Yeah, I tried the {info} to find it. by putting that in alone, it displayed all it's available attributes. Country, wasn't in the list, I even tried, and wasn't available. So I figured if it was possible, it just wasn't listed. - I read in the forums that you have a lot of internal bindings that could change, so they aren't documented.

I got it working, so thank you, I am curious though, with the matching of: /(?i)us|uk|aus|jp|etc/ wouldn't that match anywhere in the filename with replace(All) instead of just inside ()'s?

let's say a series name is preposterous. wouldn't it change it to: preposterUS?

Re: Is there a way to get the country for tv shows?

Posted: 15 Oct 2014, 22:29
by rednoah
For movies you can get country codes, but for TV Shows I'm pretty sure TheTVDB doesn't even have that information.

Yes, just going for a regex match with will lead to false positives. I'd match some \b in the very least, and maybe the () as well at the end of the String. That's why it's best to match from {n} where you know it'll be (US) or (UK) etc or not at all by TheTVDB standards.

For the sake of brevity I'm just giving you the solution:

Code: Select all

{n.upperInitial().lowerTrail().replaceTrailingBrackets()}{' '+n.match(/\([A-Z]+\)$/)}
But is it really worth figuring out meaningless things like this? The best way to name your shows is by simply using the name, i.e. {n}

Re: Is there a way to get the country for tv shows?

Posted: 15 Oct 2014, 22:48
by DevXen
Yeah, I did'nt see the country info on TheTVDB, but I did see them on TVRage, and imdb has them too.

There are cases it's worth it. for example, I have both of these shows: "Wilfred" (From Australia) "Wilfred (US)"
Naming wise. if i don't differentiate, I could pull the names for the incorrect show, in fact, if (US) is taken out of Wilfred, then it'll match it to the Australian one, as that has no country specified.

Also if I were to manually do it for each, it would organize them into:
Wilfred\[2007] - Season 01
Wilfred\[2010] - Season 02
Wilfred\[2011] - Season 01
Wilfred\[2012] - Season 02
Wilfred\[2013] - Season 03
Wilfred\[2014] - Season 04

The two different shows were only separated by one year.

Though Ideally, I'd like it to be more like:
Wilfred\Wilfred (AU)\(Seasons here)
Wilfred\Wilfred (US)\(Seasons here)

But it's even more an issue with shows like being human - I've added the Country to the end of each to identify which show it is from. "Being Human" from the UK "Being Human (US)"
would organize like:
Being Human\[2009] - Season 01\ (UK)
Being Human\[2010] - Season 02\ (UK)
Being Human\[2011] - Season 01\ (US)
Being Human\[2011] - Season 03\ (UK)
Being Human\[2012] - Season 02\ (US)
Being Human\[2012] - Season 04\ (UK)
Being Human\[2013] - Season 03\ (US)
Being Human\[2013] - Season 05\ (UK)
Being Human\[2014] - Season 04\ (US)

And if you take out the Year of the season, which I'm sure most people don't include anyways, It gets even more confusing.

Sure it doesn't happen often, But I'd like to proactively correct it when it does.

I'll try out your new solution, and see if I can get that working, thank you, again for your help.

Re: Is there a way to get the country for tv shows?

Posted: 16 Oct 2014, 07:20
by rednoah
I'd just use whatever TheTVDB uses. Using (AU) won't help with detection neither, since (AU) just won't match anything if it's the original series that doesn't contain (AU).

@see ... ies_Record

Re: Is there a way to get the country for tv shows?

Posted: 16 Oct 2014, 20:06
by DevXen
Yeah, I'm okay with following what TheTVDB uses. as i have so far. - I was using another tv renaming program. which was okay, but when it wouldn't find the shows i would use yours to find them. but then it wouldn't name them the way i wanted them. so i had to use the other program again to correctly name them. however, i recently found out FB has a great naming scheme ability, so I'm now moving over to using FB Exclusively. For Tv shows, and likely movies (I have another program for movies, and it does well, but will only do 1 at a time. that gets tedious, if I can get FB to name them the same way (And I believe I can), but do several at a time, then I'll use it Exclusively for that as well. So thank you for making such a great program.

Anyhow, I was just explaining why It was important for me at least to not take out the (Country) from the filename. and also why I wanted to Capitalize that, when it was there. So again, thank you for your time, and your help. I appreciate it. and as i'm working on perfecting my naming scheme, if i have other questions i'll post them. so Thank you again. =]