just added Legendasdivx to log msgs

pull/977/head
Bazarr 5 years ago
parent 35830abd9b
commit 989e725dd5

@ -394,13 +394,13 @@ class LegendasdivxProvider(Provider):
# stole^H^H^H^H^H inspired from subvix provider # stole^H^H^H^H^H inspired from subvix provider
archive_stream = io.BytesIO(content) archive_stream = io.BytesIO(content)
if rarfile.is_rarfile(archive_stream): if rarfile.is_rarfile(archive_stream):
logger.debug('Identified rar archive') logger.debug('Legendasdivx.pt :: Identified rar archive')
archive = rarfile.RarFile(archive_stream) archive = rarfile.RarFile(archive_stream)
elif zipfile.is_zipfile(archive_stream): elif zipfile.is_zipfile(archive_stream):
logger.debug('Identified zip archive') logger.debug('Legendasdivx.pt :: Identified zip archive')
archive = zipfile.ZipFile(archive_stream) archive = zipfile.ZipFile(archive_stream)
else: else:
raise ValueError('Unsupported compressed format') raise ValueError('Legendasdivx.pt :: Unsupported compressed format')
return archive return archive
@ -423,24 +423,24 @@ class LegendasdivxProvider(Provider):
_guess = guessit(name) _guess = guessit(name)
if isinstance(subtitle.video, Episode): if isinstance(subtitle.video, Episode):
logger.debug("guessing %s", name) logger.debug("Legendasdivx.pt :: guessing %s", name)
logger.debug("subtitle S%sE%s video S%sE%s", _guess['season'], _guess['episode'], subtitle.video.season, subtitle.video.episode) 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']: if subtitle.video.episode != _guess['episode'] or subtitle.video.season != _guess['season']:
logger.debug('subtitle does not match video, skipping') logger.debug('Legendasdivx.pt :: subtitle does not match video, skipping')
continue continue
matches = set() matches = set()
matches |= guess_matches(subtitle.video, _guess) matches |= guess_matches(subtitle.video, _guess)
logger.debug('srt matches: %s', matches) logger.debug('Legendasdivx.pt :: srt matches: %s', matches)
_score = sum((_scores.get(match, 0) for match in matches)) _score = sum((_scores.get(match, 0) for match in matches))
if _score > _max_score: if _score > _max_score:
_max_name = name _max_name = name
_max_score = _score _max_score = _score
logger.debug("new max: %s %s", name, _score) logger.debug("Legendasdivx.pt :: new max: %s %s", name, _score)
if _max_score > 0: if _max_score > 0:
logger.debug("returning from archive: %s scored %s", _max_name, _max_score) logger.debug("Legendasdivx.pt :: returning from archive: %s scored %s", _max_name, _max_score)
return archive.read(_max_name) return archive.read(_max_name)
raise ValueError("No subtitle found on compressed file. Max score was 0") raise ValueError("Legendasdivx.pt :: No subtitle found on compressed file. Max score was 0")

Loading…
Cancel
Save