diff --git a/lcd4linux/src/Photoframe.py b/lcd4linux/src/Photoframe.py index 920c45b..e8f2137 100644 --- a/lcd4linux/src/Photoframe.py +++ b/lcd4linux/src/Photoframe.py @@ -5,7 +5,6 @@ from usb.util import get_string from PIL import Image from struct import pack -from six import ensure_binary from six.moves import cStringIO as StringIO @@ -19,7 +18,11 @@ def write_jpg2frame(dev, pic): tdata = rawdata + b'\xff\x00' + pad * b'\x00' # Syntax: write(self, endpoint, data, interface = None, timeout = None): endpoint = 0x02 - dev.write(endpoint, tdata) + # send to device in packages of = 2^16 + psize = 65536 + for p in range(int(len(tdata) / psize)): + pdata = tdata[p * psize:(p + 1) * psize] + dev.write(endpoint, pdata) def get_known_devices(): @@ -27,58 +30,66 @@ def get_known_devices(): dlist = [] # listed as: Name, idVendor, idProduct, [width , height - in pixel if applicable] - #0,1 Samsung SPF-75H/76H (23) + # 0,1 Samsung SPF-75H/76H (23) dlist.append({'name': "SPF75H/76H Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x200f, 'width': 800, 'height': 480}) dlist.append({'name': "SPF75H/76H Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x200e}) - #2,3 Samsung SPF-87H (24) + # 2,3 Samsung SPF-87H (24) dlist.append({'name': "SPF87H Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2034, 'width': 800, 'height': 480}) dlist.append({'name': "SPF87H Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2033}) - #4,5 Samsung SPF-87Hold (25) + # 4,5 Samsung SPF-87Hold (25) dlist.append({'name': "SPF87Hold Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2026, 'width': 800, 'height': 480}) dlist.append({'name': "SPF87Hold Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2025}) - #6,7 Samsung SPF-83H (26) + # 6,7 Samsung SPF-83H (26) dlist.append({'name': "SPF83H Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x200d, 'width': 800, 'height': 600}) dlist.append({'name': "SPF83H Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x200c}) - #8,9 Samsung SPF-107H (27) + # 8,9 Samsung SPF-107H (27) dlist.append({'name': "SPF107H Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2036, 'width': 1024, 'height': 600}) dlist.append({'name': "SPF107H Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2035}) - #10,11 Samsung SPF-105P (28) + # 10,11 Samsung SPF-105P (28) dlist.append({'name': "SPF105P Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x201b, 'width': 1024, 'height': 600}) dlist.append({'name': "SPF105P Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x201c}) - #12,13 Samsung SPF-85H/86H (29) + # 12,13 Samsung SPF-85H/86H (29) dlist.append({'name': "SPF85H/86H Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2013, 'width': 800, 'height': 600}) dlist.append({'name': "SPF85H/86H Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2012}) - #14,15 Samsung SPF-72H (210) + # 14,15 Samsung SPF-72H (210) dlist.append({'name': "SPF72H Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x200b, 'width': 800, 'height': 480}) dlist.append({'name': "SPF72H Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x200a}) - #16,17 Samsung SPF-700T (211) + # 16,17 Samsung SPF-700T (211) dlist.append({'name': "SPF700T Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2050, 'width': 800, 'height': 600}) dlist.append({'name': "SPF700T Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x204f}) - #18,19 Samsung SPF-85P/86P (212) + # 18,19 Samsung SPF-85P/86P (212) dlist.append({'name': "SPF85P/86P Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2017, 'width': 800, 'height': 600}) dlist.append({'name': "SPF85P/86P Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2016}) - #20,21 Samsung SPF-107Hold (213) + # 20,21 Samsung SPF-107Hold (213) dlist.append({'name': "SPF107Hold Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2028, 'width': 1024, 'height': 600}) dlist.append({'name': "SPF107Hold Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2027}) - #22,23 Samsung SPF-1000P (214) + # 22,23 Samsung SPF-1000P (214) dlist.append({'name': "SPF1000P Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2040, 'width': 1024, 'height': 600}) dlist.append({'name': "SPF1000P Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2039}) - #24,25 Samsung SPF-800P (215) + # 24,25 Samsung SPF-800P (215) dlist.append({'name': "SPF800P Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2038, 'width': 800, 'height': 480}) dlist.append({'name': "SPF800P Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2037}) + # 26,27 Samsung SPF-800W (216) + dlist.append({'name': "SPF800W Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x204c, 'width': 800, 'height': 600}) + dlist.append({'name': "SPF800W Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x204b}) + + # 28,29 Samsung SPF-1000W (217) + dlist.append({'name': "SPF1000W Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x204e, 'width': 1024, 'height': 768}) + dlist.append({'name': "SPF1000W Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x204d}) + # Amazon Fire 7 (9th Generation 2019) dlist.append({'name': "Amazon Fire 7 Mini Monitor", 'idVendor': 0x1949, 'idProduct': 0x03C3, 'width': 1024, 'height': 600}) dlist.append({'name': "Amazon Fire 7 Mass Storage", 'idVendor': 0x1949, 'idProduct': 0x03C1}) @@ -115,7 +126,7 @@ def init_device(anzahl, device0, device1): dev = find_device(anzahl, device0, device1) if dev is not None: - ## found it, trying to init it + # found it, trying to init it print("[LCD4linux] Find frame device: %s" % dev) if dev.idProduct == device0["idProduct"]: print("[LCD4linux] init Device") @@ -128,7 +139,7 @@ def init_device(anzahl, device0, device1): # may need to burn some time dev = find_device(anzahl, device0, device1) if dev is not None and dev.idProduct == device0["idProduct"]: - #switching successful + # switching successful break elif time() - ts > 3: print("[LCD4linux] switching failed. Ending program") @@ -195,7 +206,7 @@ def main(): dev = init_device(1, device0, device1) print("Frame is in Mini Monitor mode and initialized. Sending pictures now") image = Image.open("mypicture.jpg") - #manipulations to consider: + # manipulations to consider: # convert # thumbnail # rotate diff --git a/lcd4linux/src/plugin.py b/lcd4linux/src/plugin.py index df2dcc2..18e1804 100644 --- a/lcd4linux/src/plugin.py +++ b/lcd4linux/src/plugin.py @@ -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-r34" +Version = "V5.0-r36" L4LElist = L4Lelement() L4LdoThread = True LCD4enigma2config = resolveFilename(SCOPE_CONFIG) # /etc/enigma2/ @@ -310,11 +310,13 @@ TimeSelect = [("1", _("5s")), ("2", _("10s")), ("3", _("15s")), ("4", _("20s")), ("6", _("30s")), ("8", _("40s")), ("10", _("50s")), ("12", _("1min")), ("24", _("2min")), ("36", _("3min")), ("48", _("4min")), ("60", _("5min")), ("120", _("10min")), ("240", _("20min")), ("360", _("30min")), ("720", _("60min")), ("1440", _("2h")), ("2160", _("3h")), ("3600", _("5h"))] LCDSelect = [("1", _("LCD 1")), ("2", _("LCD 2")), ("12", _("LCD 1+2")), ("3", _("LCD 3")), ("13", _("LCD 1+3")), ("23", _("LCD 2+3")), ("123", _("LCD 1+2+3"))] LCDSwitchSelect = [("0", _("LCD 1-3")), ("1", _("LCD 1")), ("2", _("LCD 2")), ("3", _("LCD 3"))] -LCDType = [("11", _("Pearl (or compatible LCD) 320x240")), ("12", _("Pearl (or compatible LCD) 240x320")), ("121", _("Corby@Pearl 128x128")), ("122", _("AX206 (or compatible LCD) 480x320")), ("123", _("AX206 (or compatible LCD) 800x480")), - ("210", _("Samsung SPF-72H 800x480")), ("23", _("Samsung SPF-75H/76H 800x480")), ("24", _("Samsung SPF-87H 800x480")), ("25", _("Samsung SPF-87H old 800x480")), ("26", _("Samsung SPF-83H 800x600")), - ("29", _("Samsung SPF-85H/86H 800x600")), ("212", _("Samsung SPF-85P/86P 800x600")), ("28", _("Samsung SPF-105P 1024x600")), ("27", _("Samsung SPF-107H 1024x600")), ("213", _("Samsung SPF-107H old 1024x600")), - ("211", _("Samsung SPF-700T 800x600")), ("215", _("Samsung SPF-800P 800x480")), ("214", _("Samsung SPF-1000P 1024x600")), ("430", _("Internal TFT-LCD 400x240")), ("50", _("Internal Box-Skin-LCD")), - ("31", _("only Picture 320x240")), ("33", _("only Picture 800x480")), ("36", _("only Picture 800x600")), ("37", _("only Picture 1024x600")), ("320", _("only Picture Custom Size")), ("420", _("only Picture Custom Size 2"))] +LCDType = [ + ("11", _("Pearl (or compatible LCD) 320x240")), ("12", _("Pearl (or compatible LCD) 240x320")), ("121", _("Corby@Pearl 128x128")), ("122", _("AX206 (or compatible LCD) 480x320")), ("123", _("AX206 (or compatible LCD) 800x480")), + ("210", _("Samsung SPF-72H 800x480")), ("23", _("Samsung SPF-75H/76H 800x480")), ("24", _("Samsung SPF-87H 800x480")), ("25", _("Samsung SPF-87H old 800x480")), ("26", _("Samsung SPF-83H 800x600")), + ("29", _("Samsung SPF-85H/86H 800x600")), ("212", _("Samsung SPF-85P/86P 800x600")), ("28", _("Samsung SPF-105P 1024x600")), ("27", _("Samsung SPF-107H 1024x600")), ("213", _("Samsung SPF-107H old 1024x600")), + ("211", _("Samsung SPF-700T 800x600")), ("215", _("Samsung SPF-800P 800x480")), ("214", _("Samsung SPF-1000P 1024x600")), ("216", _("Samsung SPF-800W 800x600")), ("217", _("Samsung SPF-1000W 1024x768")), ("430", _("Internal TFT-LCD 400x240")), ("50", _("Internal Box-Skin-LCD")), + ("31", _("only Picture 320x240")), ("33", _("only Picture 800x480")), ("36", _("only Picture 800x600")), ("37", _("only Picture 1024x600")), ("320", _("only Picture Custom Size")), ("420", _("only Picture Custom Size 2")) +] if PNGutilOK: LCDType.insert(14, ("930", _("Internal Vu+ Duo2 LCD 400x240"))) xmlLCDType = [("96x64", _("96x64")), ("128x32", _("128x32")), ("128x64", _("128x64")), ("132x64", _("132x64")), ("220x176", _("220x176")), ("255x64", _("255x64")), ("400x240", _("400x240")), ("480x320", _("480x320")), ("700x390", _("720x405")), ("800x480", _("800x480"))] @@ -2890,12 +2892,12 @@ def getResolution(t, r): MAX_W, MAX_H = 240, 320 elif t[1:] in ["3", "4", "5", "10", "15"]: MAX_W, MAX_H = 800, 480 - elif t[1:] in ["6", "9", "11", "12"]: + elif t[1:] in ["6", "9", "11", "12", "16"]: MAX_W, MAX_H = 800, 600 elif t[1:] in ["7", "8", "13", "14"]: MAX_W, MAX_H = 1024, 600 elif t[1:] == "17": - MAX_W, MAX_H = 220, 176 + MAX_W, MAX_H = 1024, 768 elif t[1:] == "18": MAX_W, MAX_H = 255, 64 elif t[1:] == "22": @@ -8639,7 +8641,7 @@ def getSonos(self): self.SonosTrack = self.SonosSoCo.get_current_track_info() self.Lvol = self.SonosSoCo.volume # self.SonosTrack = {u'album': 'Sehnsucht', u'artist': 'Rammstein', u'title': 'Eifersucht', u'uri': 'x-sonos-spotify:spotify%3atrack%3a4Ugp6Wu4hVXnbEKT3Nrka0?sid=9&flags=8224&sn=3', u'playlist_position': '10', u'duration': '0:03:35', u'position': '0:01:39', u'album_art': u'http://192.168.0.84:1400/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a4Ugp6Wu4hVXnbEKT3Nrka0%3fsid%3d9%26flags%3d8224%26sn%3d3', u'metadata': 'x-sonos-spotify:spotify%3atrack%3a4Ugp6Wu4hVXnbEKT3Nrka0?sid=9&flags=8224&sn=3/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a4Ugp6Wu4hVXnbEKT3Nrka0%3fsid%3d9%26flags%3d8224%26sn%3d3Eifersuchtobject.item.audioItem.musicTrackRammsteinSehnsucht'} - if self.SonosRunning == False: + if self.SonosRunning is False: self.SonosSoCo = None self.SonosRunning = True isMediaPlayer = "sonos"