Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect hearing impaired subtitles when the provider doesn't give the information #535

Closed
0xACE opened this issue Nov 18, 2015 · 7 comments · Fixed by #1175
Closed

Detect hearing impaired subtitles when the provider doesn't give the information #535

0xACE opened this issue Nov 18, 2015 · 7 comments · Fixed by #1175
Assignees

Comments

@0xACE
Copy link

0xACE commented Nov 18, 2015

Hey.

Usually when I run:

subliminal download -l en movie.mp4

It will come with hearing impaired subtitles. I find this very frustrating. Can't there be a introduction of --avoid-hearing-imparied?

The goal of that flag should be that it will try to find non-hearing-impaired subtitles first, and if they can't be found it's OK to pick a HI subtitle - but only as a last resort.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@Diaoul
Copy link
Owner

Diaoul commented Nov 18, 2015

This is already the case. Define last resort.

@0xACE
Copy link
Author

0xACE commented Nov 18, 2015

Currently, when I'm manually looking for subtitles; I can find non-HI subtitles, however subliminal picks the HI subtitles over the non-HI.

Last resort; meaning Pick non-HI and if non-HI can't be found try to find a HI version (non-HI > HI in terms of priority)

@Diaoul
Copy link
Owner

Diaoul commented Nov 18, 2015

Please include debug logs and verbose output: https://github.com/Diaoul/subliminal/blob/develop/CONTRIBUTING.md

@0xACE
Copy link
Author

0xACE commented Nov 19, 2015

/usr/lib/python2.7/site-packages/subliminal/cli.py:115: Warning: Click detected the use of the unicode_literals __future__ import.  This is heavily discouraged because it can introduce subtle bugs in your code.  You should instead use explicit u"" literals for your unicode strings.  For more information see http://click.pocoo.org/python3/
  @click.pass_context
/usr/lib/python2.7/site-packages/subliminal/cli.py:145: Warning: Click detected the use of the unicode_literals __future__ import.  This is heavily discouraged because it can introduce subtle bugs in your code.  You should instead use explicit u"" literals for your unicode strings.  For more information see http://click.pocoo.org/python3/
  @click.pass_context
/usr/lib/python2.7/site-packages/subliminal/cli.py:172: Warning: Click detected the use of the unicode_literals __future__ import.  This is heavily discouraged because it can introduce subtle bugs in your code.  You should instead use explicit u"" literals for your unicode strings.  For more information see http://click.pocoo.org/python3/
  @click.pass_obj
DEBUG:subliminal.cli:Collecting path the.leftovers.s01e01.hdtv.x264-killers.mp4
INFO:subliminal.video:Scanning video u'the.leftovers.s01e01.hdtv.x264-killers.mp4' in u''
DEBUG:subliminal.video:Size is 644614841
DEBUG:subliminal.video:Computed hashes {u'opensubtitles': u'c5ac30a019230fa8', u'thesubdb': 'b1ba37d12714994c92035e75f984ea1f'}
DEBUG:subliminal.video:Found subtitles {}
INFO:subliminal.api:Listing subtitles with provider 'thesubdb' and languages set([<Language [en]>])
INFO:subliminal.api:Initializing provider thesubdb
INFO:subliminal.providers.thesubdb:Searching subtitles {u'action': u'search', u'hash': 'b1ba37d12714994c92035e75f984ea1f'}
INFO:subliminal.providers.thesubdb:Found subtitle <TheSubDBSubtitle 'b1ba37d12714994c92035e75f984ea1f' [en]>
INFO:subliminal.providers.thesubdb:Found subtitle <TheSubDBSubtitle 'b1ba37d12714994c92035e75f984ea1f' [es]>
INFO:subliminal.providers.thesubdb:Found subtitle <TheSubDBSubtitle 'b1ba37d12714994c92035e75f984ea1f' [fr]>
INFO:subliminal.providers.thesubdb:Found subtitle <TheSubDBSubtitle 'b1ba37d12714994c92035e75f984ea1f' [pt]>
INFO:subliminal.api:Listing subtitles with provider 'opensubtitles' and languages set([<Language [en]>])
INFO:subliminal.api:Initializing provider opensubtitles
INFO:subliminal.providers.opensubtitles:Logging in
DEBUG:subliminal.providers.opensubtitles:Logged in with token 'j75arl6uoe33lgqqa9p8oa4e27'
INFO:subliminal.providers.opensubtitles:Searching subtitles [{u'moviebytesize': '644614841', u'sublanguageid': u'eng', u'moviehash': u'c5ac30a019230fa8'}, {u'query': u'the leftovers', u'sublanguageid': u'eng', u'episode': 1, u'season': 1}]
DEBUG:subliminal.providers.opensubtitles:Found subtitle <OpenSubtitlesSubtitle '1954317724' [en]>
DEBUG:subliminal.providers.opensubtitles:Found subtitle <OpenSubtitlesSubtitle '1954317726' [en]>
DEBUG:subliminal.providers.opensubtitles:Found subtitle <OpenSubtitlesSubtitle '1954317724' [en]>
DEBUG:subliminal.providers.opensubtitles:Found subtitle <OpenSubtitlesSubtitle '1954317726' [en]>
INFO:subliminal.api:Listing subtitles with provider 'addic7ed' and languages set([<Language [en]>])
INFO:subliminal.api:Initializing provider addic7ed
DEBUG:subliminal.providers.addic7ed:Getting show id
INFO:subliminal.providers.addic7ed:Getting the page of show id 4561, season 1
ERROR:subliminal.api:Unexpected error in provider 'addic7ed', discarding it
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/subliminal/api.py", line 117, in list_subtitles
    provider_subtitles = self[name].list_subtitles(video, provider_languages)
  File "/usr/lib/python2.7/site-packages/subliminal/providers/addic7ed.py", line 257, in list_subtitles
    return [s for s in self.query(video.series, video.season, video.year)
  File "/usr/lib/python2.7/site-packages/subliminal/providers/addic7ed.py", line 226, in query
    match = series_year_re.match(soup.select('#header font')[0].text.strip()[:-10])
IndexError: list index out of range
INFO:subliminal.api:Listing subtitles with provider 'podnapisi' and languages set([<Language [en]>])
INFO:subliminal.api:Initializing provider podnapisi
INFO:subliminal.providers.podnapisi:Searching subtitles {u'sK': u'the leftovers', u'sTE': 1, u'sXML': 1, u'sTS': 1, u'sL': 'en'}
DEBUG:subliminal.providers.podnapisi:Found subtitle <PodnapisiSubtitle 'hsUx' [en]>
DEBUG:subliminal.providers.podnapisi:Found subtitle <PodnapisiSubtitle 'e8Ux' [en]>
INFO:subliminal.api:Listing subtitles with provider 'tvsubtitles' and languages set([<Language [en]>])
INFO:subliminal.api:Initializing provider tvsubtitles
INFO:subliminal.providers.tvsubtitles:Searching show id for u'the leftovers'
DEBUG:subliminal.providers.tvsubtitles:Found show id 1514
INFO:subliminal.providers.tvsubtitles:Getting the page for episode 50396
INFO:subliminal.providers.tvsubtitles:Found subtitle <TVsubtitlesSubtitle '270952' [en]>
INFO:subliminal.providers.tvsubtitles:Found subtitle <TVsubtitlesSubtitle '270986' [fr]>
INFO:subliminal.providers.tvsubtitles:Found subtitle <TVsubtitlesSubtitle '271215' [fr]>
INFO:subliminal.providers.tvsubtitles:Found subtitle <TVsubtitlesSubtitle '271216' [fr]>
INFO:subliminal.providers.tvsubtitles:Found subtitle <TVsubtitlesSubtitle '271953' [hu]>
INFO:subliminal.providers.tvsubtitles:Found subtitle <TVsubtitlesSubtitle '271083' [pt]>
INFO:subliminal.providers.tvsubtitles:Found subtitle <TVsubtitlesSubtitle '280822' [pt]>
INFO:subliminal.providers.tvsubtitles:Found subtitle <TVsubtitlesSubtitle '271333' [ro]>
INFO:subliminal.subtitle:Computing score for matches set([u'hash', u'hearing_impaired']) and <Episode [u'the leftovers', 1x1]>
DEBUG:subliminal.subtitle:Final matches: set([u'hash', u'hearing_impaired'])
INFO:subliminal.subtitle:Computed score 138
INFO:subliminal.subtitle:Computing score for matches set([u'episode', u'format', u'series', u'year', u'season', u'video_codec', u'hash', u'release_group']) and <Episode [u'the leftovers', 1x1]>
DEBUG:subliminal.subtitle:Final matches: set([u'hash'])
INFO:subliminal.subtitle:Computed score 137
INFO:subliminal.subtitle:Computing score for matches set([u'episode', u'format', u'series', u'year', u'release_group', u'season', u'video_codec', u'hash', u'hearing_impaired']) and <Episode [u'the leftovers', 1x1]>
DEBUG:subliminal.subtitle:Final matches: set([u'hash', u'hearing_impaired'])
INFO:subliminal.subtitle:Computed score 138
INFO:subliminal.subtitle:Computing score for matches set([u'episode', u'format', u'series', u'year', u'season', u'video_codec', u'release_group']) and <Episode [u'the leftovers', 1x1]>
DEBUG:subliminal.subtitle:Final matches: set([u'episode', u'release_group', u'video_codec', u'format', u'series', u'year', u'season'])
INFO:subliminal.subtitle:Computed score 131
INFO:subliminal.subtitle:Computing score for matches set([u'episode', u'format', u'series', u'year', u'release_group', u'season', u'video_codec', u'hearing_impaired']) and <Episode [u'the leftovers', 1x1]>
DEBUG:subliminal.subtitle:Final matches: set([u'episode', u'format', u'series', u'season', u'hearing_impaired', u'year', u'video_codec', u'release_group'])
INFO:subliminal.subtitle:Computed score 132
INFO:subliminal.subtitle:Computing score for matches set([u'episode', u'format', u'series', u'year', u'season', u'video_codec', u'release_group']) and <Episode [u'the leftovers', 1x1]>
DEBUG:subliminal.subtitle:Final matches: set([u'episode', u'release_group', u'video_codec', u'format', u'series', u'year', u'season'])
INFO:subliminal.subtitle:Computed score 131
INFO:subliminal.subtitle:Computing score for matches set([u'episode', u'format', u'series', u'year', u'release_group', u'season', u'video_codec', u'hearing_impaired']) and <Episode [u'the leftovers', 1x1]>
DEBUG:subliminal.subtitle:Final matches: set([u'episode', u'format', u'series', u'season', u'hearing_impaired', u'year', u'video_codec', u'release_group'])
INFO:subliminal.subtitle:Computed score 132
INFO:subliminal.subtitle:Computing score for matches set([u'episode', u'format', u'series', u'season', u'hearing_impaired', u'year', u'release_group']) and <Episode [u'the leftovers', 1x1]>
DEBUG:subliminal.subtitle:Final matches: set([u'release_group', u'episode', u'hearing_impaired', u'format', u'series', u'year', u'season'])
INFO:subliminal.subtitle:Computed score 128
INFO:subliminal.api:Downloading subtitle <TheSubDBSubtitle 'b1ba37d12714994c92035e75f984ea1f' [en]> with score 138
INFO:subliminal.api:Downloading subtitle <TheSubDBSubtitle 'b1ba37d12714994c92035e75f984ea1f' [en]>
INFO:subliminal.providers.thesubdb:Downloading subtitle %r
INFO:subliminal.subtitle:Guessing encoding for language en
DEBUG:subliminal.subtitle:Trying encodings [u'utf-8', u'latin-1']
INFO:subliminal.subtitle:Guessed encoding utf-8
INFO:subliminal.subtitle:Guessing encoding for language en
DEBUG:subliminal.subtitle:Trying encodings [u'utf-8', u'latin-1']
INFO:subliminal.subtitle:Guessed encoding utf-8
DEBUG:subliminal.api:All languages downloaded
DEBUG:subliminal.api:Terminating initialized providers
INFO:subliminal.api:Terminating provider opensubtitles
INFO:subliminal.providers.opensubtitles:Logging out
DEBUG:subliminal.providers.opensubtitles:Logged out
INFO:subliminal.api:Terminating provider thesubdb
INFO:subliminal.api:Terminating provider podnapisi
INFO:subliminal.api:Terminating provider addic7ed
INFO:subliminal.api:Terminating provider tvsubtitles
INFO:subliminal.api:Saving <TheSubDBSubtitle 'b1ba37d12714994c92035e75f984ea1f' [en]> to u'the.leftovers.s01e01.hdtv.x264-killers.en.srt'

@Diaoul
Copy link
Owner

Diaoul commented Nov 21, 2015

TheSubDB doesn't differentiate between hearing impaired and non-hearing impaired subtitles. So by default subliminal assumes they are not for hearing impaired.

Sometimes this assumption is wrong as in your case.

@Diaoul
Copy link
Owner

Diaoul commented Nov 21, 2015

In this case what would solve the issue is some algorithm to detect hearing hearing impaired subtitles. That would mean guessing the encoding correctly first and look for specific patterns.

@Diaoul Diaoul changed the title Request: Introduce --avoid-hearing-impaired Detect hearing impaired subtitles when the provider doesn't give the information Nov 21, 2015
@pannal
Copy link
Contributor

pannal commented Nov 26, 2015

That'd also possibly mean downloading more than one top-scored subtitle to scan them and skip HI's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants