Skip to content

Commit

Permalink
[service.subtitles.rvm.addic7ed] 3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
romanvm committed Sep 18, 2024
1 parent f395d90 commit 808471a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions service.subtitles.rvm.addic7ed/addic7ed/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions service.subtitles.rvm.addic7ed/addic7ed/simple_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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]]]:
Expand Down
2 changes: 0 additions & 2 deletions service.subtitles.rvm.addic7ed/addic7ed/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import json
import logging
import os
import re
from collections import namedtuple

import xbmc

Expand Down
6 changes: 3 additions & 3 deletions service.subtitles.rvm.addic7ed/addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="service.subtitles.rvm.addic7ed"
name="Addic7ed.com"
version="3.2.0"
version="3.2.1"
provider-name="Roman V.M.">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
Expand Down Expand Up @@ -29,8 +29,8 @@
<icon>icon.png</icon>
<fanart>fanart.jpg</fanart>
</assets>
<news>3.2.0:
- Removed Python 2 compatibility.</news>
<news>3.2.1:
- Fixed issues with downloading subtitles.</news>
<reuselanguageinvoker>true</reuselanguageinvoker>
</extension>
</addon>

0 comments on commit 808471a

Please sign in to comment.