diff --git a/libs/subliminal_patch/providers/bsplayer.py b/libs/subliminal_patch/providers/bsplayer.py index 877db2523..9839a0331 100644 --- a/libs/subliminal_patch/providers/bsplayer.py +++ b/libs/subliminal_patch/providers/bsplayer.py @@ -1,30 +1,21 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import import logging -import re import io import os -import sys from requests import Session from guessit import guessit -from babelfish import language_converters from subliminal_patch.providers import Provider from subliminal_patch.subtitle import Subtitle -from subliminal_patch.utils import sanitize -from subliminal.exceptions import ProviderError from subliminal.utils import sanitize_release_group from subliminal.subtitle import guess_matches -from subliminal.video import Episode, Movie -from subliminal.subtitle import fix_line_ending from subzero.language import Language -from .utils import FIRST_THOUSAND_OR_SO_USER_AGENTS as AGENT_LIST import gzip import random from time import sleep from xml.etree import ElementTree -import struct logger = logging.getLogger(__name__) @@ -44,6 +35,10 @@ class BSPlayerSubtitle(Subtitle): def id(self): return self.page_link + @property + def release_info(self): + return self.filename + def get_matches(self, video): matches = set() diff --git a/libs/subliminal_patch/providers/legendasdivx.py b/libs/subliminal_patch/providers/legendasdivx.py index 2eec7c326..5537e5828 100644 --- a/libs/subliminal_patch/providers/legendasdivx.py +++ b/libs/subliminal_patch/providers/legendasdivx.py @@ -3,25 +3,19 @@ from __future__ import absolute_import import logging import io import os -import sys import rarfile import zipfile from requests import Session from guessit import guessit +from subliminal_patch.exceptions import ParseResponseError from subliminal_patch.providers import Provider from subliminal.providers import ParserBeautifulSoup from subliminal_patch.subtitle import Subtitle -from subliminal_patch.utils import sanitize -from subliminal.exceptions import ProviderError -from subliminal.utils import sanitize_release_group -from subliminal.subtitle import guess_matches -from subliminal.video import Episode, Movie +from subliminal.video import Episode from subliminal.subtitle import SUBTITLE_EXTENSIONS, fix_line_ending,guess_matches from subzero.language import Language -import gzip - logger = logging.getLogger(__name__) class LegendasdivxSubtitle(Subtitle): @@ -293,15 +287,21 @@ class LegendasdivxProvider(Provider): return archive def _get_subtitle_from_archive(self, archive): + # some files have a non subtitle with .txt extension + _tmp = list(SUBTITLE_EXTENSIONS) + _tmp.remove('.txt') + _subtitle_extensions = tuple(_tmp) + for name in archive.namelist(): # discard hidden files if os.path.split(name)[-1].startswith('.'): continue # discard non-subtitle files - if not name.lower().endswith(SUBTITLE_EXTENSIONS): + if not name.lower().endswith(_subtitle_extensions): continue + logger.debug("returning from archive: %s" % name) return archive.read(name) raise ParseResponseError('Can not find the subtitle in the compressed file') diff --git a/libs/subliminal_patch/providers/subdivx.py b/libs/subliminal_patch/providers/subdivx.py index ab7db33b6..74b3c4f7b 100644 --- a/libs/subliminal_patch/providers/subdivx.py +++ b/libs/subliminal_patch/providers/subdivx.py @@ -35,6 +35,10 @@ class SubdivxSubtitle(Subtitle): def id(self): return self.page_link + @property + def release_info(self): + return self.description + def get_matches(self, video): matches = set()