Skip to content

Commit

Permalink
Merge 1163ad2 into e2a9e18
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed Jan 20, 2024
2 parents e2a9e18 + 1163ad2 commit 885134b
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* [v3.13.0](https://github.com/newt-sc/a4kSubtitles/releases/tag/service.subtitles.a4ksubtitles%2Fservice.subtitles.a4ksubtitles-3.13.0):
* Show proper error message of wrong username for OpenSubtitles

* [v3.12.0](https://github.com/newt-sc/a4kSubtitles/releases/tag/service.subtitles.a4ksubtitles%2Fservice.subtitles.a4ksubtitles-3.12.0):
* Fix OpenSubtitles not working for titles with IMDB ID less than 1_000_000

Expand Down
5 changes: 1 addition & 4 deletions a4kSubtitles/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
def __auth_service(core, service_name, request):
service = core.services[service_name]
response = core.request.execute(core, request)
if response.status_code == 200 and response.text:
service.parse_auth_response(core, service_name, response.text)
elif service_name != 'bsplayer':
core.kodi.notification('%s authentication failed!' % service.display_name)
service.parse_auth_response(core, service_name, response)

def __query_service(core, service_name, meta, request, results):
try:
Expand Down
5 changes: 4 additions & 1 deletion a4kSubtitles/services/bsplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ def build_auth_request(core, service_name):
return __get_request(core, service_name, action, params)

def parse_auth_response(core, service_name, response):
response = __parse_response(core, service_name, response)
if response.status_code != 200 or not response.text:
return

response = __parse_response(core, service_name, response.text)
if response is None:
return

Expand Down
9 changes: 8 additions & 1 deletion a4kSubtitles/services/opensubtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ def build_auth_request(core, service_name):
return request

def parse_auth_response(core, service_name, response):
response = core.json.loads(response)
if response.status_code == 400:
core.kodi.notification('OpenSubtitles authentication failed! Bad username. Make sure you have entered your username and not your email in the username field.')
return
elif response.status_code != 200 or not response.text:
core.kodi.notification('OpenSubtitles authentication failed! Check your OpenSubtitles.com username and password.')
return

response = core.json.loads(response.text)
token = response.get('token', None)
base_url = response.get('base_url', __api_host)
allowed_downloads = response.get('user', {}).get('allowed_downloads', 0)
Expand Down
5 changes: 4 additions & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.subtitles.a4ksubtitles"
name="a4kSubtitles"
version="3.12.0"
version="3.13.0"
provider-name="Unknown">
<requires>
<import addon="script.module.requests"/>
Expand All @@ -27,6 +27,9 @@ Supports: OpenSubtitles, BSPlayer, Podnadpisi.NET, Subscene, Addic7ed
<screenshot>screenshot-03.png</screenshot>
</assets>
<news>
[v3.13.0]:
* Show proper error message of wrong username for OpenSubtitles

[v3.12.0]:
* Fix OpenSubtitles not working for titles with IMDB ID less than 1_000_000

Expand Down
5 changes: 4 additions & 1 deletion packages/addons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<addons>
<addon id="service.subtitles.a4ksubtitles"
name="a4kSubtitles"
version="3.12.0"
version="3.13.0"
provider-name="Unknown">
<requires>
<import addon="script.module.requests"/>
Expand All @@ -30,6 +30,9 @@ Supports: OpenSubtitles, BSPlayer, Podnadpisi.NET, Subscene, Addic7ed
<screenshot>screenshot-03.png</screenshot>
</assets>
<news>
[v3.13.0]:
* Show proper error message of wrong username for OpenSubtitles

[v3.12.0]:
* Fix OpenSubtitles not working for titles with IMDB ID less than 1_000_000

Expand Down
2 changes: 1 addition & 1 deletion packages/addons.xml.crc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17ec6ef140b463ff93b6887a895988cc069ae17e
33e9b59e74a6fa4392083562d5665609d8d7fe1a

0 comments on commit 885134b

Please sign in to comment.