TV Show Episode Names and Filename Sorting
TV Show Episode Names and Filename Sorting
This post is a lament about how episode names and file-name conventions interact to result in horrible sorting of tv-show filenames in the filesystem.
The Jellyfin TV Show docs show a preferred filename format like Episode S00E01.mkv
. The docs aren't really clear about what the string Episode
is supposed to represent here, though. Is that the show name, the episode name, or something else?
- The example in the multi-part episode docs gives us a hint a hint that it's really intended to be the series name like
Series (2010) S02E01<separator><parttype><separator><partnumber>.mkv
. - The tests in the source code make this even clearer with examples like
the_simpsons-s02e01_18536.mp4
andthe.series.name.s01e04.webrip.x264-Baz[Bar].mkv
. Plus the variable is called SeriesName in the tests.
Interestingly, that string shows up in the episode name in the Jellyfin UI if your series isn't in tvdb. So it can be very useful to set episode-names. But if you do this, the filesystem sort order gets pretty miserable, like:
$ ls 'my show (2023)/' 'bar - S01E02.mp4' 'baz but this episode name is longer - S01E03.mp4' 'episode foo - S01E01.mp4'
If there are 10 or more episodes, and the episode names vary in length so the season/episode strings don't line up vertically, it's very difficult to read the episode order. It would be so nice if S01E01 My Episode Name.mkv
was supported. And this is even nodded to in the tests, but commented out as it apparently does work. And in this case the show name is pulled from the directory and the episode is ignored.
I guess maybe this is lamenting the lack of proper episode name support in tv show filenames. Though abusing the current SeriesName works... it makes the filesystem sorting gross.
If it's just about the filesystem sorting that is a problem you could also define an alias that sorts the files in your current folder by the back of the file name:
alias jf-ls="ls -lah | rev | sort | rev"
I personally don't really care about the episode names and just use the series name so they are sorted properly.
I have also seen a few people put the episode name in the back like this:
Fear.the.Walking.Dead.S01E02.So.Close.Yet.So.Far.1080p.mkv
Jellyfin parses this with no issue.
Yeah, this is not a bad workaround.
It's true that this parses but to my knowledge the episode name is ignored in this case. The
SeriesName
can be abused to... without a sidecar file... inject an episode name that the web UI and apps display when series metadata is not available from standard sources. Putting text at the back improves filesystem sorting, but Jellyfin ignores that string and there will be no human-readable episode name at all.It still does that for me when the episode name is at the end, it will just list the entire thing (e.g.
Fear.the.Walking.Dead.S01E02.So.Close.Yet.So.Far.1080p
).That usually happens when TheTVDB is not updated yet with a new episode.