You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.7 KiB
44 lines
1.7 KiB
6 years ago
|
# coding=utf-8
|
||
|
|
||
5 years ago
|
from __future__ import absolute_import
|
||
4 years ago
|
|
||
|
from guessit import guessit
|
||
3 years ago
|
from subliminal.video import Episode, Movie
|
||
6 years ago
|
from subliminal.providers.subscenter import SubsCenterProvider as _SubsCenterProvider, \
|
||
|
SubsCenterSubtitle as _SubsCenterSubtitle
|
||
6 years ago
|
from subzero.language import Language
|
||
4 years ago
|
from subliminal_patch.subtitle import guess_matches
|
||
6 years ago
|
|
||
|
|
||
|
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
|
||
|
|
||
4 years ago
|
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
|
||
|
|
||
6 years ago
|
def __repr__(self):
|
||
|
return '<%s %r %s [%s]>' % (
|
||
|
self.__class__.__name__, self.page_link, self.id, self.language)
|
||
|
|
||
|
|
||
|
class SubsCenterProvider(_SubsCenterProvider):
|
||
6 years ago
|
languages = {Language.fromalpha2(l) for l in ['he']}
|
||
3 years ago
|
video_types = (Episode, Movie)
|
||
6 years ago
|
subtitle_class = SubsCenterSubtitle
|
||
|
hearing_impaired_verifiable = True
|
||
|
server_url = 'http://www.subscenter.info/he/'
|