Skip to content

Commit

Permalink
Einzelupdate ardundzdf.py, util.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rols1 committed May 13, 2023
1 parent e0c47b6 commit ae84753
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
31 changes: 20 additions & 11 deletions ardundzdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# +++++ ARDundZDF - Addon Kodi-Version, migriert von der Plexmediaserver-Version +++++

# VERSION -> addon.xml aktualisieren
# <nr>102</nr> # Numerierung für Einzelupdate
# <nr>103</nr> # Numerierung für Einzelupdate
VERSION = '4.7.1'
VDATE = '13.05.2023'

Expand Down Expand Up @@ -6844,16 +6844,17 @@ def ZDF_PageMenu(DictID, jsonObject="", urlkey="", mark="", li="", homeID=""):
PLog(mark); PLog(homeID); PLog(urlkey)
li_org=li

if not jsonObject:
if not jsonObject:
jsonObject = Dict("load", DictID)
if not jsonObject: # aus Url wiederherstellen (z.B. für Merkliste)
if urlkey:
PLog("get_from_urlkey:")
url, obj_id, obj_nr = urlkey.split("#")
PLog("obj_id: %s, obj_nr: %s" % (obj_id, obj_nr))
page, msg = get_page(path=url)
try:
jsonObject = json.loads(page)
clusterObject = jsonObject[obj_id][int(obj_nr)]
jsonObject = jsonObject[obj_id][int(obj_nr)]
except Exception as exception:
PLog(str(exception))
jsonObject=""
Expand Down Expand Up @@ -6905,15 +6906,21 @@ def ZDF_PageMenu(DictID, jsonObject="", urlkey="", mark="", li="", homeID=""):
PLog(stage); PLog(typ); PLog(title);
title = repl_json_chars(title)
descr = repl_json_chars(descr)
if(entry["type"]=="video"): # Videos
PLog("stream: " + stream)
if entry["type"]=="video": # Videos
if "channel" in entry: # Zusatz Sender
sender = entry["channel"]
tag = "%s | %s" % (tag, sender)
fparams="&fparams={'path': '%s','title': '%s','thumb': '%s','tag': '%s','summ': '%s','scms_id': '%s'}" %\
(stream, title, img, tag, descr, scms_id)
(stream, title, img, tag, descr, scms_id)
PLog("fparams: " + fparams)
addDir(li=li, label=label, action="dirList", dirID="ZDF_getApiStreams", fanart=img, thumb=img,
fparams=fparams, tagline=tag, summary=descr, mediatype=mediatype)
elif entry["type"]=="livevideo":
fparams="&fparams={'url': '%s', 'title': '%s'}" % (url, title)
PLog("fparams: " + fparams)
addDir(li=li, label=title, action="dirList", dirID="ZDF_Live", fanart=img,
thumb=img, fparams=fparams, summary=descr, tagline=tag, mediatype=mediatype)

else:
fparams="&fparams={'url': '%s', 'title': '%s', 'homeID': '%s'}" % (url, title, homeID)
PLog("fparams: " + fparams)
Expand Down Expand Up @@ -6945,16 +6952,16 @@ def ZDF_PageMenu(DictID, jsonObject="", urlkey="", mark="", li="", homeID=""):
'Mein Programm', 'Deine', 'KiKA live sehen', 'Weiterschauen'
]
skip=False
if title == '':
PLog('ohne_Titel: %s' % str(clusterObject)[:80]) # ?
skip = True
for t in skip_list:
# PLog("t: %s, title: %s" % (t, title))
if title.startswith(t) or title.endswith(t):
PLog("skip: %s" % title)
skip = True
if skip:
continue
if title == '':
PLog('ohne_Titel: %s' % str(clusterObject)[:80]) # ?
continue

title = repl_json_chars(title)
descr = repl_json_chars(descr)
Expand Down Expand Up @@ -7116,8 +7123,10 @@ def ZDF_RubrikSingle(url, title, homeID=""):
if typ == "videoCarousel":
title = "[B]Highlights[/B]: %s" % title
try:
img = ZDF_get_img(jsonObject["teaser"][0])
except:
img = ZDF_get_img(jsonObject["teaser"][0]) # kann fehlen oder leer sein
except Exception as exception:
PLog("json_error: " + str(exception))
cnt=cnt+1
continue # leerer Vorspann: sendungen-mit-audiodeskription-hoerfilme-100
tag = "Folgeseiten"
descr = ""
Expand Down
11 changes: 7 additions & 4 deletions resources/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
# 02.11.2019 Migration Python3 Modul future
# 17.11.2019 Migration Python3 Modul kodi_six + manuelle Anpassungen
#
# <nr>50</nr> # Numerierung für Einzelupdate
# Stand: 11.05.2023
# <nr>51</nr> # Numerierung für Einzelupdate
# Stand: 13.05.2023

# Python3-Kompatibilität:
from __future__ import absolute_import
Expand Down Expand Up @@ -1281,8 +1281,10 @@ def getHeaders(response):
# 23.04.2023 Rückgabe mit error-Text
def GetJsonByPath(path, jsonObject):
PLog('GetJsonByPath: '+ path)
if path == '':
return jsonObject, ""
PLog(type(jsonObject))
if not path or not jsonObject:
msg = "GetJsonByPath: param_error"
return "", msg

path = path.split('|')
i = 0; msg=""
Expand Down Expand Up @@ -2405,6 +2407,7 @@ def get_summary_pre(path,ID='ZDF',skip_verf=False,skip_pubDate=False,page='',pat

if ID == 'ARDnew':
page = page.replace('\\"', '*') # Quotierung vor " entfernen, Bsp. \"query\"
page = page.replace('\\r\\n', '') # CR+LF entf.
pubServ = stringextract('"name":"', '"', page) # publicationService (Sender)
maturitytRating = stringextract('maturityContentRating":"', '"', page) # "FSK16"
maturitytRating = maturitytRating.replace('NONE', 'Ohne')
Expand Down

0 comments on commit ae84753

Please sign in to comment.