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
{y} tag on show with special episodes
Re: {y} tag on show with special episodes
{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:
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:
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:
UPDATE 2023-01-30: Episode.regular is internal API and subject to change without notice.
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
...

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!
...

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()}
Re: {y} tag on show with special episodes
thx for the extended reply..
in the meantime I started to rename with this code:
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!
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+')')
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!
Re: {y} tag on show with special episodes
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.

Re: {y} tag on show with special episodes
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
Re: {y} tag on show with special episodes
looks like = vs
change startDate to airdate on {y} = DONE 
Code: Select all
{y}
so:getStartDate().getYear()
Code: Select all
{startDate.year}
Code: Select all
{airdate.year}
