From 8c3fc7d83b31545a337c56c5f39f223919a79f05 Mon Sep 17 00:00:00 2001 From: "Mr.Servo" Date: Sun, 22 Sep 2024 19:47:03 +0200 Subject: [PATCH 1/2] [TVSpielfilm] 7.0 some parsing adjustments - fixed 'Tipp des Tages' - fixed 'Detailansicht' --- TVSpielfilm/src/parser.py | 11 ++++---- TVSpielfilm/src/plugin.py | 58 +++++++++++++++++---------------------- 2 files changed, 31 insertions(+), 38 deletions(-) diff --git a/TVSpielfilm/src/parser.py b/TVSpielfilm/src/parser.py index ec92e90cb..876c79d4e 100644 --- a/TVSpielfilm/src/parser.py +++ b/TVSpielfilm/src/parser.py @@ -54,7 +54,7 @@ def transCHANNEL(data): r"sky .*?action.*?": "sky-a", r"sky .*?atlantic.*?": "skyat", r"sky .*?fun.*?": "sky-c", - r"sky .*?highlights.*?": "skych", + r"sky .*?special.*?": "skycs", r"sky .*?family.*?": "sky-f", r"sky .*?007.*?": "sky-h", r"sky .*?best of.*?": "sky-h", @@ -66,7 +66,8 @@ def transCHANNEL(data): r"sky .*?classics.*?": "sky-n", r"sky .*?select.*?": "sky-s", r"sky .*?replay.*?": "skyrp", - r"sky .*?premiere.*?": "cin", + r"sky .*?premieren.*?24.*?": "cin24", + r"sky .*?premieren.*?": "cin", r"sky .*?thriller.*?": "skyth", r"sky .*?special.*?": "skycs", r"sky .*?showcase.*?": "skysh", @@ -298,10 +299,10 @@ def searchTwoValues(regex, text, fallback1, fallback2, flags=None): def parsedetail(bereich, debug=None): - quelle = search(r'(.*?)

', bereich) + quelle = search(r'content-rating__rating-genre__title">(.*?)', bereich) quelle = quelle.group(1) if quelle else "" - bewertung = search(r'
\s*

(.*?)

\s*
', bereich, flags=S) - bewertung = bewertung.group(1) if bewertung else "" + bewertung = search(r'content-rating__rating-genre__conclusion-quote">\s*

(.*?)

', bereich, flags=S) + bewertung = bewertung.group(1) if bewertung else "{keine Bewertung gefunden}" # entferne alle Tags bereich = sub(r'(.*?)

', '', bereich) bereich = sub(r'
\s*

(.*?)

\s*
', '', bereich, flags=S) diff --git a/TVSpielfilm/src/plugin.py b/TVSpielfilm/src/plugin.py index 85e3bcd8a..c303a71d6 100644 --- a/TVSpielfilm/src/plugin.py +++ b/TVSpielfilm/src/plugin.py @@ -22,7 +22,8 @@ from xml.sax.saxutils import unescape # ENIGMA IMPORTS -from enigma import BT_HALIGN_CENTER, BT_KEEP_ASPECT_RATIO, BT_SCALE, BT_VALIGN_CENTER, RT_HALIGN_CENTER, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_VALIGN_CENTER, RT_VALIGN_BOTTOM, RT_WRAP, eConsoleAppContainer, eEPGCache, eServiceCenter, eServiceReference, eTimer, loadJPG, loadPNG, addFont +from enigma import BT_HALIGN_CENTER, BT_KEEP_ASPECT_RATIO, BT_SCALE, BT_VALIGN_CENTER, RT_HALIGN_CENTER, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_VALIGN_CENTER, RT_VALIGN_BOTTOM, RT_WRAP +from enigma import iPlayableService, eConsoleAppContainer, eEPGCache, eServiceCenter, eServiceReference, eTimer, loadJPG, loadPNG, addFont from Components.ActionMap import ActionMap, NumberActionMap from Components.config import config, ConfigDirectory, ConfigInteger, ConfigPassword, ConfigSelection, ConfigSubsection, ConfigText, ConfigYesNo, ConfigSelectionNumber, configfile, getConfigListEntry from Components.ConfigList import ConfigListScreen @@ -31,6 +32,7 @@ from Components.MultiContent import MultiContentEntryPixmapAlphaTest, MultiContentEntryProgress, MultiContentEntryText from Components.Pixmap import Pixmap from Components.ScrollLabel import ScrollLabel +from Components.ServiceEventTracker import ServiceEventTracker from Plugins.Plugin import PluginDescriptor from RecordTimer import RecordTimerEntry from Screens.ChannelSelection import ChannelSelection @@ -446,12 +448,12 @@ def showInfotext(self, infotexts): self['infotext%s' % i].hide() def showRatinginfos(self, output): - startpos = output.find('
') - endpos = output.find('
') + startpos = output.find('
') + endpos = output.find('
') bereich = output[startpos:endpos] bereich = cleanHTML(bereich) - ratinglabels = findall(r'(.*?)', bereich) # Humor, Anspruch, Action, Spannung, Erotik - ratingdots = findall(r'', bereich) + ratinglabels = findall(r'content-rating__rating-genre__list-item__label">(.*?)', bereich) # Humor, Anspruch, Action, Spannung, Erotik + ratingdots = findall(r'content-rating__rating-genre__list-item__rating rating-(.*?)">', bereich) for i, ri in enumerate(ratinglabels): if len(ratingdots) <= i: ratingdots.append('0') @@ -464,25 +466,17 @@ def showRatinginfos(self, output): self['ratingdot%s' % i].show() except IndexError: pass - starslabel = findall(r'(.*?)', bereich) # Community - starsrating = findall(r'', bereich) - if len(starsrating): - starsfile = join(ICONPATH, 'starbar%s.png' % starsrating[0]) - if exists(starsfile): - try: - self['starslabel'].setText(starslabel[0]) - self['starslabel'].show() - self['starsrating'].instance.setPixmapFromFile(starsfile) - self['starsrating'].show() - except IndexError: - pass + communities = findall(r'content-rating__imdb-rating__label">(.*?)', bereich) # Name der Community + commratings = findall(r'rating__rating-value">(.*?)
(.*?)
', bereich) # Community-Bewertung + if communities and commratings: + self['commrating'].setText(f"{communities[0]}{"".join(commratings[0])}") + self['commrating'].show() def hideRatingInfos(self): for i in range(5): self['ratinglabel%s' % i].hide() self['ratingdot%s' % i].hide() - self['starslabel'].hide() - self['starsrating'].hide() + self['commrating'].hide() def getShortdesc(self, output): startpos = output.find('
') @@ -946,8 +940,7 @@ def _commonInit(self, ltxt='Suche', lltxt='Zappen'): for i in range(5): self['ratinglabel%s' % i] = Label() self['ratingdot%s' % i] = Pixmap() - self['starslabel'] = Label() - self['starsrating'] = Pixmap() + self['commrating'] = Label() self['searchmenu'] = ItemList([]) self['editorial'] = Label() self['ranking'] = Label() @@ -2401,8 +2394,6 @@ def __init__(self, session, link, eventview, tagestipp): self.movie_eof = config.usage.on_movie_eof.value config.usage.on_movie_stop.value = 'quit' config.usage.on_movie_eof.value = 'quit' - from Components.ServiceEventTracker import ServiceEventTracker - from enigma import iPlayableService self.event_tracker = ServiceEventTracker(screen=self, eventmap={iPlayableService.evUpdatedEventInfo: self.zapRefresh}) self.channel_db = channelDB(SERVICEFILE) elif not self.tagestipp: @@ -3695,7 +3686,7 @@ def ok(self): try: from yt_dlp import YoutubeDL except Exception: - self.session.open(MessageBox, 'Plugin "yt_dlp" nicht gefunden!\n\nBitte im Forum nachfragen wie genau und dann installieren!', MessageBox.TYPE_ERROR, timeout=10, close_on_any_key=True) + self.session.open(MessageBox, 'Plugin "yt_dlp" nicht gefunden!\n\nBitte über den Feed installieren, notfalls im Forum nachfragen!', MessageBox.TYPE_ERROR, timeout=10, close_on_any_key=True) return c = self['list'].getSelectedIndex() trailer_id = self.trailer_id[c] @@ -4649,7 +4640,6 @@ def makePageMenu(self): sender = [sub.replace('&', '&') for sub in sender] # für Analysezwecke, z.B. wenn Picon fehlen oder überflüsssig sind if config.plugins.tvspielfilm.debuglog.value and config.plugins.tvspielfilm.logtofile.value: - from glob import glob fullnames = findall(r"