|
|
@ -4,7 +4,7 @@ import logging
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import zipfile
|
|
|
|
import zipfile
|
|
|
|
|
|
|
|
|
|
|
|
from babelfish import Language
|
|
|
|
from subzero.language import Language
|
|
|
|
from guessit import guessit
|
|
|
|
from guessit import guessit
|
|
|
|
from requests import Session
|
|
|
|
from requests import Session
|
|
|
|
|
|
|
|
|
|
|
@ -75,7 +75,7 @@ class WizdomSubtitle(Subtitle):
|
|
|
|
|
|
|
|
|
|
|
|
class WizdomProvider(Provider):
|
|
|
|
class WizdomProvider(Provider):
|
|
|
|
"""Wizdom Provider."""
|
|
|
|
"""Wizdom Provider."""
|
|
|
|
languages = {Language.fromalpha2(l) for l in ['he']}
|
|
|
|
languages = {Language(l) for l in ['heb']}
|
|
|
|
server_url = 'wizdom.xyz'
|
|
|
|
server_url = 'wizdom.xyz'
|
|
|
|
|
|
|
|
|
|
|
|
_tmdb_api_key = 'a51ee051bcd762543373903de296e0a3'
|
|
|
|
_tmdb_api_key = 'a51ee051bcd762543373903de296e0a3'
|
|
|
@ -156,7 +156,7 @@ class WizdomProvider(Provider):
|
|
|
|
# loop over results
|
|
|
|
# loop over results
|
|
|
|
subtitles = {}
|
|
|
|
subtitles = {}
|
|
|
|
for result in results:
|
|
|
|
for result in results:
|
|
|
|
language = Language.fromalpha2('he')
|
|
|
|
language = Language('heb')
|
|
|
|
hearing_impaired = False
|
|
|
|
hearing_impaired = False
|
|
|
|
subtitle_id = result['id']
|
|
|
|
subtitle_id = result['id']
|
|
|
|
release = result['version']
|
|
|
|
release = result['version']
|
|
|
@ -197,6 +197,9 @@ class WizdomProvider(Provider):
|
|
|
|
r = self.session.get(url, headers={'Referer': subtitle.page_link}, timeout=10)
|
|
|
|
r = self.session.get(url, headers={'Referer': subtitle.page_link}, timeout=10)
|
|
|
|
r.raise_for_status()
|
|
|
|
r.raise_for_status()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(r.content) == 0:
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
# open the zip
|
|
|
|
# open the zip
|
|
|
|
with zipfile.ZipFile(io.BytesIO(r.content)) as zf:
|
|
|
|
with zipfile.ZipFile(io.BytesIO(r.content)) as zf:
|
|
|
|
# remove some filenames from the namelist
|
|
|
|
# remove some filenames from the namelist
|
|
|
@ -204,4 +207,4 @@ class WizdomProvider(Provider):
|
|
|
|
if len(namelist) > 1:
|
|
|
|
if len(namelist) > 1:
|
|
|
|
raise ProviderError('More than one file to unzip')
|
|
|
|
raise ProviderError('More than one file to unzip')
|
|
|
|
|
|
|
|
|
|
|
|
subtitle.content = fix_line_ending(zf.read(namelist[0]))
|
|
|
|
subtitle.content = fix_line_ending(zf.read(namelist[0]))
|
|
|
|