2018-10-31 16:08:29 +00:00
|
|
|
# coding=utf-8
|
|
|
|
|
2019-09-17 02:04:27 +00:00
|
|
|
from __future__ import absolute_import
|
2021-06-11 02:55:58 +00:00
|
|
|
|
|
|
|
from guessit import guessit
|
2021-11-10 03:55:47 +00:00
|
|
|
from subliminal.video import Episode, Movie
|
2018-10-31 16:08:29 +00:00
|
|
|
from subliminal.providers.subscenter import SubsCenterProvider as _SubsCenterProvider, \
|
|
|
|
SubsCenterSubtitle as _SubsCenterSubtitle
|
2018-11-28 10:44:59 +00:00
|
|
|
from subzero.language import Language
|
2021-06-11 02:55:58 +00:00
|
|
|
from subliminal_patch.subtitle import guess_matches
|
2018-10-31 16:08:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SubsCenterSubtitle(_SubsCenterSubtitle):
|
|
|
|
hearing_impaired_verifiable = True
|
|
|
|
|
|
|
|
def __init__(self, language, hearing_impaired, page_link, series, season, episode, title, subtitle_id, subtitle_key,
|
|
|
|
subtitle_version, downloaded, releases):
|
|
|
|
super(SubsCenterSubtitle, self).__init__(language, hearing_impaired, page_link, series, season, episode, title,
|
|
|
|
subtitle_id, subtitle_key,
|
|
|
|
subtitle_version, downloaded, releases)
|
|
|
|
self.release_info = u", ".join(releases)
|
|
|
|
self.page_link = page_link
|
|
|
|
|
2021-06-11 02:55:58 +00:00
|
|
|
def get_matches(self, video):
|
|
|
|
matches = super().get_matches(video)
|
|
|
|
type_ = "episode" if isinstance(video, Episode) else "movie"
|
|
|
|
|
|
|
|
for release in self.releases:
|
|
|
|
matches |= guess_matches(video, guessit(release, {'type': type_}))
|
|
|
|
|
|
|
|
return matches
|
|
|
|
|
2018-10-31 16:08:29 +00:00
|
|
|
def __repr__(self):
|
|
|
|
return '<%s %r %s [%s]>' % (
|
|
|
|
self.__class__.__name__, self.page_link, self.id, self.language)
|
|
|
|
|
|
|
|
|
|
|
|
class SubsCenterProvider(_SubsCenterProvider):
|
2018-11-28 10:44:59 +00:00
|
|
|
languages = {Language.fromalpha2(l) for l in ['he']}
|
2021-11-10 03:55:47 +00:00
|
|
|
video_types = (Episode, Movie)
|
2018-10-31 16:08:29 +00:00
|
|
|
subtitle_class = SubsCenterSubtitle
|
|
|
|
hearing_impaired_verifiable = True
|
|
|
|
server_url = 'http://www.subscenter.info/he/'
|