morpheus65535 / bazarr

Bazarr is a companion application to Sonarr and Radarr. It manages and downloads subtitles based on your requirements. You define your preferences by TV show or movie and Bazarr takes care of everything for you.
https://www.bazarr.media
GNU General Public License v3.0
2.79k stars 217 forks source link

Error when searching for subtitle if ep has "part" naming? #1178

Closed stevezau closed 3 years ago

stevezau commented 3 years ago

Describe the bug An example is when i try to manually search for subs for a series such as The Mole.

Episode path is: /data/TV Shows/The Mole - Infiltrating North Korea/Season 1/The Mole - Infiltrating North Korea - S01E02 - The underground weapons factory WEBDL-720p.mp4 Scenename is: The.Mole.Infiltrating.North.Korea.Part.2.1080p.[REMOVED]

Running on the latest container linuxserver/bazarr:development.

Why is it looking for the filename as The.Mole.Infiltrating.North.Korea.Part.2...?


020-11-03 11:28:53,160 - engineio.server                  (7fd4f799fb20) :  INFO (socket:49) - bc11a705afcc4266a8f0f7e9c4a4e9a6: Received packet PING data None
2020-11-03 11:28:53,161 - engineio.server                  (7fd4f799fb20) :  INFO (socket:92) - bc11a705afcc4266a8f0f7e9c4a4e9a6: Sending packet PONG data None
2020-11-03 11:28:54,334 - root                             (7fd4f83bdb20) :  INFO (get_providers:101) - Using opensubtitles again after 20 minutes, (disabled because: ServiceUnavailable)
2020-11-03 11:28:54,334 - root                             (7fd4f83bdb20) :  INFO (get_providers:101) - Using subscene again after 10 minutes, (disabled because: ProviderError)
2020-11-03 11:28:54,334 - root                             (7fd4f83bdb20) :  INFO (get_providers:101) - Using supersubtitles again after 10 minutes, (disabled because: KeyError)
2020-11-03 11:28:54,338 - root                             (7fd4f83bdb20) :  DEBUG (get_subtitle:110) - BAZARR Searching subtitles for this file: /data/TV Shows/The Mole - Infiltrating North Korea/Season 1/The Mole - Infiltrating North Korea - S01E02 - The underground weapons factory WEBDL-720p.mp4
2020-11-03 11:28:54,338 - subzero.video                    (7fd4f83bdb20) :  DEBUG (video:60) - Parsing video: The.Mole.Infiltrating.North.Korea.Part.2.1080p.[REMOVED].mp4, hints: {'title': 'The Mole - Infiltrating North Korea', 'type': 'episode'}
2020-11-03 11:28:54,338 - subliminal_patch.core            (7fd4f83bdb20) :  INFO (core:507) - Determining basic video properties for 'The.Mole.Infiltrating.North.Korea.Part.2.1080p.[REMOVED].mp4' in '/data/TV Shows/The Mole - Infiltrating North Korea/Season 1'
2020-11-03 11:28:54,383 - subliminal_patch.core            (7fd4f83bdb20) :  DEBUG (core:533) - GuessIt found: {
    "title": "The Mole - Infiltrating North Korea",
    "season": 1,
    "part": 2,
    "screen_size": "1080p",
    "source": "Web",
    "video_codec": "H.264",
    "release_group": "NGP",
    "container": "mp4",
    "mimetype": "video/mp4",
    "type": "episode"
}
2020-11-03 11:28:54,383 - root                             (7fd4f83bdb20) :  ERROR (get_subtitle:73) - BAZARR Error trying to get video information for this file: /data/TV Shows/The Mole - Infiltrating North Korea/Season 1/The.Mole.Infiltrating.North.Korea.Part.2.1080p.[REMOVED].mp4
Traceback (most recent call last):
  File "/app/bazarr/bazarr/get_subtitle.py", line 60, in get_video
    video = parse_video(path, hints=hints, providers=providers, dry_run=used_scene_name,
  File "/app/bazarr/bazarr/../libs/subzero/video.py", line 61, in parse_video
    return scan_video(fn, hints=hints, dont_use_actual_file=dry_run, providers=providers,
  File "/app/bazarr/bazarr/../libs/subliminal_patch/core.py", line 534, in scan_video
    video = Video.fromguess(path, guessed_result)
  File "/app/bazarr/bazarr/../libs/subliminal/video.py", line 94, in fromguess
    return Episode.fromguess(name, guess)
  File "/app/bazarr/bazarr/../libs/subliminal/video.py", line 171, in fromguess
    raise ValueError('Insufficient data to process the guess')
ValueError: Insufficient data to process the guess
2020-11-03 11:28:54,384 - root                             (7fd4f83bdb20) :  DEBUG (get_subtitle:303) - BAZARR Ended searching Subtitles for file: /data/TV Shows/The Mole - Infiltrating North Korea/Season 1/The Mole - Infiltrating North Korea - S01E02 - The underground weapons factory WEBDL-720p.mp4
2020-11-03 11:28:54,384 - socketio.server                  (7fd4f83bdb20) :  INFO (server:283) - emitting event "event" to all [/]```
morpheus65535 commented 3 years ago

If there's a scenename, we use it instead of the actual filename that could have been altered to a point where it's useless: https://github.com/morpheus65535/bazarr/blob/development/bazarr/get_subtitle.py#L53-L64

In your case, the scenename contain part.2 and it seems to be breaking subliminal_patch. I've never encountered that kind of naming with my own collection.

stevezau commented 3 years ago

@morpheus65535, not sure i'm following. This ep was renamed by sonarr so it changed from part to S1E02. Shouldn't Bazarr search for both titles? But for some reason it appears to also try read from a file using the scenename which given it already understands what filess exists.. does not seem right? It shoudn't fail?

morpheus65535 commented 3 years ago

When creating the video object, we create a fake path sing the scenename (if available). This is done to make sure to have the most attributes filled with proper information. We also preserve the real path for later use. Now, the search is done using the video object created that contain attributes based on the scenename, not the real filename. This is why you end up with {'season': 1, 'part': 2} instead of {'season': 1, 'episode': 2}.