Skip to content

Commit

Permalink
[plugin.video.retrospect] v5.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
basrieter committed Dec 9, 2023
1 parent 4b090e3 commit 97fd9a6
Show file tree
Hide file tree
Showing 85 changed files with 429 additions and 145 deletions.
27 changes: 13 additions & 14 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.2"
version="5.7.3"
name="Retrospect"
provider-name="Bas Rieter">

Expand Down Expand Up @@ -122,25 +122,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.2 - Changelog - 2023-11-20[/B]
<news>[B]Retrospect v5.7.3 - Changelog - 2023-12-09[/B]

Minor &#x27;after-care&#x27;-updates for the NPO channel. After the large update for both TV4 Play (Sweden) en NPO Start (Netherlands). Both channels had their API renewed and needed a complete rewrite.
Another minor &#x27;after-care&#x27;-updates for the NPO channel. This patch also fixes a minor TV4 Play issue.

[B]Framework related[/B]
* Added: Web-based dialog to insert values.
* Added: Option to disable the Kodi directory cache.
* Added: Use `retrospect:parser` for updaters.

[B]GUI/Settings/Language related[/B]
* Updated: Some translations.
* None

[B]Channel related[/B]
* Fixed: TV4 Play major update of API (Fixes #1714).
* Fixed: NPO Start major update of API (Fixes #1730).
* Fixed: &quot;Today&quot; is not update after 23:59 (NPO).
* Added: broadcast time for &quot;dailies&quot; (NPO).
* Changed: Improved log-in experience (NPO).
* Added: season and episode info for &quot;series&quot; (NPO).
* Fixed: Folder Icon for seasons.
* Fixed: Improved NPO Plus filtering.
* Fixed: Items without type break NPO.
* Fixed: Don&#x27;t cache the &quot;recent&quot; list by Kodi.
* Fixed: Radio live streams for NPO.
* Fixed: NPO subtitles (Fixes #1742).
* Fixed: TV4 Play main list not working.
* Added: Option to not show future items in NPO Start &quot;Recent&quot; listings.

</news>
<assets>
Expand All @@ -167,7 +166,7 @@ Minor &#x27;after-care&#x27;-updates for the NPO channel. After the large update
<description lang="es_ES">Retrospect utiliza los sitios web oficiales y las transmisiones de libre acceso de diferentes empresas de radiodifusión (principalmente holandesas, belgas, británicas, noruegas y suecas) para poner a disposición de la plataforma Kodi sus episodios reemitidos/actualizados. [CR][CR]Algunos canales que se incluyen son: NPO Start, Kijk.nl (SBS6, NET5, Veronica, SBS9), RTL XL, NOS, Nickelodeon, AT5, Omroep Flevoland, L1, RTV Drenthe, RTV Oost, RTV Noord, RTV Noord-Holland, RTV Rijnmond, Omroep West, Omroep Gelderland, Omroep Brabant, Omrop Fryslân, WOS, DTV, Omroep Venlo Omroep Horst aan de Maas, Studio 040, RTV Utrecht, Omroep Zeeland, Eén, Vier, VRT. Now, VTM, Stieve, Ketnet, DPlay, SVT, ViaFree, Viasat, UR Play, MTV, NRK, BBC, Dumpert, Fox Sports, Pathé Nederland, Hardware.info y Ons. [CR][CR]Encontrará más información en https://github.com/retrospect-addon/plugin.video.retrospect o en la wiki de Retrospect en https://github.com/retrospect-addon/plugin.video.retrospect/wiki/.</description>
<description lang="es_MX">Retrospect utiliza los sitios web oficiales y las transmisiones disponibles gratuitamente de diferentes compañías de transmisión (principalmente holandesas, belgas, británicas, noruegas y suecas) para proveer de sus episodios de repetición/actualización a través de Kodi. [CR][CR]Algunos canales incluidos son: NPO Start, Kijk.nl (SBS6, NET5, Veronica, SBS9), RTL XL, NOS, Nickelodeon, AT5, Omroep Flevoland, L1, RTV Drenthe, RTV Oost, RTV Noord, RTV Noord-Holland, RTV Rijnmond, Omroep West, Omroep Gelderland, Omroep Brabant, Omrop Fryslân, WOS, DTV, Omroep Venlo Omroep Horst aan de Maas, Studio 040, RTV Utrecht, Omroep Zeeland, Eén, Vier, VRT.nu , VTM, Stieve, Ketnet, DPlay, SVT, ViaFree, Viasat, UR Play, MTV, NRK, BBC, Dumpert, Fox Sports, Pathé Nederland, Hardware.info y Ons. [CR][CR]Para obtener más información, visita https://github.com/retrospect-addon/plugin.video.retrospect o la wiki de Retrospect en https://github.com/retrospect-addon/plugin.video.retrospect/wiki/.</description>
<description lang="it_IT">Retrospect usa i siti web ufficiali e gli stream disponibili gratuitamente di diverse società di trasmissione (principalmente olandesi, belghe, britanniche, norvegesi e svedesi) per rendere disponibili e recuperare gli episodi replicati sulla piattaforma Kodi. [CR][CR]Alcuni canali inclusi sono: NPO Start, Kijk.nl (SBS6, NET5, Veronica, SBS9), RTL XL, NOS, Nickelodeon, AT5, Omroep Flevoland, L1, RTV Drenthe, RTV Oost, RTV North, RTV Noord-Holland, RTV Rijnmond, Omroep West, Omroep Gelderland, Omroep Brabant, Omrop Fryslân, WOS, DTV, Omroep Venlo, Omroep Horst aan de Maas, Studio 040, RTV Utrecht, Omroep Zeeland, One, Four, VRT. nu , VTM, Stieve, Ketnet, DPlay, SVT, ViaFree, Viasat, UR Play, MTV, NRK, BBC, Dumpert, Fox Sports, Pathé Nederland, Hardware.info e Ons.[CR][CR]È possibile trovare ulteriori informazioni su https://github.com/retrospect-addon/plugin.video.retrospect o il wiki di Retrospect su https://github.com/retrospect-addon/plugin.video.retrospect/wiki/.</description>
<description lang="nl_NL">Retrospect maakt gebruik van de officiële websites en vrij beschikbare streams van de verschillende omroepen (voornamelijk Nederlands, Belgische, Britse, Noorse en Zweedse) om hun uitzendinggemist afleveringen beschikbaar te maken viat Kodi. [CR][CR]Aantal van de beschikbare kanalen zijn: NPO Start, Kijk.nl (SBS6, NET5, Veronica, SBS9), RTL XL, NOS, Nickelodeon, AT5, Omroep Flevoland, L1, RTV Drenthe, RTV Oost, RTV Noord, RTV Noord-Holland, RTV Rijnmond, Omroep West, Omroep Gelderland, Omroep Brabant, Omrop Fryslân, WOS, DTV, Omroep Venlo Omroep Horst aan de Maas, Studio 040, RTV Utrecht, Omroep Zeeland, Eén, Vier, VRT.nu, VTM, Stieve, Ketnet, DPlay, SVT, ViaFree, Viasat, UR Play, MTV, NRK, BBC, Dumpert, Fox Sports, Pathé Nederland, Hardware.info en Ons.[CR][CR]. Meer informatie kan worden gevonden op https://github.com/retrospect-addon/plugin.video.retrospect of de Retrospect wiki op https://github.com/retrospect-addon/plugin.video.retrospect/wiki/.</description>
<description lang="nl_NL">Retrospect maakt gebruik van de officiële websites en vrij beschikbare streams van de verschillende omroepen (voornamelijk Nederlands, Belgische, Britse, Noorse en Zweedse) om hun uitzendinggemist afleveringen beschikbaar te maken via Kodi. [CR][CR]Aantal van de beschikbare kanalen zijn: NPO Start, Kijk.nl (SBS6, NET5, Veronica, SBS9), RTL XL, NOS, Nickelodeon, AT5, Omroep Flevoland, L1, RTV Drenthe, RTV Oost, RTV Noord, RTV Noord-Holland, RTV Rijnmond, Omroep West, Omroep Gelderland, Omroep Brabant, Omrop Fryslân, WOS, DTV, Omroep Venlo Omroep Horst aan de Maas, Studio 040, RTV Utrecht, Omroep Zeeland, Eén, Vier, VRT.nu, VTM, Stieve, Ketnet, DPlay, SVT, ViaFree, Viasat, UR Play, MTV, NRK, BBC, Dumpert, Fox Sports, Pathé Nederland, Hardware.info en Ons.[CR][CR] Meer informatie kan worden gevonden op https://github.com/retrospect-addon/plugin.video.retrospect of de Retrospect wiki op https://github.com/retrospect-addon/plugin.video.retrospect/wiki/.</description>
<description lang="ru_RU">Retrospect использует трансляции доступные через официальные сайты телеканалов для просмотра повторов/архива телепередач, доступных в Kodi (в основном голландские, бельгийские, британские, норвежские и шведские). [CR][CR]Некоторые доступные каналы: NPO Start, Kijk.nl (SBS6, NET5, Veronica, SBS9), RTL XL, NOS, Nickelodeon, AT5, Omroep Flevoland, L1, RTV Drenthe, RTV Oost, RTV Noord, RTV Noord-Holland, RTV Rijnmond, Omroep West, Omroep Gelderland, Omroep Brabant, Omrop Fryslân, WOS, DTV, Omroep Venlo Omroep Horst aan de Maas, Studio 040, RTV Utrecht, Omroep Zeeland, Eén, Vier, VRT.nu, VTM, Stieve, Ketnet, DPlay, SVT, ViaFree, Viasat, UR Play, MTV, NRK, BBC, Dumpert, Fox Sports, Pathé Nederland, Hardware.info and Ons.[CR][CR]Дополнительную информацию можно найти на https://github.com/retrospect-addon/plugin.video.retrospect или в вики Retrospect https://github.com/retrospect-addon/plugin.video.retrospect/wiki/.</description>
<description lang="sv_SE">Retrospect använder olika TV-kanalers (framförallt nederländska, belgiska, brittiska, norska och svenska) officiella webbsidor och fritt tillgängliga strömmar för att göra deras playkanaler tillgängliga i Kodi.[CR][CR]Mer information finns på https://github.com/retrospect-addon/plugin.video.retrospect eller Retrospects wiki på https://github.com/retrospect-addon/plugin.video.retrospect/wiki/.</description>
<disclaimer lang="da_DK">Retrospect udbydes som det er. Vi påtager os intet ansvar for mulige (men højst usandsynlige) skader forårsaget på dit system. Vi tager heller ikke ansvar for det indhold, der kan ses ved hjælp af dette add-on eller eventuelle konsekvenser af at bruge dette add-on til at se indhold via indholdsudbydernes platforme.</disclaimer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
"order": 3,
"value": "default=\"\"",
"id": "password"
},
{
"order": 4,
"value": "type=\"bool\" default=\"true\" label=\"30125\"",
"id": "show_future"
}

]
}
142 changes: 53 additions & 89 deletions plugin.video.retrospect/channels/channel.nos/nos2010/chn_nos2010.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ 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,
preprocessor=self.get_additional_live_items,
requires_logon=True,
parser=[],
creator=self.create_api_live_tv,
Expand Down Expand Up @@ -152,10 +151,16 @@ def __init__(self, channel_info: ChannelInfo):

# OLD but still working?
# live radio, the folders and items
self._add_data_parser("https://start-api.npo.nl/page/live",
name="Live Radio Streams", json=True,
parser=["components", ("panel", "live.regular.1", 0), "epg"],
creator=self.create_live_radio)
self._add_data_parser(
"https://www.npoluister.nl/", name="Live Radio Streams",
parser=Regexer.from_expresso('<li><a[^>]+href="(?<url>https:[^"]+)"[^>]*><img[^>]+src="(?<thumb>https:[^"]+)[^>]+alt="(?<title>[^"]+)"'),
creator=self.create_live_radio
)
self._add_data_parser(
"*", name="Live Radio Streams Updater",
updater=self.update_live_radio,
label="liveRadio"
)

# Alpha listing based on JSON API
# self._add_data_parser("https://start-api.npo.nl/page/catalogue", json=True,
Expand Down Expand Up @@ -359,7 +364,7 @@ def add_item(language_id: int, url: str, content_type: str,
content_type=contenttype.TVSHOWS)

live_radio = add_item(
LanguageHelper.LiveRadio, "https://start-api.npo.nl/page/live",
LanguageHelper.LiveRadio, "https://www.npoluister.nl/",
content_type=contenttype.SONGS, headers=self.__jsonApiKeyHeader)
live_radio.isLive = True

Expand Down Expand Up @@ -398,67 +403,11 @@ def add_item(language_id: int, url: str, content_type: str,
recent.complete = True
recent.dontGroup = True
recent.metaData["retrospect:parser"] = "recent"
recent.cacheToDisc = False
items.append(recent)

return data, items

def get_additional_live_items(self, data: Union[str, JsonHelper]) -> Tuple[Union[str, JsonHelper], List[MediaItem]]:
""" Adds some missing live items to the list of live items.
:param data: The retrieve data that was loaded for the current item and URL.
:return: A tuple of the data and a list of MediaItems that were generated.
"""

Logger.info("Processing Live items")

items = []

# let's add the 3FM live stream
parent = self.parentItem

live_streams = {
"3FM Live": {
"poms": "LI_3FM_300881",
"url": "https://npo.nl/start/live?channel=LI_3FM_300881",
"thumb": self.get_image_location("3fm-artwork.jpg")
},
"Radio 2 Live": {
"poms": "LI_RADIO2_300879",
"url": "https://npo.nl/start/live?channel=LI_RADIO2_300879",
"thumb": self.get_image_location("radio2image.jpg")
# "thumb": "http://www.radio2.nl/image/rm/48254/NPO_RD2_Logo_RGB_1200dpi.jpg?width=848&height=477"
},
"Radio 1 Live": {
"poms": "LI_RADIO1_300877",
"url": "https://npo.nl/start/live?channel=LI_RADIO1_300877",
"thumb": self.get_image_location("radio1image.jpg")
},
"Radio 4 Live": {
"poms": "LI_RA4_698901",
"url": "https://npo.nl/start/live?channel=LI_RA4_698901",
"thumb": self.get_image_location("radio4image.jpg")
},
"FunX": {
"poms": "LI_3FM_603983",
"url": "https://npo.nl/start/live?channel=LI_3FM_603983",
"thumb": self.get_image_location("funx.jpg")
}
}

for name, live_data in live_streams.items():
Logger.debug("Adding video item to '%s' sub item list: %s", parent, name)
item = MediaItem(name, live_data["url"], mediatype.VIDEO)
item.icon = parent.icon
item.metaData["live_pid"] = live_data["poms"]
item.thumb = live_data["thumb"]
item.isLive = True
item.isGeoLocked = True
item.complete = False
items.append(item)
return data, items

def create_profile_item(self, result_set: dict) -> Optional[MediaItem]:
""" Creates a new MediaItem for a the profiles in NPO Start.
Expand Down Expand Up @@ -557,7 +506,7 @@ def create_api_program_item(self, result_set: dict) -> Optional[MediaItem]:
guid = result_set["guid"]

# timebound_daily, timeless_series
if item_type.endswith("series"):
if item_type and item_type.endswith("series"):
# Series go by season
url = f"https://npo.nl/start/api/domain/series-seasons?slug={slug}&type={item_type}"
else:
Expand Down Expand Up @@ -633,7 +582,7 @@ def create_api_episode_item(self, result_set: dict, show_info: bool = False) ->
MediaItem]:
title = result_set["title"]
poms = result_set["productId"]
serie_info = result_set.get("series", {})
serie_info = result_set.get("series") or {}

if show_info and result_set["series"]:
show_title = result_set["series"]["title"]
Expand All @@ -646,7 +595,7 @@ def create_api_episode_item(self, result_set: dict, show_info: bool = False) ->
image_data = result_set["images"][0]
item.set_artwork(thumb=image_data["url"])

item.description = result_set.get("synopsis", {}).get("long")
item.description = (result_set.get("synopsis") or {}).get("long")
item.set_info_label(MediaItem.LabelDuration, result_set.get("durationInSeconds", 0))

# 'firstBroadcastDate'
Expand Down Expand Up @@ -684,7 +633,7 @@ def create_api_episode_item(self, result_set: dict, show_info: bool = False) ->
item.isPaid = True

episode_number = result_set.get("programKey")
season_number = result_set.get("season", {}).get("seasonKey")
season_number = (result_set.get("season") or {}).get("seasonKey")
show_type = serie_info.get("type")
if episode_number and season_number and show_type.endswith("series"):
item.set_season_info(season_number, episode_number)
Expand Down Expand Up @@ -731,6 +680,7 @@ def create_api_epg_tree(self, data: Union[str, JsonHelper]) -> Tuple[Union[str,
data = JsonHelper(data)
# Keep a list of the days.
day_lookup: Dict[str, MediaItem] = {}
show_future = self._get_setting("show_future", "true") == "true"

for channel in data.get_value():
guid = channel["guid"]
Expand Down Expand Up @@ -779,6 +729,10 @@ def create_api_epg_tree(self, data: Union[str, JsonHelper]) -> Tuple[Union[str,
date_stamp = DateHelper.get_date_from_posix(program["programStart"], tz=pytz.UTC)
date_stamp = date_stamp.astimezone(tz=self.__timezone)
date_label = date_stamp.strftime("%d-%m-%Y")

if not show_future and date_stamp > datetime.datetime.now(tz=pytz.UTC):
continue

if date_label in day_lookup:
day_item = day_lookup[date_label]
day_item.items.append(item)
Expand Down Expand Up @@ -1134,25 +1088,42 @@ def create_live_radio(self, result_set: dict) -> Optional[MediaItem]:
"""

Logger.trace("Content = %s", result_set)
result_set = result_set["channel"]

name = result_set["name"]
if name == "demo":
# url = f"{result_set['url']}/live"
url = result_set["url"].rstrip("/")
if "blend" in url:
return None

url = "%s/live/%s" % (self.baseUrlLive, result_set["slug"])
item = MediaItem(name, url, media_type=mediatype.VIDEO)
title = result_set["title"]
logo = result_set["thumb"]
item = MediaItem(title, url, media_type=mediatype.VIDEO)
item.isLive = True
item.complete = False
item.thumb = logo
item.isLive = True
item.metaData["retrospect:parser"] = "liveRadio"
return item

data = result_set.get("liveStream")
# see if there is a video stream.
if data:
video = data.get("visualRadioAsset")
if video:
item.metaData["live_pid"] = video

return item

def update_live_radio(self, item: MediaItem) -> MediaItem:
# First fetch the Javascript data file
www_data = UriHandler.open(item.url)
js_data_url = Regexer.do_regex(r'(_next/static/chunks/pages/_app[^"]+.js)', www_data)[0]
js_data = UriHandler.open(f"{item.url}/{js_data_url}")

# Then fetch the slug
# slug = Regexer.do_regex(r'slug\W*:\W*"([^"]+)"', js_data)[0]
slug = Regexer.do_regex(r'var\W*r\W*=\W*"(npo[^"]+)"', js_data)[0]

# Get the channel info and media info.
channel_json = JsonHelper(UriHandler.open(f"{item.url}/api/miniplayer/info?channel={slug}"))
media_info = channel_json.get_value("data", "coreChannels", "data", 0, "liveVideo")
if not media_info:
media_info = channel_json.get_value("data", "coreChannels", "data", 0, "liveAudio")
token_url = media_info["tokenUrl"]
token_json = JsonHelper(UriHandler.open(token_url))

mid = token_json.get_value("mid")
return self.__update_video_item(item, mid, fetch_subtitles=False)

def update_video_item(self, item: MediaItem) -> MediaItem:
""" Updates an existing MediaItem with more data.
Expand Down Expand Up @@ -1373,17 +1344,10 @@ def __update_video_item(self, item: MediaItem, episode_id: str, fetch_subtitles:

# get the subtitle
if fetch_subtitles:
sub_title_url = "https://assetscdn.npostart.nl/subtitles/original/nl/%s.vtt" % (
episode_id,)
sub_title_url = f"https://cdn.npoplayer.nl/subtitles/nl/{episode_id}.vtt"
sub_title_path = subtitlehelper.SubtitleHelper.download_subtitle(
sub_title_url, episode_id + ".nl.srt", format='srt')

if not sub_title_path:
sub_title_url = "https://rs.poms.omroep.nl/v1/api/subtitles/%s/nl_NL/CAPTION.vtt" % (
episode_id,)
sub_title_path = subtitlehelper.SubtitleHelper.download_subtitle(
sub_title_url, episode_id + ".nl.srt", format='srt')

if sub_title_path:
item.subtitle = sub_title_path

Expand Down
Loading

0 comments on commit 97fd9a6

Please sign in to comment.