Skip to content

Commit

Permalink
Merge pull request #4609 from basrieter/retrospect-matrix
Browse files Browse the repository at this point in the history
[plugin.video.retrospect] v5.7.22
  • Loading branch information
basrieter authored Dec 20, 2024
2 parents 75f83e7 + 6cc53c5 commit d13309a
Show file tree
Hide file tree
Showing 86 changed files with 714 additions and 31 deletions.
32 changes: 22 additions & 10 deletions plugin.video.retrospect/addon.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.retrospect"
version="5.7.21"
version="5.7.22"
name="Retrospect"
provider-name="Bas Rieter">

Expand Down Expand Up @@ -46,6 +46,16 @@
<visible>ListItem.Property(RetrospectCloaked)</visible>
</item>

<item library="retromenu.py" args="clear_search">
<label>30377</label>
<visible>ListItem.Property(RetrospectSearchFolder)</visible>
</item>

<item library="retromenu.py" args="remove_search_item">
<label>30378</label>
<visible>ListItem.Property(RetrospectSearchFolder)</visible>
</item>

<!-- Channel settings -->
<menu>
<label>30580</label>
Expand Down Expand Up @@ -123,22 +133,24 @@
<platform>all</platform>
<license>GPL-3.0-or-later</license>
<language>en nl de sv no lt lv fi</language>
<news>[B]Retrospect v5.7.21 - Changelog - 2024-11-26[/B]
<news>[B]Retrospect v5.7.22 - Changelog - 2024-12-20[/B]

Fixed some minor channel issues for Dutch and Swedish channels.
Fixed some channel related stuff.

[B]Framework related[/B]
* Added: Patch option to UriHandler.
_None_

[B]GUI/Settings/Language related[/B]
_None_
* Fixed: Show notification on logon failure (Fixes #1842).
* Added: Allow clearing of search history or history items (Fixes #1874).
* Fixed: Show notification on logon failure (Fixes #1842).

[B]Channel related[/B]
* Fixed: NPO Plus content not showing (Fixes #1862).
* Fixed: Some TV4 content (with encryption) was not playing (Fixes #1853).
* Fixed: Revoking a device from Videoland.nl broke Retrospect listing (Fixes #1852).
* Fixed: BVN Images did not show (Fixes #1864).
* Fixed: Don&#x27;t use HVEC for SVT (Fixes #1865).
* Fixed: NPO &#x27;Recent&#x27; items broke if there were too many season results (Fixes #1871).
* Fixed: Tweede kamer streams broke (Fixes #1872).
* Fixed: SVT date parsing.
* Changed: Make login optional for NPO (See #1842).

</news>
<assets>
<icon>resources/media/icon.png</icon>
Expand Down
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 All @@ -122,6 +126,12 @@ def __init__(self, channel_info: ChannelInfo):
parser=[], creator=self.create_api_season_item,
updater=self.update_epg_series_item)

self._add_data_parser(
"https://npo.nl/start/serie/",
name="Direct link to video", json=True,
updater=self.update_nextjs_video
)

self._add_data_parsers([
"https://npo.nl/start/api/domain/programs-by-season",
"https://npo.nl/start/api/domain/programs-by-series"],
Expand All @@ -133,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 @@ -142,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 Expand Up @@ -777,8 +789,10 @@ def create_api_epg_item(self, result_set: dict) -> Optional[MediaItem]:
program_slug = result_set["program"]["slug"]
url = f"https://npo.nl/start/video/{program_slug}"
elif series_slug and program_guid:
url = f"https://npo.nl/start/api/domain/series-seasons?slug={series_slug}"
program_slug = result_set["program"]["slug"]
season_slug = result_set["season"]["slug"]
# url = f"https://npo.nl/start/api/domain/series-seasons?slug={series_slug}"
url = f"https://npo.nl/start/serie/{series_slug}/{season_slug}/{program_slug}"
else:
return None

Expand Down Expand Up @@ -846,6 +860,17 @@ def update_epg_series_item(self, item: MediaItem) -> MediaItem:

return self.__update_video_item(item, product_id)

def update_nextjs_video(self, item: MediaItem) -> MediaItem:
data = UriHandler.open(item.url)
next_js_data = Regexer.do_regex(r"__NEXT_DATA__[^>]+>(.+?)</script>", data)[0]
next_js_json = JsonHelper(next_js_data)
data = next_js_json.get_value("props", "pageProps", "dehydratedState", "queries", -1, "state", "data")
if isinstance(data, list):
p = [p for p in data if p["guid"] == item.metaData["program_guid"]][0]
else:
p = data
return self.__update_video_item(item, p["productId"])

# noinspection PyUnusedLocal
def search_site(self, url: Optional[str] = None, needle: Optional[str] = None) -> List[MediaItem]:
""" Creates a list of items by searching the site.
Expand Down
2 changes: 2 additions & 0 deletions plugin.video.retrospect/channels/channel.se/svt/chn_svt.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,8 @@ def create_api_episode_type(self, result_set, add_parent_title=False):
elif bool(valid_from):
# Remove the Timezone information
valid_from = valid_from.split("+")[0]
# Remove milliseconds.
valid_from = valid_from.split(".")[0]
valid_from_date = DateHelper.get_date_from_string(valid_from, "%Y-%m-%dT%H:%M:%S")
item.set_date(*valid_from_date[0:6])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,12 @@ def update_video_item(self, item):
if introduction:
item.description += "\n" + introduction

url = json_data.get_value("video", "vodUrl")

# Use the LIVE url as it works with InputStream Adaptive.
url = json_data.get_value("video", "url")
# Append time stamps.
url += '&start=%s&end=%s' % (HtmlEntityHelper.url_encode(json_data.get_value('startedAt')),
HtmlEntityHelper.url_encode(json_data.get_value('endedAt')))
item.complete = M3u8.update_part_with_m3u8_streams(item, url, channel=self, encrypted=False)

Logger.info('Starting update_video_item: url = %s', url)

Expand All @@ -286,9 +288,8 @@ def update_video_item(self, item):
# item.complete = M3u8.update_part_with_m3u8_streams(item, url, channel=self, encrypted=False, map_audio=True)

# use Retrospect code to extract streams
for s, b in M3u8.get_streams_from_m3u8(url):
item.add_stream(s, b)
item.complete = True
# for s, b in M3u8.get_streams_from_m3u8(url):
# item.add_stream(s, b)

Logger.debug('Finished update_video_item: %s', item.name)
return item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30365 to 30400
msgctxt "#30401"
msgid "Dutch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30365 to 30400
msgctxt "#30401"
msgid "Dutch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30365 to 30400
msgctxt "#30401"
msgid "Dutch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30365 to 30400
msgctxt "#30401"
msgid "Dutch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30365 to 30400
msgctxt "#30401"
msgid "Dutch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30365 to 30400
msgctxt "#30401"
msgid "Dutch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30365 to 30400
msgctxt "#30401"
msgid "Dutch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30365 to 30400
msgctxt "#30401"
msgid "Dutch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30365 to 30400
msgctxt "#30401"
msgid "Dutch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30365 to 30400
msgctxt "#30401"
msgid "Dutch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30365 to 30400
msgctxt "#30401"
msgid "Dutch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30365 to 30400
msgctxt "#30401"
msgid "Dutch"
Expand Down
Loading

0 comments on commit d13309a

Please sign in to comment.