Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix geoblock #1201

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions resources/lib/streamservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class StreamService:
_UPLYNK_LICENSE_URL = 'https://content.uplynk.com/wv'
_INVALID_LOCATION = 'INVALID_LOCATION'
_INCOMPLETE_ROAMING_CONFIG = 'INCOMPLETE_ROAMING_CONFIG'
_BELGIUM_ONLY = 'CONTENT_AVAILABLE_ONLY_IN_BE'
_GEOBLOCK_ERROR_CODES = (_INCOMPLETE_ROAMING_CONFIG, _INVALID_LOCATION, _BELGIUM_ONLY)
_BELGIUM_ONLY = ('CONTENT_AVAILABLE_ONLY_IN_BE', 'CONTENT_AVAILABLE_ONLY_FOR_BE_RESIDENTS')
_GEOBLOCK_ERROR_CODES = (_INCOMPLETE_ROAMING_CONFIG, _INVALID_LOCATION) + _BELGIUM_ONLY

def __init__(self, _tokenresolver):
"""Initialize Stream Service class"""
Expand Down Expand Up @@ -257,7 +257,7 @@ def get_stream(self, video, roaming=False, api_data=None):
message = localize(30965) # Geoblock error: Blocked on your geographical location based on your IP address
return self._handle_stream_api_error(message, stream_json)

if stream_json.get('code') == self._BELGIUM_ONLY:
if stream_json.get('code') in self._BELGIUM_ONLY:
message = localize(30973) # Geoblock error: This program can only be played from EU
return self._handle_stream_api_error(message, stream_json)

Expand All @@ -281,7 +281,7 @@ def get_stream(self, video, roaming=False, api_data=None):
def _handle_stream_api_error(message, video_json=None):
"""Show localized stream api error messages in Kodi GUI"""
if video_json:
log_error(video_json.get('message'))
log_error(video_json)
ok_dialog(message=message)
end_of_directory()

Expand Down
Loading