summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorredglory <[email protected]>2021-11-01 11:11:05 +0000
committerGitHub <[email protected]>2021-11-01 07:11:05 -0400
commitf53ef40d57d4cf23fcf4410028a77bea318b6415 (patch)
treebe7a87f6faa0425ac7ca503c623609c454b48f91
parent618bddebf97fd962a89a6c9d1f11c19733fbb4d7 (diff)
downloadbazarr-f53ef40d57d4cf23fcf4410028a77bea318b6415.tar.gz
bazarr-f53ef40d57d4cf23fcf4410028a77bea318b6415.zip
Improved LegendasDivx provider to get more accurate results and prevent unnecessary throttling
-rw-r--r--libs/subliminal_patch/providers/legendasdivx.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/libs/subliminal_patch/providers/legendasdivx.py b/libs/subliminal_patch/providers/legendasdivx.py
index 8b535f59d..cf705a017 100644
--- a/libs/subliminal_patch/providers/legendasdivx.py
+++ b/libs/subliminal_patch/providers/legendasdivx.py
@@ -272,7 +272,7 @@ class LegendasdivxProvider(Provider):
querytext = video.imdb_id if video.imdb_id else video.title
if isinstance(video, Episode):
- querytext = '{} S{:02d}E{:02d}'.format(video.series, video.season, video.episode)
+ querytext = '%22{}%20S{:02d}E{:02d}%22'.format(video.series, video.season, video.episode)
querytext = quote(querytext.lower())
# language query filter
@@ -430,12 +430,13 @@ class LegendasdivxProvider(Provider):
_guess = guessit(name)
if isinstance(subtitle.video, Episode):
- logger.debug("Legendasdivx.pt :: guessing %s", name)
- logger.debug("Legendasdivx.pt :: subtitle S%sE%s video S%sE%s", _guess['season'], _guess['episode'], subtitle.video.season, subtitle.video.episode)
+ if all(key in _guess for key in ('season', 'episode')):
+ logger.debug("Legendasdivx.pt :: guessing %s", name)
+ logger.debug("Legendasdivx.pt :: subtitle S%sE%s video S%sE%s", _guess['season'], _guess['episode'], subtitle.video.season, subtitle.video.episode)
- if subtitle.video.episode != _guess['episode'] or subtitle.video.season != _guess['season']:
- logger.debug('Legendasdivx.pt :: subtitle does not match video, skipping')
- continue
+ if subtitle.video.episode != _guess['episode'] or subtitle.video.season != _guess['season']:
+ logger.debug('Legendasdivx.pt :: subtitle does not match video, skipping')
+ continue
matches = set()
matches |= guess_matches(subtitle.video, _guess)