Bug in legacy localmedia agent prevent year based seasons from pulling in subtitles

Server Version#: 1.30.1.6550

Hello, I was diagnosing a issue that was completely weird for me with the YouTube-agent.bundle where the subtitles does not show up if they are a external i.e. sidecar. More info can be found at

Anyway, tracing the issues led me to the localmedia agent bundle which is included in /usr/lib/plexmediaserver/Resources/Plug-ins-d1e0b951e/LocalMedia.bundle/Contents/Code/__init__.py mainly this section of the code.

class localMediaTV(Agent.TV_Shows):
  name = 'Local Media Assets (TV)'
  languages = [Locale.Language.NoLanguage]
  primary_provider = False
  persist_stored_files = False
  contributes_to = ['com.plexapp.agents.thetvdb', 'com.plexapp.agents.none']

  def search(self, results, media, lang):
    results.Append(MetadataSearchResult(id = 'null', score = 100))

  def update(self, metadata, media, lang):

    # Clear out the title to ensure stale data doesn't clobber other agents' contributions.
    metadata.title = None

    # Look for media, collect directories.
    dirs = {}
    for s in media.seasons:
      Log('Creating season %s', s)
      metadata.seasons[s].index = int(s)
      for e in media.seasons[s].episodes:
        
        # Make sure metadata exists, and find sidecar media.
        episodeMetadata = metadata.seasons[s].episodes[e]
        episodeMedia = media.seasons[s].episodes[e].items[0]
        dir = os.path.dirname(episodeMedia.parts[0].file)
        dirs[dir] = True
        
        try: localmedia.findAssets(episodeMetadata, media.title, [dir], 'episode', episodeMedia.parts)
        except Exception, e: 
          Log('Error finding media for episode: %s' % str(e))
        
    # Figure out the directories we should be looking in.
    try: dirs = FindUniqueSubdirs(dirs)
    except: dirs = []
    
    # Look for show images.
    Log("Looking for show media for %s.", metadata.title)
    try: localmedia.findAssets(metadata, media.title, dirs, 'show')
    except: Log("Error finding show media.")
    
    # Look for season images.
    for s in metadata.seasons:
      Log('Looking for season media for %s season %s.', metadata.title, s)
      try: localmedia.findAssets(metadata.seasons[s], media.title, dirs, 'season')
      except: Log("Error finding season media for season %s" % s)
        
    # Look for subtitles for each episode.
    for s in media.seasons:
      # If we've got a date based season, ignore it for now, otherwise it'll collide with S/E folders/XML and PMS
      # prefers date-based (why?)
      if int(s) < 1900 or metadata.guid.startswith(PERSONAL_MEDIA_IDENTIFIER):
        for e in media.seasons[s].episodes:
          for i in media.seasons[s].episodes[e].items:

            # Look for subtitles.
            for part in i.parts:
              localmedia.findSubtitles(part)

              # If there is an appropriate VideoHelper, use it.
              video_helper = videohelpers.VideoHelpers(part.file)
              if video_helper:
                video_helper.process_metadata(metadata, episode = metadata.seasons[s].episodes[e])
      else:
        # Whack it in case we wrote it.
        #del metadata.seasons[s]
        pass

looking at this section of the code

  # Look for subtitles for each episode.
    for s in media.seasons:
      # If we've got a date based season, ignore it for now, otherwise it'll collide with S/E folders/XML and PMS
      # prefers date-based (why?)
      if int(s) < 1900 or metadata.guid.startswith(PERSONAL_MEDIA_IDENTIFIER):
        for e in media.seasons[s].episodes:
          for i in media.seasons[s].episodes[e].items:

            # Look for subtitles.
            for part in i.parts:
              localmedia.findSubtitles(part)

              # If there is an appropriate VideoHelper, use it.
              video_helper = videohelpers.VideoHelpers(part.file)
              if video_helper:
                video_helper.process_metadata(metadata, episode = metadata.seasons[s].episodes[e])
      else:
        # Whack it in case we wrote it.
        #del metadata.seasons[s]
        pass

it clearly intended for the there to be an extra code to account for the year based seasons. However, it seems that part was forgotten, and this is fixed in the new plex agent. But for legacy agents that wasn’t the case.

i changed the code from int(s) < 1900 to int(s) < 3000 doing and forced it to be reloaded in plex and that indeed did allow the localmedia agent to scan for subtitles.

2023-01-10 19:27:12,235 (7fcfaac9eb38) :  INFO (__init__:121) - Creating season 2022
2023-01-10 19:27:12,239 (7fcfaac9eb38) :  INFO (localmedia:198) - Looking for episode media (01tv) in 1 paths (root file: 20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022 年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME]) with 1 media files.
2023-01-10 19:27:12,239 (7fcfaac9eb38) :  INFO (localmedia:198) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 19:27:12,244 (7fcfaac9eb38) :  INFO (localmedia:225) - Found 1 valid things for pattern 20221018\ \-\ \【LIVE\映\像\】\「SOS\!\ Summer\」\#\バ\バ\バ\バ\ン\ビ\|2022\年8\月14\日\ Zepp\ Namba\ \単\独\公\演\|\ア\イ\ド\ル\ \ダ\イ\ジ\ェ\ス\ト\ \[youtube\-qyIwYXW1hME\](-|-thumb)?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:27:12,245 (7fcfaac9eb38) :  INFO (__init__:140) - Looking for show media for None.
2023-01-10 19:27:12,248 (7fcfaac9eb38) :  INFO (localmedia:198) - Looking for show media (01tv) in 3 paths (root file: None) with 1 media files.
2023-01-10 19:27:12,248 (7fcfaac9eb38) :  INFO (localmedia:198) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA], /storage/test/media/youtube, /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 19:27:12,249 (7fcfaac9eb38) :  INFO (localmedia:225) - Found 0 valid things for pattern (show|poster|folder)-?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:27:12,250 (7fcfaac9eb38) :  INFO (localmedia:225) - Found 0 valid things for pattern banner-?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:27:12,251 (7fcfaac9eb38) :  INFO (localmedia:225) - Found 0 valid things for pattern (fanart|art|background|backdrop)-?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:27:12,252 (7fcfaac9eb38) :  INFO (localmedia:225) - Found 0 valid things for pattern theme-?[0-9]? (ext: ['mp3'])
2023-01-10 19:27:12,252 (7fcfaac9eb38) :  INFO (__init__:146) - Looking for season media for None season 2022.
2023-01-10 19:27:12,253 (7fcfaac9eb38) :  INFO (localmedia:198) - Looking for season media (01tv) in 3 paths (root file: None) with 1 media files.
2023-01-10 19:27:12,253 (7fcfaac9eb38) :  INFO (localmedia:198) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA], /storage/test/media/youtube, /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 19:27:12,254 (7fcfaac9eb38) :  INFO (localmedia:225) - Found 0 valid things for pattern season-?0?2022[-a-z]?(-poster)? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:27:12,255 (7fcfaac9eb38) :  INFO (localmedia:225) - Found 0 valid things for pattern season-?0?2022-banner[-a-z]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:27:12,256 (7fcfaac9eb38) :  INFO (localmedia:225) - Found 0 valid things for pattern season(-|0|\s)?2022-(fanart|art|background|backdrop)[-a-z]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:27:12,257 (7fcfaac9eb38) :  INFO (localmedia:275) - Looking for subtitle media in 1 paths with 1 media files.
2023-01-10 19:27:12,257 (7fcfaac9eb38) :  INFO (localmedia:276) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 19:27:12,258 (7fcfaac9eb38) :  INFO (subtitlehelpers:143) - Found subtitle file: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022/20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME].srt language: xx codec: srt format: srt default:  forced:
2023-01-10 19:27:12,262 (7fcfaac9eb38) :  DEBUG (model:229) - Serializing to /config/Library/Application Support/Plex Media Server/Metadata/TV Shows/7/91c2f3513d5981cbc081304ecde8cb27d7fdc1a.bundle/Contents/com.plexapp.agents.localmedia/Info.xml
2023-01-10 19:27:12,263 (7fcfaac9eb38) :  DEBUG (runtime:88) - Sending packed state data (110 bytes)
2023-01-10 19:27:12,263 (7fcfaac9eb38) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes

without the change this is the output

2023-01-10 19:24:45,589 (7effde2b8b38) :  INFO (__init__:121) - Creating season 2022
2023-01-10 19:24:45,592 (7effde2b8b38) :  INFO (localmedia:198) - Looking for episode media (01tv) in 1 paths (root file: 20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022 年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME]) with 1 media files.
2023-01-10 19:24:45,592 (7effde2b8b38) :  INFO (localmedia:198) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 19:24:45,597 (7effde2b8b38) :  INFO (localmedia:225) - Found 1 valid things for pattern 20221018\ \-\ \【LIVE\映\像\】\「SOS\!\ Summer\」\#\バ\バ\バ\バ\ン\ビ\|2022\年8\月14\日\ Zepp\ Namba\ \単\独\公\演\|\ア\イ\ド\ル\ \ダ\イ\ジ\ェ\ス\ト\ \[youtube\-qyIwYXW1hME\](-|-thumb)?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:24:45,597 (7effde2b8b38) :  INFO (__init__:140) - Looking for show media for None.
2023-01-10 19:24:45,601 (7effde2b8b38) :  INFO (localmedia:198) - Looking for show media (01tv) in 3 paths (root file: None) with 1 media files.
2023-01-10 19:24:45,601 (7effde2b8b38) :  INFO (localmedia:198) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA], /storage/test/media/youtube, /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 19:24:45,602 (7effde2b8b38) :  INFO (localmedia:225) - Found 0 valid things for pattern (show|poster|folder)-?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:24:45,603 (7effde2b8b38) :  INFO (localmedia:225) - Found 0 valid things for pattern banner-?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:24:45,604 (7effde2b8b38) :  INFO (localmedia:225) - Found 0 valid things for pattern (fanart|art|background|backdrop)-?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:24:45,604 (7effde2b8b38) :  INFO (localmedia:225) - Found 0 valid things for pattern theme-?[0-9]? (ext: ['mp3'])
2023-01-10 19:24:45,604 (7effde2b8b38) :  INFO (__init__:146) - Looking for season media for None season 2022.
2023-01-10 19:24:45,605 (7effde2b8b38) :  INFO (localmedia:198) - Looking for season media (01tv) in 3 paths (root file: None) with 1 media files.
2023-01-10 19:24:45,605 (7effde2b8b38) :  INFO (localmedia:198) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA], /storage/test/media/youtube, /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 19:24:45,606 (7effde2b8b38) :  INFO (localmedia:225) - Found 0 valid things for pattern season-?0?2022[-a-z]?(-poster)? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:24:45,607 (7effde2b8b38) :  INFO (localmedia:225) - Found 0 valid things for pattern season-?0?2022-banner[-a-z]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:24:45,609 (7effde2b8b38) :  INFO (localmedia:225) - Found 0 valid things for pattern season(-|0|\s)?2022-(fanart|art|background|backdrop)[-a-z]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 19:24:45,612 (7effde2b8b38) :  DEBUG (model:229) - Serializing to /config/Library/Application Support/Plex Media Server/Metadata/TV Shows/7/91c2f3513d5981cbc081304ecde8cb27d7fdc1a.bundle/Contents/com.plexapp.agents.localmedia/Info.xml
2023-01-10 19:24:45,613 (7effde2b8b38) :  DEBUG (runtime:88) - Sending packed state data (110 bytes)
2023-01-10 19:24:45,613 (7effde2b8b38) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes

@ChuckPa Please take look when you have time please.

Without knowing a show to compare and seeing example file names,

I can’t do anything here.

I need Series / Season / Episode information.

Having read the GHI, I surmise:

  1. The show is a Year-based series

  2. Seasons labeled with ‘Season XXXX’
    – Local media assets are detected

  3. Seasons labeled with ‘Season YY’
    – No local media assets are detected

Is this correct ?

This is why I need examples please.

  1. Good/valid examples

  2. Failing examples.

Sorry i thought the path was clear in the logs, anyway here is the details.

Library: test, agent: com.plexapp.agents.youtube, scanner: Absolute Series Scanner

The show is a youtube based channel ゼロイチTV, everything working fine metadata/images etc. just the subtitles are not being detected.

#Example working tree

.
└── youtube
    └── 01TV [UCWa9Ea4SfJ2kCF49NZhODoA]
        ├── Season 2021
        │   ├── 20211013 - 【音量注意】初投稿!「ゼロイチTV(仮)」始動‼ 桃月なしこが絶叫開設宣言 [youtube-OTV4CRMwO6U].eng.ass
        │   ├── 20211013 - 【音量注意】初投稿!「ゼロイチTV(仮)」始動‼ 桃月なしこが絶叫開設宣言 [youtube-OTV4CRMwO6U].mkv
        │   ├── 20211015 - 【美女悶絶】ゼロイチファミリア総出演!自己紹介でビリビリ椅子ドッキリ!! [youtube-wavhKsZTwAE].eng.ass
        │   ├── 20211015 - 【美女悶絶】ゼロイチファミリア総出演!自己紹介でビリビリ椅子ドッキリ!! [youtube-wavhKsZTwAE].mkv
        │   ├── 20211219 - 【寝起き】由良ゆら『ベットで〇〇〇〇』#Shorts [youtube-UQ2TUZrUArs].eng.ass
        │   └── 20211219 - 【寝起き】由良ゆら『ベットで〇〇〇〇』#Shorts [youtube-UQ2TUZrUArs].mkv
        └── Season 2022
            ├── 20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME].info.json
            ├── 20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME].jpg
            ├── 20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME].mkv
            └── 20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME].srt

4 directories, 10 files

Example of failing to trigger subtitle search

Logs

2023-01-10 20:50:54,911 (7fef52300b38) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.localmedia/messaging/function/X0FnZW50S2l0OlNlYXJjaA__/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoyCmRpY3QKZGljdAo2CnMyCnhuczQKbGFuZ2IwczYKbWFudWFsYjBzNwpwcmltYXJ5aTAKczcKdmVyc2lvbnIxCnM2Cmt3YXJnc3M3ClRWX1Nob3dzMTAKbWVkaWFfdHlwZTUKczYKMjE3Njk0czgKcGFyZW50SURzOTUKY29tLnBsZXhhcHAuYWdlbnRzLnlvdXR1YmU6Ly95b3V0dWJlfFVDV2E5RWE0U2ZKMmtDRjQ5TlpoT0RvQXxTZWFzb24gMjAyMS8yMDIyLzEwMTgxMjI4P2xhbmc9eG5zNApndWlkYjFzNQpmb3JjZXMyNgpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZXMxMwpwcmltYXJ5X2FnZW50czYKMjE3Njk1czIKaWRyMAo_
2023-01-10 20:50:54,912 (7fef52300b38) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2023-01-10 20:50:54,913 (7fef52300b38) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.localmedia/messaging/function/X0FnZW50S2l0OlNlYXJjaA__/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoyCmRpY3QKZGljdAo2CnMyCnhuczQKbGFuZ2IwczYKbWFudWFsYjBzNwpwcmltYXJ5aTAKczcKdmVyc2lvbnIxCnM2Cmt3YXJnc3M3ClRWX1Nob3dzMTAKbWVkaWFfdHlwZTUKczYKMjE3Njk0czgKcGFyZW50SURzOTUKY29tLnBsZXhhcHAuYWdlbnRzLnlvdXR1YmU6Ly95b3V0dWJlfFVDV2E5RWE0U2ZKMmtDRjQ5TlpoT0RvQXxTZWFzb24gMjAyMS8yMDIyLzEwMTgxMjI4P2xhbmc9eG5zNApndWlkYjFzNQpmb3JjZXMyNgpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZXMxMwpwcmltYXJ5X2FnZW50czYKMjE3Njk1czIKaWRyMAo_
2023-01-10 20:50:54,913 (7fef52300b38) :  INFO (agentkit:961) - Searching for matches for {'id': '217695', 'guid': 'com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022/10181228?lang=xn', 'force': True, 'primary_agent': 'com.plexapp.agents.youtube', 'parentID': '217694'}
2023-01-10 20:50:54,913 (7fef52300b38) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/217695/tree'
2023-01-10 20:50:54,918 (7fef52300b38) :  DEBUG (model:32) - Loading model with GUID com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022/10181228?lang=xn
2023-01-10 20:50:54,919 (7fef52300b38) :  DEBUG (model:234) - Deserializing from /config/Library/Application Support/Plex Media Server/Metadata/TV Shows/7/91c2f3513d5981cbc081304ecde8cb27d7fdc1a.bundle/Contents/com.plexapp.agents.youtube/Info.xml
2023-01-10 20:50:54,921 (7fef52300b38) :  DEBUG (runtime:88) - Sending packed state data (110 bytes)
2023-01-10 20:50:54,921 (7fef52300b38) :  DEBUG (runtime:924) - Response: [200] str, 600 bytes
2023-01-10 20:50:54,925 (7fef52300b38) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.localmedia/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNgoyMTc2OTVzNApkYmlkaTAKczcKdmVyc2lvbnM4Ngpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNXYTlFYTRTZkoya0NGNDlOWmhPRG9BfFNlYXNvbiAyMDIxLzIwMjI%40bGFuZz14bnMxMApwYXJlbnRHVUlEczYKMjE3Njk0czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzOTUKY29tLnBsZXhhcHAuYWdlbnRzLnlvdXR1YmU6Ly95b3V0dWJlfFVDV2E5RWE0U2ZKMmtDRjQ5TlpoT0RvQXxTZWFzb24gMjAyMS8yMDIyLzEwMTgxMjI4P2xhbmc9eG5zNApndWlkczQKbnVsbHMyCmlkcjAK
2023-01-10 20:50:54,925 (7fef52300b38) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2023-01-10 20:50:54,926 (7fef52300b38) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.localmedia/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNgoyMTc2OTVzNApkYmlkaTAKczcKdmVyc2lvbnM4Ngpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNXYTlFYTRTZkoya0NGNDlOWmhPRG9BfFNlYXNvbiAyMDIxLzIwMjI@bGFuZz14bnMxMApwYXJlbnRHVUlEczYKMjE3Njk0czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzOTUKY29tLnBsZXhhcHAuYWdlbnRzLnlvdXR1YmU6Ly95b3V0dWJlfFVDV2E5RWE0U2ZKMmtDRjQ5TlpoT0RvQXxTZWFzb24gMjAyMS8yMDIyLzEwMTgxMjI4P2xhbmc9eG5zNApndWlkczQKbnVsbHMyCmlkcjAK
2023-01-10 20:50:54,926 (7fef52300b38) :  DEBUG (model:32) - Loading model with GUID com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022/10181228?lang=xn
2023-01-10 20:50:54,926 (7fef52300b38) :  DEBUG (model:234) - Deserializing from /config/Library/Application Support/Plex Media Server/Metadata/TV Shows/7/91c2f3513d5981cbc081304ecde8cb27d7fdc1a.bundle/Contents/com.plexapp.agents.localmedia/Info.xml
2023-01-10 20:50:54,928 (7fef52300b38) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/217695/tree'
2023-01-10 20:50:54,933 (7fef52300b38) :  INFO (__init__:121) - Creating season 2022
2023-01-10 20:50:54,934 (7fef52300b38) :  INFO (localmedia:198) - Looking for episode media (01tv) in 1 paths (root file: 20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME]) with 1 media files.
2023-01-10 20:50:54,934 (7fef52300b38) :  INFO (localmedia:198) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 20:50:54,935 (7fef52300b38) :  INFO (localmedia:225) - Found 1 valid things for pattern 20221018\ \-\ \【LIVE\映\像\】\「SOS\!\ Summer\」\#\バ\バ\バ\バ\ン\ビ\|2022\年8\月14\日\ Zepp\ Namba\ \単\独\公\演\|\ア\イ\ド\ル\ \ダ\イ\ジ\ェ\ス\ト\ \[youtube\-qyIwYXW1hME\](-|-thumb)?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 20:50:54,935 (7fef52300b38) :  INFO (__init__:140) - Looking for show media for None.
2023-01-10 20:50:54,937 (7fef52300b38) :  INFO (localmedia:198) - Looking for show media (01tv) in 3 paths (root file: None) with 1 media files.
2023-01-10 20:50:54,937 (7fef52300b38) :  INFO (localmedia:198) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA], /storage/test/media/youtube, /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 20:50:54,937 (7fef52300b38) :  INFO (localmedia:225) - Found 0 valid things for pattern (show|poster|folder)-?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 20:50:54,937 (7fef52300b38) :  INFO (localmedia:225) - Found 0 valid things for pattern banner-?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 20:50:54,938 (7fef52300b38) :  INFO (localmedia:225) - Found 0 valid things for pattern (fanart|art|background|backdrop)-?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 20:50:54,938 (7fef52300b38) :  INFO (localmedia:225) - Found 0 valid things for pattern theme-?[0-9]? (ext: ['mp3'])
2023-01-10 20:50:54,938 (7fef52300b38) :  INFO (__init__:146) - Looking for season media for None season 2022.
2023-01-10 20:50:54,939 (7fef52300b38) :  INFO (localmedia:198) - Looking for season media (01tv) in 3 paths (root file: None) with 1 media files.
2023-01-10 20:50:54,939 (7fef52300b38) :  INFO (localmedia:198) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA], /storage/test/media/youtube, /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 20:50:54,939 (7fef52300b38) :  INFO (localmedia:225) - Found 0 valid things for pattern season-?0?2022[-a-z]?(-poster)? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 20:50:54,939 (7fef52300b38) :  INFO (localmedia:225) - Found 0 valid things for pattern season-?0?2022-banner[-a-z]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 20:50:54,940 (7fef52300b38) :  INFO (localmedia:225) - Found 0 valid things for pattern season(-|0|\s)?2022-(fanart|art|background|backdrop)[-a-z]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 20:50:54,942 (7fef52300b38) :  DEBUG (model:229) - Serializing to /config/Library/Application Support/Plex Media Server/Metadata/TV Shows/7/91c2f3513d5981cbc081304ecde8cb27d7fdc1a.bundle/Contents/com.plexapp.agents.localmedia/Info.xml
2023-01-10 20:50:54,943 (7fef52300b38) :  DEBUG (runtime:88) - Sending packed state data (110 bytes)
2023-01-10 20:50:54,943 (7fef52300b38) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes

XML data

<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="39" librarySectionTitle="test" librarySectionUUID="a8a2e006-d4d7-4d90-aad0-1c3b83446faa" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1673274029">
    <Video ratingKey="217695" key="/library/metadata/217695" parentRatingKey="217694" grandparentRatingKey="217465" guid="com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022/10181228?lang=xn" parentGuid="com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022?lang=xn" grandparentGuid="com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021?lang=xn" type="episode" title="【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト" grandparentKey="/library/metadata/217465" parentKey="/library/metadata/217694" librarySectionTitle="test" librarySectionID="39" librarySectionKey="/library/sections/39" grandparentTitle="01tv" parentTitle="Season 2022" summary="8月14日にZepp Nambaにて開催された単独公演のライブ映像を公開! 10/21(金)ワンマンライブ開催! 「バンビの野望」中野サンプラザホール🏛 18:00 開場 / 19:00 開演 🎫只今チケット絶賛販売中❗️(全席指定) http://r-t.jp/babababambi #アイドル #ライブ映像 💚池田メルダ https://twitter.com/meruda__ikeda 💖宇咲 https://twitter.com/usa_usa0427 🤍小鳥遊るい https://twitter.com/pipipi_br ❤️岸みゆ https://twitter.com/miyu_kishi0213 💙水湊みお https://twitter.com/minato__mio 💜近藤沙瑛子 https://twitter.com/saekondo_inu 💛吉沢朱音 https://twitter.com/akanekogurasi 🖤公式Twitter https://twitter.com/babababambi01 ▼YouTube関連のお問い合わせはコチラ https://forms.gle/y7T6qV6NBhvw9bGs8" index="10181228" parentIndex="2022" year="2022" thumb="/library/metadata/217695/thumb/1673373037" art="/library/metadata/217465/art/1673373037" grandparentThumb="/library/metadata/217465/thumb/1673373037" grandparentArt="/library/metadata/217465/art/1673373037" duration="117934" originallyAvailableAt="2022-10-17" addedAt="1673372976" updatedAt="1673373037">
        <Media id="297264" duration="117934" bitrate="4586" width="1920" height="1080" aspectRatio="1.78" audioChannels="2" audioCodec="aac" videoCodec="h264" videoResolution="1080" container="mkv" videoFrameRate="NTSC" audioProfile="lc" videoProfile="high">
            <Part accessible="1" exists="1" id="626587" key="/library/parts/626587/1665232094/file.mkv" duration="117934" file="/storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022/20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME].mkv" size="67719239" audioProfile="lc" container="mkv" deepAnalysisVersion="6" requiredBandwidths="4423,4423,4423,4423,4423,4423,4423,4423" videoProfile="high">
                <Stream id="2139849" streamType="1" default="1" codec="h264" index="0" bitrate="4458" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" codedHeight="1088" codedWidth="1920" colorPrimaries="bt709" colorRange="tv" colorSpace="bt709" colorTrc="bt709" frameRate="29.970" hasScalingMatrix="0" height="1080" level="40" profile="high" refFrames="3" requiredBandwidths="4300,4300,4300,4300,4300,4300,4300,4300" scanType="progressive" width="1920" displayTitle="1080p (H.264)" extendedDisplayTitle="1080p (H.264)"></Stream>
                <Stream id="2139850" streamType="2" selected="1" default="1" codec="aac" index="1" channels="2" bitrate="128" language="English" languageTag="en" languageCode="eng" audioChannelLayout="stereo" profile="lc" requiredBandwidths="124,124,124,124,124,124,124,124" samplingRate="44100" displayTitle="English (AAC Stereo)" extendedDisplayTitle="English (AAC Stereo)"></Stream>
            </Part>
        </Media>
        <Director id="380430" filter="director=380430" tag="#バババ バンビ公式チャンネル"/>
        <Extras size="0"></Extras>
        <Related></Related>
    </Video>
</MediaContainer>

XML data tree

<MediaContainer size="1" identifier="com.plexapp.plugins.library" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1673274029">
    <MetadataItem id="217465" title="01tv" guid="com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021?lang=xn" parentTitle="" instanceRatingKey="" index="1" originallyAvailableAt="" addedAt="1672574802" refreshedAt="1673362237">
        <MetadataItem id="217694" title="" guid="com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022?lang=xn" parentTitle="" instanceRatingKey="" index="2022" originallyAvailableAt="" addedAt="1673362176" refreshedAt="1673362237">
            <MetadataItem id="217695" title="【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト" guid="com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022/10181228?lang=xn" parentTitle="" instanceRatingKey="" index="10181228" originallyAvailableAt="2022-10-17" addedAt="1673362176" refreshedAt="1673362254">
                <MediaItem id="297264">
                    <MediaPart metadataType="4" id="626587" file="/storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022/20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME].mkv" size="67719239" openSubtitleHash="1ba8f856e6ad11c7" hash="036ed51794cce9d5b93821d136eb968289d93f4f" duration="117934">
                        <MediaStream id="2139849" index="0" type="1" codec="h264" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" codedHeight="1088" codedWidth="1920" colorPrimaries="bt709" colorRange="tv" colorSpace="bt709" colorTrc="bt709" frameRate="29.970" hasScalingMatrix="0" height="1080" level="40" profile="high" refFrames="3" requiredBandwidths="4300,4300,4300,4300,4300,4300,4300,4300" scanType="progressive" width="1920"/>
                        <MediaStream id="2139850" index="1" type="2" channels="2" codec="aac" language="en" audioChannelLayout="stereo" profile="lc" requiredBandwidths="124,124,124,124,124,124,124,124" samplingRate="44100"/>
                    </MediaPart>
                </MediaItem>
            </MetadataItem>
        </MetadataItem>
        <Setting id="episodeSort" label="Episode sorting" summary="How to sort the episodes for this show." type="text" default="-1" value="-1" hidden="0" advanced="0" group="" enumValues="-1:Library default|0:Oldest first|1:Newest first"/>
        <Setting id="autoDeletionItemPolicyUnwatchedLibrary" label="Keep" summary="Set the maximum number of unplayed episodes to keep for the show." type="int" default="0" value="0" hidden="0" advanced="0" group="" enumValues="0:All episodes|5:5 latest episodes|3:3 latest episodes|1:Latest episode|-3:Episodes added in the past 3 days|-7:Episodes added in the past 7 days|-30:Episodes added in the past 30 days"/>
        <Setting id="autoDeletionItemPolicyWatchedLibrary" label="Delete episodes after playing" summary="Choose how quickly episodes are removed after the server admin has played them." type="int" default="0" value="0" hidden="0" advanced="0" group="" enumValues="0:Never|1:After a day|7:After a week|100:On next refresh"/>
        <Setting id="flattenSeasons" label="Seasons" summary="Choose whether to display seasons." type="int" default="-1" value="-1" hidden="0" advanced="0" group="" enumValues="-1:Library default|0:Show|1:Hide"/>
        <Setting id="showOrdering" label="Episode ordering" summary="How the episodes are named on disk." type="text" default="" value="" hidden="0" advanced="0" group="" enumValues="aired:TheTVDB (Aired)|dvd:TheTVDB (DVD)|absolute:TheTVDB (Absolute)"/>
    </MetadataItem>
</MediaContainer>

no matter what i do plex dance, remove media purge etc restart PMS, it’s always come back like this no subtitles.

However, once i do the change i posted in my earlier response code from int(s) < 1900 to int(s) < 3000, The subtitle search start working and detect them automatically and via refresh metadata.

Example of working subtitle search on exact media file

Logs

2023-01-10 21:01:09,387 (7ff82b005b38) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.localmedia/messaging/function/X0FnZW50S2l0OlNlYXJjaA__/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoyCmRpY3QKZGljdAo2CnMyCnhuczQKbGFuZ2IwczYKbWFudWFsYjBzNwpwcmltYXJ5aTAKczcKdmVyc2lvbnIxCnM2Cmt3YXJnc3M3ClRWX1Nob3dzMTAKbWVkaWFfdHlwZTUKczYKMjE3Njk0czgKcGFyZW50SURzOTUKY29tLnBsZXhhcHAuYWdlbnRzLnlvdXR1YmU6Ly95b3V0dWJlfFVDV2E5RWE0U2ZKMmtDRjQ5TlpoT0RvQXxTZWFzb24gMjAyMS8yMDIyLzEwMTgxMjI4P2xhbmc9eG5zNApndWlkYjFzNQpmb3JjZXMyNgpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZXMxMwpwcmltYXJ5X2FnZW50czYKMjE3Njk1czIKaWRyMAo_
2023-01-10 21:01:09,387 (7ff82b005b38) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2023-01-10 21:01:09,398 (7ff82b005b38) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.localmedia/messaging/function/X0FnZW50S2l0OlNlYXJjaA__/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoyCmRpY3QKZGljdAo2CnMyCnhuczQKbGFuZ2IwczYKbWFudWFsYjBzNwpwcmltYXJ5aTAKczcKdmVyc2lvbnIxCnM2Cmt3YXJnc3M3ClRWX1Nob3dzMTAKbWVkaWFfdHlwZTUKczYKMjE3Njk0czgKcGFyZW50SURzOTUKY29tLnBsZXhhcHAuYWdlbnRzLnlvdXR1YmU6Ly95b3V0dWJlfFVDV2E5RWE0U2ZKMmtDRjQ5TlpoT0RvQXxTZWFzb24gMjAyMS8yMDIyLzEwMTgxMjI4P2xhbmc9eG5zNApndWlkYjFzNQpmb3JjZXMyNgpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZXMxMwpwcmltYXJ5X2FnZW50czYKMjE3Njk1czIKaWRyMAo_
2023-01-10 21:01:09,398 (7ff82b005b38) :  INFO (agentkit:961) - Searching for matches for {'id': '217695', 'guid': 'com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022/10181228?lang=xn', 'force': True, 'primary_agent': 'com.plexapp.agents.youtube', 'parentID': '217694'}
2023-01-10 21:01:09,398 (7ff82b005b38) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/217695/tree'
2023-01-10 21:01:09,404 (7ff82b005b38) :  DEBUG (accessor:68) - Creating a new read-only model access point for provider com.plexapp.agents.youtube in namespace 'metadata'
2023-01-10 21:01:09,407 (7ff82b005b38) :  DEBUG (model:32) - Loading model with GUID com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022/10181228?lang=xn
2023-01-10 21:01:09,408 (7ff82b005b38) :  DEBUG (model:234) - Deserializing from /config/Library/Application Support/Plex Media Server/Metadata/TV Shows/7/91c2f3513d5981cbc081304ecde8cb27d7fdc1a.bundle/Contents/com.plexapp.agents.youtube/Info.xml
2023-01-10 21:01:09,415 (7ff82b005b38) :  DEBUG (runtime:88) - Sending packed state data (110 bytes)
2023-01-10 21:01:09,415 (7ff82b005b38) :  DEBUG (runtime:924) - Response: [200] str, 600 bytes
2023-01-10 21:01:09,418 (7ff82b005b38) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.localmedia/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNgoyMTc2OTVzNApkYmlkaTAKczcKdmVyc2lvbnM4Ngpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNXYTlFYTRTZkoya0NGNDlOWmhPRG9BfFNlYXNvbiAyMDIxLzIwMjI%40bGFuZz14bnMxMApwYXJlbnRHVUlEczYKMjE3Njk0czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzOTUKY29tLnBsZXhhcHAuYWdlbnRzLnlvdXR1YmU6Ly95b3V0dWJlfFVDV2E5RWE0U2ZKMmtDRjQ5TlpoT0RvQXxTZWFzb24gMjAyMS8yMDIyLzEwMTgxMjI4P2xhbmc9eG5zNApndWlkczQKbnVsbHMyCmlkcjAK
2023-01-10 21:01:09,419 (7ff82b005b38) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2023-01-10 21:01:09,420 (7ff82b005b38) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.localmedia/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNgoyMTc2OTVzNApkYmlkaTAKczcKdmVyc2lvbnM4Ngpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNXYTlFYTRTZkoya0NGNDlOWmhPRG9BfFNlYXNvbiAyMDIxLzIwMjI@bGFuZz14bnMxMApwYXJlbnRHVUlEczYKMjE3Njk0czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzOTUKY29tLnBsZXhhcHAuYWdlbnRzLnlvdXR1YmU6Ly95b3V0dWJlfFVDV2E5RWE0U2ZKMmtDRjQ5TlpoT0RvQXxTZWFzb24gMjAyMS8yMDIyLzEwMTgxMjI4P2xhbmc9eG5zNApndWlkczQKbnVsbHMyCmlkcjAK
2023-01-10 21:01:09,420 (7ff82b005b38) :  DEBUG (model:32) - Loading model with GUID com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022/10181228?lang=xn
2023-01-10 21:01:09,420 (7ff82b005b38) :  DEBUG (model:234) - Deserializing from /config/Library/Application Support/Plex Media Server/Metadata/TV Shows/7/91c2f3513d5981cbc081304ecde8cb27d7fdc1a.bundle/Contents/com.plexapp.agents.localmedia/Info.xml
2023-01-10 21:01:09,422 (7ff82b005b38) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/217695/tree'
2023-01-10 21:01:09,427 (7ff82b005b38) :  INFO (__init__:121) - Creating season 2022
2023-01-10 21:01:09,430 (7ff82b005b38) :  INFO (localmedia:198) - Looking for episode media (01tv) in 1 paths (root file: 20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME]) with 1 media files.
2023-01-10 21:01:09,431 (7ff82b005b38) :  INFO (localmedia:198) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 21:01:09,436 (7ff82b005b38) :  INFO (localmedia:225) - Found 1 valid things for pattern 20221018\ \-\ \【LIVE\映\像\】\「SOS\!\ Summer\」\#\バ\バ\バ\バ\ン\ビ\|2022\年8\月14\日\ Zepp\ Namba\ \単\独\公\演\|\ア\イ\ド\ル\ \ダ\イ\ジ\ェ\ス\ト\ \[youtube\-qyIwYXW1hME\](-|-thumb)?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 21:01:09,436 (7ff82b005b38) :  INFO (__init__:140) - Looking for show media for None.
2023-01-10 21:01:09,440 (7ff82b005b38) :  INFO (localmedia:198) - Looking for show media (01tv) in 3 paths (root file: None) with 1 media files.
2023-01-10 21:01:09,440 (7ff82b005b38) :  INFO (localmedia:198) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA], /storage/test/media/youtube, /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 21:01:09,441 (7ff82b005b38) :  INFO (localmedia:225) - Found 0 valid things for pattern (show|poster|folder)-?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 21:01:09,442 (7ff82b005b38) :  INFO (localmedia:225) - Found 0 valid things for pattern banner-?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 21:01:09,443 (7ff82b005b38) :  INFO (localmedia:225) - Found 0 valid things for pattern (fanart|art|background|backdrop)-?[0-9]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 21:01:09,443 (7ff82b005b38) :  INFO (localmedia:225) - Found 0 valid things for pattern theme-?[0-9]? (ext: ['mp3'])
2023-01-10 21:01:09,443 (7ff82b005b38) :  INFO (__init__:146) - Looking for season media for None season 2022.
2023-01-10 21:01:09,444 (7ff82b005b38) :  INFO (localmedia:198) - Looking for season media (01tv) in 3 paths (root file: None) with 1 media files.
2023-01-10 21:01:09,444 (7ff82b005b38) :  INFO (localmedia:198) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA], /storage/test/media/youtube, /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 21:01:09,445 (7ff82b005b38) :  INFO (localmedia:225) - Found 0 valid things for pattern season-?0?2022[-a-z]?(-poster)? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 21:01:09,446 (7ff82b005b38) :  INFO (localmedia:225) - Found 0 valid things for pattern season-?0?2022-banner[-a-z]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 21:01:09,448 (7ff82b005b38) :  INFO (localmedia:225) - Found 0 valid things for pattern season(-|0|\s)?2022-(fanart|art|background|backdrop)[-a-z]? (ext: ['jpg', 'png', 'jpeg', 'tbn'])
2023-01-10 21:01:09,449 (7ff82b005b38) :  INFO (localmedia:275) - Looking for subtitle media in 1 paths with 1 media files.
2023-01-10 21:01:09,449 (7ff82b005b38) :  INFO (localmedia:276) - Paths: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022
2023-01-10 21:01:09,449 (7ff82b005b38) :  INFO (subtitlehelpers:143) - Found subtitle file: /storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022/20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14 日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME].srt language: xx codec: srt format: srt default:  forced:
2023-01-10 21:01:09,453 (7ff82b005b38) :  DEBUG (model:229) - Serializing to /config/Library/Application Support/Plex Media Server/Metadata/TV Shows/7/91c2f3513d5981cbc081304ecde8cb27d7fdc1a.bundle/Contents/com.plexapp.agents.localmedia/Info.xml
2023-01-10 21:01:09,454 (7ff82b005b38) :  DEBUG (runtime:88) - Sending packed state data (110 bytes)
2023-01-10 21:01:09,454 (7ff82b005b38) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes

XML Data

<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="39" librarySectionTitle="test" librarySectionUUID="a8a2e006-d4d7-4d90-aad0-1c3b83446faa" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1673370490">
    <Video ratingKey="217695" key="/library/metadata/217695" parentRatingKey="217694" grandparentRatingKey="217465" guid="com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022/10181228?lang=xn" parentGuid="com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022?lang=xn" grandparentGuid="com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021?lang=xn" type="episode" title="【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト" grandparentKey="/library/metadata/217465" parentKey="/library/metadata/217694" librarySectionTitle="test" librarySectionID="39" librarySectionKey="/library/sections/39" grandparentTitle="01tv" parentTitle="Season 2022" summary="8月14日にZepp Nambaにて開催された単独公演のライブ映像を公開! 10/21(金)ワンマンライブ開催! 「バンビの野望」中野サンプラザホール🏛 18:00 開場 / 19:00 開演 🎫只今チケット絶賛販売中❗️(全席指定) http://r-t.jp/babababambi #アイドル #ライブ映像 💚池田メルダ https://twitter.com/meruda__ikeda 💖宇咲 https://twitter.com/usa_usa0427 🤍小鳥遊るい https://twitter.com/pipipi_br ❤️岸みゆ https://twitter.com/miyu_kishi0213 💙水湊みお https://twitter.com/minato__mio 💜近藤沙瑛子 https://twitter.com/saekondo_inu 💛吉沢朱音 https://twitter.com/akanekogurasi 🖤公式Twitter https://twitter.com/babababambi01 ▼YouTube関連のお問い合わせはコチラ https://forms.gle/y7T6qV6NBhvw9bGs8" index="10181228" parentIndex="2022" year="2022" thumb="/library/metadata/217695/thumb/1673373037" art="/library/metadata/217465/art/1673373037" grandparentThumb="/library/metadata/217465/thumb/1673373037" grandparentArt="/library/metadata/217465/art/1673373037" duration="117934" originallyAvailableAt="2022-10-17" addedAt="1673372976" updatedAt="1673373037">
        <Media id="297264" duration="117934" bitrate="4586" width="1920" height="1080" aspectRatio="1.78" audioChannels="2" audioCodec="aac" videoCodec="h264" videoResolution="1080" container="mkv" videoFrameRate="NTSC" audioProfile="lc" videoProfile="high">
            <Part accessible="1" exists="1" id="626587" key="/library/parts/626587/1665232094/file.mkv" duration="117934" file="/storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022/20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME].mkv" size="67719239" audioProfile="lc" container="mkv" deepAnalysisVersion="6" requiredBandwidths="4423,4423,4423,4423,4423,4423,4423,4423" videoProfile="high">
                <Stream id="2139849" streamType="1" default="1" codec="h264" index="0" bitrate="4458" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" codedHeight="1088" codedWidth="1920" colorPrimaries="bt709" colorRange="tv" colorSpace="bt709" colorTrc="bt709" frameRate="29.970" hasScalingMatrix="0" height="1080" level="40" profile="high" refFrames="3" requiredBandwidths="4300,4300,4300,4300,4300,4300,4300,4300" scanType="progressive" width="1920" displayTitle="1080p (H.264)" extendedDisplayTitle="1080p (H.264)"></Stream>
                <Stream id="2139850" streamType="2" selected="1" default="1" codec="aac" index="1" channels="2" bitrate="128" language="English" languageTag="en" languageCode="eng" audioChannelLayout="stereo" profile="lc" requiredBandwidths="124,124,124,124,124,124,124,124" samplingRate="44100" displayTitle="English (AAC Stereo)" extendedDisplayTitle="English (AAC Stereo)"></Stream>
                <Stream id="2139852" key="/library/streams/2139852" streamType="3" codec="srt" language="xx" languageTag="xx" languageCode="" format="srt" displayTitle="xx (SRT External)" extendedDisplayTitle="xx (SRT External)"></Stream>
            </Part>
        </Media>
        <Director id="380430" filter="director=380430" tag="#バババ バンビ公式チャンネル"/>
        <Extras size="0"></Extras>
        <Related></Related>
    </Video>
</MediaContainer>

XML Data Tree

<MediaContainer size="1" identifier="com.plexapp.plugins.library" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1673370490">
    <MetadataItem id="217465" title="01tv" guid="com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021?lang=xn" parentTitle="" instanceRatingKey="" index="1" originallyAvailableAt="" addedAt="1672574802" refreshedAt="1673362237">
        <MetadataItem id="217694" title="" guid="com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022?lang=xn" parentTitle="" instanceRatingKey="" index="2022" originallyAvailableAt="" addedAt="1673362176" refreshedAt="1673362237">
            <MetadataItem id="217695" title="【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト" guid="com.plexapp.agents.youtube://youtube|UCWa9Ea4SfJ2kCF49NZhODoA|Season 2021/2022/10181228?lang=xn" parentTitle="" instanceRatingKey="" index="10181228" originallyAvailableAt="2022-10-17" addedAt="1673362176" refreshedAt="1673362869">
                <MediaItem id="297264">
                    <MediaPart metadataType="4" id="626587" file="/storage/test/media/youtube/01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/Season 2022/20221018 - 【LIVE映像】「SOS! Summer」#ババババンビ|2022年8月14日 Zepp Namba 単独公演|アイドル ダイジェスト [youtube-qyIwYXW1hME].mkv" size="67719239" openSubtitleHash="1ba8f856e6ad11c7" hash="036ed51794cce9d5b93821d136eb968289d93f4f" duration="117934">
                        <MediaStream id="2139849" index="0" type="1" codec="h264" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" codedHeight="1088" codedWidth="1920" colorPrimaries="bt709" colorRange="tv" colorSpace="bt709" colorTrc="bt709" frameRate="29.970" hasScalingMatrix="0" height="1080" level="40" profile="high" refFrames="3" requiredBandwidths="4300,4300,4300,4300,4300,4300,4300,4300" scanType="progressive" width="1920"/>
                        <MediaStream id="2139850" index="1" type="2" channels="2" codec="aac" language="en" audioChannelLayout="stereo" profile="lc" requiredBandwidths="124,124,124,124,124,124,124,124" samplingRate="44100"/>
                        <MediaStream id="2139852" type="3" url="file:///storage/test/media/youtube/01TV%20[UCWa9Ea4SfJ2kCF49NZhODoA]/Season%202022/20221018%20-%20【LIVE映像】「SOS!%20Summer」#ババババンビ|2022年8月14日%20Zepp%20Namba%20単独公演|アイドル%20ダイジェスト%20[youtube-qyIwYXW1hME].srt" codec="srt" language="xx" format="srt"/>
                    </MediaPart>
                </MediaItem>
            </MetadataItem>
        </MetadataItem>
        <Setting id="episodeSort" label="Episode sorting" summary="How to sort the episodes for this show." type="text" default="-1" value="-1" hidden="0" advanced="0" group="" enumValues="-1:Library default|0:Oldest first|1:Newest first"/>
        <Setting id="autoDeletionItemPolicyUnwatchedLibrary" label="Keep" summary="Set the maximum number of unplayed episodes to keep for the show." type="int" default="0" value="0" hidden="0" advanced="0" group="" enumValues="0:All episodes|5:5 latest episodes|3:3 latest episodes|1:Latest episode|-3:Episodes added in the past 3 days|-7:Episodes added in the past 7 days|-30:Episodes added in the past 30 days"/>
        <Setting id="autoDeletionItemPolicyWatchedLibrary" label="Delete episodes after playing" summary="Choose how quickly episodes are removed after the server admin has played them." type="int" default="0" value="0" hidden="0" advanced="0" group="" enumValues="0:Never|1:After a day|7:After a week|100:On next refresh"/>
        <Setting id="flattenSeasons" label="Seasons" summary="Choose whether to display seasons." type="int" default="-1" value="-1" hidden="0" advanced="0" group="" enumValues="-1:Library default|0:Show|1:Hide"/>
        <Setting id="showOrdering" label="Episode ordering" summary="How the episodes are named on disk." type="text" default="" value="" hidden="0" advanced="0" group="" enumValues="aired:TheTVDB (Aired)|dvd:TheTVDB (DVD)|absolute:TheTVDB (Absolute)"/>
    </MetadataItem>
</MediaContainer>

To be clear, the localmedia agent will work shows with seasons < 1900 for example, /media/tv/showtitle (2000)/Season 01/file.(mkv|srt) it will detect the subtitles. However, it will not detect /media/tv/showtitle (2000)/Season 2020/file.(mkv|srt)

May I see an example of a failing tree?

I think it’s

 youtube/
    01TV [UCWa9Ea4SfJ2kCF49NZhODoA]/
       Season 21/
          211013 - 【音量注意】初投稿!「ゼロイチTV(仮)」始動‼ 桃月なしこが絶叫開設宣言 [youtube-OTV4CRMwO6U].eng.ass
          211013 - 【音量注意】初投稿!「ゼロイチTV(仮)」始動‼ 桃月なしこが絶叫開設宣言 [youtube-OTV4CRMwO6U].mkv

Is this correct ??

Sorry no the season is Season 2022 & Season 2021 not Season 21 < this one will work

channel reference https://www.youtube.com/@user-xp5zv8my8n

Where is the series please on Youtube so I may also reference it for the Engineer ?

I edited the earlier post with link to the channel and corrected statement. Seasons numbered less then 1900 will work, anything past 1901 will not as per the localmedia plugin code.

Thank you. Now I have a clear description of the problem.

Please do remember, Python isn’t used very much (if at all).
These are all deprecated. Everything is migrating to internal C++

I will see what else I can learn.

I understand that they are deprecated, but there is simply no alternative to some of those plugins, like YouTube-Agent, xbmcnfotv etc, Plex simply cannot account for everything via your new agents and that’s to be expected.

As far as i know at least from some plex employee statements, is that while the plugin frontend is gone, the scanners/agents will be here for foreseeable future. as they are simply too important for healthly functionality of the product.

I have messaged the engineer.
He is gone for the day (different time zone).

He’ll see it when back in the office tomorrow.

Thank you very much. I await your update =)

Think you might have misunderstood.

  1. Scanners and Agents are critical to the functionality of PMS.

  2. Python-based scanners and agents are deprecated.
    In many cases, they are now obsolete and fully replaced by C++ for nearly 2 years

This is where I will stop and allow the Scanner/Agent engineer to speak further

2 Likes

I received a message from the engineer.

As expected,

There is no further work being done on the legacy agents unless it’s something causing huge issues with the stability of the server

Rephrasing - “Bye Bye Python” is my impression.

1 Like

That’s really unfortunate as it’s one line (4) characters change. I guess it’s time to seek other alternatives options.

Thank you for trying @ChuckPa.

A workaround for this bug, at least for linuxserver/plex image is to ssh into the container and do the following

$ docker exec -ti plex bash
$ sed -i 's/int(s) < 1900/int(s) < 3000/g' /usr/lib/plexmediaserver/Resources/Plug-ins-*/LocalMedia.bundle/Contents/Code/__init__.py
$ kill -9 $(pgrep -f 'com\.plexapp\.agents\.localmedia')

This command will make the needed changes and kill plex server it will restart with the expected changes.

@m7eesn

I received information today and now understand why they won’t be spending more time on those existing legacy agents. Spending time on them would divide their development efforts.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.