mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-04 18:09:12 +03:00
NFO Season Not Respected When Importing Files #6563
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MathWiz86 on GitHub (Dec 9, 2024).
This issue respects the following points:
Description of the bug
I have a series with a custom story arc order for that isn't provided by normal metadata providers. To download the initial metadata (namely episode title and description), the file is named with 'S01'. However, I edited the .nfo metadata to set the tag to '2' for my custom order. I also placed the file in a 'Season 02' folder. When I import this file and its .nfo however, the file name is used instead of the .nfo season when Jellyfin adds to the database. This results in the episode appearing in both the 'Season 01' and 'Season 02' folders at the same time.
The .nfo file still says has the tag as '2' at this point, but editing the metadata in the web viewer shows season 1. I'm able to edit the metadata here to be season 2, which properly removes it from the 'Season 01' page. However, it would be tedious to do this for every episode individually when I was able to edit the .nfo tag in a batch.
If the .nfo file has a tag, it should be what is imported to the database when refreshing metadata. To note, this is how the episode number is working. For one test case, I had the episode named with S01E05, but the metadata had the episode tag as 80. The tag in the .nfo file was respected on import, and properly updates if I change the file directly and refresh metadata in the web viewer.
Reproduction steps
What is the current bug behavior?
What is the expected correct behavior?
Since the episode's .nfo file lists the season as '2', the episode should only appear in the Season 2 folder. The .nfo should be honored for both the season and episode tags, not just the episode tag.
Jellyfin Server version
10.10.0+
Specify commit id
No response
Specify unstable release number
No response
Specify version number
No response
Specify the build version
10.10.3
Environment
Jellyfin logs
FFmpeg logs
Client / Browser logs
No response
Relevant screenshots or videos
Additional information
I'm aware this is an unusual use case. The primary reason I went this route is because Jellyfin does not respect folder layout under normal circumstances. By this I mean that if I have all my episodes with their metadata listed at Season 1, but I break it up into separate season folders based on a custom story arc, the separate folders show up properly, but all episodes are duplicated into Season 1 when viewing within Jellyfin. From research, this appears to be intended behavior for the purpose of supporting nfo metadata instead.
As another note, I tested out of interest what would happen if I had the episode named with S01, put in a Season 2 folder, with the .nfo having a tag of 3. The episode will be shown in a Season 1 and Season 2 folder, but not a Season 3, meaning that the .nfo's season is completely ignored.
@sjorge commented on GitHub (Dec 9, 2024):
I'm also hitting this for specials I tag as season 0 in my episode nfo's.
This used to work fine on 10.9, I only noticed yesterday myself.
I had a brief look at the nfo parser as some code churn happened there but I don't think that is an issue there.
I think the issue is after the NFO got parsed and the data from the file path and metadata get merged in.
From what I gather from @Shadowghost this was unexpected behavior.
I didn't get around to filing an issue as I had no clear root cause analysis, so thanks for opening one.
@Kiina commented on GitHub (Dec 10, 2024):
Noticed the same thing on 10.10. I have a few longer running shows that get grouped by year by the metadata providers so I used to just scrape them by hand in TMM and then let jellyfin run a library scan that would pick up the changes. All episodes imported prior to 10.10 are fine in the library, everything after is tagged as season 1 even if the nfo says Season 2024. Thought maybe it was an issue with my setup or the unusual high season numbers since nobody opened an issue before.
@sjorge commented on GitHub (Jan 11, 2025):
Some more data points, using absolute anime numbering anything with an number > 99 will have it transformed like this:
Mind you all those files have proper episode NFO's with the season and episode set correctly. Jellyfin just ignores it (and with saver enabled replaced it with the wrong data)
Manually correct the data doesn't seem as re-scanning seems to revert it. (Edit: maybe not all scan types, at least a replace all and a search missing (I think)
(I provide NFO files because Jellyfin is not the only thing using these files and it's in my case not authoritative, it used to be as long as the NFO is correct jellyfin would pull in that data. Now it seems to ignore the NFO if it has anything else that can provide data, IMHO the NFO should always be respected when NFO saver is disable)
Edit: Other side effects of this being broken, multi part episodes don't seem to be properly parsed anymore either.
@sjorge commented on GitHub (Jan 13, 2025):
I had a look and the actual parsing code doesn't seem to have changed, so it might be related to https://github.com/jellyfin/jellyfin/issues/13358 where there is no virtual season yet when the NFO is parsed and the NFO parser does not create it.
Some more info, based on the logging it creates virtual season null, I think if instead of null it would create the one listed in the nfo if it doesn't exist already it would fix the issue.
@miltuss commented on GitHub (Jan 16, 2025):
This bug absolutely needs to be fixed, because it broke the TubeArchivist plugin https://github.com/tubearchivist/tubearchivist-jf-plugin/issues/30
@Routhinator commented on GitHub (Jan 25, 2025):
I'm seeing that Jellyfin is failing to respect more than just the season when importing. It's ignoring the thumb files as well and overwriting the art for every episode in the folder with the first image found until you force a refresh and check update existing images, which is just a waste and Jellyfin does not always get the same or a better image than what was provided on import.
@sjorge commented on GitHub (Feb 9, 2025):
Hit this again just now 10.10.5, sort of forgot about it but I replaced all metadata on a part of my library and it ignored the seasons value again and moved everything to season 1 again. Seems to also happen on search missing after manually correcting this so it's kind of annoying having to manually fix it every time I want to update metadata.
I had another 10ish min look at the code but I really don't see any changes in the nfo parser related code so It has to be up stack from that. But I'm not sure where at all.
@miltuss commented on GitHub (Feb 17, 2025):
I also encounter the same problem, it is really disastrous that Jellyfin moves all the episodes in season 1, and he ignored the metadata of seasons sent by Tubearchivist!
@sxales commented on GitHub (Feb 18, 2025):
I am also experiencing this on 10.10.6.
It looks like it gets the episode # right but ignores the season # when parsing an nfo.
@sjorge commented on GitHub (Feb 24, 2025):
Might be caused by https://github.com/jellyfin/jellyfin/pull/12739 I wonder if the check here:
https://github.com/jellyfin/jellyfin/pull/12739/files#diff-15b80d3412ed90d271dbd45f72eff6a915717c8b5fceb447a113da5089eb0866R107
targetItem.ParentIndexNumber.HasValueI'm not sure how this would treat0as used by the special season.@jellyfin-bot commented on GitHub (Jun 25, 2025):
This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs.
If you have any questions you can use one of several ways to contact us.
@Routhinator commented on GitHub (Jun 26, 2025):
Not stale
@sjorge commented on GitHub (Jun 26, 2025):
I am no longer experiencing this on 10.10.7
@Julien9969 commented on GitHub (Jun 26, 2025):
In 10.10.7 i've still the issue (or feature) that the season is not read from the nfo. So stuff with episode number 100+ and no season in name like "xxxx 123xx.mp4" will be set as season 1, episode 23 even if there is a correct nfo along the media file.
@sjorge commented on GitHub (Jun 26, 2025):
I think that might be a slightly different issue, where it splits >99 into season and episode.
Where 123 becomes S1 E23, and i think the 'parsed' season/episode still takes priority.
Still a bug though, but maybe not in the nfo parser
Edit, I can confirm using absolute numbering (technically not support) but with episode nfo's (should be supported) anything <=99 gets the season grabbed from the NFO but >=101 it doesn't.
Edit 2:
If I understand https://github.com/jellyfin/jellyfin/pull/13611 correctly it does 2 things:
Since it's no longer forced to 1, the season from the NFO is used when the season is null (when parsed from the path). This is why it works for <=99 (might actually be <=100, but not super important).
But since 123 -> S1 E24, 401 -> S4 E04, ... the season is set so it's not taken from the NFO (I think that's what the code here does:
1b4394199a/Emby.Naming/Common/NamingOptions.cs (L309-L463))Edit 3:
There seems to be some hits at absolute numbering support,
10d0cec7b9/Emby.Naming/TV/EpisodePathParser.cs (L35-L42)and10d0cec7b9/Emby.Naming/TV/EpisodeResolver.cs (L35-L42)But I don't see anything calling this with this property set to true 🤷
@Routhinator commented on GitHub (Jun 26, 2025):
This becomes a problem for things like youtube or daily shows, where episode numbers are a date and the season is the year. All seasons numbered by year are >100 creating very broken behaviour.
@sxales commented on GitHub (Jun 26, 2025):
I am still experiencing it in 10.10.7
@sjorge commented on GitHub (Jun 27, 2025):
Took me a while to track it down but it's called here with the abs numbering value:
0b6f4b2bd9/Emby.Server.Implementations/Library/LibraryManager.cs (L2585)But only for missing episodes I think, aside from that it's only called in the tests. So I think absolute numbered episode are never even passed to the absolute numbering friendly regex's
Edit lots more messing about by testing the regex agains some filename, so far it seems this one is the only one that matches absolute numbered anime (for me)
0b6f4b2bd9/Emby.Naming/Common/NamingOptions.cs (L446-L451)Yet this one is not marked as absolute in the parser file. It would also not match for One Piece for example if the epno is >=1000, I haven't found yet where it splits the >=100 into season and epno. Something is doing it though e.g.
0b6f4b2bd9/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberWithoutSeasonTests.cs (L21)this test seems to indicate that at least. :(0b6f4b2bd9/tests/Jellyfin.Naming.Tests/TV/SeasonNumberTests.cs (L55)While this test seems to indicate if SupportAbsoluteEpisodeNumber is true, it doesn't do it. But I still haven't found anything except the missing episode provider that passes this. It would be great if there was a library level toggle to set to pass this.
0b6f4b2bd9/tests/Jellyfin.Naming.Tests/TV/AbsoluteEpisodeNumberTests.cs (L12-L18)@sxales commented on GitHub (Jun 28, 2025):
@sjorge I suspect it is an issue with the EpisodeNFOParser (or somewhere in the chain) because I've noticed that it actually never takes the season given in the nfo.
It could be a coincidence but looks like there is only 1 commit d4eeafe53ff8ae2f287f5dca49a873cd71f4c3da in the timeframe when it stopped working.
@Neurology0443 commented on GitHub (Oct 3, 2025):
EDIT2: It's still happening on some files... Specially those with a date in their name.
<seasonnumber>1</seasonnumber>Didn't fixed it either. So this is probably a bug ! ^^ Sorry for the noise !
@FabianoIlCapo commented on GitHub (Dec 14, 2025):
I'd like to suggest an idea about this, since I'm also having problem with the anime absolute episode numbering, in my case episodes numbers are 4 digits long (0001, 0002, ...) which leads to an absolute mess, pun intended.
Apart from solving this specific parser bug which is surely helpful, wouldn't it be a good idea to also let the user tell Jellyfin how the numbering of a specific media is organised?
Feels like it would be impossible to cover all the very peculiar cases, there would always be an exception to every parsing rule, no matter how rare they can become.
In my example, seasons are divided in folders (I'm not free to reorganise these files as I wish), episodes are numbered with four digits at the beginning of the file name, then there's the episode's title.
The series gets correctly recognised; at the moment it's impossible for me to get rid of the non-existing Special Season (created because of the first 00 in the name) unless I go and edit everything in the metadata editor, and this bug might not even let me do it if the parser gets priority.
While if I had a way to tell Jellyfin: grab the season number from the folder and the episode number from the name, maybe with checkboxes in case one of the two is missing.
Jellyfin could let me prompt prefixes or suffixes in dedicated fields to recognise these informations.
@jon0101010 commented on GitHub (Feb 2, 2026):
I am having this issue as well in 10.11.6.
What I have noticed after a number of attempts is that for the Season Folder must be only Season XX. If it has any other text with numbers to the right it has issues. My folders are organized like seasons and episodes but are for engine building so lots of numbers. One folder that is has particular issues with is "Season 20 - 351 Bearings". I've tried it in different formats such as "Season 20 (351 Bearings)" to no avail. If it has the 351 to the right of 20 when it imports these is ignores the "season.nfo" reparses the season and creates a new nfo files overwriting the one I have in the folder. In doing so it is overwriting data. The NFO file that it is ignoring contains elements for plot, outline, lockdata=true, dateadded, title & seasonnumber. It's literally ignoring and overwriting the correct season number in the NFO file.
More over it is doing this on a file with lockdata=true in it.
I am speculating here, but I suspect that is an order of operations (pipeline sequencing) on how names and metadata are read / generated has an issue. It looks like it is parsing the names from folder and files first vs loading the nfo first. In my opinion if a folder has a season.nfo with a valid seasonnumber element it should not parsing the folder name trying to determine a season number. The folder name should be a fallback if proper metadata is not present in the nfo.
There is similar issues with Episode NFOs getting ignored / overwritten. I suspect there is a similar sequencing issue however I have not tested this one as deeply.