{y} tag on show with special episodes

All about user-defined episode / movie / file name format expressions
Post Reply
Bazzu85
Posts: 51
Joined: 16 Nov 2016, 19:28

{y} tag on show with special episodes

Post by Bazzu85 »

Hi,

I use the {ny} or {y} tag when renaming and I have some scenarios where some shows has the special episodes aired before the first episodes
examples:
Cobra Kai (1984) -> first episode is in 2018 -> resulting file name is Cobra Kai (1984) - S01E01
One Piece (1998) -> first episode is in 1999 -> resulting file name is One Piece (2018) - S01E01

This cause emby to have problem identifying the shows sometimes. For example One Piece is searched as 1999.
So...
1. what's the correct way to search?
2. if I want to use the emby year how can I do? maybe taking the year of the S01E01?
thx
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {y} tag on show with special episodes

Post by rednoah »

{y} is primarily based on the series information, which is unrelated to any specific episode information, and may vary depending on the database. However, the series start date is sometimes undefined in the series record, so in this case FileBot will "conjure up" the year based on episode metadata, i.e. use the year of the minimum airdate. Looks like we need to fine-tune this logic.



I can confirm the problem for Cobra Kai:

Code: Select all

$ filebot -list --db TheTVDB --q "Cobra Kai" --format "{ny} [{airdate}] {t}"
Cobra Kai (1984) [2018-05-02] Ace Degenerate
...
Cobra Kai (1984) [1984-06-22] The Karate Kid
...
:arrow: Although the main issue is the series start date being undefined in the series record, we can certainly "conjure up" the desired date by ignoring special episodes in this specific context.



I cannot confirm the problem with One Piece though:

Code: Select all

$ filebot -list --db TheTVDB --q "One Piece" --format "{ny} [{airdate}] {t}"
One Piece (1998) [1999-10-20] I'm Luffy! The Man Who's Gonna Be King of the Pirates!
...


:?: You may need to double check with the Emby developers for the best way to name things, especially in corner cases where the series start date field is undefined in the TheTVDB series record.



EDIT:

Cobra Kai is explicitly listed as "firstAired":"1984-06-22" according to the TheTVDB API response. You may prefer to use TheMovieDB (Series Mode) in both FileBot and Emby if TheTVDB doesn't list the values you or Emby want to see.



EDIT 2:

You can always "conjure up" the value you want yourself in your custom format, but if this value matches what Emby expects is a different problem entirely:

Code: Select all

{episodelist.findAll{ it.regular }.airdate.year.min()}
UPDATE 2023-01-30: Episode.regular is internal API and subject to change without notice.
:idea: Please read the FAQ and How to Request Help.
Bazzu85
Posts: 51
Joined: 16 Nov 2016, 19:28

Re: {y} tag on show with special episodes

Post by Bazzu85 »

thx for the extended reply..

in the meantime I started to rename with this code:

Code: Select all

year = episodelist.findAll{ it.season == 1 }.airdate.year.min().toString()
folder.toString().replace('('+y+')' , '('+year+')')
for the folder name..this is similar to your last suggestion..

talking about the emby team..I just posted on his forum but no answer..
btw renaming with the correct year made the trick, now emby recognize all anime I have fixed..
I think emby use a sort of this method we are talking, exluding the specials..and IMHO is the correct way to name a show!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {y} tag on show with special episodes

Post by rednoah »

Bazzu85 wrote: 28 Apr 2021, 10:48 I think emby use a sort of this method we are talking, exluding the specials..and IMHO is the correct way to name a show!
Cobra Kai (2018) is easy. But I'm not sure which One Piece (1998) vs One Piece (1999) is technically correct. We could change the internal behaviour, but that would certainly result in new unexpected behaviour in other corner cases, so I'm reluctant to make an internal change here, and instead recommend to use a custom format or a different database in the meanwhile.


:idea: Notably, TheTVDB does list 2018 in the search results, so there's a good chance there's some recent change / new feature on the website that that isn't yet visible via the v2 API. Might resolve itself if v2 API starts sending back the correct values. Might resolve itself when we switch to v4 API sometime later this year.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: {y} tag on show with special episodes

Post by kim »

Bazzu85 wrote: 28 Apr 2021, 10:48 I think emby use a sort of this method we are talking, exluding the specials..and IMHO is the correct way to name a show!
the correct way is the way the DB being used is using...
my guess is exclude the specials on 99% of the time

DB's:
imdb
thetvdb
themoviedb

btw: Cobra Kai = 1984 is 100% WRONG
"The Karate Kid" MOVIE is not a part of Cobra Kai the series
only thetvdb thinks this is ok
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: {y} tag on show with special episodes

Post by kim »

looks like

Code: Select all

{y}
=
getStartDate().getYear()
so:

Code: Select all

{startDate.year}
vs

Code: Select all

{airdate.year}
change startDate to airdate on {y} = DONE ;)
Post Reply