pannal / Sub-Zero.bundle

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

'list' object has no attribute 'lower' #325

Closed BrutuZ closed 6 years ago

BrutuZ commented 6 years ago

Would that be caused by the media file or subtitle?

2017-07-31 00:12:46,838 (34e0) :  ERROR (logkit:22) - subliminal_patch.core: <OpenSubtitlesSubtitle 'http://www.opensubtitles.org/en/subtitles/7033056/sid-nN1ARl1sMo6qA8g5rqv9esqEtq5/ghost-in-the-shell-pb' [pt-BR:None]>: Match computation failed: Traceback (most recent call last):
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Libraries\Shared\subliminal_patch\core.py", line 262, in download_best_subtitles
    matches = s.get_matches(video)
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Libraries\Shared\subliminal_patch\providers\opensubtitles.py", line 35, in get_matches
    matches = super(OpenSubtitlesSubtitle, self).get_matches(video)
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Libraries\Shared\subliminal\providers\opensubtitles.py", line 98, in get_matches
    matches |= guess_matches(video, guessit(self.movie_release_name, {'type': 'movie'}))
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Libraries\Shared\subliminal\subtitle.py", line 235, in guess_matches
    if video.format and 'format' in guess and guess['format'].lower() == video.format.lower():
AttributeError: 'list' object has no attribute 'lower'
pannal commented 6 years ago

Which media file/subtitle causes this? Can you make that out from the logs?

BrutuZ commented 6 years ago

Sorry, made a markdown mistake which hid the first line with the subtitle URL. Edited to fix it. Still need info on the media?

pannal commented 6 years ago

Yes, please!

BrutuZ commented 6 years ago

Subtitle URL: http://www.opensubtitles.org/en/subtitles/7033056/sid-nN1ARl1sMo6qA8g5rqv9esqEtq5/ghost-in-the-shell-pb Note: It also happened with other 3-ish Opensubtitles results and one from Legendas.tv

MediaInfo:

General
Complete name               : Ghost.In.The.Shell.2017.1080p.BluRay.x264.mp4
Format                      : MPEG-4
Format profile              : Base Media
Codec ID                    : isom (isom/iso2/avc1/mp41)
File size                   : 1.63 GiB
Duration                    : 1 h 46 min
Overall bit rate            : 2 185 kb/s
Writing application         : Lavf57.22.100

Video
ID                          : 1
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : High@L4.1
Format settings, CABAC      : Yes
Format settings, ReFrames   : 4 frames
Codec ID                    : avc1
Codec ID/Info               : Advanced Video Coding
Duration                    : 1 h 46 min
Bit rate                    : 2 050 kb/s
Width                       : 1 920 pixels
Height                      : 1 072 pixels
Display aspect ratio        : 16:9
Frame rate mode             : Constant
Frame rate                  : 23.976 FPS
Color space                 : YUV
Chroma subsampling          : 4:2:0
Bit depth                   : 8 bits
Scan type                   : Progressive
Bits/(Pixel*Frame)          : 0.042
Stream size                 : 1.53 GiB (94%)
Writing library             : x264 core 148
Encoding settings           : cabac=1 / ref=4 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-3 / threads=12 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=2pass / mbtree=1 / bitrate=2050 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=31250 / vbv_bufsize=31250 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00

Audio
ID                          : 2
Format                      : AAC
Format/Info                 : Advanced Audio Codec
Format profile              : LC
Codec ID                    : 40
Duration                    : 1 h 46 min
Bit rate mode               : Constant
Bit rate                    : 130 kb/s
Channel(s)                  : 2 channels
Channel positions           : Front: L R
Sampling rate               : 48.0 kHz
Frame rate                  : 46.875 FPS (1024 spf)
Compression mode            : Lossy
Stream size                 : 99.1 MiB (6%)
Default                     : Yes
Alternate group             : 1
pannal commented 6 years ago

Do you have guessit installed locally?

BrutuZ commented 6 years ago

I do not. Now that I looked into it, could this have been caused by square brackets on the filename being parsed as a list object?

BrutuZ commented 6 years ago

Setting SZ logging to Debug returned these:

2017-08-02 18:06:11,015 (2d60) :  DEBUG (logkit:13) - subliminal_patch.core: GuessIt found: {
    "title": "Ghost In The Shell", 
    "year": 2017, 
    "screen_size": "1080p", 
    "format": "BluRay", 
    "video_codec": "h264", 
    "container": "mp4", 
    "mimetype": "video/mp4", 
    "type": "movie"
}
2017-08-02 18:06:11,016 (2d60) :  DEBUG (logkit:13) - subliminal_patch.core: Size is 1752687332
2017-08-02 18:06:12,000 (2d60) :  DEBUG (logkit:13) - subliminal_patch.core: Computed hashes {'thesubdb': '057aae57e2387d82fee3e7c31df677dd', 'opensubtitles': 'ce6365228de3bebf', 'shooter': '4519a52ab74506e3ba21bad9b5d23d78;a3ad14623aafd70ba2bc5c08813fbd82;13f32e1f0e0e6e14fa656e0c2e659b8e;16718d1daa01a1656b9741c4311e918b', 'napiprojekt': '6ab985894fa660811d1d5e654a441783'}
pannal commented 6 years ago

I don't see any square brackets in the filename you gave me. Are you sure this is the file that had the error? Is multithreading on in SZ's settings? It might confuse you on which item it is, that errors.

BrutuZ commented 6 years ago

Indeed, it could be multi-threading. Even though it was a manually triggered scan, SZ could coincidentally be up to its own business in the background. Other than that maybe the + (plus signs) in the subtitle filename? Don't know if they even go trough GuessIt. Otherwise, seems like just an aberration then, especially seeing as it did successfully get 2 proper subtitles (different languages, as set).

pannal commented 6 years ago

Hmm. I don't want to put this off yet. Could you try to reproduce it, or is that out of the question?

At the very least, please keep a lookout for this bug, as it is one.

BrutuZ commented 6 years ago

Ran some tests and it does seem to be related to the subtitles and not the media file. Here's what I did:

  1. Disabled all but one provider known to trigger the issue
  2. Disabled Multi-threading
  3. Set Logging level to DEBUG
  4. Applied changes to settings
  5. Loaded SZ's page for the movie (to have the refresh subtitles "button" ready)
  6. Restarted Plex server to clear the logs
  7. Trigger Refresh Subtitles

Full log can be found here. Two files cause the error at lines 344 and 357

Notes: I used Legendas.tv instead of Opensubtitles because the log file with the latter was huge, too big for pastebin to accept it. Also renamed the media file back to its original name, as it was when the bug was first spotted.

pannal commented 6 years ago

You're right. Will be fixed in the next version. Fixed in #330

BrutuZ commented 6 years ago

FYI: #330 only addresses Legendas.tv, bug is still present on OpenSubtitles.

pannal commented 6 years ago

Yeah my fix is also incomplete. Will revisit.

pannal commented 6 years ago

develop-2.0 should finally fix it. Can you try it out?

BrutuZ commented 6 years ago

Tested it with all the usual providers enabled, not a single error came up. 👍

pannal commented 6 years ago

Awesome :)