diff --git a/service.subtitles.rvm.addic7ed/addic7ed/parser.py b/service.subtitles.rvm.addic7ed/addic7ed/parser.py index d03a5be8ca..9a5c64b45f 100644 --- a/service.subtitles.rvm.addic7ed/addic7ed/parser.py +++ b/service.subtitles.rvm.addic7ed/addic7ed/parser.py @@ -159,13 +159,13 @@ def parse_episode(sub_cells, languages): download_cell = lang_cell.find_next('td', {'colspan': '3'}) download_button = download_cell.find( 'a', - class_='buttonDownload', + class_='face-button', href=updated_download_re ) if download_button is None: download_button = download_cell.find( 'a', - class_='buttonDownload', + class_='face-button', href=original_download_re ) download_row = download_button.parent.parent diff --git a/service.subtitles.rvm.addic7ed/addic7ed/simple_requests.py b/service.subtitles.rvm.addic7ed/addic7ed/simple_requests.py index 0d755e4d88..7da42d8963 100644 --- a/service.subtitles.rvm.addic7ed/addic7ed/simple_requests.py +++ b/service.subtitles.rvm.addic7ed/addic7ed/simple_requests.py @@ -89,7 +89,7 @@ class Response: def __init__(self): self.encoding: str = 'utf-8' self.status_code: int = -1 - self.headers: Dict[str, str] = {} + self._headers: Optional[HTTPMessage] = None self.url: str = '' self.content: bytes = b'' self._text = None @@ -101,6 +101,17 @@ def __str__(self) -> str: def __repr__(self) -> str: return self.__str__() + @property + def headers(self) -> HTTPMessage: + return self._headers + + @headers.setter + def headers(self, value: HTTPMessage): + charset = value.get_content_charset() + if charset is not None: + self.encoding = charset + self._headers = value + @property def ok(self) -> bool: return self.status_code < 400 @@ -111,7 +122,10 @@ def text(self) -> str: :return: Response payload as decoded text """ if self._text is None: - self._text = self.content.decode(self.encoding) + try: + self._text = self.content.decode(self.encoding) + except UnicodeDecodeError: + self._text = self.content.decode('utf-8', 'replace') return self._text def json(self) -> Optional[Union[Dict[str, Any], List[Any]]]: diff --git a/service.subtitles.rvm.addic7ed/addic7ed/utils.py b/service.subtitles.rvm.addic7ed/addic7ed/utils.py index 340081ba8b..1f948a8cb9 100644 --- a/service.subtitles.rvm.addic7ed/addic7ed/utils.py +++ b/service.subtitles.rvm.addic7ed/addic7ed/utils.py @@ -16,8 +16,6 @@ import json import logging import os -import re -from collections import namedtuple import xbmc diff --git a/service.subtitles.rvm.addic7ed/addon.xml b/service.subtitles.rvm.addic7ed/addon.xml index 258a7eaec0..a33b2e6e34 100644 --- a/service.subtitles.rvm.addic7ed/addon.xml +++ b/service.subtitles.rvm.addic7ed/addon.xml @@ -1,7 +1,7 @@ @@ -29,8 +29,8 @@ icon.png fanart.jpg - 3.2.0: -- Removed Python 2 compatibility. + 3.2.1: +- Fixed issues with downloading subtitles. true