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.

  • Domi@lemmy.secnd.me
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 year ago

    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"

    [root@worker01 test]# jf-ls
    drwxr-xr-x 2 root root  5 Jun  6 09:29 .
    dr-xr-x--- 5 root root 17 Jun  6 09:29 ..
    -rw-r--r-- 1 root root  0 Jun  6 09:29 episode foo - S01E01.mp4
    -rw-r--r-- 1 root root  0 Jun  6 09:29 bar - S01E02.mp4
    -rw-r--r-- 1 root root  0 Jun  6 09:29 baz but this episode name is longer - S01E03.mp4
    total 19K
    

    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.

    • PriorProject@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 year ago

      If it’s just about the filesystem sorting that is a problem you could also define an alias that sorts the files…

      Yeah, this is not a bad workaround.

      I have also seen a few people put the episode name in the back…

      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.

      • Domi@lemmy.secnd.me
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 year ago

        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.

        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.

        • PriorProject@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          1 year ago

          Old thread, but I just figured out what lead me to my confusion about Jellyfin filename/episode-names and wanted to follow-up for posterity.

          The problem was that my episode names had something that looked like a year in them, and that was throwing the filename parser into some confused state:

          stuff 2020 - s01e01 - episode name parses to an episode name of simply stuff, presumably because the year disorients Jellyfin. All the rest of the filename is omitted from the metata episode name, which isn’t fun.

          s01e02 - episode name results in Jellyfin using the full filename (without the suffix) as the episode name as desired. Other formats can work as well, the important part is that 2020 has to be removed.

          Anyhoo, thanks for pointing me in this direction, I’ve got a naming convention I’m much happier with now.