Skip to content

Commit

Permalink
Änderungen / Korrekturen siehe changelog.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
rols1 committed Jul 22, 2024
1 parent b19214e commit 89a698f
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 134 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.ardundzdf" name="ARDundZDF" version="5.0.6+matrix" provider-name="rols1 (rols1@gmx.de)">
<addon id="plugin.video.ardundzdf" name="ARDundZDF" version="5.0.7+matrix" provider-name="rols1 (rols1@gmx.de)">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.kodi-six" />
Expand Down
73 changes: 55 additions & 18 deletions ardundzdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@

# VERSION -> addon.xml aktualisieren
# <nr>210</nr> # Numerierung für Einzelupdate
VERSION = '5.0.6'
VDATE = '19.07.2024'
VERSION = '5.0.7'
VDATE = '22.07.2024'


# (c) 2019 by Roland Scholz, rols1@gmx.de
Expand Down Expand Up @@ -1085,10 +1085,10 @@ def Main_ZDF(name=''):
thumb=R("suche_mv.png"), tagline=tag, summary=summ, fparams=fparams)

title="Suche in ZDF-Mediathek"
fparams="&fparams={'query': '', 'title': '%s'}" % title
addDir(li=li, label=title, action="dirList", dirID="ZDF_Search", fanart=R(ICON_ZDF_SEARCH),
thumb=R(ICON_ZDF_SEARCH), fparams=fparams)

fparams="&fparams={'title': '%s', 'homeID': 'ZDF'}" % quote(title)
addDir(li=li, label=title, action="dirList", dirID="resources.lib.ARDnew.SearchARDundZDFnew",
fanart=R(ICON_ZDF_SEARCH), thumb=R(ICON_ZDF_SEARCH), fparams=fparams)
title = 'Startseite'
fparams="&fparams={'ID': '%s'}" % title
addDir(li=li, label=title, action="dirList", dirID="ZDF_Start", fanart=R(ICON_MAIN_ZDF), thumb=R(ICON_MAIN_ZDF),
Expand Down Expand Up @@ -8181,7 +8181,7 @@ def ZDF_PageMenu(DictID, jsonObject="", urlkey="", mark="", li="", homeID="", u
li_org=li

if not jsonObject and DictID:
jsonObject = Dict("load", DictID, CacheTime=ZDF_CacheTime_AZ) # 30 min
jsonObject = Dict("load", DictID, CacheTime=ZDF_CacheTime_AZ) # 30 min
if not jsonObject: # aus Url wiederherstellen (z.B. für Merkliste)
if url: # url ohne key (Seiten ZDF_Start)
PLog("get_from_url:")
Expand Down Expand Up @@ -9532,16 +9532,44 @@ def ZDF_FlatListEpisodes(sid):
# Mitnutzung get_form_streams sowie build_Streamlists_buttons
# gui=False: ohne Gui, z.B. für ZDF_getStrmList
# 16.05.2024 Auswertung Bitraten entfernt (unsicher)
# 21.07.2024 zdf-cdn-api bei vielen Url's nicht mehr akzeptiert,
# Alternative profile_url mit api.zdf.de hinzugefügt.
#
def ZDF_getApiStreams(path, title, thumb, tag, summ, scms_id="", gui=True):
PLog("ZDF_getApiStreams: " + scms_id)


cdn_api=True
page, msg = get_page(path)
if page == '':
msg1 = "Fehler in ZDF_getStreamSources:"
msg2 = msg
MyDialog(msg1, msg2, '')
return
if "Error 503" in msg: # cdn-api nicht akzeptiert? -> api.zdf.de
try:
profile_url="https://api.zdf.de/content/documents/%s.json?profile=player" % scms_id
PLog("profile_url: " + profile_url)
# Aktualisierung apiToken via window.zdfsite www.zdf.de (apiToken:)
apiToken = "5bb200097db507149612d7d983131d06c79706d5" # 21.07.2024
header = "{'Api-Auth': 'Bearer %s','Host': 'api.zdf.de'}" % apiToken
page, msg = get_page(path=profile_url, header=header, JsonPage=True)
pos = page.rfind('mainVideoContent') # 'mainVideoContent' am Ende suchen
page_part = page[pos:]
PLog("page_part: " + page_part[:40])
ptmd_player = 'ngplayer_2_4' # ab 22.12.2020
videodat_url = stringextract('ptmd-template":"', '"', page_part)
videodat_url = videodat_url.replace('{playerId}', ptmd_player) # ptmd_player injiziert
videodat_url = 'https://api.zdf.de' + videodat_url
videodat_url = videodat_url.replace('\\/','/')
PLog('videodat_url: ' + videodat_url)
page, msg = get_page(path=videodat_url, header=header, JsonPage=True)
page=page.replace('" :', '":'); page=page.replace('": "', '":"') # Formatanpassung für get_form_streams
PLog("videodat_page: " + page[:80])
cdn_api=False
except Exception as exception:
PLog("profile_url_error: " + str(exception))
page=""
if page == "":
MyDialog(msg1, msg2, '')
return
page = page.replace('\\/','/')

li = xbmcgui.ListItem()
Expand All @@ -9560,16 +9588,23 @@ def ZDF_getApiStreams(path, title, thumb, tag, summ, scms_id="", gui=True):

# Format formitaeten von Webversion abweichend, build_Streamlists
# nicht verwendbar
PLog("cdn_api: " + str(cdn_api))
formitaeten, duration, geoblock, sub_path = get_form_streams(page)
forms=[]
if len(formitaeten) > 0: # Videoquellen fehlen?
forms = stringextract('formitaeten":', ']', formitaeten[0])
forms = blockextract('"type":', forms)
PLog("formitaeten_0: " + str(formitaeten[0])[:100])
if cdn_api:
formsblock = stringextract('formitaeten":', ']', formitaeten[0])
forms = blockextract('"type":', formsblock)
else:
forms = blockextract('"type":', str(formitaeten))

PLog("forms: %d" % len(forms))

Plot = "%s||||%s" % (tag, summ)
line=''; skip_list=[]
for form in forms:
#PLog("form: " + form)
track_add=''; class_add=''; lang_add='' # class-und Sprach-Zusätze
typ = stringextract('"type":"', '"', form)
class_add = stringextract('"class":"', '"', form)
Expand All @@ -9582,15 +9617,18 @@ def ZDF_getApiStreams(path, title, thumb, tag, summ, scms_id="", gui=True):
track_add = "%23s" % track_add # formatiert

url = stringextract('"url":"', '"', form) # Stream-URL
PLog("url: " + url)
if url == "":
url = stringextract('"uri":"', '"', form) # api.zdf.de
PLog("url: " + url); PLog("typ: " + typ);
server = stringextract('//', '/', url) # 2 Server pro Bitrate möglich
if typ not in only_list or url in skip_list:
if typ not in only_list or url in skip_list or url == "":
continue

skip_list.append(url)

quality = stringextract('"quality":"', '"', form)
mimeType = stringextract('mimeType":"', '"', form)
PLog("quality: " + quality); PLog("mimeType: " + mimeType);

# bei HLS entfällt Parseplaylist - verschiedene HLS-Streams verfügbar
if url.find('master.m3u8') > 0: # HLS-Stream
Expand All @@ -9612,7 +9650,7 @@ def ZDF_getApiStreams(path, title, thumb, tag, summ, scms_id="", gui=True):
title_url = u"%s#%s" % (title, url)
item = u"MP4, %s | %s ** Auflösung %s ** %s" %\
(track_add, quality, res, title_url)
PLog("item: " + item)
PLog("title_url: " + title_url); PLog("item: " + item)
PLog("server: " + server) # nur hier, kein Platz im Titel
MP4_List.append(item)

Expand Down Expand Up @@ -10493,7 +10531,6 @@ def get_form_streams(page):
duration = max(1, duration) # 1 zeigen bei Werten < 1
duration = str(duration) + " min"
PLog('duration: ' + duration)
PLog('page_formitaeten: ' + page[:100])
formitaeten = blockextract('formitaeten', page) # Video-URL's ermitteln
PLog('formitaeten: ' + str(len(formitaeten)))
# PLog(formitaeten[0]) # bei Bedarf
Expand All @@ -10508,8 +10545,7 @@ def get_form_streams(page):
geoblock = ' | Geoblock DE!'
if geoblock == 'dach': # Info-Anhang für summary
geoblock = ' | Geoblock DACH!'



return formitaeten, duration, geoblock, sub_path

#-------------------------
Expand Down Expand Up @@ -11196,6 +11232,7 @@ def router(paramstring):
Main()

#----------------------------------------------------------------

PLog('Addon_URL: ' + PLUGIN_URL) # sys.argv[0], plugin://plugin.video.ardundzdf/
PLog('ADDON_ID: ' + ADDON_ID); PLog(SETTINGS); PLog(ADDON_NAME);PLog(SETTINGS_LOC);
PLog(ADDON_PATH);PLog(ADDON_VERSION);
Expand Down
20 changes: 20 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@ CHANGE HISTORY
max_col 97
--------------

22.07.2024 5.0.7
EPG_Sender, EPG_ShowAll: spez. Sender ohne Link in livesenderTV.xml aus den
Sender-Listen entfernt, z.B. liga3.
get_page (util): http-Header bei Stufe page2 hinzugefügt - ssl-Error bei
Windows10 und ARD-Links möglich (wie in url_check V5.0.5)
update_single (EPG): Doppelzählung Module im Githubrepo unterbunden.
ARDSportLiga3: raw-String statt unicode in re.search (my_day = re.search..),
übersehen in Anpassungen für V.5.0.4.
ARDSportWDR: Event-Button OLYMPIA 2024 ergänzt (Funktionsziel zunächst
ARDSportMedia statt ARDSportCluster wg. fehlender Cluster), Anpassung in
ARDSportMedia.
get_foruminfo (tools): Anpassung an geänderten Text im Startpost.
SearchARDundZDFnew: Anpassung für Einzelsuchen (ARD oder ZDF) zur Vermeidung
Addon-Crashes bei Videoabbruch i.V.m. Sofortstart.
ZDF_getApiStreams: zdf-cdn-api bei vielen Url's nicht mehr akzeptiert,
Alternative profile_url mit api.zdf.de hinzugefügt einschl. neuer Funktion
get_form_streams_oldapi.

07.07.2024 5.0.6
Haupt-PRG: Prüfung Existenz Cache-Datei ard_streamlinks ergänzt (führte
bei Fehlen zum Startabbruch des Addons).
Expand All @@ -23,6 +41,8 @@ CHANGE HISTORY
Navigationsmenü im Web).
TV-Livestreams: Deutsche Welle (EN) umgestellt (iptv -> livesenderTV.xml,
iptv-Quelle funktioniert nicht mehr).
get_json_content (ARDnew): Logausgabe für page als string (slice-Error bei
Kodi Omega).

23.06.2024 5.0.5
ARDSportMediaPlayer (ARD Sportschau WDR: Anpassung an veränderter Position
Expand Down
Binary file added resources/images/tv-EPG-suche.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 89a698f

Please sign in to comment.