pannal / Sub-Zero.bundle

Subtitles for Plex, as good you would expect them to be.
Other
1.76k stars 120 forks source link

Subtitle Download Loop #761

Closed apathy closed 3 years ago

apathy commented 3 years ago

Hello, I can't seem to figure out exactly how to fix this after countless reinstalls and trying to diagnose the issue by myself. I've made sure SubZero was installed and configured properly all the way to making sure every file has the right permissions but still I haven't managed to find out how to stop SubZero from downloading subtitles when they already exist/have been downloaded. One scenario: I have a show already added with 4 episodes and all 4 of those subtitles have been downloaded by SubZero previously then when a new episode airs, SubZero proceeds to grab all not only the new episode subtitle but the previous 4 again. This also applies to missing subtitles, if I add a show and SubZero didn't manage to find all the subtitles, it will try to grab any missing subtitles over and over again no matter if they eventually exist. These are my current settings so I don't know if I've missed something to stop SubZero from downloading stuff again: image image image image

apathy commented 3 years ago

Here is a debug log of me performing a "Refresh Metadata" on the same movie 3 times, the settings are the same with the only difference being "Don't search for subtitles if a subtitle in any configured language exists as" set as "External subtitles". The reason I did Refresh Metadata on the same movie 3 times is to best replicate the issue that happens with TV Shows that either already had existing subtitles or missed subtitles as it'll constantly replace them every time when they already exist.

com.plexapp.agents.subzero.log

Here's another set of logs from a show with 2 seasons that SubZero previously downloaded subtitles for, but when a new episode was added it decided to grab all of the subtitles instead (as if it never had any subtitles) of just grabbing it for the one new episode thus leading to a longer metadata match for the latest episode. com.plexapp.agents.subzero2.log

apathy commented 3 years ago

I've looked further into this and I think I know where the issue is, it seems like when SubZero is looking for that external subtitle to see if it exists or not, it's not looking at my custom path but rather where the media file is and of course that will always return false as I've set it to specifically be in one path. Example:

Code Block (43 lines) ```log 2021-03-03 14:04:59,272 (7f656f7fe700) : DEBUG (scanning:157) - Determining force-refresh (video: 6327, series: None, season: None), result: False 2021-03-03 14:04:59,272 (7f656f7fe700) : DEBUG (scanning:33) - Detecting streams: /home/snip/media/Movies/The Mauritanian (2021)/The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv, account_for_external_subtitles=True, account_for_embedded_subtitles=False 2021-03-03 14:04:59,273 (7f656f7fe700) : DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/6327' 2021-03-03 14:04:59,278 (7f656f7fe700) : DEBUG (scanning:113) - Known metadata subtitles: set([]) 2021-03-03 14:04:59,278 (7f656f7fe700) : DEBUG (scanning:114) - Known embedded subtitles: [] 2021-03-03 14:04:59,319 (7f656f7fe700) : DEBUG (logger:28) - subzero.video: Parsing video: The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv, hints: {'type': 'movie', 'title': 'The Mauritanian'} 2021-03-03 14:04:59,319 (7f656f7fe700) : INFO (logger:38) - subliminal_patch.core: Determining basic video properties for 'The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv' in '/home/snip/media/Movies/The Mauritanian (2021)' 2021-03-03 14:04:59,332 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: GuessIt found: { "title": "The Mauritanian", "year": 2021, "other": "Proper", "proper_count": 1, "screen_size": "1080p", "streaming_service": "Amazon Prime", "format": "WEB-DL", "audio_codec": "EAC3", "audio_channels": "5.1", "video_codec": "h264", "release_group": "NTG", "container": "mkv", "mimetype": "video/x-matroska", "type": "movie" } 2021-03-03 14:04:59,343 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: Size is 7436579936 2021-03-03 14:04:59,351 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: Computed hashes {'opensubtitles': '32c45783acc343e9'} 2021-03-03 14:04:59,351 (7f656f7fe700) : INFO (scanning:128) - Found audio streams: en 2021-03-03 14:04:59,352 (7f656f7fe700) : DEBUG (logger:28) - subzero.video: Determining existing subtitles for /home/snip/media/Movies/The Mauritanian (2021)/The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv 2021-03-03 14:04:59,352 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: external subs: scanning path /home/snip/media/Movies/The Mauritanian (2021)/The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv 2021-03-03 14:04:59,352 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: Found subtitles {} 2021-03-03 14:04:59,352 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: external subs: found {} 2021-03-03 14:04:59,353 (7f656f7fe700) : INFO (datakit:131) - Saved the dictionary file 2021-03-03 14:04:59,354 (7f656f7fe700) : DEBUG (scheduler:67) - Task data cleared: MissingSubtitles 2021-03-03 14:04:59,354 (7f656f7fe700) : INFO (download:121) - The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv has missing languages: set([, ]) 2021-03-03 14:04:59,354 (7f656f7fe700) : INFO (logger:38) - subliminal_patch.core: Refining video with sz_omdb 2021-03-03 14:04:59,355 (7f656f7fe700) : DEBUG (logger:28) - subliminal.refiners.omdb: Found 1 results 2021-03-03 14:04:59,355 (7f656f7fe700) : DEBUG (logger:28) - subliminal.refiners.omdb: Found result with matching year 2021-03-03 14:04:59,355 (7f656f7fe700) : DEBUG (logger:28) - subliminal.refiners.omdb: Found movie {u'imdbID': u'tt4761112', u'Title': u'The Mauritanian', u'Type': u'movie', u'Poster': u'https://m.media-amazon.com/images/M/MV5BODJlMzdlYzItMzRkNi00NTE0LTliZjQtMTllNzkxNDVhNjkxXkEyXkFqcGdeQXVyNjY1MTg4Mzc@._V1_SX300.jpg', u'Year': u'2021'} 2021-03-03 14:04:59,355 (7f656f7fe700) : INFO (logger:38) - subzero.video: Using filename: The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv 2021-03-03 14:04:59,397 (7f656f7fe700) : DEBUG (download:131) - Download best subtitles using settings: min_score: 60, hearing_impaired: don't prefer, languages: set([, ]) 2021-03-03 14:04:59,397 (7f656f7fe700) : INFO (logger:38) - subliminal_patch.core: Using 2 threads for 2 providers (['opensubtitles', 'addic7ed']) 2021-03-03 14:04:59,397 (7f656f7fe700) : INFO (logger:38) - subliminal_patch.core: Downloading best subtitles for 2021-03-03 14:04:59,398 (7f656ffff700) : INFO (logger:38) - subliminal_patch.core: Listing subtitles with provider 'opensubtitles' and languages set([, ]) ```

However, this works as intended when that subtitle is actually in the same path.

Code Block (30 lines) ```log 2021-03-04 11:30:51,874 (7f65a15fc700) : DEBUG (scanning:157) - Determining force-refresh (video: 6108, series: None, season: None), result: False 2021-03-04 11:30:51,874 (7f65a15fc700) : DEBUG (scanning:33) - Detecting streams: /home/snip/media/Movies/Judas and the Black Messiah (2021)/Judas.and.the.Black.Messiah.2021.1080p.WEB.H264-NAISU.mkv, account_for_external_subtitles=True, account_for_embedded_subtitles=False 2021-03-04 11:30:51,875 (7f65a15fc700) : DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/6108' 2021-03-04 11:30:51,881 (7f65a15fc700) : DEBUG (scanning:113) - Known metadata subtitles: set([]) 2021-03-04 11:30:51,881 (7f65a15fc700) : DEBUG (scanning:114) - Known embedded subtitles: [] 2021-03-04 11:30:51,894 (7f65a15fc700) : DEBUG (logger:28) - subzero.video: Parsing video: Judas.and.the.Black.Messiah.2021.1080p.WEB.H264-NAISU.mkv, hints: {'type': 'movie', 'title': 'Judas and the Black Messiah'} 2021-03-04 11:30:51,895 (7f65a15fc700) : INFO (logger:38) - subliminal_patch.core: Determining basic video properties for 'Judas.and.the.Black.Messiah.2021.1080p.WEB.H264-NAISU.mkv' in '/home/snip/media/Movies/Judas and the Black Messiah (2021)' 2021-03-04 11:30:51,905 (7f65a15fc700) : DEBUG (logger:28) - subliminal_patch.core: GuessIt found: { "title": "Judas and the Black Messiah", "year": 2021, "screen_size": "1080p", "format": "WEB-DL", "video_codec": "h264", "release_group": "NAISU", "container": "mkv", "mimetype": "video/x-matroska", "type": "movie" } 2021-03-04 11:30:51,913 (7f65a15fc700) : DEBUG (logger:28) - subliminal_patch.core: Size is 8468936501 2021-03-04 11:30:51,943 (7f65a15fc700) : DEBUG (logger:28) - subliminal_patch.core: Computed hashes {'opensubtitles': '97993c5f17174a19'} 2021-03-04 11:30:51,943 (7f65a15fc700) : INFO (scanning:128) - Found audio streams: en 2021-03-04 11:30:51,943 (7f65a15fc700) : DEBUG (logger:28) - subzero.video: Determining existing subtitles for /home/snip/media/Movies/Judas and the Black Messiah (2021)/Judas.and.the.Black.Messiah.2021.1080p.WEB.H264-NAISU.mkv 2021-03-04 11:30:51,943 (7f65a15fc700) : DEBUG (logger:28) - subliminal_patch.core: external subs: scanning path /home/snip/media/Movies/Judas and the Black Messiah (2021)/Judas.and.the.Black.Messiah.2021.1080p.WEB.H264-NAISU.mkv 2021-03-04 11:30:51,944 (7f65a15fc700) : DEBUG (logger:28) - subliminal_patch.core: Found subtitles {u'Judas.and.the.Black.Messiah.2021.1080p.WEB.H264-NAISU.en.srt': } 2021-03-04 11:30:51,944 (7f65a15fc700) : DEBUG (logger:28) - subliminal_patch.core: external subs: found {u'Judas.and.the.Black.Messiah.2021.1080p.WEB.H264-NAISU.en.srt': } 2021-03-04 11:30:51,945 (7f65a15fc700) : INFO (datakit:131) - Saved the dictionary file 2021-03-04 11:30:51,945 (7f65a15fc700) : DEBUG (scheduler:67) - Task data cleared: MissingSubtitles 2021-03-04 11:30:51,946 (7f65a15fc700) : DEBUG (download:62) - We have at least one external subtitle for any configured language. 2021-03-04 11:30:51,946 (7f65a15fc700) : DEBUG (download:142) - All languages for all requested videos exist. Doing nothing. ```

So, by looking at all the logs, the root cause of this is when "subliminal_patch.core" runs and then tries to look for an external subtitle in the same media folder instead of the custom path I assigned. So in my case it should look like this:

Code Block (2 lines) ```log 2021-03-03 14:04:59,352 (7f656f7fe700) : DEBUG (logger:28) - subzero.video: Determining existing subtitles for /home/snip/media/Movies/The Mauritanian (2021)/The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv 2021-03-03 14:04:59,352 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: external subs: scanning path /home/snip/media/Movies/The Mauritanian (2021)/The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv, /home/snip/.config/SubZero/Subtitles ```

I did notice before "subliminal_patch.core" runs SubZero does try to look for the subtitle in my custom subtitle path and actually finds the subtitles but still runs and grabs the subtitle again nonetheless.

Code Block (51 lines) ```log 2021-03-03 14:15:26,345 (7f656f7fe700) : INFO (localmedia:108) - Skipping housekeeping of folder: /home/snip/.config/SubZero/Subtitles 2021-03-03 14:15:26,345 (7f656f7fe700) : INFO (localmedia:140) - Looking for subtitle media in 2 paths with 1 media files. 2021-03-03 14:15:26,345 (7f656f7fe700) : INFO (localmedia:141) - Paths: /home/snip/media/Movies/The Mauritanian (2021), /home/snip/.config/SubZero/Subtitles 2021-03-03 14:15:26,349 (7f656f7fe700) : INFO (subtitlehelpers:164) - Found subtitle file: /home/snip/.config/SubZero/Subtitles/The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.en.forced.srt language: en codec: srt format: srt default: forced: 1 2021-03-03 14:15:26,350 (7f656f7fe700) : INFO (subtitlehelpers:164) - Found subtitle file: /home/snip/.config/SubZero/Subtitles/The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.en.srt language: en codec: srt format: srt default: forced: 2021-03-03 14:15:26,354 (7f656f7fe700) : INFO (datakit:131) - Saved the dictionary file 2021-03-03 14:15:26,355 (7f656f7fe700) : INFO (datakit:131) - Saved the dictionary file 2021-03-03 14:15:26,357 (7f656f7fe700) : INFO (datakit:131) - Saved the dictionary file 2021-03-03 14:15:26,357 (7f656f7fe700) : DEBUG (scanning:157) - Determining force-refresh (video: 6327, series: None, season: None), result: False 2021-03-03 14:15:26,358 (7f656f7fe700) : DEBUG (scanning:33) - Detecting streams: /home/snip/media/Movies/The Mauritanian (2021)/The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv, account_for_external_subtitles=True, account_for_embedded_subtitles=False 2021-03-03 14:15:26,358 (7f656f7fe700) : DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/6327' 2021-03-03 14:15:26,363 (7f656f7fe700) : DEBUG (scanning:113) - Known metadata subtitles: set([]) 2021-03-03 14:15:26,363 (7f656f7fe700) : DEBUG (scanning:114) - Known embedded subtitles: [] 2021-03-03 14:15:26,404 (7f656f7fe700) : DEBUG (logger:28) - subzero.video: Parsing video: The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv, hints: {'type': 'movie', 'title': 'The Mauritanian'} 2021-03-03 14:15:26,404 (7f656f7fe700) : INFO (logger:38) - subliminal_patch.core: Determining basic video properties for 'The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv' in '/home/snip/media/Movies/The Mauritanian (2021)' 2021-03-03 14:15:26,416 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: GuessIt found: { "title": "The Mauritanian", "year": 2021, "other": "Proper", "proper_count": 1, "screen_size": "1080p", "streaming_service": "Amazon Prime", "format": "WEB-DL", "audio_codec": "EAC3", "audio_channels": "5.1", "video_codec": "h264", "release_group": "NTG", "container": "mkv", "mimetype": "video/x-matroska", "type": "movie" } 2021-03-03 14:15:26,426 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: Size is 7436579936 2021-03-03 14:15:26,434 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: Computed hashes {'opensubtitles': '32c45783acc343e9'} 2021-03-03 14:15:26,435 (7f656f7fe700) : INFO (scanning:128) - Found audio streams: en 2021-03-03 14:15:26,435 (7f656f7fe700) : DEBUG (logger:28) - subzero.video: Determining existing subtitles for /home/snip/media/Movies/The Mauritanian (2021)/The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv 2021-03-03 14:15:26,435 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: external subs: scanning path /home/snip/media/Movies/The Mauritanian (2021)/The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv 2021-03-03 14:15:26,435 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: Found subtitles {} 2021-03-03 14:15:26,435 (7f656f7fe700) : DEBUG (logger:28) - subliminal_patch.core: external subs: found {} 2021-03-03 14:15:26,437 (7f656f7fe700) : INFO (datakit:131) - Saved the dictionary file 2021-03-03 14:15:26,437 (7f656f7fe700) : DEBUG (scheduler:67) - Task data cleared: MissingSubtitles 2021-03-03 14:15:26,437 (7f656f7fe700) : INFO (download:121) - The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv has missing languages: set([, ]) 2021-03-03 14:15:26,438 (7f656f7fe700) : INFO (logger:38) - subliminal_patch.core: Refining video with sz_omdb 2021-03-03 14:15:26,438 (7f656f7fe700) : DEBUG (logger:28) - subliminal.refiners.omdb: Found 1 results 2021-03-03 14:15:26,438 (7f656f7fe700) : DEBUG (logger:28) - subliminal.refiners.omdb: Found result with matching year 2021-03-03 14:15:26,438 (7f656f7fe700) : DEBUG (logger:28) - subliminal.refiners.omdb: Found movie {u'imdbID': u'tt4761112', u'Title': u'The Mauritanian', u'Type': u'movie', u'Poster': u'https://m.media-amazon.com/images/M/MV5BODJlMzdlYzItMzRkNi00NTE0LTliZjQtMTllNzkxNDVhNjkxXkEyXkFqcGdeQXVyNjY1MTg4Mzc@._V1_SX300.jpg', u'Year': u'2021'} 2021-03-03 14:15:26,438 (7f656f7fe700) : INFO (logger:38) - subzero.video: Using filename: The.Mauritanian.2021.REPACK.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv 2021-03-03 14:15:26,479 (7f656f7fe700) : DEBUG (download:131) - Download best subtitles using settings: min_score: 60, hearing_impaired: don't prefer, languages: set([, ]) 2021-03-03 14:15:26,480 (7f656f7fe700) : INFO (logger:38) - subliminal_patch.core: Using 2 threads for 2 providers (['opensubtitles', 'addic7ed']) 2021-03-03 14:15:26,480 (7f656f7fe700) : INFO (logger:38) - subliminal_patch.core: Downloading best subtitles for 2021-03-03 14:15:26,481 (7f656ffff700) : INFO (logger:38) - subliminal_patch.core: Listing subtitles with provider 'opensubtitles' and languages set([, ]) ```

I hope everything I've provided is clear. Really appreciate the hard work on SubZero but hopefully after this this one issue is sorted, it'll be perfect.

pannal commented 3 years ago

Yeah, that was a fuckup on my end. If you get develop-2.6, this will be fixed for you. Will be fixed in the next release.

So few people actually use the custom subtitles folder option that this never surfaced before.

apathy commented 3 years ago

Worked perfectly! Thank you so much.