Skip to content

Commit 483005f

Browse files
authored
Merge pull request #22 from Hains/python3
Update LCD4Linux
2 parents 9ecc2cc + f8668c2 commit 483005f

File tree

2 files changed

+40
-27
lines changed

2 files changed

+40
-27
lines changed

lcd4linux/src/Photoframe.py

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from usb.util import get_string
66
from PIL import Image
77
from struct import pack
8-
from six import ensure_binary
98
from six.moves import cStringIO as StringIO
109

1110

@@ -19,66 +18,78 @@ def write_jpg2frame(dev, pic):
1918
tdata = rawdata + b'\xff\x00' + pad * b'\x00'
2019
# Syntax: write(self, endpoint, data, interface = None, timeout = None):
2120
endpoint = 0x02
22-
dev.write(endpoint, tdata)
21+
# send to device in packages of = 2^16
22+
psize = 65536
23+
for p in range(int(len(tdata) / psize)):
24+
pdata = tdata[p * psize:(p + 1) * psize]
25+
dev.write(endpoint, pdata)
2326

2427

2528
def get_known_devices():
2629
# Return a dict of photo frames
2730
dlist = []
2831
# listed as: Name, idVendor, idProduct, [width , height - in pixel if applicable]
2932

30-
#0,1 Samsung SPF-75H/76H (23)
33+
# 0,1 Samsung SPF-75H/76H (23)
3134
dlist.append({'name': "SPF75H/76H Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x200f, 'width': 800, 'height': 480})
3235
dlist.append({'name': "SPF75H/76H Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x200e})
3336

34-
#2,3 Samsung SPF-87H (24)
37+
# 2,3 Samsung SPF-87H (24)
3538
dlist.append({'name': "SPF87H Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2034, 'width': 800, 'height': 480})
3639
dlist.append({'name': "SPF87H Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2033})
3740

38-
#4,5 Samsung SPF-87Hold (25)
41+
# 4,5 Samsung SPF-87Hold (25)
3942
dlist.append({'name': "SPF87Hold Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2026, 'width': 800, 'height': 480})
4043
dlist.append({'name': "SPF87Hold Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2025})
4144

42-
#6,7 Samsung SPF-83H (26)
45+
# 6,7 Samsung SPF-83H (26)
4346
dlist.append({'name': "SPF83H Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x200d, 'width': 800, 'height': 600})
4447
dlist.append({'name': "SPF83H Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x200c})
4548

46-
#8,9 Samsung SPF-107H (27)
49+
# 8,9 Samsung SPF-107H (27)
4750
dlist.append({'name': "SPF107H Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2036, 'width': 1024, 'height': 600})
4851
dlist.append({'name': "SPF107H Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2035})
4952

50-
#10,11 Samsung SPF-105P (28)
53+
# 10,11 Samsung SPF-105P (28)
5154
dlist.append({'name': "SPF105P Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x201b, 'width': 1024, 'height': 600})
5255
dlist.append({'name': "SPF105P Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x201c})
5356

54-
#12,13 Samsung SPF-85H/86H (29)
57+
# 12,13 Samsung SPF-85H/86H (29)
5558
dlist.append({'name': "SPF85H/86H Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2013, 'width': 800, 'height': 600})
5659
dlist.append({'name': "SPF85H/86H Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2012})
5760

58-
#14,15 Samsung SPF-72H (210)
61+
# 14,15 Samsung SPF-72H (210)
5962
dlist.append({'name': "SPF72H Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x200b, 'width': 800, 'height': 480})
6063
dlist.append({'name': "SPF72H Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x200a})
6164

62-
#16,17 Samsung SPF-700T (211)
65+
# 16,17 Samsung SPF-700T (211)
6366
dlist.append({'name': "SPF700T Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2050, 'width': 800, 'height': 600})
6467
dlist.append({'name': "SPF700T Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x204f})
6568

66-
#18,19 Samsung SPF-85P/86P (212)
69+
# 18,19 Samsung SPF-85P/86P (212)
6770
dlist.append({'name': "SPF85P/86P Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2017, 'width': 800, 'height': 600})
6871
dlist.append({'name': "SPF85P/86P Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2016})
6972

70-
#20,21 Samsung SPF-107Hold (213)
73+
# 20,21 Samsung SPF-107Hold (213)
7174
dlist.append({'name': "SPF107Hold Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2028, 'width': 1024, 'height': 600})
7275
dlist.append({'name': "SPF107Hold Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2027})
7376

74-
#22,23 Samsung SPF-1000P (214)
77+
# 22,23 Samsung SPF-1000P (214)
7578
dlist.append({'name': "SPF1000P Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2040, 'width': 1024, 'height': 600})
7679
dlist.append({'name': "SPF1000P Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2039})
7780

78-
#24,25 Samsung SPF-800P (215)
81+
# 24,25 Samsung SPF-800P (215)
7982
dlist.append({'name': "SPF800P Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x2038, 'width': 800, 'height': 480})
8083
dlist.append({'name': "SPF800P Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x2037})
8184

85+
# 26,27 Samsung SPF-800W (216)
86+
dlist.append({'name': "SPF800W Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x204c, 'width': 800, 'height': 600})
87+
dlist.append({'name': "SPF800W Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x204b})
88+
89+
# 28,29 Samsung SPF-1000W (217)
90+
dlist.append({'name': "SPF1000W Mini Monitor", 'idVendor': 0x04e8, 'idProduct': 0x204e, 'width': 1024, 'height': 768})
91+
dlist.append({'name': "SPF1000W Mass Storage", 'idVendor': 0x04e8, 'idProduct': 0x204d})
92+
8293
# Amazon Fire 7 (9th Generation 2019)
8394
dlist.append({'name': "Amazon Fire 7 Mini Monitor", 'idVendor': 0x1949, 'idProduct': 0x03C3, 'width': 1024, 'height': 600})
8495
dlist.append({'name': "Amazon Fire 7 Mass Storage", 'idVendor': 0x1949, 'idProduct': 0x03C1})
@@ -115,7 +126,7 @@ def init_device(anzahl, device0, device1):
115126
dev = find_device(anzahl, device0, device1)
116127

117128
if dev is not None:
118-
## found it, trying to init it
129+
# found it, trying to init it
119130
print("[LCD4linux] Find frame device: %s" % dev)
120131
if dev.idProduct == device0["idProduct"]:
121132
print("[LCD4linux] init Device")
@@ -128,7 +139,7 @@ def init_device(anzahl, device0, device1):
128139
# may need to burn some time
129140
dev = find_device(anzahl, device0, device1)
130141
if dev is not None and dev.idProduct == device0["idProduct"]:
131-
#switching successful
142+
# switching successful
132143
break
133144
elif time() - ts > 3:
134145
print("[LCD4linux] switching failed. Ending program")
@@ -195,7 +206,7 @@ def main():
195206
dev = init_device(1, device0, device1)
196207
print("Frame is in Mini Monitor mode and initialized. Sending pictures now")
197208
image = Image.open("mypicture.jpg")
198-
#manipulations to consider:
209+
# manipulations to consider:
199210
# convert
200211
# thumbnail
201212
# rotate

lcd4linux/src/plugin.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
if find_library("usb-0.1") is not None or find_library("usb-1.0") is not None:
173173
print("[LCD4linux] libusb found :-)", getEnigmaVersionString())
174174
USBok = True
175-
Version = "V5.0-r34"
175+
Version = "V5.0-r36"
176176
L4LElist = L4Lelement()
177177
L4LdoThread = True
178178
LCD4enigma2config = resolveFilename(SCOPE_CONFIG) # /etc/enigma2/
@@ -310,11 +310,13 @@
310310
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"))]
311311
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"))]
312312
LCDSwitchSelect = [("0", _("LCD 1-3")), ("1", _("LCD 1")), ("2", _("LCD 2")), ("3", _("LCD 3"))]
313-
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")),
314-
("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")),
315-
("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")),
316-
("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")),
317-
("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"))]
313+
LCDType = [
314+
("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")),
315+
("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")),
316+
("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")),
317+
("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")),
318+
("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"))
319+
]
318320
if PNGutilOK:
319321
LCDType.insert(14, ("930", _("Internal Vu+ Duo2 LCD 400x240")))
320322
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):
28902892
MAX_W, MAX_H = 240, 320
28912893
elif t[1:] in ["3", "4", "5", "10", "15"]:
28922894
MAX_W, MAX_H = 800, 480
2893-
elif t[1:] in ["6", "9", "11", "12"]:
2895+
elif t[1:] in ["6", "9", "11", "12", "16"]:
28942896
MAX_W, MAX_H = 800, 600
28952897
elif t[1:] in ["7", "8", "13", "14"]:
28962898
MAX_W, MAX_H = 1024, 600
28972899
elif t[1:] == "17":
2898-
MAX_W, MAX_H = 220, 176
2900+
MAX_W, MAX_H = 1024, 768
28992901
elif t[1:] == "18":
29002902
MAX_W, MAX_H = 255, 64
29012903
elif t[1:] == "22":
@@ -8639,7 +8641,7 @@ def getSonos(self):
86398641
self.SonosTrack = self.SonosSoCo.get_current_track_info()
86408642
self.Lvol = self.SonosSoCo.volume
86418643
# 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': '<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="-1" parentID="-1" restricted="true"><res protocolInfo="sonos.com-spotify:*:audio/x-spotify:*" duration="0:03:35">x-sonos-spotify:spotify%3atrack%3a4Ugp6Wu4hVXnbEKT3Nrka0?sid=9&amp;flags=8224&amp;sn=3</res><r:streamContent></r:streamContent><upnp:albumArtURI>/getaa?s=1&amp;u=x-sonos-spotify%3aspotify%253atrack%253a4Ugp6Wu4hVXnbEKT3Nrka0%3fsid%3d9%26flags%3d8224%26sn%3d3</upnp:albumArtURI><dc:title>Eifersucht</dc:title><upnp:class>object.item.audioItem.musicTrack</upnp:class><dc:creator>Rammstein</dc:creator><upnp:album>Sehnsucht</upnp:album></item></DIDL-Lite>'}
8642-
if self.SonosRunning == False:
8644+
if self.SonosRunning is False:
86438645
self.SonosSoCo = None
86448646
self.SonosRunning = True
86458647
isMediaPlayer = "sonos"

0 commit comments

Comments
 (0)