From aafc55f3cbfaa4b1ba8564d83840b67c0fd15607 Mon Sep 17 00:00:00 2001 From: e01 Date: Wed, 30 Jan 2019 09:14:17 +0200 Subject: [PATCH] Fix previously mess with providers registering on subssabbz and subsunacs --- .../providers/subssabbz.py | 16 ++++++++-------- .../providers/subsunacs.py | 0 libs/subliminal_patch/extensions.py | 2 -- 3 files changed, 8 insertions(+), 10 deletions(-) rename libs/{subliminal_patch => subliminal}/providers/subssabbz.py (98%) rename libs/{subliminal_patch => subliminal}/providers/subsunacs.py (100%) diff --git a/libs/subliminal_patch/providers/subssabbz.py b/libs/subliminal/providers/subssabbz.py similarity index 98% rename from libs/subliminal_patch/providers/subssabbz.py rename to libs/subliminal/providers/subssabbz.py index 22d8dc800..0cd8881ad 100644 --- a/libs/subliminal_patch/providers/subssabbz.py +++ b/libs/subliminal/providers/subssabbz.py @@ -37,7 +37,7 @@ class SubsSabBzSubtitle(Subtitle): def get_matches(self, video): matches = set() - + video_filename = video.name video_filename = os.path.basename(video_filename) video_filename, _ = os.path.splitext(video_filename) @@ -76,11 +76,11 @@ class SubsSabBzProvider(Provider): def terminate(self): self.session.close() - + def query(self, language, video): subtitles = [] isEpisode = isinstance(video, Episode) - + params = { 'act': 'search', 'movie': '', @@ -112,7 +112,7 @@ class SubsSabBzProvider(Provider): soup = BeautifulSoup(response.content, 'html.parser') rows = soup.findAll('tr', {'class': 'subs-row'}) - + # Search on first 10 rows only for row in rows[:10]: a_element_wrapper = row.find('td', { 'class': 'c2field' }) @@ -122,7 +122,7 @@ class SubsSabBzProvider(Provider): link = element.get('href') logger.info('Found subtitle link %r', link) subtitles = subtitles + self.download_archive_and_add_subtitle_files(link, language, video) - + return subtitles def list_subtitles(self, video, languages): @@ -130,7 +130,7 @@ class SubsSabBzProvider(Provider): def download_subtitle(self, subtitle): pass - + def process_archive_subtitle_files(self, archiveStream, language, video): subtitles = [] type = 'episode' if isinstance(video, Episode) else 'movie' @@ -141,11 +141,11 @@ class SubsSabBzProvider(Provider): subtitle.content = archiveStream.read(file_name) subtitles.append(subtitle) return subtitles - + def download_archive_and_add_subtitle_files(self, link, language, video ): logger.info('Downloading subtitle %r', link) request = self.session.get(link, headers={ - 'Referer': 'http://subs.sab.bz/index.php?' + 'Referer': 'http://subs.sab.bz/index.php?' }) request.raise_for_status() diff --git a/libs/subliminal_patch/providers/subsunacs.py b/libs/subliminal/providers/subsunacs.py similarity index 100% rename from libs/subliminal_patch/providers/subsunacs.py rename to libs/subliminal/providers/subsunacs.py diff --git a/libs/subliminal_patch/extensions.py b/libs/subliminal_patch/extensions.py index 22198a24a..5e20e8556 100644 --- a/libs/subliminal_patch/extensions.py +++ b/libs/subliminal_patch/extensions.py @@ -63,5 +63,3 @@ subliminal.refiner_manager.register('drone = subliminal_patch.refiners.drone:ref subliminal.refiner_manager.register('filebot = subliminal_patch.refiners.filebot:refine') subliminal.refiner_manager.register('file_info_file = subliminal_patch.refiners.file_info_file:refine') subliminal.refiner_manager.register('symlinks = subliminal_patch.refiners.symlinks:refine') -subliminal.refiner_manager.register('subsunacs = subliminal.providers.subsunacs:SubsUnacsProvider') -subliminal.refiner_manager.register('subssabbz = subliminal.providers.subssabbz:SubsSabBzProvider') \ No newline at end of file