Skip to content

Commit

Permalink
Fixed: Show better error on Geo restrictions for Videoland (See #1834).
Browse files Browse the repository at this point in the history
  • Loading branch information
basrieter committed Sep 15, 2024
1 parent f8feff7 commit 736e22d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
14 changes: 11 additions & 3 deletions channels/channel.videoland/videolandnl/chn_videolandnl.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,18 @@ def filter_premium(self) -> Optional[bool]:

def update_video_item(self, item: MediaItem) -> MediaItem:
data = JsonHelper(UriHandler.open(item.url, additional_headers=self.httpHeaders))
from resources.lib.logger import Logger
import json
Logger.debug(json.dumps(data.json, indent=2))

# Check for video info and possible locks.
video_info = data.get_value("blocks", 0, "content", "items", 0, "itemContent", "video")
if not video_info:
return item

if len(video_info.get("assets", [])) == 0:
target_info = data.get_value("blocks", 0, "content", "items", 0, "itemContent", "action", "target")
if target_info["type"] == "lock" and target_info["value_lock"]["reason"].lower() == "geoblocked":
XbmcWrapper.show_dialog(LanguageHelper.GeoLockedId, LanguageHelper.GeoLockedMessageId)
item.isGeoLocked = True
return item

# Find the first Dash item for DRM info (assuming they are all equally DRM-ed).
dash_assets = [v for v in video_info["assets"] if v["format"] == "dashcenc"]
Expand Down
6 changes: 5 additions & 1 deletion resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,11 @@ msgctxt "#30587"
msgid "Show streams with accessibility features"
msgstr ""

# empty strings from id 30588 to 30589
msgctxt "#30588"
msgid "This stream cannot be played due to geographical restrictions."
msgstr ""

# empty strings from id 30589 to 30589

msgctxt "#30590"
msgid "Set a new Retrospect PIN"
Expand Down
2 changes: 2 additions & 0 deletions resources/lib/helpers/languagehelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ class LanguageHelper(object):
AddonsNotEnabledText = 30568
FetchMultiApi = 30584
PageOfPages = 30585
# 30586 and 30587 taken by settings.
GeoLockedMessageId = 30588

Active = 30068
InitChannelTitle = 30556
Expand Down

0 comments on commit 736e22d

Please sign in to comment.