[Emby] Removing Duplicate Years When Show Has Them

All about user-defined episode / movie / file name format expressions
Post Reply
AllRoCol
Posts: 8
Joined: 30 Sep 2020, 04:55

[Emby] Removing Duplicate Years When Show Has Them

Post by AllRoCol »

Thank you for the help.

Right now I have this for my renaming (Open to suggestions on improving anything).

Code: Select all

{n}{n =~ {episodelist.findAll{it.season}.airdate.year.min()} ? '' : " (${episodelist.findAll{it.season}.airdate.year.min()})"}/{'Season '+s}/{n}{n =~ {episodelist.findAll{it.season}.airdate.year.min()} ? '' : " (${episodelist.findAll{it.season}.airdate.year.min()})"} - {s00e00} - {t} ({airdate.format('MMMM dd, yyyy')})
It works fine for regular shows and fine for shows with past dates for specials, like Tales From The Crypt (It lists as 1989 instead of 1972). It also appears to work fine for future seasons.

The problem I am having is I hit something like Teachers (2016 or Roots (2016) and I end up with a double year.

I have kind of just pieced that together from various forum posts on here, only brought on by the combo of the year handling change by TVDB and the combo platter of wanting more accurate Emby guesses when scanning in new stuff.

Is there some sort of way to take

Code: Select all

{n}{n =~ {episodelist.findAll{it.season}.airdate.year.min()} ? '' : " (${episodelist.findAll{it.season}.airdate.year.min()})"}
and turn it into some sort of don't add if the date is already available as part of the filename?

To be clear, I want the show name to include the date of the first year the show actually aired, not the earlier special years. I don't want a double date to show, though, if the show already has a date attached.

If I am doing anything wrong even prior to that, please let me know. This is my first time doing anything even the least bit difficult in the program, so I am a bit lost.

I appreciate any help. Thank you.
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Removing Duplicate Years When Show Has Them

Post by rednoah »

Use {ny} for Name (Year) folder names:

Code: Select all

{ny}

:idea: That being said, if you're organizing files for Kodi / Plex / Emby / etc then the {plex} format is generally recommended.
:idea: Please read the FAQ and How to Request Help.
AllRoCol
Posts: 8
Joined: 30 Sep 2020, 04:55

Re: Removing Duplicate Years When Show Has Them

Post by AllRoCol »

Thank you for the reply.

May I ask, what would that look like? If I use it the ny approach solo, it has the special year shown for certain shows, like Tales From The Crypt (1972) and if I try to put it into the rest of the line, I still have the double name issue.

Basically if a show has a year, it doesn't add one, if a show doesn't have a year, it adds one, and if a show has no year and the original year is a special or some subpar choice, it chooses the correct one, say episode 1 of the show.

I can't seem to get all three to line up.

Thanks again.
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Removing Duplicate Years When Show Has Them

Post by rednoah »

{ny} will add the year if it's not already part of the name.


:!: Looks like there's a small number of shows where the year in the name doesn't match the start year in the database, so that will trick FileBot into thinking that the year isn't already part of the series name, in some very specific rare cases.


I guess you can always work around things with something like this:

Code: Select all

{n =~ /\(\d{4}\)$/ ? n : ny}
:idea: Please read the FAQ and How to Request Help.
AllRoCol
Posts: 8
Joined: 30 Sep 2020, 04:55

Re: Removing Duplicate Years When Show Has Them

Post by AllRoCol »

Thank you, but the code still doesn't cover all three, as far as I can tell. The older date stuff still gets screwed up.

{ny} is nice, but it doesn't cover the date problem, either. I know it is TVDB that messed all of this up, but it really isn't fun. I have 2100 properly named/sorted shows, soon to be 3000. I wanted to add the year, now, due to it increasing the likelihood of Emby getting the match right. I wiped my Emby install when I had a few hundred and held off on doing it for a while. Now I am looking to readd them. When I tried it with the dates, as a test, with a couple thousand, it actually got closer than it had been, which is good. Less manual editing and refreshing.

At this point, I don't know. My original one that was a combo of ones from the forum gets two out of three, but creates double dates. Your stuff gets two out of three, as well, but can't handle the way TVDB set up the dates (Which is garbage on their part, since they connect in specials that had nothing to do with shows.). I have quite a few shows that are effected by this. So at this point, if you have no further ideas or anyone else, I think I am going to have to suck it up and play Sophie's Choice.

Is there a way to maybe do an OR on my original one to have it basically be check for a year, use that if it is there, otherwise check for the first episode year? Or maybe a feature request for a new alternative to {y} and {ny}, like the latter, but the actual show start date and not their trash date system.

Thank you.
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Removing Duplicate Years When Show Has Them

Post by rednoah »

Please give at least 1 specific example where this doesn't work:

Code: Select all

{n =~ /\(\d{4}\)$/ ? n : ny}
:idea: This code does use a if-then-else approach to add the year if n doesn't already end with a (1234) pattern.


Here's what I'm getting, which looks good to me:

Code: Select all

alias => Alias (2001)
firefly => Firefly (2002)
teachers => Teachers (2001)
teachers 2016 => Teachers (2016)
roots 2016 => Roots (2016)
tales from the crypt => Tales from the Crypt (1972)

:idea: Please read How to Request Help.
:idea: Please read the FAQ and How to Request Help.
AllRoCol
Posts: 8
Joined: 30 Sep 2020, 04:55

Re: Removing Duplicate Years When Show Has Them

Post by AllRoCol »

It's the Tales From The Crypt one that I am talking about.

I may not have been 100% clear in my original post. I am trying to make the original code I posted work to also remove duplicate years.

Basically TVDB now has years count as the first special, as you know. Tales for example, came out in 1989 and that was 17 years after a movie that was never really connected to it, in the it was a special kind of way. I have quite a few cases like this. Maybe not as extreme, but essentially the wrong years due to their new year system. I don't just use my collection in Emby and it is effecting my ability to search stuff off my computer since the years don't always line up or look right at first glance.

I am asking if there is a way to retain the ability to pick the year from the first episode, while also not ending up with double episodes. Is there a way to combine your code with the code I got off the forums that was a bit hacked together? It picks the right year, but if the year is already in the title it ignores it.

Thank you.
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Removing Duplicate Years When Show Has Them

Post by rednoah »

I see. Well, I can only give you a snippet that solves the specific problem discussed above. But integrating / copy-and-pasting this solution into your larger format to make it work the way you want is kinda your job. ;)
Image


:?: In this particular case, do we want Tales From The Crypt (1972) or do we want Tales From The Crypt (1989)? The latter most certainly isn't making things easier for Emby, even if it might make more sense to a human fan of the show.


:idea: Note that Emby will expect the series folder to be called Tales From The Crypt. Both Tales From The Crypt (1972) and Tales From The Crypt (1989) are probably a bad idea if you wanna set things up for Emby.
:idea: Please read the FAQ and How to Request Help.
AllRoCol
Posts: 8
Joined: 30 Sep 2020, 04:55

Re: Removing Duplicate Years When Show Has Them

Post by AllRoCol »

Ok, you win. For the record my original question was how to I change that script, though my topic title could have been more clear and that is on me.

However, I get your point, to an extent. They actually recommend using years all over the Emby forums and I know it is because it guesses wrong more often when years aren't used. Having had thousands of shows loaded into Emby, I can tell you that it is a huge pain, especially since episode metadata may not be refreshable and one may have to manually edit the TVDB and IMDB IDs for many episodes.

In my personal experience, using years cuts down on it a reasonable amount, without causing additional problems. Let me give you an example using Filebot. Type Strike in to find the British show, on the search in the episodes tab. Your return is Strike!. Same on Emby. Then try Strike 2017 and it then returns Strike as the correct response. This happens on Emby as well. Since I watch many obscure shows and many ones with names the same or similar to other shows, I was having to manually edit many shows. A pain when I had a few hundred, but then I went all media server and now I will eventually have a few thousand.

Now with all of that said, you are likely right that it is more me than the system and using years friendly to the system probably makes more sense. I do watch most of my stuff outside of Emby and just use it for connections to some devices. I was being bothered by it because it wasn't lining up. I will suck it up and get over it. It just gets confusing because I watch many US, British, and Australian shows (Among other countries) that tend to have the same name. I know what year they come out, so it is easier for me to find them and track them.

I will take your advice and just use the default years.

Thank you again.
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Removing Duplicate Years When Show Has Them

Post by rednoah »

The general rule for the Plex world is "names things exactly as in the database" which is "Doctor Who" for Doctor Who and "Doctor Who (2005)" for Doctor Who (2005). Presumably, the Emby world works in a similar manner. Adding the year (series creation year or first episode airdate year?) might help make it work better in some cases I suppose, but could equally have the opposite effect in other cases. Depending which shows you have specifically, one approach might work better than the other, neither being perfect.


:idea: Strike! vs Strike is an interesting example. FileBot / Plex / Emby generally ignore punctuation, since file names usually strip them too, and so Strike! becomes Strike, and so it's a 50:50 which one gets the match. I suppose it's one of these corner cases that FileBot / Plex / Emby developers didn't think of, since show names that use punctuation as identifying markers are somewhat rare.


:idea: Most users media center users would recommend adding *.nfo files or *.url files so FileBot / Plex / Emby can pick up the correct series based on the numeric identifier, rather than the name.
:idea: Please read the FAQ and How to Request Help.
AllRoCol
Posts: 8
Joined: 30 Sep 2020, 04:55

Re: Removing Duplicate Years When Show Has Them

Post by AllRoCol »

I'm not sure it's as 50/50 as you think. The search through the API is different than the web search and consistently gives the exact same results each identical search. I'm only saying the second part for anyone unfamiliar with it. This means that one that has say put their TV folders into Emby many times over, like myself, can track differences in what is caught and what isn't. I build up a library, then tear it down when I figure out how to do it better and keep working at it. I am getting close to being happy with the chosen settings. Each time I have seen what has hit and what hasn't when using the different approaches. Folder years are much stronger than not having them.

The web search itself seems to not care, but the API search, including in Filebot, does seem to. Take Backstrom for example. If you search it, you get a no doubt less popular new Swedish show that is spelled Bäckström. Now one can be like ok, search engines ignore something like that and just use the default search. Ok, I agree, but... When you put the year after it, Backstrom (2015), it becomes the number one search. The same thing with Chance, which pulls a Strike and goes to Chance!, unless you put the year.

Now I have read probably 1,000+ Emby posts, as I learned it in and out, and I have seen the developer and others mention over and over to use years in the folder names. Here is a good example where he openly says it is used in the search. . Emby rarely missed a match for me.

Here I am right now processing 2100+ shows, with Filebot, changing to a different format. I chose not to use f3 to pick up on any recent changes or anything that felt off. I have noticed that Filebot often gets the show selection wrong when there are various similar/matching names, but that Filebot only searches with the year, which I have as part of the folder name (In parenthesis), when it is a part of the show name in the first place, from TVDB. Otherwise it searches the show name and gets the result order that you would get without the year. Now of course it is right more often than not, not to mention the order comes from the subpar(TVDB search (Which is subpar on the web and through the API). That goes without saying. We both know they could do a better job of pushing more popular results up and stop lower popularity stuff and foreign barely watched by the masses stuff from taking over the results. I have actually thought about suggesting adding the years to all shows, to make them easier to search and connect with. That would give them a more unique name and hopefully separate out the same name shows, especially since they keep dumping more English names of non-English shows, which then end up matching with other shows, and wreaking havoc.

So I just did This Life and I got the wrong one, then I chose to add the (2015) in a test through the Episodes tab search and without it as well. Without it I got the wrong This Life, but with it I got the correct one. Same thing for Blood and Oil (2010). Out of order unless the (2010) is used. Same for After Hours (2010), The Code (2014), Dominion Creek (2015) and every one I tried, except Crims (2015), which has a poor name to test and would have popped the question of which, either way . It goes on and on. I even notice less results when the year is used, but more accurate ones. It drops some of the weaker matches.

I see Filebot hit on most results and not ask me, sure, but when it asks me what I am looking for, the difference between the date and not having the date is very, very noticeable. It seems to work, on the API search (Not the web one, which is horrible.), to specify exactly which one you mean. After using Emby on thousands of shows and Filebot changing formats many times and on thousands more shows over the years, I can tell you straight up that I truly believe you may be underestimating the difference maker the year can actually be. Perhaps run your own tests, any time something pops off that has two matches of the same name and gives them out of order. You would know better than me if it would serve Filebot well or not. Maybe consider giving an option to include year, if found, when searching, if you find it suitable. As far as I can tell, it would improve top matches and overall results quite a bit. Maybe your tests will find something different. Who knows. I watch many shows that have the same names and often the less popular ones and the more popular ones, so I see this non-stop. It can get to be quite annoying.

Also on side notes. Emby is quite a bit stronger than Plex with local media, so maybe they worked on making use of years for increased accuracy. I have used both and found Emby to be considerably better that Plex for that. Obviously Emby can't do streaming to save itself and Plex has its strengths, but also its mission goals, too. Which are very different. I have ran them side by side in the past, though I find myself never having a need for Plex.

I also use NFO files and have the correct metadata sorted as best I can. I just wiped them all out, as I always do, in order to redo it to make sure all of the matches are accurate. Once I have them settled, I will finalize another batch of created NFOs and images and hopefully be done with this. I have been working on getting this collection as accurate as possible and have learned a lot along the way. Every single file matches TVDB and Trakt, not an episode missing in the middle anywhere, completed seasons, highest quality available for each... I just got stuck on trying to lock down the final format before I put them back in Emby for hopefully the last time. That is how I ended up here.

My head is starting to spin from staring at so many shows as I change the format... Filebot overload.
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Removing Duplicate Years When Show Has Them

Post by rednoah »

Makes sense. Looks like you've got a large and peculiar enough collection to check for all the corner cases. I shall remember to recommend Name (Year) format for Emby users. Maybe it's time for a dedicated {emby} binding. On this note, I've also fixed the {ny} binding to only print the first year from the name even if there's a different series year in the series database record.


EDIT: FileBot r8045 adds the {emby} binding.
:idea: Please read the FAQ and How to Request Help.
AllRoCol
Posts: 8
Joined: 30 Sep 2020, 04:55

Re: [Emby] Removing Duplicate Years When Show Has Them

Post by AllRoCol »

Thank you. I appreciate your help and the changes you made.
Post Reply