subdivx: replacing ParseReponseError by APIThrootled

pull/806/head
German Gutierrez 5 years ago
parent 034ce9bf4c
commit 881a16350a

@ -15,7 +15,7 @@ from subliminal.exceptions import ServiceUnavailable
from subliminal.providers import ParserBeautifulSoup, Provider from subliminal.providers import ParserBeautifulSoup, Provider
from subliminal.subtitle import SUBTITLE_EXTENSIONS, Subtitle, fix_line_ending,guess_matches from subliminal.subtitle import SUBTITLE_EXTENSIONS, Subtitle, fix_line_ending,guess_matches
from subliminal.video import Episode, Movie from subliminal.video import Episode, Movie
from subliminal_patch.exceptions import ParseResponseError from subliminal_patch.exceptions import APIThrottled
from six.moves import range from six.moves import range
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -132,7 +132,8 @@ class SubdivxSubtitlesProvider(Provider):
try: try:
page_subtitles = self._parse_subtitles_page(response, language) page_subtitles = self._parse_subtitles_page(response, language)
except Exception as e: except Exception as e:
raise ParseResponseError('Error parsing subtitles list: ' + str(e)) logger.error('Error parsing subtitles list: ' + str(e))
break
subtitles += page_subtitles subtitles += page_subtitles
@ -221,9 +222,9 @@ class SubdivxSubtitlesProvider(Provider):
if link_soup['href'].startswith('bajar'): if link_soup['href'].startswith('bajar'):
return self.server_url + link_soup['href'] return self.server_url + link_soup['href']
except Exception as e: except Exception as e:
raise ParseResponseError('Error parsing download link: ' + str(e)) raise APIThrottled('Error parsing download link: ' + str(e))
raise ParseResponseError('Download link not found') raise APIThrottled('Download link not found')
def _get_archive(self, content): def _get_archive(self, content):
# open the archive # open the archive
@ -235,7 +236,7 @@ class SubdivxSubtitlesProvider(Provider):
logger.debug('Identified zip archive') logger.debug('Identified zip archive')
archive = zipfile.ZipFile(archive_stream) archive = zipfile.ZipFile(archive_stream)
else: else:
raise ParseResponseError('Unsupported compressed format') raise APIThrottled('Unsupported compressed format')
return archive return archive
@ -251,4 +252,4 @@ class SubdivxSubtitlesProvider(Provider):
return archive.read(name) return archive.read(name)
raise ParseResponseError('Can not find the subtitle in the compressed file') raise APIThrottled('Can not find the subtitle in the compressed file')

Loading…
Cancel
Save