Skip to content

Commit

Permalink
Merge branch '1842-npostart-login-failed'
Browse files Browse the repository at this point in the history
  • Loading branch information
basrieter committed Dec 20, 2024
2 parents 7e2682d + fcc01d4 commit 02cce10
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ t.b.d.
_None_

[B]GUI/Settings/Language related[/B]
_None_
* Fixed: Show notification on logon failure (Fixes #1842).

[B]Channel related[/B]
* Fixed: NPO 'Recent' items broke if there were too many season results (Fixes #1871).
Expand Down
22 changes: 14 additions & 8 deletions channels/channel.nos/nos2010/chn_nos2010.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, channel_info: ChannelInfo):

self._add_data_parser("https://npo.nl/start/api/domain/guide-channels",
name="Main Live TV Streams json", json=True,
requires_logon=True,
requires_logon=bool(self.__user_name),
parser=[],
creator=self.create_api_live_tv,
updater=self.update_video_item_live)
Expand All @@ -81,21 +81,23 @@ def __init__(self, channel_info: ChannelInfo):

self._add_data_parser("https://npo.nl/start/live?channel=",
name="Live Video Updater from json",
requires_logon=True,
requires_logon=bool(self.__user_name),
updater=self.update_video_item_live)

# If the user was logged in, we need to refresh the token otherwise it will result in 403
self._add_data_parsers([
"https://npo.nl/start/api/domain/page-collection?guid=",
"https://npo.nl/start/api/domain/page-collection?type=series&guid=",
"https://npo.nl/start/api/domain/search-results?searchType=series"],
name="Collections with series", json=True, requires_logon=bool(self.__user_name),
name="Collections with series", json=True,
requires_logon=bool(self.__user_name),
parser=["items"],
creator=self.create_api_program_item)
# Use the new `label` options for the collections
self._add_data_parser(
"https://npo.nl/start/api/domain/recommendation-collection?key=", name="Collection with series",
json=True, label="collection-with-series", requires_logon=bool(self.__user_name),
json=True, label="collection-with-series",
requires_logon=bool(self.__user_name),
parser=["items"],
creator=self.create_api_program_item)

Expand All @@ -104,14 +106,16 @@ def __init__(self, channel_info: ChannelInfo):
"https://npo.nl/start/api/domain/search-results?searchType=broadcasts",
"https://npo.nl/start/api/domain/page-collection?type=program&guid="
],
name="Collections with videos", json=True, requires_logon=bool(self.__user_name),
name="Collections with videos", json=True,
requires_logon=bool(self.__user_name),
parser=["items"],
creator=self.create_api_episode_item_with_data
)
# Use the new `label` options for the collections
self._add_data_parser(
"https://npo.nl/start/api/domain/recommendation-collection?key=", name="Collection with videos",
json=True, label="collection-with-videos", requires_logon=bool(self.__user_name),
json=True, label="collection-with-videos",
requires_logon=bool(self.__user_name),
parser=["items"],
creator=self.create_api_episode_item_with_data)

Expand Down Expand Up @@ -139,7 +143,8 @@ def __init__(self, channel_info: ChannelInfo):
updater=self.update_single_video)

# Standard updater
self._add_data_parser("*", requires_logon=True,
self._add_data_parser("*",
requires_logon=bool(self.__user_name),
updater=self.update_video_item)

self._add_data_parser("https://npo.nl/start/api/domain/page-layout?slug=",
Expand All @@ -148,7 +153,8 @@ def __init__(self, channel_info: ChannelInfo):

# Favourites (not yet implemented in the site).
self._add_data_parser("https://npo.nl/start/api/domain/user-profiles",
match_type=ParserData.MatchExact, json=True, requires_logon=True,
match_type=ParserData.MatchExact, json=True,
requires_logon=True,
name="Profile selection",
parser=[], creator=self.create_profile_item)

Expand Down
4 changes: 3 additions & 1 deletion resources/lib/chn_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,9 @@ def process_video_item(self, item):
Logger.warning("Could not log on for: %s", self)
title = LanguageHelper.get_localized_string(LanguageHelper.LoginErrorTitle)
text = LanguageHelper.get_localized_string(LanguageHelper.LoginErrorText)
XbmcWrapper.show_dialog(title, text)
XbmcWrapper.show_notification(
title, text, display_time=2000, notification_type=XbmcWrapper.Error, logger=Logger.instance())
# XbmcWrapper.show_dialog(title, text)

Logger.debug("Processing Updater from %s", data_parser)
return data_parser.Updater(item)
Expand Down

0 comments on commit 02cce10

Please sign in to comment.