Skip to content

Commit

Permalink
[LCD4linux] v5.0-r22 bugfix: shows picon during IPTV
Browse files Browse the repository at this point in the history
- bugfix: zeigt Picons während dem IPTV-streamen und Cover während dem MP3-streamen (z.B. Internetradio)
  • Loading branch information
MrServo authored and Hains committed Aug 11, 2024
1 parent b8d7bcd commit 267b0a9
Showing 1 changed file with 38 additions and 34 deletions.
72 changes: 38 additions & 34 deletions lcd4linux/src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
if find_library("usb-0.1") is not None or find_library("usb-1.0") is not None:
print("[LCD4linux] libusb found :-)", getEnigmaVersionString())
USBok = True
Version = "V5.0-r21"
Version = "V5.0-r22"
L4LElist = L4Lelement()
L4LdoThread = True
LCD4enigma2config = resolveFilename(SCOPE_CONFIG) # /etc/enigma2/
Expand Down Expand Up @@ -2982,15 +2982,14 @@ def getpiconres(x, y, full, picon, channelname, channelname2, P2, P2A, P2C):
if not PY3:
name2 = "%s.png" % channelname.decode("utf-8").encode("latin-1", "ignore")
name4 = "%s.png" % channelname.decode("utf-8").encode("utf-8", "ignore")
else:
name2 = "%s.png" % channelname
name4 = "%s.png" % channelname
name = normalize('NFKD', channelname)
name = sub(r'[^a-z0-9]', '', "%s.png" % str(name).replace('&', 'and').replace('+', 'plus').replace('*', 'star').lower())
if not PY3:
name3 = "%s.png" % channelname2.replace('\xc2\x87', '').replace('\xc2\x86', '').decode("utf-8").encode("utf-8")
name = normalize('NFKD', unicode(str("" + channelname), 'utf-8', errors='ignore')).encode('ASCII', 'ignore')
else:
name2 = "%s.png" % channelname.encode("latin-1", "ignore").decode("utf-8")
name4 = "%s.png" % channelname.encode("utf-8", "ignore").decode("utf-8")
name3 = "%s.png" % channelname2.replace('\x87', '').replace('\x86', '')
name = normalize('NFKD', str("" + channelname))
name = "%s.png" % sub(r'[^a-z0-9]', '', str(name).replace('&', 'and').replace('+', 'plus').replace('*', 'star').lower())
PIC.append(join(P2, name3))
PIC.append(join(P2, name2))
PIC.append(join(P2, name))
Expand Down Expand Up @@ -9737,22 +9736,30 @@ def downloadWetter(self, ort, wetter):
callInThread(getPage, self.feedurl, boundFunction(self.downloadOMcallback, wetter), self.downloadListError)

elif LCD4linux.WetterApi.value == "OPENWEATHER":
apkey = "&appid=%s" % LCD4linux.WetterApiKeyOpenWeatherMap.value if len(LCD4linux.WetterApiKeyOpenWeatherMap.value) > 5 else ""
city = "id=%s" % quote(ort[3:]) if ort.startswith("wc:") else "q=%s" % quote(ort)
self.feedurl = "http://api.openweathermap.org/data/2.5/weather?%s&lang=%s&units=metric%s" % (city, la[:2], apkey)
L4logE("OWM-getcurrentweather%s: %s" % (wetter, self.feedurl))
callInThread(getPage, self.feedurl, boundFunction(self.downloadOWMcallback, wetter), self.downloadListError)
self.feedurl = "https://api.openweathermap.org/data/2.5/onecall?&lon=%s&lat=%s&units=metric&exclude=hourly,minutely,current&lang=%s%s" % (self.Long[wetter], self.Lat[wetter], la[:2], apkey)
L4logE("OWM-getforecastweather%s: %s" % (wetter, self.feedurl))
callInThread(getPage, self.feedurl, boundFunction(self.downloadOWMcallback, wetter), self.downloadListError)
if float(self.Long[wetter]) == 0 and float(self.Lat[wetter]) == 0:
self.feedurl = "https://geocoding-api.open-meteo.com/v1/search?language=%s&count=10&name=%s" % (la[:2], city)
L4logE("OWM-citysearch%s: %s" % (wetter, self.feedurl))
callInThread(getPage, self.feedurl, boundFunction(self.getCityCoords, wetter), self.downloadListError)
else:
apkey = LCD4linux.WetterApiKeyOpenWeatherMap.value if len(LCD4linux.WetterApiKeyOpenWeatherMap.value) > 5 else ""
self.feedurl = "https://api.openweathermap.org/data/3.0/onecall?&lon=%s&lat=%s&units=metric&exclude=hourly,minutely,current&lang=%s&appid=%s" % (self.Long[wetter], self.Lat[wetter], la[:2], apkey)
L4logE("OWM-getOneCallWeather%s: %s" % (wetter, self.feedurl))
callInThread(getPage, self.feedurl, boundFunction(self.downloadOWMcallback, wetter), self.downloadListError)

elif LCD4linux.WetterApi.value == "WEATHERUNLOCKED":
apkey = "?app_id=%s&app_key=%s" % (LCD4linux.WetterApiKeyWeatherUnlocked.value.split()[0], LCD4linux.WetterApiKeyWeatherUnlocked.value.split()[1]) if len(LCD4linux.WetterApiKeyWeatherUnlocked.value.split()) == 2 else ""
lang = "&lang=%s" % ort.split(".")[0] if "." in ort else ""
self.feedurl = "http://api.weatherunlocked.com/api/current/%s%s%s" % (city, apkey, lang)
city = LCD4linux.WetterCity.value if wetter == 0 else LCD4linux.Wetter2City.value
if "." in city: # e.g. 'de.ZIPccode'
self.feedurl = "http://api.weatherunlocked.com/api/current/%s%s%s" % (city, apkey, lang)
else:
self.feedurl = "http://api.weatherunlocked.com/api/current/%s,%s%s%s" % (self.Long[wetter], self.Lat[wetter], apkey, lang)
L4logE("WU-getcurrentweather%s: %s" % (wetter, self.feedurl))
callInThread(getPage, self.feedurl, boundFunction(self.downloadWUcallback, wetter), self.downloadListError)
self.feedurl = "http://api.weatherunlocked.com/api/forecast/%s%s%s" % (city, apkey, lang)
if "." in city: # e.g. 'de.ZIPcode'
self.feedurl = "http://api.weatherunlocked.com/api/forecast/%s%s%s" % (city, apkey, lang)
else:
self.feedurl = "http://api.weatherunlocked.com/api/forecast/%s,%s%s%s" % (self.Long[wetter], self.Lat[wetter], apkey, lang)
L4logE("WU-getforecastweather%s: %s" % (wetter, self.feedurl))
callInThread(getPage, self.feedurl, boundFunction(self.downloadWUcallback, wetter), self.downloadListError)
L4log("Wetter%s: downloadstart %s:%s %s %s" % (wetter, LCD4linux.WetterApi.value, ort, language.getLanguage(), la))
Expand Down Expand Up @@ -10823,16 +10830,17 @@ def getShowCover(BildFile):
P2A = LCD4linux.PiconPathAlt.value
PIC = []
PIC.append(join(P2, picon))
name = normalize('NFKD', self.Lchannel_name)
name = sub(r'[^a-z0-9]', '', "%s.png" % str(name).replace('&', 'and').replace('+', 'plus').replace('*', 'star').lower())
if not PY3:
name2 = "%s.png" % self.Lchannel_name.decode("utf-8").encode("latin-1", "ignore")
name4 = "%s.png" % self.Lchannel_name.decode("utf-8").encode("utf-8", "ignore")
name3 = "%s.png" % self.Lchannel_name2.replace('\xc2\x87', '').replace('\xc2\x86', '').decode("utf-8").encode("utf-8")
name = normalize('NFKD', unicode(str("" + self.Lchannel_name), 'utf-8', errors='ignore')).encode('ASCII', 'ignore')
else:
name2 = "%s.png" % self.Lchannel_name
name4 = "%s.png" % self.Lchannel_name
name2 = "%s.png" % self.Lchannel_name.encode("latin-1", "ignore").decode("utf-8")
name4 = "%s.png" % self.Lchannel_name.encode("utf-8", "ignore").decode("utf-8")
name3 = "%s.png" % self.Lchannel_name2.replace('\x87', '').replace('\x86', '')
name = normalize('NFKD', str("" + self.Lchannel_name))
name = "%s.png" % sub(r'[^a-z0-9]', '', str(name).replace('&', 'and').replace('+', 'plus').replace('*', 'star').lower())
PIC.append(join(P2, name3))
PIC.append(join(P2, name2))
PIC.append(join(P2, name))
Expand Down Expand Up @@ -12033,16 +12041,17 @@ def putPicon(workaround, draw, im):
useCache = False
PIC = []
PIC.append(join(P2, picon))
name = normalize('NFKD', self.Lchannel_name if PY3 else self.Lchannel_name.decode('unicode-escape'))
name = sub(r'[^a-z0-9]', '', "%s.png" % str(name).replace('&', 'and').replace('+', 'plus').replace('*', 'star').lower())
if not PY3:
name2 = "%s.png" % self.Lchannel_name.decode("utf-8").encode("latin-1", "ignore")
name4 = "%s.png" % self.Lchannel_name.decode("utf-8").encode("latin-1", "ignore")
name3 = "%s.png" % self.Lchannel_name2.replace('\xc2\x87', '').replace('\xc2\x86', '').decode("utf-8").encode("utf-8")
name = normalize('NFKD', self.Lchannel_name.decode('unicode-escape'))
else:
name2 = "%s.png" % self.Lchannel_name
name4 = "%s.png" % self.Lchannel_name
name2 = "%s.png" % self.Lchannel_name.encode("latin-1", "ignore").decode("utf-8")
name4 = "%s.png" % self.Lchannel_name.encode("utf-8", "ignore").decode("utf-8")
name3 = "%s.png" % self.Lchannel_name2.replace('\x87', '').replace('\x86', '')
name = normalize('NFKD', self.Lchannel_name)
name = "%s.png" % sub(r'[^a-z0-9]', '', str(name).replace('&', 'and').replace('+', 'plus').replace('*', 'star').lower())
name5 = getPiconName(self.LsreftoString)
PIC.append(join(P2, name3))
PIC.append(join(P2, name2))
Expand Down Expand Up @@ -12768,7 +12777,6 @@ def putTuner(workaround, draw, im):
number = -1
if self.Ltuner_number is not None:
number = self.Ltuner_number
i = ""
Tcount = 0
font = ImageFont.truetype(ConfigFont, ConfigSize, encoding='unic')
w, h = getFsize("A ", font)
Expand Down Expand Up @@ -12797,10 +12805,7 @@ def putTuner(workaround, draw, im):
for x in range(TunerCount):
isON = True
if TunerMask & count != 0:
if x == number:
c = LCD4linux.TunerColorActive.value
else:
c = LCD4linux.TunerColorOn.value
c = LCD4linux.TunerColorActive.value if x == number else LCD4linux.TunerColorOn.value
else:
c = LCD4linux.TunerColor.value
isON = False
Expand All @@ -12827,7 +12832,6 @@ def putInfo(workaround, draw, im):

def NL(count):
return "\n" if int(count) > 2 else ""

global CPUtotal
global CPUidle
MAX_W, MAX_H = self.im[im].size
Expand Down Expand Up @@ -14438,7 +14442,7 @@ def Lput4(LCD, SCR, FUNC, PARA):
if not LCD4linux.Enable.value:
return
tt = time()
# L4logE("MP-Mode",isMediaPlayer)
# L4logE("MP-Mode", isMediaPlayer)
L4log("creating LCD-Picture: %s" % ScreenActive)
if isdir("%slcd4linux" % TMP) == False:
try:
Expand Down Expand Up @@ -14482,8 +14486,8 @@ def Lput4(LCD, SCR, FUNC, PARA):
self.CoverName = ["-", "-"]
elif sref.startswith(("4097:0", "5001:0", "5002:0", "5003:0")):
if self.Lpath and self.Lpath.startswith("http") and self.Llength and self.Llength[0] == -1:
L4log("detected IPTV")
isMediaPlayer = "mp3" if LCD4linux.Streaming.value == "0" else ""
L4log("detected AudioMedia or IPTV")
isMediaPlayer = "mp3"
else:
L4log("detected VOD Media")
isMediaPlayer = "mp3"
Expand Down

0 comments on commit 267b0a9

Please sign in to comment.