jellyfin

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 and the.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.

14
7
Comments 7