From 9c6663982862bb31301d561f72b0ddce91f65914 Mon Sep 17 00:00:00 2001 From: Ori Date: Wed, 8 Apr 2020 17:44:12 +0300 Subject: [PATCH 1/2] bugfix language id in wizdom provider --- libs/subliminal_patch/providers/wizdom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/subliminal_patch/providers/wizdom.py b/libs/subliminal_patch/providers/wizdom.py index dfae411ff..f55df5167 100644 --- a/libs/subliminal_patch/providers/wizdom.py +++ b/libs/subliminal_patch/providers/wizdom.py @@ -4,7 +4,7 @@ import logging import os import zipfile -from babelfish import Language +from subzero.language import Language from guessit import guessit from requests import Session @@ -75,7 +75,7 @@ class WizdomSubtitle(Subtitle): class WizdomProvider(Provider): """Wizdom Provider.""" - languages = {Language.fromalpha2(l) for l in ['he']} + languages = {Language(l) for l in ['heb']} server_url = 'wizdom.xyz' _tmdb_api_key = 'a51ee051bcd762543373903de296e0a3' @@ -156,7 +156,7 @@ class WizdomProvider(Provider): # loop over results subtitles = {} for result in results: - language = Language.fromalpha2('he') + language = Language('heb') hearing_impaired = False subtitle_id = result['id'] release = result['version'] @@ -204,4 +204,4 @@ class WizdomProvider(Provider): if len(namelist) > 1: raise ProviderError('More than one file to unzip') - subtitle.content = fix_line_ending(zf.read(namelist[0])) \ No newline at end of file + subtitle.content = fix_line_ending(zf.read(namelist[0])) From 8dad86c8aa90edf69d7ae87b34731d65574c371f Mon Sep 17 00:00:00 2001 From: Ori Date: Wed, 8 Apr 2020 18:39:38 +0300 Subject: [PATCH 2/2] wizdom: some subtitle files are empty, skip --- libs/subliminal_patch/providers/wizdom.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/subliminal_patch/providers/wizdom.py b/libs/subliminal_patch/providers/wizdom.py index f55df5167..44808a3e8 100644 --- a/libs/subliminal_patch/providers/wizdom.py +++ b/libs/subliminal_patch/providers/wizdom.py @@ -197,6 +197,9 @@ class WizdomProvider(Provider): r = self.session.get(url, headers={'Referer': subtitle.page_link}, timeout=10) r.raise_for_status() + if len(r.content) == 0: + return + # open the zip with zipfile.ZipFile(io.BytesIO(r.content)) as zf: # remove some filenames from the namelist