[Implemented] Custom title for TV episode extras

With the new Plex TV agent beta we finally get local TV extras on show, season and episode level, to me this is one of the greatest feature improvement recently. However on episode level, local extra currently does not support custom naming, we can only do Episode_Name-Extra_Type.ext.

I hope we can add custom extra titles like with movie and show extras. For example a format like Episode_Name-Descriptive_Name-Extra_Type.ext, or a folder structure for individual episode. Then the TV extra game would be perfect!

I like that suggestion… need to free up a vote from another suggestion to get this :smiley:
There’s been a few other examples / ideas that had been floating in the preview/beta threads for the new tv-show scanner/agent, e.g. …

Option to handle episodes as folders (same as movies / shows / seasons)

TV Shows
  Show Name
    Season XX
      Show Name - sXXeYY - blah blah         <- episode folder
        Show Name - sXXeYY - blah blah.ext   <- episode file
        Making of Episode YY-behind.ext      <- inline extra (named)
        Deleted Scenes                       <- episode extra type folder
          Cold Open.ext
          Scene 51.ext
          Alternate Ending.ext

Option to have per-type episode extra subfolders

TV Shows
  Show Name
    Season XX
      Show Name - sXXeYY - blah blah.ext   <- episode file
      Show Name - sXXeYY-deleted           <- episode extra-type folder
        Cold Open.ext
        Scene 51.ext
        Alternate Ending.ext
      Show Name - sXXeYY-behind.ext        <- inline extra without specific name

Preferably handling the file/folders based on the sXXeYY level without the need to match the full episode file name.
Personally I suppose I prefer the 2nd option (Show Name - sXXeYY-extra_type [folder] > ... [individual extras of that type])

Since the show name and episode title are basically irrelevant (the scanner only looks for S1E1 or 1x01), I’d like to suggest this:

TV Show (Year)/
└─ Season 1/
   ├─ TV Show - S1E1 - Episode Name.ext
   ├─ TV Show - S1E1 - Extra Name-behindthescenes.ext
   ├─ 1x02 Episode Name.ext
   └─ 1x02 Extra Name-behindthescenes.ext

If you look around the forum what kind of … interesting information users add to their file names, that’s unlikely to work. As a side note… keep in mind that those 1x01 names are not officially supported.

I would definitely prefer the

TV Shows
 └─ Season 1
       └─ Show Name - sXXeYY - Title of Ep
              ├─ Show Name - sXXeYY - Title of Ep.ext
              ├─ Deleted Scenes
                    └─ Show Name - sXXeYY - Title of Ep.ext
              ├─ Behind The Scenes
                    └─ Show Name - sXXeYY - Title of Ep.ext

Agreed. Please flesh out support for TV Extras. First, make them available on all platforms. Then, allow users to name them beyond the episode title. It would also be nice if they showed up in Continue Watching as well (same with movies).

Interestingly I just renamed some of my extras so they’re episode level and accidentally put episode name.mkv.mkv. the extra mkv showed up on Android TV. So I tested further and as long as the episode name matches you can put anything on the end of it and it’ll show up on the client as well.

E.g.
Episode
Doctor who (2005) S07E13 The Name of the Doctor.mkv
Extra shows with additional description:
Doctor who (2005) S07E13 The Name of the Doctor He Said She Said-short.mkv
Extra will not display:
Doctor who (2005) S07E13 He Said She Said-short.mkv

Not sure if this is new or it’s always worked for people but thought I’d mention it.

IIRC it’s been like this from the beginning. Episode level extras must use the full episode file name as the base for their name.
Based on the official documentation / support article I would not rely on adding the extra name to that base name.

Because Plex doesn’t want to help us (yet again), I’ve decided to take matters into my own hands and write a little script:

#!/usr/bin/env python3
from json import loads
from re import match
from subprocess import check_output
from urllib.parse import unquote, urlparse

s3 = '/usr/lib/plexmediaserver/Plex SQLite'
db = '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db'

check_output(['systemctl', 'stop', 'plexmediaserver'])

for extra in check_output([s3, db, 'SELECT id, guid, title FROM metadata_items WHERE metadata_type = 12']).decode('utf-8').splitlines():
  id, guid, title = extra.split('|')
  if match('^\dx\d+(x\d+)? ', title):
    try:
      fpath = unquote(urlparse(guid).path)
      minfo = check_output(['mediainfo', '--Output=JSON', fpath])
      title = loads(minfo)['media']['track'][0]['Title']
      check_output([s3, db, f'UPDATE metadata_items SET title = "{title}" WHERE id = {id}'])
    except: pass

check_output(['systemctl', 'start', 'plexmediaserver'])

My script looks for all extras which match the episode syntax (e.g. 1x01 Pilot), looks up the title of the file and applies that to the Plex database. These changes are temporarily and will reset once you refresh your metadata, meaning you can’t really mess up your database but you’ll have to run this after the Scheduled Task (e.g. crontab at the end of the stop time).
You may have to change a few things, like the Regex to match your episode extras (in case you use S1E01), so learn to read the script instead of asking me for support.

Disclaimer: This shouldn’t destroy your database because it will only write the title if a) the file exists and b) the file has a title. Just be careful and have a backup ready just in case.

1 Like

Just a general heads-up. You should now be able to pass a title for a local episode extra to Plex. The naming could be a bit clunky, but it’s working rather nicely (tested this last night).

Naming schema is in line with that for other extras, though there’s no subfolder per extra-type approach.

[full base name of the episode] - [extra title]-[extra-type suffix].ext

It’s essential that the base name is 100% identical to the episode file name!!

Example:

TV Shows  <- the folder linked to my library
  Doctor Who (2005)
    Season 10
      Doctor Who (2005) - s10e01 - The Pilot.mkv                            <- the episode
      Doctor Who (2005) - s10e01 - The Pilot - Scene 16-deleted.mkv         <- deleted scene (#16)
      Doctor Who (2005) - s10e01 - The Pilot - Scene 18-deleted.mkv         <- deleted scene (#18)
      Doctor Who (2005) - s10e01 - The Pilot - Scene 21-deleted.mkv         <- deleted scene (#21)
      Doctor Who (2005) - s10e01 - The Pilot - Season Intro-featurette.mkv  <- some fake featurette

Output


Sorry… I only had a German-language mobile at hand to get that screenshot.

When testing this I’ve stumbled over 1 caveat. The agent will currently not support extra titles that contain a dash (-). Such episode extras will still be recognized but Plex will use the default title based on the full file name.
I’m not sure if/when this might be addressed.

Using this new schema does allow to have multiple extras of the same type for a single episode without requiring to add an index to the extra-type suffix (e.g. -deleted1, -deleted2, -deleted3…). If you had been using those, it’s probably best to remove the index when you update your file names.

TL;DR: while I certainly hope we’ll also get some subfolder based approach… I consider this feature suggestion to be implemented :smiley:

1 Like

Awesome! Can’t wait to try it out. Thanks for the heads up! :grin:

Although I still think that my syntax is superior, this is definitely a step in the right direction and greatly appreciated.

The syntax seems to look like this:

/^(?P>episodename)\h*(?<extraname>[^-]+)\h*-(?P>extratype)\.(?P>ext)/

Which basically just means that it strips whitespace around the extraname. I was thinking about waiting to see if the syntax is going to change but I think that ship has sailed. Just unfortunate that you can’t use the “normal” hyphen (hyphen-minus) but it’s not like there aren’t any alternatives (like hyphen or any of the dashes).

I’ll probably still wait for the folder support in case the syntax does change but in the meantime my script is doing just fine.

I don’t disagree :wink:
Though given the new options I’ve pulled the plug and committed a bunch of named episode extras from DVDs I had held back so far… e.g. Futurama S6+7 had 1 file per disc with a total of 40-50 deleted scenes per season. Now they’re split and neatly assigned to their respective episodes (and I love it).

Simplifying the structure if the naming schema allows it shouldn’t be that big of a deal :crossed_fingers:

2022 clean-up: implemented