From 0955f85c48512ed86d10c457e14ec2c5954dadf4 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 7 Oct 2012 21:36:31 +0200 Subject: [PATCH 001/337] Show "connection success" popup only when not initially connecting to not annoy users --- script.xbmc.lcd/lcdmain.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 4598b2e..b2bacc3 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -33,6 +33,7 @@ from lcdproc import * global g_failedConnectionNotified +global g_initialConnectAttempt global g_lcdproc global g_oldMenu @@ -41,12 +42,14 @@ def initGlobals(): global g_failedConnectionNotified + global g_initialConnectAttempt global g_lcdproc global g_oldMenu global g_oldSubMenu global g_timer g_failedConnectionNotified = False + g_initialConnectAttempt = True settings_initGlobals() g_lcdproc = LCDProc() g_oldMenu = "" @@ -115,6 +118,7 @@ def process_lcd(): def handleConnectLCD(): global g_failedConnectionNotified + global g_initialConnectAttempt while not xbmc.abortRequested: #check for new settings @@ -137,11 +141,14 @@ def handleConnectLCD(): xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) else: text = __settings__.getLocalizedString(501) - if not g_failedConnectionNotified: + if not g_failedConnectionNotified and not g_initialConnectAttempt: xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) g_failedConnectionNotified = True print "lcd: connected to LCD" break + + # initial connection attempt done, update flag + g_initialConnectAttempt = False return True #MAIN - entry point From 4b16df3d412873a08ed47b268534646129392f51 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 7 Oct 2012 21:42:36 +0200 Subject: [PATCH 002/337] gitignore: Ignore compiled python stuff --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc From b778acb64e7aa3c49f64cd066c34c8a52449a900 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 7 Oct 2012 21:47:11 +0200 Subject: [PATCH 003/337] remove unused (commented) stuff --- script.xbmc.lcd/lcdmain.py | 3 - script.xbmc.lcd/resources/lib/lcdbase.py | 77 ------------------------ script.xbmc.lcd/resources/lib/lcdproc.py | 65 -------------------- 3 files changed, 145 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index b2bacc3..5113092 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -158,6 +158,3 @@ def handleConnectLCD(): while not xbmc.abortRequested: settings_setup() process_lcd() #lcd loop - -#lcd_initGlobals() #clears lists - for skin doesn't show the old values -#fhem_updateInfoWindow() #push cleared values to the skin diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index f3138ad..d582f8e 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -40,83 +40,6 @@ def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,),level=loglevel ) -''' -# TEMPLATE: TRANSLATION-TABLE FOR FUTURE LCD-TYPE-CHARSETS -{ -0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, -0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, -0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, -0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, -0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, -0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, -0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, -0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, -0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, -0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, -0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, -0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, -0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, -0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, -0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, -0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff -} - -''' -''' -# UNUSED by now -def GetLCDCharsetCharacter(_nCharacter, _nCharset): - - arrCharsets = [[ # Xbmc default, currently implemented elsewhere - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] - ], - [ # Small Char - [0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01], # | _ - [0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1f], # _ _| - [0x1f, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11], # | | - [0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1f], # _| - [0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1f], # |_| _ - [0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f], # _ |_ - [0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01], # | _ - [0x1f, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1f] # |_| - ], - [ # Medium Char - [0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f], # _ - [0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f], # |_ _ - [0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18], # _ | - [0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f], # |_ _ - [0x1f, 0x1f, 0x03, 0x03, 0x03, 0x03, 0x1f, 0x1f], # _ _| - [0x1f, 0x1f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03], # | - [0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x1f, 0x1f] # _| - ], - [ # Big Char - [0x01, 0x03, 0x03, 0x07, 0x07, 0x0f, 0x0f, 0x1f], # topleft corner - [0x10, 0x18, 0x18, 0x1c, 0x1c, 0x1e, 0x1e, 0x1f], # topright corner - [0x1f, 0x1e, 0x1e, 0x1c, 0x1c, 0x18, 0x18, 0x10], # bottomright corner - [0x1f, 0x0f, 0x0f, 0x07, 0x07, 0x03, 0x03, 0x01], # bottomleft corner - [0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00], # upper half block - # Free to use - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] - ]] - - if _nCharset == -1: - _nCharset = m_eCurrentCharset - - if ( ( _nCharacter >= 64 ) or ( _nCharset >= CUSTOM_CHARSET.CUSTOM_CHARSET_MAX ) ): - return 0 - - return arrCharsets[_nCharset][_nCharacter/8][_nCharacter%8] -''' - # enumerations class DISABLE_ON_PLAY: DISABLE_ON_PLAY_NONE = 0 diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index a11b0f7..bbfbae1 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -35,71 +35,6 @@ from settings import * from lcdbase import * - -''' -def fhem_parseXML(xmlstr): - global g_fht_list - global g_fhttk_list - global g_fs20_list - - ret = True - fhemcontents = xmltree.fromstring(xmlstr) - for element in fhemcontents.getiterator(): - #PARSE FHT infos heating control - if element.tag == "FHT_LIST": - for child in element: - if child.tag == "FHT": - fhtobj = FHTObj() - fhtobj.name = child.attrib.get('name') - for subchild in child: - if subchild.tag == "ATTR" and subchild.attrib.get('key') == "room": - fhtobj.room = subchild.attrib.get('value') - if subchild.tag == "STATE" and subchild.attrib.get('key') == "measured-temp": - fhtobj.temperature = subchild.attrib.get('value') - if subchild.tag == "STATE" and subchild.attrib.get('key') == "actuator": - fhtobj.actuator = subchild.attrib.get('value') - if subchild.tag == "STATE" and subchild.attrib.get('key') == "battery": - fhtobj.battery = subchild.attrib.get('value') - if subchild.tag == "STATE" and subchild.attrib.get('key') == "mode": - fhtobj.mode = subchild.attrib.get('value') - if subchild.tag == "STATE" and subchild.attrib.get('key') == "desired-temp": - fhtobj.setTemp = subchild.attrib.get('value') - if subchild.tag == "STATE" and subchild.attrib.get('key') == "windowsensor": - fhtobj.windowSensor = subchild.attrib.get('value') - g_fht_list.append(fhtobj) - - #PARSE FHTTK infos window sensors - if element.tag == "CUL_FHTTK_LIST": - for child in element: - if child.tag == "CUL_FHTTK": - fhttkobj = FHTTKObj() - fhttkobj.name = child.attrib.get('name') - for subchild in child: - if subchild.tag == "ATTR" and subchild.attrib.get('key') == "room": - fhttkobj.room = subchild.attrib.get('value') - if subchild.tag == "STATE" and subchild.attrib.get('key') == "Battery": - fhttkobj.battery = subchild.attrib.get('value') - if subchild.tag == "STATE" and subchild.attrib.get('key') == "Window": - fhttkobj.window = subchild.attrib.get('value') - g_fhttk_list.append(fhttkobj) - - #PARSE FS20 infos switches - if element.tag == "FS20_LIST": - for child in element: - if child.tag == "FS20": - fs20obj = FS20Obj() - fs20obj.name = child.attrib.get('name') - for subchild in child: - if subchild.tag == "ATTR" and subchild.attrib.get('key') == "room": - fs20obj.room = subchild.attrib.get('value') - if subchild.tag == "STATE" and subchild.attrib.get('key') == "state": - fs20obj.state = subchild.attrib.get('value') - - g_fs20_list.append(fs20obj) - - return ret -''' - def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,),level=loglevel ) From ef8427c905ca4ec848091b3583603a0459a3564c Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 7 Oct 2012 22:40:50 +0200 Subject: [PATCH 004/337] lcdproc.Connect(): add (unused for now) info request, later used for iMon/mdm166a identification --- script.xbmc.lcd/resources/lib/lcdproc.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index bbfbae1..19c5966 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -122,6 +122,12 @@ def Connect(self): self.m_iCellWidth = int(tmparray[2]) self.m_iCellHeight = int(tmparray[3]) log(xbmc.LOGDEBUG, "LCDproc data: Columns %s - Rows %s - CellWidth %s." % (str(self.m_iColumns), str(self.m_iRows), str(self.m_iCellWidth))) + + # Retrieve driver name for additional functionality + self.tn.write("info\n") + reply = self.tn.read_until("\n",3) + log(xbmc.LOGDEBUG,"info Reply: " + reply) + except: log(xbmc.LOGERROR,"Connect: Telnet exception.") return False From d2d9814044177271390175ee4b5c2c17f87e761f Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 7 Oct 2012 23:01:47 +0200 Subject: [PATCH 005/337] lcdproc.Connect(): Use regex to determine lcd parameters, do protocol version check --- script.xbmc.lcd/resources/lib/lcdproc.py | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 19c5966..9daafab 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -107,21 +107,21 @@ def Connect(self): reply = self.tn.read_until("\n",3) log(xbmc.LOGDEBUG,"Reply: " + reply) - if len(reply) < 5: + lcdinfo = re.match("^connect .+ protocol ([0-9\.]+) lcd wid (\d+) hgt (\d+) cellwid (\d+) cellhgt (\d+)$", reply) + + if lcdinfo is None: return False - i = 0 - while (i < (len(reply)-5)) and reply[i:i+3] != "lcd" and (i+3) < len(reply): - i = i + 1 - - if i < len(reply): - tmparray = re.findall(r'\d+',reply[i:]) - if len(tmparray) >= 2: - self.m_iColumns = int(tmparray[0]) - self.m_iRows = int(tmparray[1]) - self.m_iCellWidth = int(tmparray[2]) - self.m_iCellHeight = int(tmparray[3]) - log(xbmc.LOGDEBUG, "LCDproc data: Columns %s - Rows %s - CellWidth %s." % (str(self.m_iColumns), str(self.m_iRows), str(self.m_iCellWidth))) + # protocol version must currently be 0.3 + if float(lcdinfo.group(1)) != 0.3: + log(xbmc.LOGERROR, "Only LCDproc protocol 0.3 supported (got " + lcdinfo.group(1) +")") + return False + + self.m_iColumns = int(lcdinfo.group(2)) + self.m_iRows = int(lcdinfo.group(3)) + self.m_iCellWidth = int(lcdinfo.group(4)) + self.m_iCellHeight = int(lcdinfo.group(5)) + log(xbmc.LOGDEBUG, "LCDproc data: Columns %s - Rows %s - CellWidth %s - CellHeight %s" % (str(self.m_iColumns), str(self.m_iRows), str(self.m_iCellWidth), str(self.m_iCellHeight))) # Retrieve driver name for additional functionality self.tn.write("info\n") From b37a1d7ebf56a6f2109969e088fd6b2a151a8c0b Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 7 Oct 2012 23:07:37 +0200 Subject: [PATCH 006/337] Add myself to authors :) --- script.xbmc.lcd/addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/addon.xml b/script.xbmc.lcd/addon.xml index cfc417e..ee94e60 100644 --- a/script.xbmc.lcd/addon.xml +++ b/script.xbmc.lcd/addon.xml @@ -1,5 +1,5 @@ - + From aa7509f47190de55248b6a47943dbdf225695f8b Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 8 Oct 2012 22:15:59 +0200 Subject: [PATCH 007/337] Add display refreshrate setting, work around getSetting() stupidity to prevent python errors (int returns float with localized separator, wtf?) --- script.xbmc.lcd/lcdmain.py | 2 +- .../resources/language/English/strings.xml | 2 +- .../resources/language/German/strings.xml | 1 + script.xbmc.lcd/resources/lib/settings.py | 44 +++++++++++++------ script.xbmc.lcd/resources/settings.xml | 1 + 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 5113092..2dfa7fd 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -114,7 +114,7 @@ def process_lcd(): else: g_lcdproc.DisableOnPlayback(False, False) - time.sleep(1) #refresh every second + time.sleep(1.0 / float(settings_getRefreshRate())) #refresh after configured rate def handleConnectLCD(): global g_failedConnectionNotified diff --git a/script.xbmc.lcd/resources/language/English/strings.xml b/script.xbmc.lcd/resources/language/English/strings.xml index 3aed616..a05afbe 100644 --- a/script.xbmc.lcd/resources/language/English/strings.xml +++ b/script.xbmc.lcd/resources/language/English/strings.xml @@ -12,7 +12,7 @@ Delay for scrolling text Dim backlight on screensaver Navigation display duration (s) - + Display refresh rate (Hz) Failed to connect to LCDProc! diff --git a/script.xbmc.lcd/resources/language/German/strings.xml b/script.xbmc.lcd/resources/language/German/strings.xml index f956f25..6417b07 100644 --- a/script.xbmc.lcd/resources/language/German/strings.xml +++ b/script.xbmc.lcd/resources/language/German/strings.xml @@ -12,6 +12,7 @@ Geschwindigkeit fuer gescrollten Text Hintergrundbeleuchtung ausschalten, wenn Bildschirmschoner laeuft Anzeigedauer der Navigationsansicht (s) + Display-Aktualisierungsrate (Hz) Fehler beim Verbinden zu LCDProc! diff --git a/script.xbmc.lcd/resources/lib/settings.py b/script.xbmc.lcd/resources/lib/settings.py index 2e26f27..d26b37b 100644 --- a/script.xbmc.lcd/resources/lib/settings.py +++ b/script.xbmc.lcd/resources/lib/settings.py @@ -16,6 +16,7 @@ along with this program. If not, see . ''' +import string import sys import time import xbmc @@ -36,6 +37,7 @@ global g_settingsChanged global g_dimonscreensaver global g_navtimeout +global g_refreshrate #init globals with defaults def settings_initGlobals(): @@ -47,8 +49,7 @@ def settings_initGlobals(): global g_settingsChanged global g_dimonscreensaver global g_navtimeout - - + global g_refreshrate g_hostip = "127.0.0.1" g_hostport = 13666 @@ -58,7 +59,7 @@ def settings_initGlobals(): g_settigsChanged = True g_dimonscreensaver = False g_navtimeout = 3 - + g_refreshrate = 1 def settings_getHostIp(): @@ -70,20 +71,24 @@ def settings_getHostPort(): return g_hostport def settings_getHeartBeat(): - global g_heartbeat - return g_heartbeat + global g_heartbeat + return g_heartbeat def settings_getScrollDelay(): - global g_scrolldelay - return g_scrolldelay + global g_scrolldelay + return g_scrolldelay def settings_getDimOnScreensaver(): - global g_dimonscreensaver - return g_dimonscreensaver + global g_dimonscreensaver + return g_dimonscreensaver def settings_getNavTimeout(): - global g_navtimeout - return g_navtimeout + global g_navtimeout + return g_navtimeout + +def settings_getRefreshRate(): + global g_refreshrate + return g_refreshrate #check for new settings and handle them if anything changed #only checks if the last check is 5 secs old @@ -135,12 +140,15 @@ def settings_handleLcdSettings(): global g_settingsChanged global g_dimonscreensaver global g_navtimeout + global g_refreshrate + g_settingsChanged = False - - scrolldelay = int(float(__settings__.getSetting("scrolldelay"))) + + scrolldelay = int(float(string.replace(__settings__.getSetting("scrolldelay"), ",", "."))) heartbeat = __settings__.getSetting("heartbeat") == "true" dimonscreensaver = __settings__.getSetting("dimonscreensver") == "true" - navtimeout = int(float(__settings__.getSetting("navtimeout"))) + navtimeout = int(float(string.replace(__settings__.getSetting("navtimeout"), ",", "."))) + refreshrate = int(float(string.replace(__settings__.getSetting("refreshrate"), ",", "."))) if g_scrolldelay != scrolldelay: g_scrolldelay = scrolldelay @@ -158,6 +166,14 @@ def settings_handleLcdSettings(): g_navtimeout = navtimeout g_settingsChanged = True + if g_refreshrate != refreshrate: + g_refreshrate = refreshrate + + if refreshrate < 1: + g_refreshrate = 1 + + g_settingsChanged = True + #handles all settings of boblight and applies them as needed #returns if a reconnect is needed due to settings changes def settings_setup(): diff --git a/script.xbmc.lcd/resources/settings.xml b/script.xbmc.lcd/resources/settings.xml index 775e60f..952c9cc 100644 --- a/script.xbmc.lcd/resources/settings.xml +++ b/script.xbmc.lcd/resources/settings.xml @@ -8,5 +8,6 @@ + From 4edcbbc75220b2956a9b1de4b32d841ee14348ed Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 8 Oct 2012 22:58:15 +0200 Subject: [PATCH 008/337] SendCommand() throughly checks LCDproc replies to provide a real proper cmd/reply dialog, SetupScreen() handles previous big-command-push properly and reacts accordingly --- script.xbmc.lcd/resources/lib/lcdproc.py | 89 +++++++++++++++++------- 1 file changed, 63 insertions(+), 26 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 9daafab..d5693e1 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -59,6 +59,66 @@ def __init__(self): self.m_iProgressBarLine = -1 LcdBase.__init__(self) + def SendCommand(self, strCmd, bCheckRet): + try: + # Send to server and read reply + self.tn.write(strCmd + "\n") + reply = self.tn.read_until("\n",3) + except: + # Something bad happened, abort + log(xbmc.LOGERROR, "SendCommand: Telnet exception - send") + return False + + if not bCheckRet: + return True # no return checking desired, so be fine + + if reply[:6] == 'listen' or reply[:6] == 'ignore': + try: + reply = self.tn.read_until("\n",3) + except: + # Reread failed, abort + log(xbmc.LOGERROR, "SendCommand: Telnet exception - reread") + return False + + if strCmd == 'noop' and reply == 'noop complete\n': + return True # noop has special reply + + if reply == 'success\n': + return True + + log(xbmc.LOGWARNING, "Reply to '" + strCmd +"' was '" + reply) + return False + + def SetupScreen(self): + # Add screen first + if not self.SendCommand("screen_add xbmc", True): + return False + + # Set screen priority + if not self.SendCommand("screen_set xbmc -priority info", True): + return False + + # Turn off heartbeat if desired + if not settings_getHeartBeat(): + if not self.SendCommand("screen_set xbmc -heartbeat off", True): + return False + + # Setup widgets + for i in range(1,int(self.m_iRows)+1): + # Text widgets + if not self.SendCommand("widget_add xbmc lineScroller" + str(i) + " scroller", True): + return False + + # Progress bars + if not self.SendCommand("widget_add xbmc lineProgress" + str(i) + " hbar", True): + return False + + # Icons + if not self.SendCommand("widget_add xbmc lineIcon" + str(i) + " icon", True): + return False + + return True + def Initialize(self): connected = False if not self.m_used: @@ -132,25 +192,12 @@ def Connect(self): log(xbmc.LOGERROR,"Connect: Telnet exception.") return False - # Build command to setup screen - cmd = "screen_add xbmc\n" - cmd += "screen_set xbmc -priority info\n" - if not settings_getHeartBeat(): - cmd += "screen_set xbmc -heartbeat off\n" - - cmd += self.GetWidgetsCmd() - - try: - #Send to server - self.tn.write(cmd) - self.tn.read_until("\n",3) - except: - log(xbmc.LOGERROR, "Connect: Telnet exception - send") - return False + if not self.SetupScreen(): + log(xbmc.LOGERROR, "Screen setup failed!") + return False return True - def CloseSocket(self): self.tn.close() @@ -167,16 +214,6 @@ def IsConnected(self): return False return True - def GetWidgetsCmd(self): - cmd = "" - for i in range(1,int(self.m_iRows)+1): - cmd += "widget_add xbmc lineScroller" + str(i) + " scroller\n" - for i in range(1,int(self.m_iRows)+1): - cmd += "widget_add xbmc lineString" + str(i) + " string\n" -# for i in range(1,int(self.m_iRows)+1): -# cmd += "widget_add xbmc lineProgress" + str(i) + " hbar\n" - return cmd - def SetBackLight(self, iLight): if self.tn.get_socket() == None: return From 1fa36a3197c631dcf4441c15990ea6f99f7975a2 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 8 Oct 2012 23:42:14 +0200 Subject: [PATCH 009/337] Setup default icon, use proper SendCommand() dialog in SetLine and don't try to wildly delete any widgets but rather use stuff we set up before, finally get rid of string/scroller difference --- script.xbmc.lcd/resources/lib/lcdproc.py | 41 ++++++++++-------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index d5693e1..fd7c5d6 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -117,6 +117,10 @@ def SetupScreen(self): if not self.SendCommand("widget_add xbmc lineIcon" + str(i) + " icon", True): return False + # Default icon + if not self.SendCommand("widget_set xbmc lineIcon" + str(i) + " 0 0 BLOCK_FILLED", True): + return False + return True def Initialize(self): @@ -307,34 +311,23 @@ def SetLine(self, iLine, strLine, bForce): if strLineLong != self.m_strLine[iLine] or bForce: ln = iLine + 1 - cmd = "" + if int(self.m_iProgressBarLine) >= 0 and self.m_iProgressBarLine == iLine: - cmd = "widget_add xbmc lineProgress%i hbar\n" % (ln) - cmd += "widget_set xbmc lineProgress%i 2 %i %i\n" % (ln, ln, self.m_iProgressBarWidth) - if settings_getScrollDelay() != 0: - cmd += "widget_set xbmc lineScroller%i 1 %i %i %i m %i [\n" % (ln, ln, self.m_iColumns, ln, settings_getScrollDelay()) - cmd += "widget_add xbmc lineScroller2%i scroller\n" % (ln) - cmd += "widget_set xbmc lineScroller2%i %i %i %i %i m %i ]\n" % (ln, self.m_iColumns, ln, self.m_iColumns, ln, settings_getScrollDelay()) - else: - cmd += "widget_set xbmc lineString%i 1 %i [\n" % (ln, ln) - cmd += "widget_add xbmc lineString2%i string\n" % (ln) - cmd += "widget_set xbmc lineString2%i %i %i ]\n" % (ln, self.m_iColumns, ln) - elif settings_getScrollDelay() != 0: - cmd = "widget_del xbmc lineScroller2%i\n" % (ln) - cmd += "widget_del xbmc lineProgress%i\n" % (ln) - cmd += "widget_set xbmc lineScroller%i 1 %i %i %i m %i \"%s\"\n" % (ln, ln, int(self.m_iColumns), ln, settings_getScrollDelay(), strLineLong) + barborder = "[" + " " * (self.m_iColumns - 2) + "]" + self.SendCommand("widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"" + barborder +"\"" % (ln, ln, self.m_iColumns, ln), False) + self.SendCommand("widget_set xbmc lineProgress%i 2 %i %i" % (ln, ln, self.m_iProgressBarWidth), False) else: - cmd = "widget_del xbmc lineString2%i\n" % (ln) - cmd += "widget_del xbmc lineProgress%i\n" % (ln) - cmd += "widget_set xbmc lineString%i 1 %i \"%s\"\n" % (ln, ln, strLineLong) + self.SendCommand("widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED" % (ln), False) + self.SendCommand("widget_set xbmc lineProgress%i 0 0 0" % (ln), False) + self.SendCommand("widget_set xbmc lineScroller%i 1 %i %i %i m %i \"%s\"" % (ln, ln, self.m_iColumns, ln, settings_getScrollDelay(), strLineLong), False) # Send to server - try: - self.tn.get_socket().send(cmd) #use the socket here for getting the special chars over the wire - self.tn.read_until("\n",3) - except: - log(xbmc.LOGERROR, "Unable to write to socket - SetLine") - self.CloseSocket() + #try: + # self.tn.get_socket().send(cmd) #use the socket here for getting the special chars over the wire + # self.tn.read_until("\n",3) + #except: + # log(xbmc.LOGERROR, "Unable to write to socket - SetLine") + # self.CloseSocket() self.m_strLine[iLine] = strLineLong From 18d20bea17bf5d69eb34b296242402d1aaa38e5d Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 8 Oct 2012 23:45:26 +0200 Subject: [PATCH 010/337] cleanup: Use SendCommand() for noop in IsConnected() - exceptions are handled in SendCommand, only need to properly return --- script.xbmc.lcd/resources/lib/lcdproc.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index fd7c5d6..95bf14c 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -208,14 +208,11 @@ def CloseSocket(self): def IsConnected(self): if self.tn.get_socket() == None: return False - - try: - self.tn.write("noop\n") - self.tn.read_until("\n",3) - except: - log(xbmc.LOGERROR, "Unable to write to socket - IsConnected") - self.CloseSocket() + + if not self.SendCommand("noop", True): + log(xbmc.LOGERROR, "noop failed in IsConnected(), aborting!") return False + return True def SetBackLight(self, iLight): From e2cc4cdf7a23fd53f8f211e83f8f80331c235c21 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 8 Oct 2012 23:53:20 +0200 Subject: [PATCH 011/337] fix: []-surroundings insertion python error --- script.xbmc.lcd/resources/lib/lcdproc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 95bf14c..75b4aea 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -311,7 +311,7 @@ def SetLine(self, iLine, strLine, bForce): if int(self.m_iProgressBarLine) >= 0 and self.m_iProgressBarLine == iLine: barborder = "[" + " " * (self.m_iColumns - 2) + "]" - self.SendCommand("widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"" + barborder +"\"" % (ln, ln, self.m_iColumns, ln), False) + self.SendCommand("widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"" % (ln, ln, self.m_iColumns, ln, barborder), False) self.SendCommand("widget_set xbmc lineProgress%i 2 %i %i" % (ln, ln, self.m_iProgressBarWidth), False) else: self.SendCommand("widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED" % (ln), False) From 554e586c30ab4e98c80cc246d08e758c600136f9 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 9 Oct 2012 21:08:54 +0200 Subject: [PATCH 012/337] (needs testing) Make sure LCDproc receives iso-8859-1 strings --- script.xbmc.lcd/resources/lib/lcdbase.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index d582f8e..32cafb0 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -68,6 +68,10 @@ def __init__(self): self.m_eCurrentCharset = CUSTOM_CHARSET.CUSTOM_CHARSET_DEFAULT self.m_lcdMode = [None] * LCD_MODE.LCD_MODE_MAX self.m_bDimmedOnPlayback = False + self.m_strInfoLabelEncoding = sys.getfilesystemencoding() + self.m_strLCDEncoding = "iso-8859-1" + + log(xbmc.LOGDEBUG, "Determined InfoLabelEncoding: " + self.m_strInfoLabelEncoding) # @abstractmethod def _concrete_method(self): @@ -366,6 +370,8 @@ def Render(self, mode, bForce): line = "p" + str(pixelsWidth) else: line = xbmc.getInfoLabel(self.m_lcdMode[mode][inLine]) + if self.m_strInfoLabelEncoding != self.m_strLCDEncoding: + line = line.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") self.SetProgressBar(0, -1) inLine += 1 From c65e7afda491743eeb68f539fc7a398d17fa4a6e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 9 Oct 2012 21:43:09 +0200 Subject: [PATCH 013/337] Escape strings in LCDproc command --- script.xbmc.lcd/resources/lib/lcdproc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 75b4aea..5974a22 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -316,7 +316,7 @@ def SetLine(self, iLine, strLine, bForce): else: self.SendCommand("widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED" % (ln), False) self.SendCommand("widget_set xbmc lineProgress%i 0 0 0" % (ln), False) - self.SendCommand("widget_set xbmc lineScroller%i 1 %i %i %i m %i \"%s\"" % (ln, ln, self.m_iColumns, ln, settings_getScrollDelay(), strLineLong), False) + self.SendCommand("widget_set xbmc lineScroller%i 1 %i %i %i m %i \"%s\"" % (ln, ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)), False) # Send to server #try: From 3be19c4be5d535b248e4d64f4e73ef1806442e86 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 9 Oct 2012 21:47:52 +0200 Subject: [PATCH 014/337] cosmetics, comments et al --- script.xbmc.lcd/lcdmain.py | 10 +++++----- script.xbmc.lcd/resources/lib/lcdbase.py | 6 +++--- script.xbmc.lcd/resources/lib/lcdproc.py | 12 ++---------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 2dfa7fd..356a09d 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -1,6 +1,6 @@ ''' - FHEM for XBMC - Copyright (C) 2011 Team XBMC + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -89,8 +89,8 @@ def process_lcd(): subMenu = xbmc.getInfoLabel("$INFO[System.CurrentControl]") settingsChanged = settings_didSettingsChange() mode = getLcdMode() - - #handle navigation + + #handle navigation if menu != g_oldMenu or subMenu != g_oldSubMenu or (g_timer + navtimeout) > time.time(): g_lcdproc.Render(LCD_MODE.LCD_MODE_NAVIGATION,settingsChanged) if menu != g_oldMenu or subMenu != g_oldSubMenu: @@ -102,7 +102,7 @@ def process_lcd(): g_lcdproc.SetBackLight(0) bBacklightDimmed = True g_lcdproc.Render(getLcdMode(),settingsChanged) - #turn the backlight on when leaving screensaver and it was dimmed + #turn the backlight on when leaving screensaver and it was dimmed if mode != LCD_MODE.LCD_MODE_SCREENSAVER and bBacklightDimmed: g_lcdproc.SetBackLight(1) bBacklightDimmed = False diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 32cafb0..f236875 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -1,6 +1,6 @@ ''' - LCD/VFD for XBMC - Copyright (C) 2011 Team XBMC + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -362,7 +362,7 @@ def Render(self, mode, bForce): while (outLine < int(self.GetRows()) and inLine < len(self.m_lcdMode[mode])): #parse the progressbar infolabel by ourselfs! if self.m_lcdMode[mode][inLine] == "$INFO[LCD.ProgressBar]": - # get playtime and duration and convert into seconds + # get playtime and duration and convert into seconds currentSecs = self.getCurrentTimeSecs() durationSecs = self.getCurrentDurationSecs() percent = self.GetProgressBarPercent(currentSecs,durationSecs) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 5974a22..b9161b3 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -1,6 +1,6 @@ ''' - LCD/VFD for XBMC - Copyright (C) 2011 Team XBMC + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -318,13 +318,5 @@ def SetLine(self, iLine, strLine, bForce): self.SendCommand("widget_set xbmc lineProgress%i 0 0 0" % (ln), False) self.SendCommand("widget_set xbmc lineScroller%i 1 %i %i %i m %i \"%s\"" % (ln, ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)), False) - # Send to server - #try: - # self.tn.get_socket().send(cmd) #use the socket here for getting the special chars over the wire - # self.tn.read_until("\n",3) - #except: - # log(xbmc.LOGERROR, "Unable to write to socket - SetLine") - # self.CloseSocket() - self.m_strLine[iLine] = strLineLong From 4476d9106b3791173ef7948fb07bcc5beae97079 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 9 Oct 2012 21:49:10 +0200 Subject: [PATCH 015/337] Remove GetBigDigit(), will later be superseeded by num-widgets --- script.xbmc.lcd/resources/lib/lcdbase.py | 161 ----------------------- 1 file changed, 161 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index f236875..129fd5c 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -119,167 +119,6 @@ def SetCharset(self,_nCharset): if _nCharset < CUSTOM_CHARSET.CUSTOM_CHARSET_MAX: self.m_eCurrentCharset = _nCharset - def GetBigDigit(self,_nCharset, _nDigit, _nLine, _nMinSize, _nMaxSize, _bSpacePadding): - # Get the partial digit(s) for the given line - # that is needed to build a big character - nCurrentSize = 0 - nCurrentValue = 0 - nValue = 0 - strDigits = "" - strCurrentDigit = "" - - # If the charset doesn't match our - # custom chars, return with nothing - # The XBMC 'icon' charset - if ( _nCharset == CUSTOM_CHARSET.CUSTOM_CHARSET_DEFAULT ) or ( _nCharset >= CUSTOM_CHARSET.CUSTOM_CHARSET_MAX ): - return "" - - arrSizes = [ - [ 1, 1 ], - [ 1, 2 ], - [ 2, 2 ], - [ 3, 4 ]] - - # Return with nothing if the linenumber falls outside our char 'height' - if _nLine > arrSizes[ _nCharset ][1]: - return "" - - # Define the 2x1 line characters - arrMedNumbers = [ - [[0x0a], [0x0c]], # 0 - [[0x08], [0x08]], # 1 # 0xaf - [[0x0e], [0x0d]], # 2 - [[0x09], [0x0b]], # 3 - [[0x0c], [0x08]], # 4 - [[0x0d], [0x0b]], # 5 - [[0x0d], [0x0c]], # 6 - [[0x0e], [0x08]], # 7 - [[0x0f], [0x0c]], # 8 - [[0x0f], [0x0b]]] # 9 - - # Define the 2x2 bold line characters - arrMedBoldNumbers = [ - [[0x0b, 0x0e], [0x0a, 0x0f]], #0 - [[0x0e, 0x20], [0x0f, 0x09]], #1 - [[0x08, 0x0d], [0x0c, 0x09]], #2 - [[0x08, 0x0d], [0x09, 0x0f]], #3 - [[0x0a, 0x0f], [0x20, 0x0e]], #4 - [[0x0c, 0x08], [0x09, 0x0d]], #5 - [[0x0b, 0x08], [0x0c, 0x0d]], #6 - [[0x08, 0x0e], [0x20, 0x0e]], #7 - [[0x0c, 0x0d], [0x0a, 0x0f]], #8 - [[0x0c, 0x0d], [0x09, 0x0f]]] # 9 - - # Define the 4 line characters (this could be more readable, but that may take up to 3 screens) - arrBigNumbers = [ - [ - [0x08, 0xa0, 0x09], # 0 - [0xa0, 0x20, 0xa0], # 0 - [0xa0, 0x20, 0xa0], # 0 - [0x0b, 0xa0, 0x0a], # 0 - ], - [ - [0x08, 0xa0, 0x20], # 1 - [0x20, 0xa0, 0x20], # 1 - [0x20, 0xa0, 0x20], # 1 - [0xa0, 0xa0, 0xa0], # 1 - ], - [ - [0x08, 0xa0, 0x09], # 2 - [0x20, 0x08, 0x0a], # 2 - [0x08, 0x0a, 0x20], # 2 - [0xa0, 0xa0, 0xa0], # 2 - ], - [ - [0x08, 0xa0, 0x09], # 3 - [0x20, 0x20, 0xa0], # 3 - [0x20, 0x0c, 0xa0], # 3 - [0x0b, 0xa0, 0x0a], # 3 - ], - [ - [0xa0, 0x20, 0xa0], # 4 - [0xa0, 0xa0, 0xa0], # 4 - [0x20, 0x20, 0xa0], # 4 - [0x20, 0x20, 0xa0], # 4 - ], - [ - [0xa0, 0xa0, 0xa0], # 5 - [0xa0, 0x20, 0x20], # 5 - [0x20, 0x0c, 0xa0], # 5 - [0xa0, 0xa0, 0x0a], # 5 - ], - [ - [0x08, 0xa0, 0x09], # 6 - [0xa0, 0x20, 0x20], # 6 - [0xa0, 0x0c, 0xa0], # 6 - [0x0b, 0xa0, 0x0a], # 6 - ], - [ - [0xa0, 0xa0, 0xa0], # 7 - [0x20, 0x20, 0xa0], # 7 - [0x20, 0x20, 0xa0], # 7 - [0x20, 0x20, 0xa0], # 7 - ], - [ - [0x08, 0xa0, 0x09], # 8 - [0xa0, 0x20, 0xa0], # 8 - [0xa0, 0x0c, 0xa0], # 8 - [0x0b, 0xa0, 0x0a], # 8 - ], - [ - [0x08, 0xa0, 0x09], # 9 - [0xa0, 0x20, 0xa0], # 9 - [0x20, 0x0c, 0xa0], # 9 - [0x0b, 0xa0, 0x0a], # 9 - ], - ] - - - if _nDigit < 0: - # TODO: Add a '-' sign - _nDigit = -_nDigit - - # Set the current size, and value (base numer) - nCurrentSize = 1 - nCurrentValue = 10 - - # Build the characters - strDigits = "" - - while ( nCurrentSize <= _nMinSize ) or ( _nDigit >= nCurrentValue and (nCurrentSize <= _nMaxSize or _nMaxSize == 0) ): - # Determine current value - nValue = ( _nDigit % nCurrentValue ) / ( nCurrentValue / 10 ) - - # Reset current digit - strCurrentDigit = "" - for nX in range(0, arrSizes[ _nCharset ][0]): - # Add a space if we have more than one digit, and the given - # digit is smaller than the current value (base numer) we are dealing with - if _bSpacePadding and ((nCurrentValue / 10) > _nDigit ) and ( nCurrentSize > 1 ): - strCurrentDigit += " " - # TODO: make sure this is not hardcoded - else: - if _nCharset == CUSTOM_CHARSET.CUSTOM_CHARSET_SMALLCHAR: - strCurrentDigit += arrMedNumbers[ nValue ][ _nLine ][ nX ] - elif _nCharset == CUSTOM_CHARSET.CUSTOM_CHARSET_SMALLCHAR: - strCurrentDigit += arrMedBoldNumbers[ nValue ][ _nLine ][ nX ] - elif _nCharset == CUSTOM_CHARSET.CUSTOM_CHARSET_BIGCHAR: - strCurrentDigit += arrBigNumbers[ nValue ][ _nLine ][ nX ] - - # Add as partial string - # Note that is it reversed, I.E. 'LSB' is added first - strDigits = strCurrentDigit + strDigits - - # Increase the size and base number - nCurrentSize += 1 - nCurrentValue *= 10 - - # Update the character mode - m_eCurrentCharset = _nCharset - - # Return the created digit part - return strDigits - def Initialize(self): self.m_eCurrentCharset = CUSTOM_CHARSET.CUSTOM_CHARSET_DEFAULT self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE From 5ea2712e703dd01651a8c12df7164142ff788401 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 9 Oct 2012 22:04:28 +0200 Subject: [PATCH 016/337] SendCommand(): Rearrange to ignore multiple "unwanted" responses --- script.xbmc.lcd/resources/lib/lcdproc.py | 29 ++++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index b9161b3..35b3531 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -61,31 +61,46 @@ def __init__(self): def SendCommand(self, strCmd, bCheckRet): try: - # Send to server and read reply + # Send to server self.tn.write(strCmd + "\n") - reply = self.tn.read_until("\n",3) except: # Something bad happened, abort log(xbmc.LOGERROR, "SendCommand: Telnet exception - send") return False - if not bCheckRet: - return True # no return checking desired, so be fine - - if reply[:6] == 'listen' or reply[:6] == 'ignore': + # Read in (multiple) responses + while True: try: + # Read server reply reply = self.tn.read_until("\n",3) except: - # Reread failed, abort + # (Re)read failed, abort log(xbmc.LOGERROR, "SendCommand: Telnet exception - reread") return False + # Skip these messages + if reply[:6] == 'listen': + continue + elif reply[:6] == 'ignore': + continue + elif reply[:3] == 'key': + continue + elif reply[:9] == 'menuevent': + continue + + # Response seems interesting, so stop here + break + + if not bCheckRet: + return True # no return checking desired, so be fine + if strCmd == 'noop' and reply == 'noop complete\n': return True # noop has special reply if reply == 'success\n': return True + # Leave information something undesired happened log(xbmc.LOGWARNING, "Reply to '" + strCmd +"' was '" + reply) return False From fe531e80c2297995819fcdeec81d80379ac0fd72 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 9 Oct 2012 22:18:07 +0200 Subject: [PATCH 017/337] More send/reply->SendCommand() cleanup --- script.xbmc.lcd/resources/lib/lcdproc.py | 28 +++++++----------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 35b3531..b2799f6 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -236,21 +236,16 @@ def SetBackLight(self, iLight): log(xbmc.LOGDEBUG, "Switch Backlight to: " + str(iLight)) # Build command - cmd = "" if iLight == 0: self.m_bStop = True - cmd += "screen_set xbmc -backlight off\n" + cmd = "screen_set xbmc -backlight off\n" elif iLight > 0: self.m_bStop = False - cmd += "screen_set xbmc -backlight on\n" - cmd += self.GetWidgetsCmd() + cmd = "screen_set xbmc -backlight on\n" # Send to server - try: - self.tn.write(cmd) - self.tn.read_until("\n",3) - except: - log(xbmc.LOGERROR, "Unable to write to socket - SetBackLight") + if not self.SendCommand(cmd, True): + log(xbmc.LOGERROR, "SetBackLight(): Cannot change backlight state") self.CloseSocket() def SetContrast(self, iContrast): @@ -269,11 +264,8 @@ def Suspend(self): cmd = "screen_set xbmc -priority hidden\n" # Send to server - try: - self.tn.write(cmd) - self.tn.read_until("\n",3) - except: - log(xbmc.LOGERROR, "Unable to write to socket - Suspend") + if not self.SendCommand(cmd, True): + log(xbmc.LOGERROR, "Suspend(): Cannot suspend") self.CloseSocket() def Resume(self): @@ -284,11 +276,8 @@ def Resume(self): cmd = "screen_set xbmc -priority info\n" # Send to server - try: - self.tn.write(cmd) - self.tn.read_until("\n",3) - except: - log(xbmc.LOGERROR, "Unable to write to socket - Resume") + if not self.SendCommand(cmd, True): + log(xbmc.LOGERROR, "Resume(): Cannot resume") self.CloseSocket() def GetColumns(self): @@ -334,4 +323,3 @@ def SetLine(self, iLine, strLine, bForce): self.SendCommand("widget_set xbmc lineScroller%i 1 %i %i %i m %i \"%s\"" % (ln, ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)), False) self.m_strLine[iLine] = strLineLong - From f3fa08e675f5d09d1652060f3db6cb1277b85bef Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 9 Oct 2012 22:41:07 +0200 Subject: [PATCH 018/337] Don't ping LCDproc more than every 2 (m_timeSocketIdleTimeout) seconds and only if nothing happened --- script.xbmc.lcd/resources/lib/lcdproc.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index b2799f6..4c37514 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -54,6 +54,8 @@ def __init__(self): self.m_initRetryInterval = INIT_RETRY_INTERVAL self.m_used = True self.tn = telnetlib.Telnet() + self.m_timeLastSockAction = time.time() + self.m_timeSocketIdleTimeout = 2 self.m_strLine = [None]*MAX_ROWS self.m_iProgressBarWidth = 0 self.m_iProgressBarLine = -1 @@ -68,6 +70,9 @@ def SendCommand(self, strCmd, bCheckRet): log(xbmc.LOGERROR, "SendCommand: Telnet exception - send") return False + # Update last socketaction timestamp + self.m_timeLastSockAction = time.time() + # Read in (multiple) responses while True: try: @@ -224,6 +229,10 @@ def IsConnected(self): if self.tn.get_socket() == None: return False + # Ping only every SocketIdleTimeout seconds + if (self.m_timeLastSockAction + self.m_timeSocketIdleTimeout) > time.time(): + return True + if not self.SendCommand("noop", True): log(xbmc.LOGERROR, "noop failed in IsConnected(), aborting!") return False From c6ce414b94f510f6b5c1af83a39f82e6d02d7400 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 9 Oct 2012 23:13:43 +0200 Subject: [PATCH 019/337] Adjust SetLine and SendCommand to support pushing multiple commands at once --- script.xbmc.lcd/resources/lib/lcdproc.py | 88 ++++++++++++++---------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 4c37514..aa8ac91 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -62,6 +62,13 @@ def __init__(self): LcdBase.__init__(self) def SendCommand(self, strCmd, bCheckRet): + numcmds = string.count(strCmd, '\n') + ret = True + + # Single command without lf + if numcmds < 1: + numcmds = 1 + try: # Send to server self.tn.write(strCmd + "\n") @@ -73,41 +80,47 @@ def SendCommand(self, strCmd, bCheckRet): # Update last socketaction timestamp self.m_timeLastSockAction = time.time() - # Read in (multiple) responses - while True: - try: - # Read server reply - reply = self.tn.read_until("\n",3) - except: - # (Re)read failed, abort - log(xbmc.LOGERROR, "SendCommand: Telnet exception - reread") - return False - - # Skip these messages - if reply[:6] == 'listen': - continue - elif reply[:6] == 'ignore': - continue - elif reply[:3] == 'key': - continue - elif reply[:9] == 'menuevent': - continue - - # Response seems interesting, so stop here - break + # Repeat for number of found commands + for i in range(1, (numcmds + 1)): + # Read in (multiple) responses + while True: + try: + # Read server reply + reply = self.tn.read_until("\n",3) + except: + # (Re)read failed, abort + log(xbmc.LOGERROR, "SendCommand: Telnet exception - reread") + return False + + # Skip these messages + if reply[:6] == 'listen': + continue + elif reply[:6] == 'ignore': + continue + elif reply[:3] == 'key': + continue + elif reply[:9] == 'menuevent': + continue + + # Response seems interesting, so stop here + break - if not bCheckRet: - return True # no return checking desired, so be fine + if not bCheckRet: + continue # no return checking desired, so be fine - if strCmd == 'noop' and reply == 'noop complete\n': - return True # noop has special reply + if strCmd == 'noop' and reply == 'noop complete\n': + continue # noop has special reply - if reply == 'success\n': - return True + if reply == 'success\n': + continue + + ret = False # Leave information something undesired happened - log(xbmc.LOGWARNING, "Reply to '" + strCmd +"' was '" + reply) - return False + if ret is False: + log(xbmc.LOGWARNING, "Reply to '" + strCmd +"' was '" + reply) + + return ret def SetupScreen(self): # Add screen first @@ -322,13 +335,18 @@ def SetLine(self, iLine, strLine, bForce): if strLineLong != self.m_strLine[iLine] or bForce: ln = iLine + 1 + cmdlist = "" + if int(self.m_iProgressBarLine) >= 0 and self.m_iProgressBarLine == iLine: barborder = "[" + " " * (self.m_iColumns - 2) + "]" - self.SendCommand("widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"" % (ln, ln, self.m_iColumns, ln, barborder), False) - self.SendCommand("widget_set xbmc lineProgress%i 2 %i %i" % (ln, ln, self.m_iProgressBarWidth), False) + cmdlist += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, barborder) + cmdlist += "widget_set xbmc lineProgress%i 2 %i %i\n" % (ln, ln, self.m_iProgressBarWidth) else: - self.SendCommand("widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED" % (ln), False) - self.SendCommand("widget_set xbmc lineProgress%i 0 0 0" % (ln), False) - self.SendCommand("widget_set xbmc lineScroller%i 1 %i %i %i m %i \"%s\"" % (ln, ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)), False) + cmdlist += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (ln) + cmdlist += "widget_set xbmc lineProgress%i 0 0 0\n" % (ln) + cmdlist += "widget_set xbmc lineScroller%i 1 %i %i %i m %i \"%s\"\n" % (ln, ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)) + + # Send complete command package + self.SendCommand(cmdlist, False) self.m_strLine[iLine] = strLineLong From 01115d04704117dc7f2704b0571cf325288853c1 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 9 Oct 2012 23:42:36 +0200 Subject: [PATCH 020/337] Make SetLine() collect a bunch of commands, when done let Render() flush them at once - this should greatly improve performace especially with real hardware displays (xosd et al seemed not to be performance bottlenecks) --- script.xbmc.lcd/resources/lib/lcdbase.py | 6 ++++ script.xbmc.lcd/resources/lib/lcdproc.py | 37 ++++++++++++++---------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 129fd5c..a0b6e9b 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -99,6 +99,10 @@ def SetContrast(self, iContrast): # @abstractmethod def SetLine(self, iLine, strLine): pass + +# @abstractmethod + def FlushLines(self): + pass # @abstractmethod def GetColumns(self): @@ -225,6 +229,8 @@ def Render(self, mode, bForce): self.SetLine(outLine, "", bForce) outLine += 1 + self.FlushLines() + def DisableOnPlayback(self, playingVideo, playingAudio): if (playingVideo and (self.m_disableOnPlay & DISABLE_ON_PLAY.DISABLE_ON_PLAY_VIDEO)) or (playingAudio and (self.m_disableOnPlay & DISABLE_ON_PLAY.DISABLE_ON_PLAY_MUSIC)): if not self.m_bDimmedOnPlayback: diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index aa8ac91..77bba76 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -59,19 +59,22 @@ def __init__(self): self.m_strLine = [None]*MAX_ROWS self.m_iProgressBarWidth = 0 self.m_iProgressBarLine = -1 + self.m_strSetLineCmds = "" LcdBase.__init__(self) def SendCommand(self, strCmd, bCheckRet): - numcmds = string.count(strCmd, '\n') + countcmds = string.count(strCmd, '\n') + sendcmd = strCmd ret = True # Single command without lf - if numcmds < 1: - numcmds = 1 + if countcmds < 1: + #countcmds = 1 + sendcmd += "\n" try: # Send to server - self.tn.write(strCmd + "\n") + self.tn.write(sendcmd) except: # Something bad happened, abort log(xbmc.LOGERROR, "SendCommand: Telnet exception - send") @@ -81,7 +84,7 @@ def SendCommand(self, strCmd, bCheckRet): self.m_timeLastSockAction = time.time() # Repeat for number of found commands - for i in range(1, (numcmds + 1)): + for i in range(1, (countcmds + 1)): # Read in (multiple) responses while True: try: @@ -335,18 +338,22 @@ def SetLine(self, iLine, strLine, bForce): if strLineLong != self.m_strLine[iLine] or bForce: ln = iLine + 1 - cmdlist = "" - if int(self.m_iProgressBarLine) >= 0 and self.m_iProgressBarLine == iLine: barborder = "[" + " " * (self.m_iColumns - 2) + "]" - cmdlist += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, barborder) - cmdlist += "widget_set xbmc lineProgress%i 2 %i %i\n" % (ln, ln, self.m_iProgressBarWidth) + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, barborder) + self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 2 %i %i\n" % (ln, ln, self.m_iProgressBarWidth) else: - cmdlist += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (ln) - cmdlist += "widget_set xbmc lineProgress%i 0 0 0\n" % (ln) - cmdlist += "widget_set xbmc lineScroller%i 1 %i %i %i m %i \"%s\"\n" % (ln, ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)) - - # Send complete command package - self.SendCommand(cmdlist, False) + self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (ln) + self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (ln) + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m %i \"%s\"\n" % (ln, ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)) self.m_strLine[iLine] = strLineLong + + def FlushLines(self): + #log(xbmc.LOGDEBUG, "Flushing Command List:" + self.m_strSetLineCmds) + + if len(self.m_strSetLineCmds) > 0: + # Send complete command package + self.SendCommand(self.m_strSetLineCmds, False) + + self.m_strSetLineCmds = "" From 58954257da43b2494c186d942df1b237eee15357 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 11 Oct 2012 20:43:24 +0200 Subject: [PATCH 021/337] currentTime/currentDur: prevent script error if InfoLabel response is invalid, additionally prevent divbyzero in GetProgressBarPercent() --- script.xbmc.lcd/resources/lib/lcdbase.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index a0b6e9b..5c34de7 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -117,6 +117,9 @@ def SetProgressBar(self, percent, lineIdx): pass def GetProgressBarPercent(self, tCurrent, tTotal): + if float(tTotal) == 0.0: + return 0 + return float(tCurrent)/float(tTotal) def SetCharset(self,_nCharset): @@ -192,10 +195,16 @@ def timeToSecs(self, timeAr): def getCurrentTimeSecs(self): currentTimeAr = xbmc.getInfoLabel("Player.Time").split(":") + if currentTimeAr[0] == "": + return 0 + return self.timeToSecs(currentTimeAr) def getCurrentDurationSecs(self): currentDurationAr = xbmc.getInfoLabel("Player.Duration").split(":") + if currentDurationAr[0] == "": + return 0 + return self.timeToSecs(currentDurationAr) def Render(self, mode, bForce): From 18e7975fc0aa3b130fc65781b35ed87464e70ceb Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 11 Oct 2012 21:01:33 +0200 Subject: [PATCH 022/337] ClearDisplay() clears all widgets, call on DisplayOnPlayback(..) --- script.xbmc.lcd/resources/lib/lcdbase.py | 5 +++++ script.xbmc.lcd/resources/lib/lcdproc.py | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 5c34de7..fbde786 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -100,6 +100,10 @@ def SetContrast(self, iContrast): def SetLine(self, iLine, strLine): pass +# @abstractmethod + def ClearDisplay(self): + pass + # @abstractmethod def FlushLines(self): pass @@ -245,6 +249,7 @@ def DisableOnPlayback(self, playingVideo, playingAudio): if not self.m_bDimmedOnPlayback: self.SetBackLight(0) self.m_bDimmedOnPlayback = True + self.ClearDisplay() elif self.m_bDimmedOnPlayback: self.SetBackLight(1) self.m_bDimmedOnPlayback = False diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 77bba76..1a79578 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -349,6 +349,21 @@ def SetLine(self, iLine, strLine, bForce): self.m_strLine[iLine] = strLineLong + def ClearDisplay(self): + log(xbmc.LOGDEBUG, "Clearing display contents") + + # clear line buffer first + self.FlushLines() + + # set all widgets to empty stuff and/or offscreen + for i in range(1,int(self.m_iRows)+1): + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"\"\n" % (i, i, self.m_iColumns, i) + self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (i) + self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (i) + + # send to display + self.FlushLines() + def FlushLines(self): #log(xbmc.LOGDEBUG, "Flushing Command List:" + self.m_strSetLineCmds) From 75ddf20c8fe386a6f639e9b1da6eb75963451582 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 11 Oct 2012 21:06:26 +0200 Subject: [PATCH 023/337] whitespace, infocomment --- script.xbmc.lcd/resources/lib/lcdbase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index fbde786..d8de7dd 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -69,7 +69,7 @@ def __init__(self): self.m_lcdMode = [None] * LCD_MODE.LCD_MODE_MAX self.m_bDimmedOnPlayback = False self.m_strInfoLabelEncoding = sys.getfilesystemencoding() - self.m_strLCDEncoding = "iso-8859-1" + self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! log(xbmc.LOGDEBUG, "Determined InfoLabelEncoding: " + self.m_strInfoLabelEncoding) @@ -149,7 +149,7 @@ def LoadSkin(self, xmlFile): #PARSE LCD infos if element.tag == "lcd": # load our settings - disableOnPlay = element.find("disableonplay") + disableOnPlay = element.find("disableonplay") if disableOnPlay != None: self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE if str(disableOnPlay.text).find("video") >= 0: From 868b61d0b7b501654394700cd55cbe8061e30296 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 11 Oct 2012 21:16:46 +0200 Subject: [PATCH 024/337] configurable scroll separator (LCD.xml: ) --- script.xbmc.lcd/resources/lib/lcdbase.py | 10 +++++++++- script.xbmc.lcd/resources/lib/lcdproc.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index d8de7dd..b5b067f 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -70,6 +70,7 @@ def __init__(self): self.m_bDimmedOnPlayback = False self.m_strInfoLabelEncoding = sys.getfilesystemencoding() self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! + self.m_strScrollSeparator = " " log(xbmc.LOGDEBUG, "Determined InfoLabelEncoding: " + self.m_strInfoLabelEncoding) @@ -156,7 +157,14 @@ def LoadSkin(self, xmlFile): self.m_disableOnPlay += DISABLE_ON_PLAY.DISABLE_ON_PLAY_VIDEO if str(disableOnPlay.text).find("music") >= 0: self.m_disableOnPlay += DISABLE_ON_PLAY.DISABLE_ON_PLAY_MUSIC - #load moads + + scrollSeparator = element.find("scrollseparator") + if scrollSeparator != None: + + if str(scrollSeparator.text).strip() != "": + self.m_strScrollSeparator = " " + scrollSeparator.text + " " + + #load modes tmpMode = element.find("music") self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_MUSIC) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 1a79578..f4a5071 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -333,7 +333,7 @@ def SetLine(self, iLine, strLine, bForce): numSpaces = int(self.m_iColumns) - len(strLineLong) strLineLong.ljust(numSpaces) #pad with spaces elif len(strLineLong) > int(self.m_iColumns): #else if the string doesn't fit the display, lcdproc will scroll it, so we need a space - strLineLong += " " + strLineLong += self.m_strScrollSeparator if strLineLong != self.m_strLine[iLine] or bForce: ln = iLine + 1 From 216aaf109652ae7185015d97cab97e1b95273adb Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Fri, 12 Oct 2012 00:03:25 +0200 Subject: [PATCH 025/337] Initial work on supporting different line types --- script.xbmc.lcd/resources/lib/lcdbase.py | 55 +++++++++++++++++++----- script.xbmc.lcd/resources/lib/lcdproc.py | 22 ++++------ 2 files changed, 53 insertions(+), 24 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index b5b067f..fc3390a 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -35,7 +35,13 @@ __lcdxml__ = xbmc.translatePath( os.path.join("special://masterprofile","LCD.xml")) from settings import * - + +g_dictEmptyLineDescriptor = {} +g_dictEmptyLineDescriptor['type'] = str("text") +g_dictEmptyLineDescriptor['startx'] = int(0) +g_dictEmptyLineDescriptor['text'] = str("") +g_dictEmptyLineDescriptor['endx'] = int(0) + # global functions def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,),level=loglevel ) @@ -98,7 +104,7 @@ def SetContrast(self, iContrast): pass # @abstractmethod - def SetLine(self, iLine, strLine): + def SetLine(self, iLine, strLine, dictDescriptor, bForce): pass # @abstractmethod @@ -164,6 +170,13 @@ def LoadSkin(self, xmlFile): if str(scrollSeparator.text).strip() != "": self.m_strScrollSeparator = " " + scrollSeparator.text + " " + self.m_bProgressbarSurroundings = False + + progressbarSurroundings = element.find("progressbarsurroundings") + if progressbarSurroundings != None: + if str(progressbarSurroundings.text) == "on": + self.m_bProgressbarSurroundings = True + #load modes tmpMode = element.find("music") self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_MUSIC) @@ -187,8 +200,29 @@ def LoadSkin(self, xmlFile): def LoadMode(self, node, mode): if node == None: return + for line in node.findall("line"): - self.m_lcdMode[mode].append(str(line.text)) + linedescriptor = {} + linetext = line.text + + if str(linetext).find("$INFO[LCD.ProgressBar]") >= 0: + linedescriptor['type'] = str("progressbar") + linedescriptor['startx'] = int(1) + linedescriptor['text'] = "" + linedescriptor['endx'] = int(self.m_iCellWidth) * int(self.m_iColumns) + + if self.m_bProgressbarSurroundings == True: + linedescriptor['startx'] = int(2) + linedescriptor['text'] = "[" + " " * (self.m_iColumns - 2) + "]" + linedescriptor['endx'] = int(self.m_iCellWidth) * (int(self.GetColumns()) - 2) + + else: + linedescriptor['type'] = str("text") + linedescriptor['startx'] = int(1) + linedescriptor['text'] = str(linetext) + linedescriptor['endx'] = int(self.GetColumns()) + + self.m_lcdMode[mode].append(linedescriptor) def Reset(self): self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE @@ -225,29 +259,28 @@ def Render(self, mode, bForce): while (outLine < int(self.GetRows()) and inLine < len(self.m_lcdMode[mode])): #parse the progressbar infolabel by ourselfs! - if self.m_lcdMode[mode][inLine] == "$INFO[LCD.ProgressBar]": + if self.m_lcdMode[mode][inLine]['type'] == "progressbar": # get playtime and duration and convert into seconds currentSecs = self.getCurrentTimeSecs() durationSecs = self.getCurrentDurationSecs() percent = self.GetProgressBarPercent(currentSecs,durationSecs) - pixelsWidth = self.SetProgressBar(percent, outLine) + pixelsWidth = self.SetProgressBar(percent, self.m_lcdMode[mode][inLine]['endx']) line = "p" + str(pixelsWidth) else: - line = xbmc.getInfoLabel(self.m_lcdMode[mode][inLine]) + line = xbmc.getInfoLabel(self.m_lcdMode[mode][inLine]['text']) if self.m_strInfoLabelEncoding != self.m_strLCDEncoding: line = line.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") self.SetProgressBar(0, -1) - inLine += 1 if len(line) > 0: -# log(xbmc.LOGDEBUG, "Request write of line" + str(outLine) + ": " + str(line)) - self.SetLine(outLine, line, bForce) + self.SetLine(outLine, line, self.m_lcdMode[mode][inLine], bForce) outLine += 1 + inLine += 1 + # fill remainder with empty space while outLine < int(self.GetRows()): -# log(xbmc.LOGDEBUG, "Request write of emptyline" + str(outLine)) - self.SetLine(outLine, "", bForce) + self.SetLine(outLine, "", g_dictEmptyLineDescriptor, bForce) outLine += 1 self.FlushLines() diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index f4a5071..2bf3b7f 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -170,8 +170,6 @@ def Initialize(self): return False self.m_lastInitAttempt = now - LcdBase.Initialize(self) - if self.Connect(): # reset the retry interval after a successful connect self.m_initRetryInterval = INIT_RETRY_INTERVAL @@ -189,6 +187,8 @@ def Initialize(self): self.m_initRetryInterval = self.m_initRetryInterval * 2 log(xbmc.LOGERROR,"Connect failed. Retry in %d seconds." % self.m_initRetryInterval) + LcdBase.Initialize(self) + return connected def Connect(self): @@ -308,17 +308,14 @@ def Resume(self): def GetColumns(self): return int(self.m_iColumns) - def SetProgressBar(self, percent, lineIdx): - iColumns = int(self.m_iColumns) - 2 # -2 because of [surroundings] - iNumHorPixels = int(self.m_iCellWidth) * int(iColumns) - self.m_iProgressBarWidth = int(float(percent) * iNumHorPixels) - self.m_iProgressBarLine = lineIdx + def SetProgressBar(self, percent, pxWidth): + self.m_iProgressBarWidth = int(float(percent) * pxWidth) return self.m_iProgressBarWidth def GetRows(self): return int(self.m_iRows) - def SetLine(self, iLine, strLine, bForce): + def SetLine(self, iLine, strLine, dictDescriptor, bForce): if self.m_bStop or self.tn.get_socket() == None: return @@ -338,14 +335,13 @@ def SetLine(self, iLine, strLine, bForce): if strLineLong != self.m_strLine[iLine] or bForce: ln = iLine + 1 - if int(self.m_iProgressBarLine) >= 0 and self.m_iProgressBarLine == iLine: - barborder = "[" + " " * (self.m_iColumns - 2) + "]" - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, barborder) - self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 2 %i %i\n" % (ln, ln, self.m_iProgressBarWidth) + if dictDescriptor['type'] == "progressbar": + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text']) + self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, dictDescriptor['startx'], ln, self.m_iProgressBarWidth) else: self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (ln) self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (ln) - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m %i \"%s\"\n" % (ln, ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)) + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i m %i \"%s\"\n" % (ln, dictDescriptor['startx'], ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)) self.m_strLine[iLine] = strLineLong From 2edbd059c05be6c97ae1a0452cc9803069dda9f2 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 15:46:43 +0200 Subject: [PATCH 026/337] Don't Initialize() when not connected --- script.xbmc.lcd/resources/lib/lcdproc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 2bf3b7f..1f7af22 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -186,8 +186,8 @@ def Initialize(self): else: self.m_initRetryInterval = self.m_initRetryInterval * 2 log(xbmc.LOGERROR,"Connect failed. Retry in %d seconds." % self.m_initRetryInterval) - - LcdBase.Initialize(self) + else: + LcdBase.Initialize(self) return connected From 848e6bdf7e0e242e6da5d982c69ec11a937b721a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 16:15:06 +0200 Subject: [PATCH 027/337] ClearLine() clears all widget of diplay line iLine --- script.xbmc.lcd/resources/lib/lcdproc.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 1f7af22..cc6612b 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -315,6 +315,12 @@ def SetProgressBar(self, percent, pxWidth): def GetRows(self): return int(self.m_iRows) + def ClearLine(self, iLine): + ln = iLine + 1 + self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (ln) + self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (ln) + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"\"\n" % (ln, ln, self.m_iColumns, ln) + def SetLine(self, iLine, strLine, dictDescriptor, bForce): if self.m_bStop or self.tn.get_socket() == None: return From b27bff63ebee87a65f767a4d6b672dcdf4ad2ec0 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 16:17:20 +0200 Subject: [PATCH 028/337] Assume 1-based linenum in ClearLine(), use ClearLine() in ClearDisplay() --- script.xbmc.lcd/resources/lib/lcdproc.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index cc6612b..f52433c 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -316,10 +316,9 @@ def GetRows(self): return int(self.m_iRows) def ClearLine(self, iLine): - ln = iLine + 1 - self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (ln) - self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (ln) - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"\"\n" % (ln, ln, self.m_iColumns, ln) + self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (iLine) + self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (iLine) + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"\"\n" % (iLine, iLine, self.m_iColumns, iLine) def SetLine(self, iLine, strLine, dictDescriptor, bForce): if self.m_bStop or self.tn.get_socket() == None: @@ -359,9 +358,7 @@ def ClearDisplay(self): # set all widgets to empty stuff and/or offscreen for i in range(1,int(self.m_iRows)+1): - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"\"\n" % (i, i, self.m_iColumns, i) - self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (i) - self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (i) + ClearLine(i) # send to display self.FlushLines() From 3bc58066011cb6a590e3a88e9cc4a6043cb78576 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 16:23:44 +0200 Subject: [PATCH 029/337] Have "caches" for type, text (content) and active icon --- script.xbmc.lcd/resources/lib/lcdproc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index f52433c..7b6e0b4 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -56,7 +56,9 @@ def __init__(self): self.tn = telnetlib.Telnet() self.m_timeLastSockAction = time.time() self.m_timeSocketIdleTimeout = 2 - self.m_strLine = [None]*MAX_ROWS + self.m_strLineText = [None]*MAX_ROWS + self.m_strLineType = [None]*MAX_ROWS + self.m_strLineIcon = [None]*MAX_ROWS self.m_iProgressBarWidth = 0 self.m_iProgressBarLine = -1 self.m_strSetLineCmds = "" @@ -337,7 +339,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): elif len(strLineLong) > int(self.m_iColumns): #else if the string doesn't fit the display, lcdproc will scroll it, so we need a space strLineLong += self.m_strScrollSeparator - if strLineLong != self.m_strLine[iLine] or bForce: + if strLineLong != self.m_strLineText[iLine] or bForce: ln = iLine + 1 if dictDescriptor['type'] == "progressbar": @@ -348,7 +350,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (ln) self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i m %i \"%s\"\n" % (ln, dictDescriptor['startx'], ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)) - self.m_strLine[iLine] = strLineLong + self.m_strLineText[iLine] = strLineLong def ClearDisplay(self): log(xbmc.LOGDEBUG, "Clearing display contents") From 65cef64049701b5bb48bed4892dbb4640a9b5357 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 16:31:07 +0200 Subject: [PATCH 030/337] Use ClearLine() on line setup, optimize widget setting, fix call of ClearLine in ClearDisplay --- script.xbmc.lcd/resources/lib/lcdproc.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 7b6e0b4..a23b47a 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -329,6 +329,13 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): if iLine < 0 or iLine >= int(self.m_iRows): return + if self.m_strLineType[iLine] != dictDescriptor['type']: + self.ClearLine(int(iLine + 1)) + self.m_strLineType[iLine] = dictDescriptor['type'] + + if dictDescriptor['type'] == "progressbar" and dictDescriptor['text'] != "": + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text']) + strLineLong = strLine strLineLong.strip() @@ -343,11 +350,8 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): ln = iLine + 1 if dictDescriptor['type'] == "progressbar": - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text']) self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, dictDescriptor['startx'], ln, self.m_iProgressBarWidth) else: - self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (ln) - self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (ln) self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i m %i \"%s\"\n" % (ln, dictDescriptor['startx'], ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)) self.m_strLineText[iLine] = strLineLong @@ -360,7 +364,7 @@ def ClearDisplay(self): # set all widgets to empty stuff and/or offscreen for i in range(1,int(self.m_iRows)+1): - ClearLine(i) + self.ClearLine(i) # send to display self.FlushLines() From afbacc216e23ac5e0ba429857cdd3cd2f1401b32 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 16:37:03 +0200 Subject: [PATCH 031/337] Use pseudo-enum for linetypes, fix uninitialized local var usage (ln) in SetLine() --- script.xbmc.lcd/resources/lib/lcdbase.py | 9 +++++++-- script.xbmc.lcd/resources/lib/lcdproc.py | 7 ++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index fc3390a..8a4c75e 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -61,6 +61,11 @@ class LCD_MODE: LCD_MODE_XBE_LAUNCH = 5 LCD_MODE_MAX = 6 +class LCD_LINETYPE: + LCD_LINETYPE_TEXT = "text" + LCD_LINETYPE_PROGRESS = "progressbar" + LCD_LINETYPE_ICONTEXT = "icontext" + class CUSTOM_CHARSET: CUSTOM_CHARSET_DEFAULT = 0 CUSTOM_CHARSET_SMALLCHAR = 1 @@ -206,7 +211,7 @@ def LoadMode(self, node, mode): linetext = line.text if str(linetext).find("$INFO[LCD.ProgressBar]") >= 0: - linedescriptor['type'] = str("progressbar") + linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_PROGRESS linedescriptor['startx'] = int(1) linedescriptor['text'] = "" linedescriptor['endx'] = int(self.m_iCellWidth) * int(self.m_iColumns) @@ -217,7 +222,7 @@ def LoadMode(self, node, mode): linedescriptor['endx'] = int(self.m_iCellWidth) * (int(self.GetColumns()) - 2) else: - linedescriptor['type'] = str("text") + linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_TEXT linedescriptor['startx'] = int(1) linedescriptor['text'] = str(linetext) linedescriptor['endx'] = int(self.GetColumns()) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index a23b47a..cdee2c8 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -329,11 +329,13 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): if iLine < 0 or iLine >= int(self.m_iRows): return + ln = iLine + 1 + if self.m_strLineType[iLine] != dictDescriptor['type']: self.ClearLine(int(iLine + 1)) self.m_strLineType[iLine] = dictDescriptor['type'] - if dictDescriptor['type'] == "progressbar" and dictDescriptor['text'] != "": + if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS and dictDescriptor['text'] != "": self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text']) strLineLong = strLine @@ -347,9 +349,8 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): strLineLong += self.m_strScrollSeparator if strLineLong != self.m_strLineText[iLine] or bForce: - ln = iLine + 1 - if dictDescriptor['type'] == "progressbar": + if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS: self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, dictDescriptor['startx'], ln, self.m_iProgressBarWidth) else: self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i m %i \"%s\"\n" % (ln, dictDescriptor['startx'], ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)) From 191c7807657e993f8079549677c4c9cd46d3f0c0 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 16:47:41 +0200 Subject: [PATCH 032/337] comments --- script.xbmc.lcd/resources/lib/lcdproc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index cdee2c8..7554d07 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -345,16 +345,19 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): if len(strLineLong) < int(self.m_iColumns): numSpaces = int(self.m_iColumns) - len(strLineLong) strLineLong.ljust(numSpaces) #pad with spaces - elif len(strLineLong) > int(self.m_iColumns): #else if the string doesn't fit the display, lcdproc will scroll it, so we need a space + elif len(strLineLong) > int(self.m_iColumns): #else if the string doesn't fit the display, lcdproc will scroll it, so add separator strLineLong += self.m_strScrollSeparator + # check if update is required if strLineLong != self.m_strLineText[iLine] or bForce: - + # progressbar line if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS: self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, dictDescriptor['startx'], ln, self.m_iProgressBarWidth) + # everything else (text, icontext) else: self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i m %i \"%s\"\n" % (ln, dictDescriptor['startx'], ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)) + # cache contents self.m_strLineText[iLine] = strLineLong def ClearDisplay(self): From 3b225e9c8d7415f3a42bfb7926fe1bc9d1b216af Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 16:50:33 +0200 Subject: [PATCH 033/337] abstract method for ClearLine() --- script.xbmc.lcd/resources/lib/lcdbase.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 8a4c75e..275b275 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -108,6 +108,10 @@ def SetBackLight(self, iLight): def SetContrast(self, iContrast): pass +# @abstractmethod + def ClearLine(self, iLine): + pass + # @abstractmethod def SetLine(self, iLine, strLine, dictDescriptor, bForce): pass From 6d378f59535bb15a26aaa1ec23b6bf0bb6f84bac Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 16:52:06 +0200 Subject: [PATCH 034/337] missed linetype-enum in Render() --- script.xbmc.lcd/resources/lib/lcdbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 275b275..37eda30 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -268,7 +268,7 @@ def Render(self, mode, bForce): while (outLine < int(self.GetRows()) and inLine < len(self.m_lcdMode[mode])): #parse the progressbar infolabel by ourselfs! - if self.m_lcdMode[mode][inLine]['type'] == "progressbar": + if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS: # get playtime and duration and convert into seconds currentSecs = self.getCurrentTimeSecs() durationSecs = self.getCurrentDurationSecs() From 61272d727632a3629aad5c174e7041d750b21b0e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 17:07:44 +0200 Subject: [PATCH 035/337] Begin implementing icontext line type, strip infolabel during setup --- script.xbmc.lcd/resources/lib/lcdbase.py | 13 ++++++++++++- script.xbmc.lcd/resources/lib/lcdproc.py | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 37eda30..5422ae3 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -132,6 +132,10 @@ def GetColumns(self): def GetRows(self): pass +# @abstractmethod + def SetPlayingStateIcon(self): + pass + # @abstractmethod def SetProgressBar(self, percent, lineIdx): pass @@ -157,7 +161,6 @@ def Initialize(self): def IsConnected(self): return True - def LoadSkin(self, xmlFile): self.Reset() doc = xmltree.parse(xmlFile) @@ -225,6 +228,11 @@ def LoadMode(self, node, mode): linedescriptor['text'] = "[" + " " * (self.m_iColumns - 2) + "]" linedescriptor['endx'] = int(self.m_iCellWidth) * (int(self.GetColumns()) - 2) + elif str(linetext).find("$INFO[LCD.PlayIcon]") >= 0: + linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_ICONTEXT + linedescriptor['startx'] = int(3) # icon widgets take 2 chars, so shift text offset to 3 + linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', str(linetext), flags=re.IGNORECASE)).strip() + linedescriptor['endx'] = int(self.GetColumns()) else: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_TEXT linedescriptor['startx'] = int(1) @@ -276,6 +284,9 @@ def Render(self, mode, bForce): pixelsWidth = self.SetProgressBar(percent, self.m_lcdMode[mode][inLine]['endx']) line = "p" + str(pixelsWidth) else: + if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_ICONTEXT: + self.SetPlayingStateIcon() + line = xbmc.getInfoLabel(self.m_lcdMode[mode][inLine]['text']) if self.m_strInfoLabelEncoding != self.m_strLCDEncoding: line = line.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 7554d07..1070e47 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -314,6 +314,9 @@ def SetProgressBar(self, percent, pxWidth): self.m_iProgressBarWidth = int(float(percent) * pxWidth) return self.m_iProgressBarWidth + def SetPlayingStateIcon(self): + return True + def GetRows(self): return int(self.m_iRows) From fc0eaf28b1326a7267cb428cbaefcf4fa4ac2eb9 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 17:34:27 +0200 Subject: [PATCH 036/337] Set icon widget to matching playing state --- script.xbmc.lcd/resources/lib/lcdproc.py | 25 +++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 1070e47..817fb37 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -61,6 +61,7 @@ def __init__(self): self.m_strLineIcon = [None]*MAX_ROWS self.m_iProgressBarWidth = 0 self.m_iProgressBarLine = -1 + self.m_strIconName = "BLOCK_FILLED" self.m_strSetLineCmds = "" LcdBase.__init__(self) @@ -315,7 +316,21 @@ def SetProgressBar(self, percent, pxWidth): return self.m_iProgressBarWidth def SetPlayingStateIcon(self): - return True + bPlaying = xbmc.getCondVisibility("Player.Playing") + bPaused = xbmc.getCondVisibility("Player.Paused") + bForwarding = xbmc.getCondVisibility("Player.Forwarding") + bRewinding = xbmc.getCondVisibility("Player.Rewinding") + + self.m_strIconName = "STOP" + + if bForwarding: + self.m_strIconName = "FF" + elif bRewinding: + self.m_strIconName = "FR" + elif bPaused: + self.m_strIconName = "PAUSE" + elif bPlaying: + self.m_strIconName = "PLAY" def GetRows(self): return int(self.m_iRows) @@ -333,10 +348,12 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): return ln = iLine + 1 + bIconForce = False if self.m_strLineType[iLine] != dictDescriptor['type']: self.ClearLine(int(iLine + 1)) self.m_strLineType[iLine] = dictDescriptor['type'] + bIconForce = True if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS and dictDescriptor['text'] != "": self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text']) @@ -363,6 +380,12 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): # cache contents self.m_strLineText[iLine] = strLineLong + if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_ICONTEXT: + if self.m_strLineIcon[iLine] != self.m_strIconName or bIconForce: + self.m_strLineIcon[iLine] = self.m_strIconName + + self.m_strSetLineCmds += "widget_set xbmc lineIcon%i %i 1 %s\n" % (ln, ln, self.m_strIconName) + def ClearDisplay(self): log(xbmc.LOGDEBUG, "Clearing display contents") From a42e665ec32e40dca4ba4543a8138d9c814ebfb9 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 18:44:28 +0200 Subject: [PATCH 037/337] Filter out BigDigit InfoLabels and create LCD modes accordingly --- script.xbmc.lcd/resources/lib/lcdbase.py | 26 +++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 5422ae3..a716684 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -62,9 +62,10 @@ class LCD_MODE: LCD_MODE_MAX = 6 class LCD_LINETYPE: - LCD_LINETYPE_TEXT = "text" - LCD_LINETYPE_PROGRESS = "progressbar" - LCD_LINETYPE_ICONTEXT = "icontext" + LCD_LINETYPE_TEXT = "text" + LCD_LINETYPE_PROGRESS = "progressbar" + LCD_LINETYPE_ICONTEXT = "icontext" + LCD_LINETYPE_BIGSCREEN = "bigscreen" class CUSTOM_CHARSET: CUSTOM_CHARSET_DEFAULT = 0 @@ -213,6 +214,25 @@ def LoadMode(self, node, mode): if node == None: return + timeregex = r'' + re.escape('$INFO[LCD.') + 'Time((Wide)?\d?\d?)' + re.escape(']') + + for line in node.findall("line"): + linetext = str(line.text).strip() + if linetext == "" or linetext == None: + continue + + timematch = re.match(timeregex, linetext, flags=re.IGNORECASE) + if timematch != None: + linedescriptor = {} + + linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN + linedescriptor['startx'] = int(1) + linedescriptor['text'] = "" + linedescriptor['endx'] = int(self.GetColumns()) + + self.m_lcdMode[mode].append(linedescriptor) + return + for line in node.findall("line"): linedescriptor = {} linetext = line.text From 1a69e2352c60bb02f1e9e88a5a93aa56b6d7a889 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 19:02:00 +0200 Subject: [PATCH 038/337] Set some text for bigscreens to make sure it will get attention --- script.xbmc.lcd/resources/lib/lcdbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index a716684..4c92ac4 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -240,7 +240,7 @@ def LoadMode(self, node, mode): if str(linetext).find("$INFO[LCD.ProgressBar]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_PROGRESS linedescriptor['startx'] = int(1) - linedescriptor['text'] = "" + linedescriptor['text'] = "Time" linedescriptor['endx'] = int(self.m_iCellWidth) * int(self.m_iColumns) if self.m_bProgressbarSurroundings == True: From ceeb97b6c3eb7d1cb245169e4ff059865e26603e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 19:22:00 +0200 Subject: [PATCH 039/337] Setup big digits and handling --- script.xbmc.lcd/resources/lib/lcdproc.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 817fb37..494079b 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -62,6 +62,7 @@ def __init__(self): self.m_iProgressBarWidth = 0 self.m_iProgressBarLine = -1 self.m_strIconName = "BLOCK_FILLED" + self.m_iBigDigits = int(8) # 12:45:78 / colons count as digit self.m_strSetLineCmds = "" LcdBase.__init__(self) @@ -160,6 +161,15 @@ def SetupScreen(self): if not self.SendCommand("widget_set xbmc lineIcon" + str(i) + " 0 0 BLOCK_FILLED", True): return False + for i in range(1,int(self.m_iBigDigits + 1)): + # Big Digit + if not self.SendCommand("widget_add xbmc lineBigDigit" + str(i) + " num", True): + return False + + # Set Digit + if not self.SendCommand("widget_set xbmc lineBigDigit" + str(i) + " 0 0", True): + return False + return True def Initialize(self): @@ -231,6 +241,11 @@ def Connect(self): reply = self.tn.read_until("\n",3) log(xbmc.LOGDEBUG,"info Reply: " + reply) + if self.m_iColumns < 16: + self.m_iBigDigits = 5 + elif self.m_iColumns < 20: + self.m_iBigDigits = 7 + except: log(xbmc.LOGERROR,"Connect: Telnet exception.") return False From 5a0f5ce9cfdf8012870d910707f4d99152e27f00 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 19:31:55 +0200 Subject: [PATCH 040/337] Bigdigit cache, rename IconForce bool to a generic title --- script.xbmc.lcd/resources/lib/lcdproc.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 494079b..fb7dd96 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -40,6 +40,7 @@ def log(loglevel, msg): SCROLL_SPEED_IN_MSEC = 250 MAX_ROWS = 20 +MAX_BIGDIGITS = 20 INIT_RETRY_INTERVAL = 2 INIT_RETRY_INTERVAL_MAX = 60000 @@ -59,6 +60,7 @@ def __init__(self): self.m_strLineText = [None]*MAX_ROWS self.m_strLineType = [None]*MAX_ROWS self.m_strLineIcon = [None]*MAX_ROWS + self.m_strDigits = [None]*MAX_BIGDIGITS self.m_iProgressBarWidth = 0 self.m_iProgressBarLine = -1 self.m_strIconName = "BLOCK_FILLED" @@ -363,17 +365,21 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): return ln = iLine + 1 - bIconForce = False + bExtraForce = False if self.m_strLineType[iLine] != dictDescriptor['type']: self.ClearLine(int(iLine + 1)) self.m_strLineType[iLine] = dictDescriptor['type'] - bIconForce = True + bExtraForce = True if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS and dictDescriptor['text'] != "": self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text']) - strLineLong = strLine + if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: + strLineLong = xbmc.getInfoLabel("Player.Time") + else: + strLineLong = strLine + strLineLong.strip() # make string fit the display if it's smaller than the width @@ -396,7 +402,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): self.m_strLineText[iLine] = strLineLong if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_ICONTEXT: - if self.m_strLineIcon[iLine] != self.m_strIconName or bIconForce: + if self.m_strLineIcon[iLine] != self.m_strIconName or bExtraForce: self.m_strLineIcon[iLine] = self.m_strIconName self.m_strSetLineCmds += "widget_set xbmc lineIcon%i %i 1 %s\n" % (ln, ln, self.m_strIconName) From 02e329147b9ec643f91a43b8288bc8243d79b4a6 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 14 Oct 2012 23:56:45 +0200 Subject: [PATCH 041/337] Implement BigDigit display, fix some mistakes and annoyances --- script.xbmc.lcd/resources/lib/lcdbase.py | 17 ++++--- script.xbmc.lcd/resources/lib/lcdproc.py | 63 +++++++++++++++++++++++- 2 files changed, 72 insertions(+), 8 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 4c92ac4..fcabaf8 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -109,6 +109,10 @@ def SetBackLight(self, iLight): def SetContrast(self, iContrast): pass +# @abstractmethod + def SetBigDigits(self, strTimeString, bForceUpdate): + pass + # @abstractmethod def ClearLine(self, iLine): pass @@ -227,7 +231,7 @@ def LoadMode(self, node, mode): linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN linedescriptor['startx'] = int(1) - linedescriptor['text'] = "" + linedescriptor['text'] = "Time" linedescriptor['endx'] = int(self.GetColumns()) self.m_lcdMode[mode].append(linedescriptor) @@ -240,7 +244,7 @@ def LoadMode(self, node, mode): if str(linetext).find("$INFO[LCD.ProgressBar]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_PROGRESS linedescriptor['startx'] = int(1) - linedescriptor['text'] = "Time" + linedescriptor['text'] = "" linedescriptor['endx'] = int(self.m_iCellWidth) * int(self.m_iColumns) if self.m_bProgressbarSurroundings == True: @@ -318,10 +322,11 @@ def Render(self, mode, bForce): inLine += 1 - # fill remainder with empty space - while outLine < int(self.GetRows()): - self.SetLine(outLine, "", g_dictEmptyLineDescriptor, bForce) - outLine += 1 + # fill remainder with empty space if not bigscreen + if self.m_lcdMode[mode][0]['type'] != LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: + while outLine < int(self.GetRows()): + self.SetLine(outLine, "", g_dictEmptyLineDescriptor, bForce) + outLine += 1 self.FlushLines() diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index fb7dd96..8447a5a 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -328,6 +328,43 @@ def Resume(self): def GetColumns(self): return int(self.m_iColumns) + def SetBigDigits(self, strTimeString, bForceUpdate): + iOffset = 1 + iDigitCount = 1 + iStringOffset = 0 + strRealTimeString = "" + + if strTimeString == "" or strTimeString == None: + return + + iStringLength = int(len(strTimeString)) + + if iStringLength > self.m_iBigDigits: + iStringOffset = len(strTimeString) - self.m_iBigDigits + + for i in range(int(iStringOffset), int(iStringLength)): + if self.m_strDigits[iDigitCount] != strTimeString[i] or bForceUpdate: + self.m_strDigits[iDigitCount] = strTimeString[i] + + if strTimeString[i] == ":": + self.m_strSetLineCmds += "widget_set xbmc lineBigDigit%i %i 10\n" % (iDigitCount, iOffset) + else: + self.m_strSetLineCmds += "widget_set xbmc lineBigDigit%i %i %s\n" % (iDigitCount, iOffset, strTimeString[i]) + + if strTimeString[i] == ":": + iOffset += 1 + else: + iOffset += 3 + + iDigitCount += 1 + + for j in range(i + 2, int(self.m_iBigDigits + 1)): + if self.m_strDigits[iDigitCount] != "" or bForceUpdate: + self.m_strDigits[iDigitCount] = "" + self.m_strSetLineCmds += "widget_set xbmc lineBigDigit" + str(j) + " 0 0\n" + + iDigitCount += 1 + def SetProgressBar(self, percent, pxWidth): self.m_iProgressBarWidth = int(float(percent) * pxWidth) return self.m_iProgressBarWidth @@ -352,6 +389,15 @@ def SetPlayingStateIcon(self): def GetRows(self): return int(self.m_iRows) + def ClearBigDigits(self): + for i in range(1,int(self.m_iBigDigits + 1)): + # Clear Digit + self.m_strSetLineCmds += "widget_set xbmc lineBigDigit" + str(i) + " 0 0\n" + + # make sure all widget get redrawn by resetting their type + for i in range(0, int(self.GetRows())): + self.m_strLineType[i] = "" + def ClearLine(self, iLine): self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (iLine) self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (iLine) @@ -368,7 +414,14 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): bExtraForce = False if self.m_strLineType[iLine] != dictDescriptor['type']: - self.ClearLine(int(iLine + 1)) + if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: + self.ClearDisplay() + else: + if self.m_strLineType[iLine] == LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: + self.ClearBigDigits() + else: + self.ClearLine(int(iLine + 1)) + self.m_strLineType[iLine] = dictDescriptor['type'] bExtraForce = True @@ -391,8 +444,11 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): # check if update is required if strLineLong != self.m_strLineText[iLine] or bForce: + # bigscreen + if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: + self.SetBigDigits(strLineLong, bExtraForce) # progressbar line - if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS: + elif dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS: self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, dictDescriptor['startx'], ln, self.m_iProgressBarWidth) # everything else (text, icontext) else: @@ -417,6 +473,9 @@ def ClearDisplay(self): for i in range(1,int(self.m_iRows)+1): self.ClearLine(i) + # add commands to clear big digits + self.ClearBigDigits() + # send to display self.FlushLines() From 70e763b804418781c43e984d0ee56594877b3e75 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 15 Oct 2012 00:12:06 +0200 Subject: [PATCH 042/337] Support additional modes for PVR-TV and PVR-Radio --- script.xbmc.lcd/lcdmain.py | 6 ++++++ script.xbmc.lcd/resources/lib/lcdbase.py | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 356a09d..07c932f 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -65,9 +65,15 @@ def getLcdMode(): screenSaver = xbmc.getCondVisibility("System.ScreenSaverActive") playingVideo = xbmc.getCondVisibility("Player.HasVideo") playingMusic = xbmc.getCondVisibility("Player.HasAudio") + playingPVRTV = xbmc.getCondVisibility("PVR.IsPlayingTV") + playingPVRRadio = xbmc.getCondVisibility("PVR.IsPlayingRadio") if screenSaver: ret = LCD_MODE.LCD_MODE_SCREENSAVER + elif playingPVRTV: + ret = LCD_MODE.LCD_MODE_PVRTV + elif playingPVRRadio: + ret = LCD_MODE.LCD_MODE_PVRRADIO elif playingVideo: #we play something ret = LCD_MODE.LCD_MODE_VIDEO elif playingMusic: diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index fcabaf8..aad9ef0 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -59,7 +59,9 @@ class LCD_MODE: LCD_MODE_NAVIGATION = 3 LCD_MODE_SCREENSAVER = 4 LCD_MODE_XBE_LAUNCH = 5 - LCD_MODE_MAX = 6 + LCD_MODE_PVRTV = 6 + LCD_MODE_PVRRADIO = 7 + LCD_MODE_MAX = 8 class LCD_LINETYPE: LCD_LINETYPE_TEXT = "text" @@ -213,6 +215,11 @@ def LoadSkin(self, xmlFile): tmpMode = element.find("xbelaunch") self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_XBE_LAUNCH) + tmpMode = element.find("pvrtv") + self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_PVRTV) + + tmpMode = element.find("pvrradio") + self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_PVRRADIO) def LoadMode(self, node, mode): if node == None: From bd65258bcae47a5f0d617390b53bf1d9235659a1 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 16 Oct 2012 18:00:14 +0200 Subject: [PATCH 043/337] sys.getfilesystemencoding() doesn't seem to match XBMC's InfoLabel encoding, so assume UTF-8 for now (needs further testing and/or confirmation) --- script.xbmc.lcd/resources/lib/lcdbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index aad9ef0..08044ff 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -82,7 +82,7 @@ def __init__(self): self.m_eCurrentCharset = CUSTOM_CHARSET.CUSTOM_CHARSET_DEFAULT self.m_lcdMode = [None] * LCD_MODE.LCD_MODE_MAX self.m_bDimmedOnPlayback = False - self.m_strInfoLabelEncoding = sys.getfilesystemencoding() + self.m_strInfoLabelEncoding = "utf-8" # Assume InfoLabel is UTF-8 encoded self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! self.m_strScrollSeparator = " " From d59c8edbd3b24cc6bbb272ea9334e0a7f05796d5 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 16 Oct 2012 18:01:13 +0200 Subject: [PATCH 044/337] Clear BigDigit cache in ClearBigDigits() so they get redrawn --- script.xbmc.lcd/resources/lib/lcdproc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 8447a5a..f648dc1 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -393,6 +393,7 @@ def ClearBigDigits(self): for i in range(1,int(self.m_iBigDigits + 1)): # Clear Digit self.m_strSetLineCmds += "widget_set xbmc lineBigDigit" + str(i) + " 0 0\n" + self.m_strDigits[i] = "" # make sure all widget get redrawn by resetting their type for i in range(0, int(self.GetRows())): From 1c7b67014d4533ac28d0ec7c723801b095af1f82 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 17 Oct 2012 20:32:52 +0200 Subject: [PATCH 045/337] Cleanup, commentary updates --- script.xbmc.lcd/resources/lib/lcdbase.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 08044ff..a85748f 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -69,25 +69,15 @@ class LCD_LINETYPE: LCD_LINETYPE_ICONTEXT = "icontext" LCD_LINETYPE_BIGSCREEN = "bigscreen" -class CUSTOM_CHARSET: - CUSTOM_CHARSET_DEFAULT = 0 - CUSTOM_CHARSET_SMALLCHAR = 1 - CUSTOM_CHARSET_MEDIUMCHAR = 2 - CUSTOM_CHARSET_BIGCHAR = 3 - CUSTOM_CHARSET_MAX = 4 - class LcdBase(): def __init__(self): self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE - self.m_eCurrentCharset = CUSTOM_CHARSET.CUSTOM_CHARSET_DEFAULT self.m_lcdMode = [None] * LCD_MODE.LCD_MODE_MAX self.m_bDimmedOnPlayback = False - self.m_strInfoLabelEncoding = "utf-8" # Assume InfoLabel is UTF-8 encoded + self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! self.m_strScrollSeparator = " " - log(xbmc.LOGDEBUG, "Determined InfoLabelEncoding: " + self.m_strInfoLabelEncoding) - # @abstractmethod def _concrete_method(self): pass @@ -153,12 +143,7 @@ def GetProgressBarPercent(self, tCurrent, tTotal): return float(tCurrent)/float(tTotal) - def SetCharset(self,_nCharset): - if _nCharset < CUSTOM_CHARSET.CUSTOM_CHARSET_MAX: - self.m_eCurrentCharset = _nCharset - def Initialize(self): - self.m_eCurrentCharset = CUSTOM_CHARSET.CUSTOM_CHARSET_DEFAULT self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE self.LoadSkin(__lcdxml__) From 8ed1f1d78c097486d4cb9add11b5d109fa0dd8eb Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 17 Oct 2012 20:57:43 +0200 Subject: [PATCH 046/337] LoadMode(): Cleanup and don't loop twice through elements --- script.xbmc.lcd/resources/lib/lcdbase.py | 40 +++++++++++++----------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index a85748f..d32a0db 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -210,29 +210,29 @@ def LoadMode(self, node, mode): if node == None: return + # regex to determine any of $INFO[LCD.Time(Wide)21-44] timeregex = r'' + re.escape('$INFO[LCD.') + 'Time((Wide)?\d?\d?)' + re.escape(']') - for line in node.findall("line"): - linetext = str(line.text).strip() - if linetext == "" or linetext == None: - continue - - timematch = re.match(timeregex, linetext, flags=re.IGNORECASE) - if timematch != None: - linedescriptor = {} - - linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN - linedescriptor['startx'] = int(1) - linedescriptor['text'] = "Time" - linedescriptor['endx'] = int(self.GetColumns()) - - self.m_lcdMode[mode].append(linedescriptor) - return - for line in node.findall("line"): linedescriptor = {} - linetext = line.text - + linetext = str(line.text).strip() + + # make sure linetext has something so re.match won't fail + if linetext != "" and linetext != None: + timematch = re.match(timeregex, linetext, flags=re.IGNORECASE) + + # if line matches, throw away mode, add BigDigit descriptor and end processing for this mode + if timematch != None: + linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN + linedescriptor['startx'] = int(1) + linedescriptor['text'] = "Time" + linedescriptor['endx'] = int(self.GetColumns()) + + self.m_lcdMode[mode] = [] + self.m_lcdMode[mode].append(linedescriptor) + return + + # progressbar line if InfoLabel exists if str(linetext).find("$INFO[LCD.ProgressBar]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_PROGRESS linedescriptor['startx'] = int(1) @@ -244,11 +244,13 @@ def LoadMode(self, node, mode): linedescriptor['text'] = "[" + " " * (self.m_iColumns - 2) + "]" linedescriptor['endx'] = int(self.m_iCellWidth) * (int(self.GetColumns()) - 2) + # textline with icon in front elif str(linetext).find("$INFO[LCD.PlayIcon]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_ICONTEXT linedescriptor['startx'] = int(3) # icon widgets take 2 chars, so shift text offset to 3 linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', str(linetext), flags=re.IGNORECASE)).strip() linedescriptor['endx'] = int(self.GetColumns()) + # standard (scrolling) text line else: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_TEXT linedescriptor['startx'] = int(1) From 602e2851f9cabed97aafab7ab32c7715f50b6c9b Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 17 Oct 2012 21:03:54 +0200 Subject: [PATCH 047/337] more comment cleanup --- script.xbmc.lcd/lcdmain.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 07c932f..d3deb3f 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -57,11 +57,10 @@ def initGlobals(): g_timer = time.time() -#returns the settings category based on the currently played media -#returns "movie" if a movies is played, "musicvideo" if a musicvideo is played", "other" else +# returns mode identifier based on currently playing media/active navigation def getLcdMode(): ret = LCD_MODE.LCD_MODE_GENERAL -# LCD_MODE_XBE_LAUNCH = 5 + screenSaver = xbmc.getCondVisibility("System.ScreenSaverActive") playingVideo = xbmc.getCondVisibility("Player.HasVideo") playingMusic = xbmc.getCondVisibility("Player.HasAudio") From 184c44c5293356c2830eb4c1057e928214730375 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 17 Oct 2012 21:13:00 +0200 Subject: [PATCH 048/337] move navigation-active-determination to function --- script.xbmc.lcd/lcdmain.py | 51 ++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index d3deb3f..d6ef93f 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -56,18 +56,40 @@ def initGlobals(): g_oldSubMenu = "" g_timer = time.time() +def isNavigationActive(): + global g_oldMenu + global g_oldSubMenu + global g_timer + + ret = False + + navtimeout = settings_getNavTimeout() + menu = xbmc.getInfoLabel("$INFO[System.CurrentWindow]") + subMenu = xbmc.getInfoLabel("$INFO[System.CurrentControl]") + + if menu != g_oldMenu or subMenu != g_oldSubMenu or (g_timer + navtimeout) > time.time(): + ret = True + if menu != g_oldMenu or subMenu != g_oldSubMenu: + g_timer = time.time() + g_oldMenu = menu + g_oldSubMenu = subMenu + + return ret # returns mode identifier based on currently playing media/active navigation def getLcdMode(): ret = LCD_MODE.LCD_MODE_GENERAL + navActive = isNavigationActive() screenSaver = xbmc.getCondVisibility("System.ScreenSaverActive") playingVideo = xbmc.getCondVisibility("Player.HasVideo") playingMusic = xbmc.getCondVisibility("Player.HasAudio") playingPVRTV = xbmc.getCondVisibility("PVR.IsPlayingTV") playingPVRRadio = xbmc.getCondVisibility("PVR.IsPlayingRadio") - if screenSaver: + if navActive: + ret = LCD_MODE.LCD_MODE_NAVIGATION + elif screenSaver: ret = LCD_MODE.LCD_MODE_SCREENSAVER elif playingPVRTV: ret = LCD_MODE.LCD_MODE_PVRTV @@ -81,32 +103,19 @@ def getLcdMode(): return ret def process_lcd(): - global g_oldMenu - global g_oldSubMenu - global g_timer - bBacklightDimmed = False while not xbmc.abortRequested: handleConnectLCD() - navtimeout = settings_getNavTimeout() - menu = xbmc.getInfoLabel("$INFO[System.CurrentWindow]") - subMenu = xbmc.getInfoLabel("$INFO[System.CurrentControl]") settingsChanged = settings_didSettingsChange() mode = getLcdMode() - #handle navigation - if menu != g_oldMenu or subMenu != g_oldSubMenu or (g_timer + navtimeout) > time.time(): - g_lcdproc.Render(LCD_MODE.LCD_MODE_NAVIGATION,settingsChanged) - if menu != g_oldMenu or subMenu != g_oldSubMenu: - g_timer = time.time() - g_oldMenu = menu - g_oldSubMenu = subMenu - else:#handle all other lcd modes - if mode == LCD_MODE.LCD_MODE_SCREENSAVER and settings_getDimOnScreensaver(): - g_lcdproc.SetBackLight(0) - bBacklightDimmed = True - g_lcdproc.Render(getLcdMode(),settingsChanged) + if mode == LCD_MODE.LCD_MODE_SCREENSAVER and settings_getDimOnScreensaver(): + g_lcdproc.SetBackLight(0) + bBacklightDimmed = True + + g_lcdproc.Render(getLcdMode(), settingsChanged) + #turn the backlight on when leaving screensaver and it was dimmed if mode != LCD_MODE.LCD_MODE_SCREENSAVER and bBacklightDimmed: g_lcdproc.SetBackLight(1) @@ -130,7 +139,7 @@ def handleConnectLCD(): if settings_checkForNewSettings() or not g_lcdproc.IsConnected(): #networksettings changed? g_failedConnectionNotified = False #reset notification flag else: - return True + return True ret = g_lcdproc.Initialize() From 0147900c2cbe5eac9981ca877b13b847b72ffb73 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 17 Oct 2012 21:23:20 +0200 Subject: [PATCH 049/337] cleanup --- script.xbmc.lcd/resources/lib/lcdbase.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index d32a0db..b2456c7 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -147,9 +147,6 @@ def Initialize(self): self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE self.LoadSkin(__lcdxml__) - # Big number blocks, used for screensaver clock - # Note, the big block isn't here, it's in the LCD's ROM - def IsConnected(self): return True From ab3b90287144d6536e287a747592f2122e59c636 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 18 Oct 2012 21:20:32 +0200 Subject: [PATCH 050/337] Running getLcdMode() only once is enough --- script.xbmc.lcd/lcdmain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index d6ef93f..18c96f6 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -114,7 +114,7 @@ def process_lcd(): g_lcdproc.SetBackLight(0) bBacklightDimmed = True - g_lcdproc.Render(getLcdMode(), settingsChanged) + g_lcdproc.Render(mode, settingsChanged) #turn the backlight on when leaving screensaver and it was dimmed if mode != LCD_MODE.LCD_MODE_SCREENSAVER and bBacklightDimmed: From 05172646daaa6858757ca1399f6021a4784649ee Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 18 Oct 2012 21:29:00 +0200 Subject: [PATCH 051/337] housekeeping --- script.xbmc.lcd/lcdmain.py | 6 ++-- script.xbmc.lcd/resources/lib/lcdbase.py | 40 +++++++++++++----------- script.xbmc.lcd/resources/lib/lcdproc.py | 9 +++--- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 18c96f6..9009275 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -95,7 +95,7 @@ def getLcdMode(): ret = LCD_MODE.LCD_MODE_PVRTV elif playingPVRRadio: ret = LCD_MODE.LCD_MODE_PVRRADIO - elif playingVideo: #we play something + elif playingVideo: ret = LCD_MODE.LCD_MODE_VIDEO elif playingMusic: ret = LCD_MODE.LCD_MODE_MUSIC @@ -116,7 +116,7 @@ def process_lcd(): g_lcdproc.Render(mode, settingsChanged) - #turn the backlight on when leaving screensaver and it was dimmed + # turn the backlight on when leaving screensaver and it was dimmed if mode != LCD_MODE.LCD_MODE_SCREENSAVER and bBacklightDimmed: g_lcdproc.SetBackLight(1) bBacklightDimmed = False @@ -128,7 +128,7 @@ def process_lcd(): else: g_lcdproc.DisableOnPlayback(False, False) - time.sleep(1.0 / float(settings_getRefreshRate())) #refresh after configured rate + time.sleep(1.0 / float(settings_getRefreshRate())) # refresh after configured rate def handleConnectLCD(): global g_failedConnectionNotified diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index b2456c7..9140576 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -78,62 +78,67 @@ def __init__(self): self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! self.m_strScrollSeparator = " " -# @abstractmethod +# @abstractmethod def _concrete_method(self): - pass -# @abstractmethod + pass + +# @abstractmethod + def IsConnected(self): + pass + +# @abstractmethod def Stop(self): pass -# @abstractmethod +# @abstractmethod def Suspend(self): pass -# @abstractmethod +# @abstractmethod def Resume(self): pass -# @abstractmethod +# @abstractmethod def SetBackLight(self, iLight): pass -# @abstractmethod +# @abstractmethod def SetContrast(self, iContrast): pass -# @abstractmethod +# @abstractmethod def SetBigDigits(self, strTimeString, bForceUpdate): pass -# @abstractmethod +# @abstractmethod def ClearLine(self, iLine): pass -# @abstractmethod +# @abstractmethod def SetLine(self, iLine, strLine, dictDescriptor, bForce): pass -# @abstractmethod +# @abstractmethod def ClearDisplay(self): pass -# @abstractmethod +# @abstractmethod def FlushLines(self): pass -# @abstractmethod +# @abstractmethod def GetColumns(self): pass -# @abstractmethod +# @abstractmethod def GetRows(self): pass -# @abstractmethod +# @abstractmethod def SetPlayingStateIcon(self): pass -# @abstractmethod +# @abstractmethod def SetProgressBar(self, percent, lineIdx): pass @@ -147,9 +152,6 @@ def Initialize(self): self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE self.LoadSkin(__lcdxml__) - def IsConnected(self): - return True - def LoadSkin(self, xmlFile): self.Reset() doc = xmltree.parse(xmlFile) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index f648dc1..fbc9085 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -36,7 +36,7 @@ from lcdbase import * def log(loglevel, msg): - xbmc.log("### [%s] - %s" % (__scriptname__,msg,),level=loglevel ) + xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) SCROLL_SPEED_IN_MSEC = 250 MAX_ROWS = 20 @@ -217,13 +217,15 @@ def Connect(self): self.tn.open(ip, port) # Start a new session self.tn.write("hello\n") - # time.sleep(1) + # Receive LCDproc data to determine row and column information reply = self.tn.read_until("\n",3) log(xbmc.LOGDEBUG,"Reply: " + reply) + # parse reply by regex lcdinfo = re.match("^connect .+ protocol ([0-9\.]+) lcd wid (\d+) hgt (\d+) cellwid (\d+) cellhgt (\d+)$", reply) + # if regex didn't match, LCDproc is incompatible or something's odd if lcdinfo is None: return False @@ -243,6 +245,7 @@ def Connect(self): reply = self.tn.read_until("\n",3) log(xbmc.LOGDEBUG,"info Reply: " + reply) + # Set up BigNum values based on display geometry if self.m_iColumns < 16: self.m_iBigDigits = 5 elif self.m_iColumns < 20: @@ -481,8 +484,6 @@ def ClearDisplay(self): self.FlushLines() def FlushLines(self): - #log(xbmc.LOGDEBUG, "Flushing Command List:" + self.m_strSetLineCmds) - if len(self.m_strSetLineCmds) > 0: # Send complete command package self.SendCommand(self.m_strSetLineCmds, False) From f0cec59c08ebfe5fb45f6a965f9f8744d8f17f6f Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 18 Oct 2012 22:20:36 +0200 Subject: [PATCH 052/337] Provide better information to users --- script.xbmc.lcd/lcdmain.py | 2 -- script.xbmc.lcd/resources/lib/lcdproc.py | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 9009275..343fb37 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -144,7 +144,6 @@ def handleConnectLCD(): ret = g_lcdproc.Initialize() if not ret: - print "lcd: connection to LCDProc failed" count = 10 while (not xbmc.abortRequested) and (count > 0): time.sleep(1) @@ -158,7 +157,6 @@ def handleConnectLCD(): if not g_failedConnectionNotified and not g_initialConnectAttempt: xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) g_failedConnectionNotified = True - print "lcd: connected to LCD" break # initial connection attempt done, update flag diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index fbc9085..2688743 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -234,11 +234,14 @@ def Connect(self): log(xbmc.LOGERROR, "Only LCDproc protocol 0.3 supported (got " + lcdinfo.group(1) +")") return False + # set up class vars self.m_iColumns = int(lcdinfo.group(2)) self.m_iRows = int(lcdinfo.group(3)) self.m_iCellWidth = int(lcdinfo.group(4)) self.m_iCellHeight = int(lcdinfo.group(5)) - log(xbmc.LOGDEBUG, "LCDproc data: Columns %s - Rows %s - CellWidth %s - CellHeight %s" % (str(self.m_iColumns), str(self.m_iRows), str(self.m_iCellWidth), str(self.m_iCellHeight))) + + # tell users what's going on + log(xbmc.LOGNOTICE, "Connected to LCDd at %s:%s, Protocol version %s - Geometry %sx%s characters (%sx%s pixels, %sx%s pixels per character)" % (str(ip), str(port), float(lcdinfo.group(1)), str(self.m_iColumns), str(self.m_iRows), str(self.m_iColumns * self.m_iCellWidth), str(self.m_iRows * self.m_iCellHeight), str(self.m_iCellWidth), str(self.m_iCellHeight))) # Retrieve driver name for additional functionality self.tn.write("info\n") From 0ba0b29bc4fe8752bab907446e74b4881469bb94 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 18 Oct 2012 23:13:36 +0200 Subject: [PATCH 053/337] Also initialise progress bars to zero --- script.xbmc.lcd/resources/lib/lcdproc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 2688743..2a0cb5a 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -155,6 +155,10 @@ def SetupScreen(self): if not self.SendCommand("widget_add xbmc lineProgress" + str(i) + " hbar", True): return False + # Reset bars to zero + if not self.SendCommand("widget_set xbmc lineProgress" + str(i) + " 0 0 0", True): + return False + # Icons if not self.SendCommand("widget_add xbmc lineIcon" + str(i) + " icon", True): return False From cd815309971eaab3fda2406bea40d0e6a72d2b0e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 18 Oct 2012 23:42:02 +0200 Subject: [PATCH 054/337] Improve connection loss/reconnection handling and user notification, initialize caches on widget init --- script.xbmc.lcd/lcdmain.py | 7 ++++--- script.xbmc.lcd/resources/lib/lcdproc.py | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 343fb37..65516ec 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -145,13 +145,14 @@ def handleConnectLCD(): if not ret: count = 10 - while (not xbmc.abortRequested) and (count > 0): - time.sleep(1) - count -= 1 if not g_failedConnectionNotified: g_failedConnectionNotified = True + g_initialConnectAttempt = False text = __settings__.getLocalizedString(500) xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) + while (not xbmc.abortRequested) and (count > 0): + time.sleep(1) + count -= 1 else: text = __settings__.getLocalizedString(501) if not g_failedConnectionNotified and not g_initialConnectAttempt: diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 2a0cb5a..7f2f26b 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -167,6 +167,10 @@ def SetupScreen(self): if not self.SendCommand("widget_set xbmc lineIcon" + str(i) + " 0 0 BLOCK_FILLED", True): return False + self.m_strLineText[i-1] = "" + self.m_strLineType[i-1] = "" + self.m_strLineIcon[i-1] = "" + for i in range(1,int(self.m_iBigDigits + 1)): # Big Digit if not self.SendCommand("widget_add xbmc lineBigDigit" + str(i) + " num", True): @@ -176,6 +180,8 @@ def SetupScreen(self): if not self.SendCommand("widget_set xbmc lineBigDigit" + str(i) + " 0 0", True): return False + self.m_strDigits[i] = "" + return True def Initialize(self): @@ -270,6 +276,8 @@ def Connect(self): def CloseSocket(self): self.tn.close() + del self.tn + self.tn = telnetlib.Telnet() def IsConnected(self): if self.tn.get_socket() == None: From 2acdd34f6c56040dbac60c32f7643045387698d8 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Fri, 19 Oct 2012 20:34:03 +0200 Subject: [PATCH 055/337] Fix: Set icon position correctly for icontext-lines (x/y values swapped) --- script.xbmc.lcd/resources/lib/lcdproc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 7f2f26b..d21ab12 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -480,7 +480,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): if self.m_strLineIcon[iLine] != self.m_strIconName or bExtraForce: self.m_strLineIcon[iLine] = self.m_strIconName - self.m_strSetLineCmds += "widget_set xbmc lineIcon%i %i 1 %s\n" % (ln, ln, self.m_strIconName) + self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 1 %i %s\n" % (ln, ln, self.m_strIconName) def ClearDisplay(self): log(xbmc.LOGDEBUG, "Clearing display contents") From d5ad27233c6db1aed6d5e3575c4746f64294060b Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 11:53:54 +0200 Subject: [PATCH 056/337] remove unused vars --- script.xbmc.lcd/resources/lib/lcdproc.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index d21ab12..a7dc910 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -38,7 +38,6 @@ def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) -SCROLL_SPEED_IN_MSEC = 250 MAX_ROWS = 20 MAX_BIGDIGITS = 20 INIT_RETRY_INTERVAL = 2 @@ -46,11 +45,7 @@ def log(loglevel, msg): class LCDProc(LcdBase): def __init__(self): - self.m_iActualpos = 0 - self.m_iBackLight = 32 - self.m_iLCDContrast = 50 self.m_bStop = True - self.m_sockfd = -1 self.m_lastInitAttempt = 0 self.m_initRetryInterval = INIT_RETRY_INTERVAL self.m_used = True From e90b2d15affde239b27dbf330fe0995c1dbc0e3e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 21 Oct 2012 12:13:25 +0200 Subject: [PATCH 057/337] Support Python < 2.7 when stripping PlayIcon InfoLabels --- script.xbmc.lcd/lcdmain.py | 4 ++-- script.xbmc.lcd/resources/lib/lcdbase.py | 6 +++++- script.xbmc.lcd/resources/lib/lcdproc.py | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 65516ec..58565f0 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -35,7 +35,7 @@ global g_failedConnectionNotified global g_initialConnectAttempt global g_lcdproc - + global g_oldMenu global g_oldSubMenu global g_timer @@ -47,7 +47,7 @@ def initGlobals(): global g_oldMenu global g_oldSubMenu global g_timer - + g_failedConnectionNotified = False g_initialConnectAttempt = True settings_initGlobals() diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 9140576..c14cd6d 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -247,7 +247,11 @@ def LoadMode(self, node, mode): elif str(linetext).find("$INFO[LCD.PlayIcon]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_ICONTEXT linedescriptor['startx'] = int(3) # icon widgets take 2 chars, so shift text offset to 3 - linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', str(linetext), flags=re.IGNORECASE)).strip() + # support Python < 2.7 (e.g. Debian Squeeze) + if self.m_vPythonVersion < (2, 7): + linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', str(linetext))).strip() + else: + linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', str(linetext), flags=re.IGNORECASE)).strip() linedescriptor['endx'] = int(self.GetColumns()) # standard (scrolling) text line else: diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index a7dc910..6382592 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -61,6 +61,11 @@ def __init__(self): self.m_strIconName = "BLOCK_FILLED" self.m_iBigDigits = int(8) # 12:45:78 / colons count as digit self.m_strSetLineCmds = "" + self.m_vPythonVersion = sys.version_info + + if self.m_vPythonVersion < (2, 7): + log(xbmc.LOGWARNING, "Python < 2.7 detected. Upgrade your Python for optimal results.") + LcdBase.__init__(self) def SendCommand(self, strCmd, bCheckRet): From 29768c0d1c9f8a7c4330e5fc528da83045bf9352 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 27 Oct 2012 14:47:34 +0200 Subject: [PATCH 058/337] README --- README | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 README diff --git a/README b/README new file mode 100644 index 0000000..90d3c54 --- /dev/null +++ b/README @@ -0,0 +1,11 @@ +XBMC LCDproc Python addon +========================== + +Copyright (C) 2012 Daniel Scheller +Based on initial work (C) 2012 Memphiz/Team XBMC + +LCDproc support for XBMC implemented in Python, direct drop-in replacement for +the LCD support in XBMC core. + +See https://github.com/herrnst/script.xbmc.lcd/wiki for details and usage +information. From 711402971a243bb66796a0c223490118ac64b1ac Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 27 Oct 2012 15:10:34 +0200 Subject: [PATCH 059/337] Missed: ScrollDelay = 0 noscroll support, now implemented --- script.xbmc.lcd/resources/lib/lcdproc.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 6382592..5fcf5f2 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -453,13 +453,20 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): strLineLong = strLine strLineLong.strip() + + iMaxLineLen = dictDescriptor['endx'] - (int(dictDescriptor['startx']) - 1) + iScrollSpeed = settings_getScrollDelay() # make string fit the display if it's smaller than the width if len(strLineLong) < int(self.m_iColumns): - numSpaces = int(self.m_iColumns) - len(strLineLong) + numSpaces = int(iMaxLineLen) - len(strLineLong) strLineLong.ljust(numSpaces) #pad with spaces - elif len(strLineLong) > int(self.m_iColumns): #else if the string doesn't fit the display, lcdproc will scroll it, so add separator - strLineLong += self.m_strScrollSeparator + elif len(strLineLong) > int(self.m_iColumns): #else if the string doesn't fit the display... + if iScrollSpeed != 0: # add separator when scrolling enabled + strLineLong += self.m_strScrollSeparator + else: # or cut off + strLineLong = strLineLong[:iMaxLineLen] + iScrollSpeed = 1 # check if update is required if strLineLong != self.m_strLineText[iLine] or bForce: @@ -471,7 +478,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, dictDescriptor['startx'], ln, self.m_iProgressBarWidth) # everything else (text, icontext) else: - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i m %i \"%s\"\n" % (ln, dictDescriptor['startx'], ln, self.m_iColumns, ln, settings_getScrollDelay(), re.escape(strLineLong)) + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i m %i \"%s\"\n" % (ln, dictDescriptor['startx'], ln, self.m_iColumns, ln, iScrollSpeed, re.escape(strLineLong)) # cache contents self.m_strLineText[iLine] = strLineLong From 7ce32c3274c187912424fc1aa5f708da1ab26352 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 27 Oct 2012 15:17:54 +0200 Subject: [PATCH 060/337] LoadMode(): Make matching PlayIcon and ProgressBar InfoLabels case-insensitive --- script.xbmc.lcd/resources/lib/lcdbase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index c14cd6d..0b07580 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -232,7 +232,7 @@ def LoadMode(self, node, mode): return # progressbar line if InfoLabel exists - if str(linetext).find("$INFO[LCD.ProgressBar]") >= 0: + if str(linetext).lower().find("$info[lcd.progressbar]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_PROGRESS linedescriptor['startx'] = int(1) linedescriptor['text'] = "" @@ -244,7 +244,7 @@ def LoadMode(self, node, mode): linedescriptor['endx'] = int(self.m_iCellWidth) * (int(self.GetColumns()) - 2) # textline with icon in front - elif str(linetext).find("$INFO[LCD.PlayIcon]") >= 0: + elif str(linetext).lower().find("$info[lcd.playicon]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_ICONTEXT linedescriptor['startx'] = int(3) # icon widgets take 2 chars, so shift text offset to 3 # support Python < 2.7 (e.g. Debian Squeeze) From 6c45f57e0c2c6834d4cf46401e84e41b5cbd4211 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 28 Oct 2012 13:17:38 +0100 Subject: [PATCH 061/337] Configurable scroll mode (marquee, leftright/pingpong) --- .../resources/language/English/strings.xml | 12 ++++++++--- .../resources/language/German/strings.xml | 21 ++++++++++++------- script.xbmc.lcd/resources/lib/lcdproc.py | 6 ++++-- script.xbmc.lcd/resources/lib/settings.py | 21 ++++++++++++++++++- script.xbmc.lcd/resources/settings.xml | 7 ++++--- 5 files changed, 50 insertions(+), 17 deletions(-) diff --git a/script.xbmc.lcd/resources/language/English/strings.xml b/script.xbmc.lcd/resources/language/English/strings.xml index a05afbe..d624a56 100644 --- a/script.xbmc.lcd/resources/language/English/strings.xml +++ b/script.xbmc.lcd/resources/language/English/strings.xml @@ -10,14 +10,20 @@ LCDd IP Show heartbeat symbol Delay for scrolling text - Dim backlight on screensaver - Navigation display duration (s) - Display refresh rate (Hz) + Scroll mode + Dim backlight on screensaver + Navigation display duration (s) + Display refresh rate (Hz) + + + Marquee + Left/Right Failed to connect to LCDProc! Connected to LCDProc! Settings changed! + diff --git a/script.xbmc.lcd/resources/language/German/strings.xml b/script.xbmc.lcd/resources/language/German/strings.xml index 6417b07..a37dd86 100644 --- a/script.xbmc.lcd/resources/language/German/strings.xml +++ b/script.xbmc.lcd/resources/language/German/strings.xml @@ -6,16 +6,21 @@ Allgemein - Entfernten LCDProc server benutzen + Entfernten LCDproc-Server benutzen LCDd IP Heartbeatsymbol anzeigen - Geschwindigkeit fuer gescrollten Text - Hintergrundbeleuchtung ausschalten, wenn Bildschirmschoner laeuft - Anzeigedauer der Navigationsansicht (s) - Display-Aktualisierungsrate (Hz) + Geschwindigkeit für gescrollten Text + Scroll-Modus + Hintergrundbeleuchtung ausschalten, wenn Bildschirmschoner aktiv + Anzeigedauer der Navigationsansicht (s) + Display-Aktualisierungsrate (Hz) + + + Durchlaufend + Links/Rechts - Fehler beim Verbinden zu LCDProc! - Verbunden mit LCDProc! - Einstellungen geaendert! + Fehler beim Verbinden zu LCDproc! + Verbunden mit LCDproc! + Einstellungen geändert! diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 5fcf5f2..7244c7a 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -456,6 +456,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): iMaxLineLen = dictDescriptor['endx'] - (int(dictDescriptor['startx']) - 1) iScrollSpeed = settings_getScrollDelay() + strScrollMode = settings_getLCDprocScrollMode() # make string fit the display if it's smaller than the width if len(strLineLong) < int(self.m_iColumns): @@ -463,7 +464,8 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): strLineLong.ljust(numSpaces) #pad with spaces elif len(strLineLong) > int(self.m_iColumns): #else if the string doesn't fit the display... if iScrollSpeed != 0: # add separator when scrolling enabled - strLineLong += self.m_strScrollSeparator + if strScrollMode == "m": # and scrollmode is marquee + strLineLong += self.m_strScrollSeparator else: # or cut off strLineLong = strLineLong[:iMaxLineLen] iScrollSpeed = 1 @@ -478,7 +480,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, dictDescriptor['startx'], ln, self.m_iProgressBarWidth) # everything else (text, icontext) else: - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i m %i \"%s\"\n" % (ln, dictDescriptor['startx'], ln, self.m_iColumns, ln, iScrollSpeed, re.escape(strLineLong)) + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i %s %i \"%s\"\n" % (ln, dictDescriptor['startx'], ln, self.m_iColumns, ln, strScrollMode, iScrollSpeed, re.escape(strLineLong)) # cache contents self.m_strLineText[iLine] = strLineLong diff --git a/script.xbmc.lcd/resources/lib/settings.py b/script.xbmc.lcd/resources/lib/settings.py index d26b37b..0c7a98e 100644 --- a/script.xbmc.lcd/resources/lib/settings.py +++ b/script.xbmc.lcd/resources/lib/settings.py @@ -34,6 +34,7 @@ global g_timer global g_heartbeat global g_scrolldelay +global g_scrollmode global g_settingsChanged global g_dimonscreensaver global g_navtimeout @@ -46,6 +47,7 @@ def settings_initGlobals(): global g_timer global g_heartbeat global g_scrolldelay + global g_scrollmode global g_settingsChanged global g_dimonscreensaver global g_navtimeout @@ -56,6 +58,7 @@ def settings_initGlobals(): g_timer = time.time() g_heartbeat = False g_scrolldelay = 1 + g_scrollmode = "0" g_settigsChanged = True g_dimonscreensaver = False g_navtimeout = 3 @@ -73,11 +76,21 @@ def settings_getHostPort(): def settings_getHeartBeat(): global g_heartbeat return g_heartbeat - + def settings_getScrollDelay(): global g_scrolldelay return g_scrolldelay +def settings_getScrollMode(): + global g_scrollmode + return g_scrollmode + +def settings_getLCDprocScrollMode(): + global g_scrollmode + if g_scrollmode == "1": + return "h" + return "m" + def settings_getDimOnScreensaver(): global g_dimonscreensaver return g_dimonscreensaver @@ -136,6 +149,7 @@ def settings_handleNetworkSettings(): def settings_handleLcdSettings(): global g_scrolldelay + global g_scrollmode global g_heartbeat global g_settingsChanged global g_dimonscreensaver @@ -145,6 +159,7 @@ def settings_handleLcdSettings(): g_settingsChanged = False scrolldelay = int(float(string.replace(__settings__.getSetting("scrolldelay"), ",", "."))) + scrollmode = __settings__.getSetting("scrollmode") heartbeat = __settings__.getSetting("heartbeat") == "true" dimonscreensaver = __settings__.getSetting("dimonscreensver") == "true" navtimeout = int(float(string.replace(__settings__.getSetting("navtimeout"), ",", "."))) @@ -154,6 +169,10 @@ def settings_handleLcdSettings(): g_scrolldelay = scrolldelay g_settingsChanged = True + if g_scrollmode != scrollmode: + g_scrollmode = scrollmode + g_settingsChanged = True + if g_heartbeat != heartbeat: g_heartbeat = heartbeat g_settingsChanged = True diff --git a/script.xbmc.lcd/resources/settings.xml b/script.xbmc.lcd/resources/settings.xml index 952c9cc..46829c9 100644 --- a/script.xbmc.lcd/resources/settings.xml +++ b/script.xbmc.lcd/resources/settings.xml @@ -6,8 +6,9 @@ - - - + + + + From 9b50be4d85bea93c8cbfbb34f35d3ac430099a3e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 29 Oct 2012 22:23:13 +0100 Subject: [PATCH 062/337] BigDigits: Show locale-based system time when player.time is empty (e.g. when not playing anything) --- script.xbmc.lcd/resources/lib/lcdproc.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 7244c7a..1248cab 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -346,6 +346,17 @@ def Resume(self): def GetColumns(self): return int(self.m_iColumns) + def GetBigDigitTime(self): + ret = xbmc.getInfoLabel("Player.Time") + + if ret == "": # no usable timestring, e.g. not playing anything + if self.m_iBigDigits < 8: # return only h:m when display too small + ret = time.strftime("%X")[:5] # %X = locale-based currenttime + else: + ret = time.strftime("%X")[:8] + + return ret + def SetBigDigits(self, strTimeString, bForceUpdate): iOffset = 1 iDigitCount = 1 @@ -448,7 +459,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text']) if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: - strLineLong = xbmc.getInfoLabel("Player.Time") + strLineLong = self.GetBigDigitTime() else: strLineLong = strLine From 286d355bbc63ada92e79f9014ad7a10449765673 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 30 Oct 2012 22:26:19 +0100 Subject: [PATCH 063/337] Reset also LineText+Icon in ClearBigDigits(), should finally fix redrawing when switching from BigDigit mode --- script.xbmc.lcd/resources/lib/lcdproc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 1248cab..af3b6cf 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -427,6 +427,8 @@ def ClearBigDigits(self): # make sure all widget get redrawn by resetting their type for i in range(0, int(self.GetRows())): self.m_strLineType[i] = "" + self.m_strLineText[i] = "" + self.m_strLineIcon[i] = "" def ClearLine(self, iLine): self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (iLine) From fa5e5f6f53d11969a87e66770a14f3491c6ad2b9 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 30 Oct 2012 22:47:08 +0100 Subject: [PATCH 064/337] Improve handling of errorneous config files: Undefined modes or modes without lines get at least one empty line and leaves warning in log --- script.xbmc.lcd/resources/lib/lcdbase.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 0b07580..37c6785 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -207,6 +207,13 @@ def LoadSkin(self, xmlFile): def LoadMode(self, node, mode): if node == None: + log(xbmc.LOGWARNING, "Empty Mode %d, check LCD.xml" % (mode)) + self.m_lcdMode[mode].append(g_dictEmptyLineDescriptor) + return + + if len(node.findall("line")) <= 0: + log(xbmc.LOGWARNING, "Mode %d defined without lines, check LCD.xml" % (mode)) + self.m_lcdMode[mode].append(g_dictEmptyLineDescriptor) return # regex to determine any of $INFO[LCD.Time(Wide)21-44] From 88554080c3ee852824620d2dfb97a4de563cebf9 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 30 Oct 2012 23:38:31 +0100 Subject: [PATCH 065/337] Add a configurable option "allowemptylines" to allow for blank/empty lines --- script.xbmc.lcd/resources/lib/lcdbase.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 37c6785..2d2cc2b 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -180,6 +180,13 @@ def LoadSkin(self, xmlFile): if str(progressbarSurroundings.text) == "on": self.m_bProgressbarSurroundings = True + self.m_bAllowEmptyLines = False + + allowemptylines = element.find("allowemptylines") + if allowemptylines != None: + if str(allowemptylines.text) == "on": + self.m_bAllowEmptyLines = True + #load modes tmpMode = element.find("music") self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_MUSIC) @@ -221,10 +228,13 @@ def LoadMode(self, node, mode): for line in node.findall("line"): linedescriptor = {} - linetext = str(line.text).strip() + if line.text == None: + linetext = "" + else: + linetext = str(line.text).strip() # make sure linetext has something so re.match won't fail - if linetext != "" and linetext != None: + if linetext != "": timematch = re.match(timeregex, linetext, flags=re.IGNORECASE) # if line matches, throw away mode, add BigDigit descriptor and end processing for this mode @@ -320,7 +330,7 @@ def Render(self, mode, bForce): line = line.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") self.SetProgressBar(0, -1) - if len(line) > 0: + if self.m_bAllowEmptyLines or len(line) > 0: self.SetLine(outLine, line, self.m_lcdMode[mode][inLine], bForce) outLine += 1 From 088f26af504ab7b90a423353db0f92457c17d785 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 30 Oct 2012 23:47:13 +0100 Subject: [PATCH 066/337] Initialisers, comments --- script.xbmc.lcd/resources/lib/lcdbase.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 2d2cc2b..95ad414 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -77,6 +77,8 @@ def __init__(self): self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! self.m_strScrollSeparator = " " + self.m_bProgressbarSurroundings = False + self.m_bAllowEmptyLines = False # @abstractmethod def _concrete_method(self): @@ -167,12 +169,14 @@ def LoadSkin(self, xmlFile): if str(disableOnPlay.text).find("music") >= 0: self.m_disableOnPlay += DISABLE_ON_PLAY.DISABLE_ON_PLAY_MUSIC + # apply scrollseparator scrollSeparator = element.find("scrollseparator") if scrollSeparator != None: if str(scrollSeparator.text).strip() != "": self.m_strScrollSeparator = " " + scrollSeparator.text + " " + # check for progressbarsurroundings setting self.m_bProgressbarSurroundings = False progressbarSurroundings = element.find("progressbarsurroundings") @@ -180,6 +184,7 @@ def LoadSkin(self, xmlFile): if str(progressbarSurroundings.text) == "on": self.m_bProgressbarSurroundings = True + # check for allowemptylines setting self.m_bAllowEmptyLines = False allowemptylines = element.find("allowemptylines") From b490b4430d9f64b076b222fe0d6c7968efa48374 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 31 Oct 2012 00:08:20 +0100 Subject: [PATCH 067/337] Add configurable int to manually set the offset for text on icontext lines, do proper type checking --- script.xbmc.lcd/resources/lib/lcdbase.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 95ad414..a67f0ee 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -78,6 +78,7 @@ def __init__(self): self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! self.m_strScrollSeparator = " " self.m_bProgressbarSurroundings = False + self.m_iIconTextOffset = 2 self.m_bAllowEmptyLines = False # @abstractmethod @@ -184,6 +185,23 @@ def LoadSkin(self, xmlFile): if str(progressbarSurroundings.text) == "on": self.m_bProgressbarSurroundings = True + # icontext offset setting + self.m_iIconTextOffset = 2 + + icontextoffset = element.find("icontextoffset") + if icontextoffset != None and icontextoffset.text != None: + try: + intoffset = int(icontextoffset.text) + except ValueError, TypeError: + log(xbmc.LOGERROR, "Value for icontextoffset must be integer (got: %s)" % (icontextoffset.text)) + else: + if intoffset <= 0 or intoffset >= self.GetColumns(): + log(xbmc.LOGERROR, "Value %d for icontextoffset out of range, ignoring" % (intoffset)) + else: + if intoffset < 2: + log(xbmc.LOGWARNING, "Value %d for icontextoffset smaller than LCDproc's icon width" % (intoffset)) + self.m_iIconTextOffset = intoffset + # check for allowemptylines setting self.m_bAllowEmptyLines = False @@ -268,7 +286,7 @@ def LoadMode(self, node, mode): # textline with icon in front elif str(linetext).lower().find("$info[lcd.playicon]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_ICONTEXT - linedescriptor['startx'] = int(3) # icon widgets take 2 chars, so shift text offset to 3 + linedescriptor['startx'] = int(1 + self.m_iIconTextOffset) # icon widgets take 2 chars, so shift text offset (default: 2) # support Python < 2.7 (e.g. Debian Squeeze) if self.m_vPythonVersion < (2, 7): linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', str(linetext))).strip() From 377b7d53c91e0191a873d1b4e39d25d60d65d659 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 31 Oct 2012 00:24:23 +0100 Subject: [PATCH 068/337] fix typo in settings var so dimming actually works... also prevent socket flood - disabling backlight once is enough --- script.xbmc.lcd/lcdmain.py | 2 +- script.xbmc.lcd/resources/lib/settings.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 58565f0..39be036 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -110,7 +110,7 @@ def process_lcd(): settingsChanged = settings_didSettingsChange() mode = getLcdMode() - if mode == LCD_MODE.LCD_MODE_SCREENSAVER and settings_getDimOnScreensaver(): + if mode == LCD_MODE.LCD_MODE_SCREENSAVER and settings_getDimOnScreensaver() and not bBacklightDimmed: g_lcdproc.SetBackLight(0) bBacklightDimmed = True diff --git a/script.xbmc.lcd/resources/lib/settings.py b/script.xbmc.lcd/resources/lib/settings.py index 0c7a98e..2386100 100644 --- a/script.xbmc.lcd/resources/lib/settings.py +++ b/script.xbmc.lcd/resources/lib/settings.py @@ -161,7 +161,7 @@ def settings_handleLcdSettings(): scrolldelay = int(float(string.replace(__settings__.getSetting("scrolldelay"), ",", "."))) scrollmode = __settings__.getSetting("scrollmode") heartbeat = __settings__.getSetting("heartbeat") == "true" - dimonscreensaver = __settings__.getSetting("dimonscreensver") == "true" + dimonscreensaver = __settings__.getSetting("dimonscreensaver") == "true" navtimeout = int(float(string.replace(__settings__.getSetting("navtimeout"), ",", "."))) refreshrate = int(float(string.replace(__settings__.getSetting("refreshrate"), ",", "."))) From f5dd071b8d4b8c7fe210b9eeb420d5a567807953 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 31 Oct 2012 00:38:16 +0100 Subject: [PATCH 069/337] Allow display updates even when dimmed (experimental) --- script.xbmc.lcd/resources/lib/lcdproc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index af3b6cf..de311b1 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -300,10 +300,10 @@ def SetBackLight(self, iLight): # Build command if iLight == 0: - self.m_bStop = True + #self.m_bStop = True cmd = "screen_set xbmc -backlight off\n" elif iLight > 0: - self.m_bStop = False + #self.m_bStop = False cmd = "screen_set xbmc -backlight on\n" # Send to server From 6434854ff8e6095101f3f27a67994982bfea7e41 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 1 Nov 2012 16:04:04 +0100 Subject: [PATCH 070/337] Fix licensing --- script.xbmc.lcd/LICENSE.txt | 27 +++++++++++------------ script.xbmc.lcd/lcdmain.py | 14 ++++++++---- script.xbmc.lcd/resources/lib/lcdbase.py | 13 +++++++---- script.xbmc.lcd/resources/lib/lcdproc.py | 13 +++++++---- script.xbmc.lcd/resources/lib/settings.py | 17 +++++++++----- 5 files changed, 52 insertions(+), 32 deletions(-) diff --git a/script.xbmc.lcd/LICENSE.txt b/script.xbmc.lcd/LICENSE.txt index ae4787d..b8b347f 100644 --- a/script.xbmc.lcd/LICENSE.txt +++ b/script.xbmc.lcd/LICENSE.txt @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - - GNU GENERAL PUBLIC LICENSE + + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,6 +277,5 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS -------------------------------------------------------------------------- + END OF TERMS AND CONDITIONS diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 39be036..ec0bc66 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -1,20 +1,26 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - - This program is free software: you can redistribute it and/or modify + Copyright (C) 2012 Daniel Scheller + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or + the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' + import xbmc import xbmcaddon import xbmcgui diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index a67f0ee..c793744 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -1,17 +1,22 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - - This program is free software: you can redistribute it and/or modify + Copyright (C) 2012 Daniel Scheller + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or + the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index de311b1..290bd06 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -1,17 +1,22 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - - This program is free software: you can redistribute it and/or modify + Copyright (C) 2012 Daniel Scheller + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or + the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' diff --git a/script.xbmc.lcd/resources/lib/settings.py b/script.xbmc.lcd/resources/lib/settings.py index 2386100..3911267 100644 --- a/script.xbmc.lcd/resources/lib/settings.py +++ b/script.xbmc.lcd/resources/lib/settings.py @@ -1,17 +1,22 @@ ''' - LCD/VFD for XBMC - Copyright (C) 2011 Team XBMC - - This program is free software: you can redistribute it and/or modify + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC + Copyright (C) 2012 Daniel Scheller + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or + the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' From d1c0e8e4310a8919ca9fe86bbc5a30c89c263f50 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 1 Nov 2012 16:07:06 +0100 Subject: [PATCH 071/337] Version bump to 1.1.0 --- script.xbmc.lcd/addon.xml | 2 +- script.xbmc.lcd/changelog.txt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/script.xbmc.lcd/addon.xml b/script.xbmc.lcd/addon.xml index ee94e60..6f83020 100644 --- a/script.xbmc.lcd/addon.xml +++ b/script.xbmc.lcd/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/script.xbmc.lcd/changelog.txt b/script.xbmc.lcd/changelog.txt index 286dcd1..fbaa019 100644 --- a/script.xbmc.lcd/changelog.txt +++ b/script.xbmc.lcd/changelog.txt @@ -1,2 +1,7 @@ +1.1.0 +- greatly improved client/server communication +- native widgets for bars, icons and bignumbers +- character conversion left to be done by LCDproc +- additional configuration options 1.0.0 - initial addon release From 6c5398b4fb2097d6556f2f3450a1ec7bb2861c32 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 12:20:39 +0200 Subject: [PATCH 072/337] Detect display type based on "info" reply --- script.xbmc.lcd/resources/lib/lcdproc.py | 33 ++++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 290bd06..4dcb71a 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -66,6 +66,7 @@ def __init__(self): self.m_strIconName = "BLOCK_FILLED" self.m_iBigDigits = int(8) # 12:45:78 / colons count as digit self.m_strSetLineCmds = "" + self.m_cExtraIcons = None self.m_vPythonVersion = sys.version_info if self.m_vPythonVersion < (2, 7): @@ -221,6 +222,31 @@ def Initialize(self): return connected + def DetermineExtraSupport(self): + rematch_imon = "SoundGraph iMON(.*)LCD" + rematch_mdm166a = "Targa(.*)mdm166a" + + # Never cause script failure/interruption by this! This is totally optional! + try: + # Retrieve driver name for additional functionality + self.tn.write("info\n") + reply = str(self.tn.read_until("\n",3)).strip() + + # When the LCDd driver doesn't supply a valid string, inform and return + if reply == "": + log(xbmc.LOGNOTICE, "Empty driver information reply") + return + + log(xbmc.LOGNOTICE, "Driver information reply: " + reply) + + if re.match(rematch_imon, reply): + log(xbmc.LOGNOTICE, "SoundGraph iMON LCD detected") + + elif re.match(rematch_mdm166a, reply): + log(xbmc.LOGNOTICE, "Futaba/Targa USB mdm166a VFD detected") + except: + pass + def Connect(self): self.CloseSocket() @@ -258,10 +284,7 @@ def Connect(self): # tell users what's going on log(xbmc.LOGNOTICE, "Connected to LCDd at %s:%s, Protocol version %s - Geometry %sx%s characters (%sx%s pixels, %sx%s pixels per character)" % (str(ip), str(port), float(lcdinfo.group(1)), str(self.m_iColumns), str(self.m_iRows), str(self.m_iColumns * self.m_iCellWidth), str(self.m_iRows * self.m_iCellHeight), str(self.m_iCellWidth), str(self.m_iCellHeight))) - # Retrieve driver name for additional functionality - self.tn.write("info\n") - reply = self.tn.read_until("\n",3) - log(xbmc.LOGDEBUG,"info Reply: " + reply) + self.DetermineExtraSupport() # Set up BigNum values based on display geometry if self.m_iColumns < 16: @@ -270,7 +293,7 @@ def Connect(self): self.m_iBigDigits = 7 except: - log(xbmc.LOGERROR,"Connect: Telnet exception.") + log(xbmc.LOGERROR,"Connect: Caught exception, aborting.") return False if not self.SetupScreen(): From c716a5bc34658f77e184ea76c22421fdd759182e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 13:06:04 +0200 Subject: [PATCH 073/337] Begin implementation of extraicon support stuff --- script.xbmc.lcd/resources/lib/extraicons.py | 105 ++++++++++++++++++ .../resources/lib/lcdproc_extra_imon.py | 43 +++++++ 2 files changed, 148 insertions(+) create mode 100644 script.xbmc.lcd/resources/lib/extraicons.py create mode 100644 script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py diff --git a/script.xbmc.lcd/resources/lib/extraicons.py b/script.xbmc.lcd/resources/lib/extraicons.py new file mode 100644 index 0000000..c4aa9df --- /dev/null +++ b/script.xbmc.lcd/resources/lib/extraicons.py @@ -0,0 +1,105 @@ +''' + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +# enum snippet from http://stackoverflow.com/a/1695250 - thanks! +def enum(*sequential, **named): + enums = dict(zip(sequential, range(len(sequential))), **named) + return type('Enum', (), enums) + +LCD_EXTRAICONS = enum( + 'LCD_EXTRAICON_NONE', + 'LCD_EXTRAICON_PLAYING', + 'LCD_EXTRAICON_PAUSE', + 'LCD_EXTRAICON_MOVIE', + 'LCD_EXTRAICON_MUSIC', + 'LCD_EXTRAICON_WEATHER', + 'LCD_EXTRAICON_TV', + 'LCD_EXTRAICON_PHOTO', + 'LCD_EXTRAICON_MUTE', + 'LCD_EXTRAICON_REPEAT', + 'LCD_EXTRAICON_SHUFFLE', + 'LCD_EXTRAICON_ALARM', + 'LCD_EXTRAICON_RECORD', + 'LCD_EXTRAICON_VOLUME', + 'LCD_EXTRAICON_TIME', + 'LCD_EXTRAICON_SPDIF', + 'LCD_EXTRAICON_DISC_IN', + 'LCD_EXTRAICON_SCR1', + 'LCD_EXTRAICON_SCR2', + 'LCD_EXTRAICON_RESOLUTION_SD', + 'LCD_EXTRAICON_RESOLUTION_HD', + 'LCD_EXTRAICON_VCODEC_MPEG', + 'LCD_EXTRAICON_VCODEC_DIVX', + 'LCD_EXTRAICON_VCODEC_XVID', + 'LCD_EXTRAICON_VCODEC_WMV', + 'LCD_EXTRAICON_ACODEC_MPEG', + 'LCD_EXTRAICON_ACODEC_AC3', + 'LCD_EXTRAICON_ACODEC_DTS', + 'LCD_EXTRAICON_ACODEC_VWMA', # e.g. iMON has video-WMA AND audio-WMA... + 'LCD_EXTRAICON_ACODEC_MP3', + 'LCD_EXTRAICON_ACODEC_OGG', + 'LCD_EXTRAICON_ACODEC_AWMA', # see ACODEC_VWMA + 'LCD_EXTRAICON_ACODEC_WAV', + 'LCD_EXTRAICON_OUTSOURCE', + 'LCD_EXTRAICON_OUTFIT', + 'LCD_EXTRAICON_OUT_2_0', + 'LCD_EXTRAICON_OUT_5_1', + 'LCD_EXTRAICON_OUT_7_1', + 'LCD_EXTRAICON_MAX' +) +''' +class LCD_EXTRAICONS_CLASS: + LCD_EXTRAICON_BLANK = 0 + LCD_EXTRAICON_PLAYING = 1 + LCD_EXTRAICON_PAUSE = 2 + LCD_EXTRAICON_MOVIE = 3 + LCD_EXTRAICON_MUSIC = 4 + LCD_EXTRAICON_WEATHER = 5 + LCD_EXTRAICON_TV = 6 + LCD_EXTRAICON_PHOTO = 7 + LCD_EXTRAICON_RESOLUTION_SD = 8 + LCD_EXTRAICON_RESOLUTION_HD = 9 + LCD_EXTRAICON_MUTE = 10 + LCD_EXTRAICON_REPEAT = 11 + LCD_EXTRAICON_SHUFFLE = 12 + LCD_EXTRAICON_ALARM = 13 + LCD_EXTRAICON_RECORD = 14 + LCD_EXTRAICON_VOLUME = 15 + LCD_EXTRAICON_TIME = 16 + LCD_EXTRAICON_SPDIF = 17 + LCD_EXTRAICON_DISC_IN = 18 + LCD_EXTRAICON_OUTSOURCE = 19 + LCD_EXTRAICON_OUTFIT = 20 + LCD_EXTRAICON_SCR1 = 21 + LCD_EXTRAICON_SCR2 = 22 + LCD_EXTRAICON_VCODEC_MPEG = 23 + LCD_EXTRAICON_VCODEC_DIVX = 24 + LCD_EXTRAICON_VCODEC_XVID = 25 + LCD_EXTRAICON_VCODEC_WMV = 26 + LCD_EXTRAICON_ACODEC_MPEG = 27 + LCD_EXTRAICON_ACODEC_AC3 = 28 + LCD_EXTRAICON_ACODEC_DTS = 29 + LCD_EXTRAICON_ACODEC_VWMA = 30 # e.g. iMON has video-WMA AND audio-WMA... + LCD_EXTRAICON_ACODEC_MP3 = 31 + LCD_EXTRAICON_ACODEC_OGG = 32 + LCD_EXTRAICON_ACODEC_AWMA = 33 # see ACODEC_VWMA + LCD_EXTRAICON_ACODEC_WAV = 34 + LCD_EXTRAICON_OUT_2_0 = 35 + LCD_EXTRAICON_OUT_5_1 = 36 + LCD_EXTRAICON_OUT_7_1 = 37 +''' diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py new file mode 100644 index 0000000..384020f --- /dev/null +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -0,0 +1,43 @@ +''' + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC + + Support for extra symbols on SoundGraph iMON LCD displays + Copyright (C) 2012 Daniel Scheller + Original C implementation (C) 2010 theonlychrizz + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +import xbmc +import sys + +__scriptname__ = sys.modules[ "__main__" ].__scriptname__ +__settings__ = sys.modules[ "__main__" ].__settings__ +__cwd__ = sys.modules[ "__main__" ].__cwd__ +__icon__ = sys.modules[ "__main__" ].__icon__ + +from lcdbase import LCD_EXTRAICONS +from extraicons import * + +def log(loglevel, msg): + xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) + +class IMON_ICONS: + ICON_SPINDISC = 0 + +class LCDproc_extra_imon(): + def __init__(self): + pass + \ No newline at end of file From 37096d6c25d59d0f113ee363fe92dce37f6c6059 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 14:23:31 +0200 Subject: [PATCH 074/337] iMON: LCDproc "returners", progress bar calculation --- .../resources/lib/lcdproc_extra_imon.py | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index 384020f..c253760 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -28,6 +28,7 @@ __cwd__ = sys.modules[ "__main__" ].__cwd__ __icon__ = sys.modules[ "__main__" ].__icon__ +from lcdproc import * from lcdbase import LCD_EXTRAICONS from extraicons import * @@ -36,8 +37,49 @@ def log(loglevel, msg): class IMON_ICONS: ICON_SPINDISC = 0 + BARS = 29 class LCDproc_extra_imon(): def __init__(self): - pass - \ No newline at end of file + self.m_iOutputValueOldIcons = 1 + self.m_iOutputValueOldBars = 1 + self.m_iOutputValueIcons = 0 + self.m_iOutputValueBars = 0 + + def __SetBar(self, barnum, value): + if barnum == 1: + bitmask = 0x00000FC0 + bitshift = 6 + elif barnum == 2: + bitmask = 0x00FC0000 + bitshift = 18 + elif barnum == 3: + bitmask = 0x0000003F + bitshift = 0 + elif barnum == 4: + bitmask = 0x0003F000 + bitshift = 12 + else: + return self.m_iOutputValueProgress + + self.m_iOutputValueBars = (self.m_iOutputValueBars &~ bitmask) + self.m_iOutputValueBars |= (int(32 * (value / 100)) << bitshift) & bitmask + self.m_iOutputValueBars |= 1 << IMON_ICONS.BARS + + def SetOutputIcons(self): + ret = "" + + if self.m_iOutputValueIcons != self.m_iOutputValueOldIcons: + self.m_iOutputValueOldIcons = self.m_iOutputValueIcons + ret += "output %d\n" % (self.m_iOutputValueIcons) + + return ret + + def SetOutputBars(self): + ret = "" + + if self.m_iOutputValueBars != self.m_iOutputValueOldBars: + self.m_iOutputValueOldBars = self.m_iOutputValueBars + ret += "output %d\n" % (self.m_iOutputValueBars) + + return ret From a25882c7fc02b4ccd261fc161220ef348b752a4e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 14:24:23 +0200 Subject: [PATCH 075/337] Attach class for iMON displays --- script.xbmc.lcd/resources/lib/lcdproc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 4dcb71a..628ab99 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -40,6 +40,8 @@ from settings import * from lcdbase import * +from lcdproc_extra_imon import * + def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) @@ -241,9 +243,11 @@ def DetermineExtraSupport(self): if re.match(rematch_imon, reply): log(xbmc.LOGNOTICE, "SoundGraph iMON LCD detected") + self.m_cExtraIcons = LCDproc_extra_imon() elif re.match(rematch_mdm166a, reply): log(xbmc.LOGNOTICE, "Futaba/Targa USB mdm166a VFD detected") + except: pass From 066aeb77e3d16acc6d0d5a861cbd5e521f6728b2 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 14:24:59 +0200 Subject: [PATCH 076/337] Do rendering if class is set, do some dummy rendering --- script.xbmc.lcd/resources/lib/lcdbase.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index c793744..0f92331 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -40,6 +40,7 @@ __lcdxml__ = xbmc.translatePath( os.path.join("special://masterprofile","LCD.xml")) from settings import * +from extraicons import * g_dictEmptyLineDescriptor = {} g_dictEmptyLineDescriptor['type'] = str("text") @@ -370,6 +371,9 @@ def Render(self, mode, bForce): self.SetLine(outLine, "", g_dictEmptyLineDescriptor, bForce) outLine += 1 + if self.m_cExtraIcons is not None: + self.RenderExtraIcons() + self.FlushLines() def DisableOnPlayback(self, playingVideo, playingAudio): @@ -382,3 +386,12 @@ def DisableOnPlayback(self, playingVideo, playingAudio): self.SetBackLight(1) self.m_bDimmedOnPlayback = False + def RenderExtraIcons(self): + bPlaying = (xbmc.getCondVisibility("Player.Playing") | + xbmc.getCondVisibility("Player.Paused") | + xbmc.getCondVisibility("Player.Forwarding") | + xbmc.getCondVisibility("Player.Rewinding")) + + if bPlaying: + pass + From 7e5b78048c9e4e6dc42a83579e6a2d07db5e4c7f Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 16:23:18 +0200 Subject: [PATCH 077/337] Bitmasks for icon setting and clearing --- .../resources/lib/lcdproc_extra_imon.py | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index c253760..c173b36 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -35,9 +35,53 @@ def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) +# extra icon bitmasks class IMON_ICONS: - ICON_SPINDISC = 0 - BARS = 29 + ICON_SPINDISC = 0x01 << 0 + ICON_TOP_MUSIC = 0x01 << 1 + ICON_TOP_MOVIE = 0x01 << 2 + ICON_TOP_PHOTO = (0x01 << 1) | (0x01 << 2) + ICON_TOP_CDDVD = 0x01 << 3 + ICON_TOP_TV = (0x01 << 1) | (0x01 << 3) + ICON_TOP_WEBCASTING = (0x01 << 2) | (0x01 << 3) + ICON_TOP_NEWSWEATHER = (0x01 << 1) | (0x01 << 2) | (0x01 << 3) + ICON_CH_2_0 = 0x01 << 4 + ICON_CH_5_1 = 0x01 << 5 + ICON_CH_7_1 = (0x01 << 4) | (0x01 << 5) + ICON_SPDIF = 0x01 << 6 + ICON_OUT_SRC = 0x01 << 7 + ICON_OUT_FIT = 0x01 << 8 + ICON_OUT_SD = 0x01 << 9 + ICON_OUT_HDTV = 0x01 << 10 + ICON_SCR1 = 0x01 << 11 + ICON_SCR2 = 0x01 << 12 + ICON_ACODEC_MP3 = 0x01 << 13 + ICON_ACODEC_OGG = 0x01 << 14 + ICON_ACODEC_AWMA = (0x01 << 13) | (0x01 << 14) + ICON_ACODEC_WAV = 0x01 << 15 + ICON_ACODEC_MPEG = 0x01 << 16 + ICON_ACODEC_AC3 = 0x01 << 17 + ICON_ACODEC_DTS = (0x01 << 16) | (0x01 << 17) + ICON_ACODEC_VWMA = 0x01 << 18 + ICON_VCODEC_MPEG = 0x01 << 19 + ICON_VCODEC_DIVX = 0x01 << 20 + ICON_VCODEC_XVID = (0x01 << 19) | (0x01 << 20) + ICON_VCODEC_WMV = 0x01 << 21 + ICON_VOLUME = 0x01 << 22 + ICON_TIME = 0x01 << 23 + ICON_ALARM = 0x01 << 24 + ICON_REC = 0x01 << 25 + ICON_REPEAT = 0x01 << 26 + ICON_SHUFFLE = 0x01 << 27 + BARS = 0x01 << 28 # additionally needs bar values in other bits + ICON_DISC_IN = 0x01 << 29 + + # clear masks + ICON_CLEAR_TOPROW = 0xffffffff &~ ((0x01 << 1) | (0x01 << 2) | (0x01 << 3)) + ICON_CLEAR_CHANNELS = 0xffffffff &~ ((0x01 << 4) | (0x01 << 5)) + ICON_CLEAR_BR = 0xffffffff &~ ((0x01 << 13) | (0x01 << 14) | (0x01 << 15)) + ICON_CLEAR_BM = 0xffffffff &~ ((0x01 << 16) | (0x01 << 17) | (0x01 << 18)) + ICON_CLEAR_BL = 0xffffffff &~ ((0x01 << 19) | (0x01 << 20) | (0x01 << 21)) class LCDproc_extra_imon(): def __init__(self): From 6d12bfbf1ee4be1736a6cc99232af9d4ea7d73ef Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 17:45:42 +0200 Subject: [PATCH 078/337] Do some rendering --- script.xbmc.lcd/resources/lib/lcdbase.py | 12 ++++++------ script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 0f92331..410d7cc 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -372,8 +372,10 @@ def Render(self, mode, bForce): outLine += 1 if self.m_cExtraIcons is not None: - self.RenderExtraIcons() - + self.SetExtraIcons() + self.m_strSetLineCmds += self.m_cExtraIcons.SetOutputIcons() + self.m_strSetLineCmds += self.m_cExtraIcons.SetOutputBars() + self.FlushLines() def DisableOnPlayback(self, playingVideo, playingAudio): @@ -386,12 +388,10 @@ def DisableOnPlayback(self, playingVideo, playingAudio): self.SetBackLight(1) self.m_bDimmedOnPlayback = False - def RenderExtraIcons(self): + def SetExtraIcons(self): bPlaying = (xbmc.getCondVisibility("Player.Playing") | xbmc.getCondVisibility("Player.Paused") | xbmc.getCondVisibility("Player.Forwarding") | xbmc.getCondVisibility("Player.Rewinding")) - if bPlaying: - pass - + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING, bPlaying) diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index c173b36..d9bb794 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -110,6 +110,12 @@ def __SetBar(self, barnum, value): self.m_iOutputValueBars |= (int(32 * (value / 100)) << bitshift) & bitmask self.m_iOutputValueBars |= 1 << IMON_ICONS.BARS + def __SetIconStateDo(self, bitmask, state): + if state: + self.m_iOutputValueIcons |= bitmask + else: + self.m_iOutputValueIcons &= ~bitmask + def SetOutputIcons(self): ret = "" @@ -127,3 +133,7 @@ def SetOutputBars(self): ret += "output %d\n" % (self.m_iOutputValueBars) return ret + + def SetIconState(self, icon, state): + if icon == LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING: + self.__SetIconStateDo(IMON_ICONS.ICON_SPINDISC, state) From 1348436b86f31936384510d694c7e46639f94768 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 18:03:26 +0200 Subject: [PATCH 079/337] Stub class, Initialisation method --- script.xbmc.lcd/resources/lib/lcdbase.py | 2 +- script.xbmc.lcd/resources/lib/lcdproc.py | 1 + .../resources/lib/lcdproc_extra_base.py | 48 +++++++++++++++++++ .../resources/lib/lcdproc_extra_imon.py | 23 ++++++--- 4 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 script.xbmc.lcd/resources/lib/lcdproc_extra_base.py diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 410d7cc..ed4df50 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -111,7 +111,7 @@ def Resume(self): def SetBackLight(self, iLight): pass -# @abstractmethod +# @abstractmethod def SetContrast(self, iContrast): pass diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 628ab99..a09b9be 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -244,6 +244,7 @@ def DetermineExtraSupport(self): if re.match(rematch_imon, reply): log(xbmc.LOGNOTICE, "SoundGraph iMON LCD detected") self.m_cExtraIcons = LCDproc_extra_imon() + self.m_cExtraIcons.Initialize() elif re.match(rematch_mdm166a, reply): log(xbmc.LOGNOTICE, "Futaba/Targa USB mdm166a VFD detected") diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py new file mode 100644 index 0000000..1b6fe36 --- /dev/null +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py @@ -0,0 +1,48 @@ +''' + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC + + Support for extra symbols on SoundGraph iMON LCD displays + Copyright (C) 2012 Daniel Scheller + Original C implementation (C) 2010 theonlychrizz + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +import sys + +__scriptname__ = sys.modules[ "__main__" ].__scriptname__ +__settings__ = sys.modules[ "__main__" ].__settings__ +__cwd__ = sys.modules[ "__main__" ].__cwd__ +__icon__ = sys.modules[ "__main__" ].__icon__ + +class LCDproc_extra_base(): + def __init__(self): + pass + +# @abstractmethod + def SetOutputIcons(self): + pass + +# @abstractmethod + def SetOutputBars(self): + pass + +# @abstractmethod + def SetIconState(self, icon, state): + pass + +# @abstractmethod + def Initialize(self): + pass diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index d9bb794..2bd6a6b 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -31,6 +31,7 @@ from lcdproc import * from lcdbase import LCD_EXTRAICONS from extraicons import * +from lcdproc_extra_base import * def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) @@ -83,14 +84,16 @@ class IMON_ICONS: ICON_CLEAR_BM = 0xffffffff &~ ((0x01 << 16) | (0x01 << 17) | (0x01 << 18)) ICON_CLEAR_BL = 0xffffffff &~ ((0x01 << 19) | (0x01 << 20) | (0x01 << 21)) -class LCDproc_extra_imon(): +class LCDproc_extra_imon(LCDproc_extra_base): def __init__(self): self.m_iOutputValueOldIcons = 1 self.m_iOutputValueOldBars = 1 self.m_iOutputValueIcons = 0 self.m_iOutputValueBars = 0 - def __SetBar(self, barnum, value): + LCDproc_extra_base.__init__(self) + + def _SetBar(self, barnum, value): if barnum == 1: bitmask = 0x00000FC0 bitshift = 6 @@ -104,13 +107,17 @@ def __SetBar(self, barnum, value): bitmask = 0x0003F000 bitshift = 12 else: - return self.m_iOutputValueProgress + return + log(xbmc.LOGNOTICE, "ifdone") self.m_iOutputValueBars = (self.m_iOutputValueBars &~ bitmask) + log(xbmc.LOGNOTICE, "reset") self.m_iOutputValueBars |= (int(32 * (value / 100)) << bitshift) & bitmask - self.m_iOutputValueBars |= 1 << IMON_ICONS.BARS + log(xbmc.LOGNOTICE, "set") + self.m_iOutputValueBars |= IMON_ICONS.BARS + log(xbmc.LOGNOTICE, "mask") - def __SetIconStateDo(self, bitmask, state): + def _SetIconStateDo(self, bitmask, state): if state: self.m_iOutputValueIcons |= bitmask else: @@ -136,4 +143,8 @@ def SetOutputBars(self): def SetIconState(self, icon, state): if icon == LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING: - self.__SetIconStateDo(IMON_ICONS.ICON_SPINDISC, state) + self._SetIconStateDo(IMON_ICONS.ICON_SPINDISC, state) + + def Initialize(self): + for i in range(1, 5): + self._SetBar(i, float(0)) From ef9e9f6f124d7a2e3e96489408e8b8f938737ac4 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 18:05:56 +0200 Subject: [PATCH 080/337] Mark as private by comment, function reorder --- script.xbmc.lcd/resources/lib/lcdbase.py | 8 ++++++++ script.xbmc.lcd/resources/lib/lcdproc_extra_base.py | 7 ++++--- script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py | 9 ++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index ed4df50..9765b4e 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -395,3 +395,11 @@ def SetExtraIcons(self): xbmc.getCondVisibility("Player.Rewinding")) self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING, bPlaying) + + + + + + + + diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py index 1b6fe36..c524a74 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py @@ -31,6 +31,10 @@ class LCDproc_extra_base(): def __init__(self): pass +# @abstractmethod + def Initialize(self): + pass + # @abstractmethod def SetOutputIcons(self): pass @@ -43,6 +47,3 @@ def SetOutputBars(self): def SetIconState(self, icon, state): pass -# @abstractmethod - def Initialize(self): - pass diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index 2bd6a6b..d817758 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -93,6 +93,7 @@ def __init__(self): LCDproc_extra_base.__init__(self) + # private def _SetBar(self, barnum, value): if barnum == 1: bitmask = 0x00000FC0 @@ -117,12 +118,17 @@ def _SetBar(self, barnum, value): self.m_iOutputValueBars |= IMON_ICONS.BARS log(xbmc.LOGNOTICE, "mask") + # private def _SetIconStateDo(self, bitmask, state): if state: self.m_iOutputValueIcons |= bitmask else: self.m_iOutputValueIcons &= ~bitmask + def Initialize(self): + for i in range(1, 5): + self._SetBar(i, float(0)) + def SetOutputIcons(self): ret = "" @@ -145,6 +151,3 @@ def SetIconState(self, icon, state): if icon == LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING: self._SetIconStateDo(IMON_ICONS.ICON_SPINDISC, state) - def Initialize(self): - for i in range(1, 5): - self._SetBar(i, float(0)) From 2432d05a9584f5b65dd44fc9dfe5c1d055463091 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 20:45:34 +0200 Subject: [PATCH 081/337] Many icon states and ClearIcon functions --- script.xbmc.lcd/resources/lib/extraicons.py | 9 ++ script.xbmc.lcd/resources/lib/lcdbase.py | 125 +++++++++++++++++- .../resources/lib/lcdproc_extra_base.py | 3 + .../resources/lib/lcdproc_extra_imon.py | 101 +++++++++++++- 4 files changed, 230 insertions(+), 8 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/extraicons.py b/script.xbmc.lcd/resources/lib/extraicons.py index c4aa9df..7cf0a41 100644 --- a/script.xbmc.lcd/resources/lib/extraicons.py +++ b/script.xbmc.lcd/resources/lib/extraicons.py @@ -62,6 +62,15 @@ def enum(*sequential, **named): 'LCD_EXTRAICON_OUT_7_1', 'LCD_EXTRAICON_MAX' ) + +LCD_EXTRAICONCATEGORIES = enum( + 'LCD_ICONCAT_MODES', + 'LCD_ICONCAT_CODECS', + 'LCD_ICONCAT_VIDEOCODECS', + 'LCD_ICONCAT_AUDIOCODECS', + 'LCD_ICONCAT_AUDIOCHANNELS' +) + ''' class LCD_EXTRAICONS_CLASS: LCD_EXTRAICON_BLANK = 0 diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 9765b4e..035d60d 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -372,7 +372,7 @@ def Render(self, mode, bForce): outLine += 1 if self.m_cExtraIcons is not None: - self.SetExtraIcons() + self.SetExtraInformation() self.m_strSetLineCmds += self.m_cExtraIcons.SetOutputIcons() self.m_strSetLineCmds += self.m_cExtraIcons.SetOutputBars() @@ -388,14 +388,133 @@ def DisableOnPlayback(self, playingVideo, playingAudio): self.SetBackLight(1) self.m_bDimmedOnPlayback = False - def SetExtraIcons(self): + def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): + if isplaying: + if isvideo: + try: + iVideoRes = int(xbmc.getInfoLabel("VideoPlayer.VideoResolution")) + except: + iVideoRes = int(0) + + try: + iScreenRes = int(xbmc.getInfoLabel("System.ScreenHeight")) + except: + iScreenRes = int(0) + + if xbmc.getCondVisibility("PVR.IsPlayingTV"): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TV, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MOVIE, True) + + if iVideoRes < 720: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_RESOLUTION_SD, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_RESOLUTION_HD, True) + + if iScreenRes <= (iVideoRes + (float(iVideoRes) * 0.1)) and iScreenRes >= (iVideoRes - (float(iVideoRes) * 0.1)): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUTSOURCE, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUTFIT, True) + + elif isaudio: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUSIC, True) + + else: + self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_MODES) + ###FIXME###TODO### ID = g_windowManager.GetActiveWindow() translation for navigation + + def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): + if isplaying: + if xbmc.getCondVisibility("Player.PassThrough"): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, False) + + if isvideo: + videocodec = xbmc.getInfoLabel("VideoPlayer.VideoCodec") + audiocodec = xbmc.getInfoLabel("VideoPlayer.AudioCodec") + audiochannels = xbmc.getInfoLabel("VideoPlayer.AudioChannels") + elif isaudio: + videocodec = "" + audiocodec = xbmc.getInfoLabel("MusicPlayer.Codec") + audiochannels = xbmc.getInfoLabel("MusicPlayer.Channels") + + if audiochannels == "" and audiocodec != "": + audiochannels = 2 + elif audiochannels == "": + audiochannels = 0 + else: + audiochannels = int(audiochannels) + + if audiochannels > 0 and audiochannels <= 3: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_2_0, True) + elif audiochannels <= 6: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_5_1, True) + elif audiochannels <= 8: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_7_1, True) + else: + self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_AUDIOCHANNELS) + + else: + self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_CODECS) + + def SetExtraInfoGeneric(self, ispaused): + if xbmc.getInfoLabel("Player.Volume") == 0.0: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUTE, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUTE, False) + + if xbmc.getCondVisibility("Player.Paused"): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PAUSE, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PAUSE, False) + + if xbmc.getCondVisibility("PVR.IsRecording"): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_RECORD, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_RECORD, False) + + if xbmc.getCondVisibility("Playlist.IsRandom"): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SHUFFLE, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SHUFFLE, False) + + if xbmc.getCondVisibility("Playlist.IsRepeat") or xbmc.getCondVisibility("Playlist.IsRepeatOne"): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_REPEAT, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_REPEAT, False) + + if xbmc.getCondVisibility("System.HasMediaDVD"): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_DISC_IN, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_DISC_IN, False) + + if xbmc.getCondVisibility("System.ScreenSaverActive"): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TIME, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TIME, False) + + ###FIXME###TODO### g_windowManager.IsWindowActive(WINDOW_DIALOG_VOLUME_BAR) : ICON_VOLUME + ###FIXME###TODO### g_windowManager.IsWindowActive(WINDOW_DIALOG_KAI_TOAST) : ICON_ALARM + + def SetExtraInformation(self): + # These four states count for "isplayinganything" + bPaused = xbmc.getCondVisibility("Player.Paused") bPlaying = (xbmc.getCondVisibility("Player.Playing") | - xbmc.getCondVisibility("Player.Paused") | + bPaused | xbmc.getCondVisibility("Player.Forwarding") | xbmc.getCondVisibility("Player.Rewinding")) + bIsVideo = xbmc.getCondVisibility("Player.HasVideo") + bIsAudio = xbmc.getCondVisibility("Player.HasAudio") + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING, bPlaying) + self.SetExtraInfoPlaying(bPlaying, bIsVideo, bIsAudio) + self.SetExtraInfoCodecs(bPlaying, bIsVideo, bIsAudio) + self.SetExtraInfoGeneric(bPaused) + + diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py index c524a74..345f1d3 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py @@ -47,3 +47,6 @@ def SetOutputBars(self): def SetIconState(self, icon, state): pass +# @abstractmethod + def ClearIconStates(self, category): + pass diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index d817758..eb01a7b 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -76,10 +76,12 @@ class IMON_ICONS: ICON_SHUFFLE = 0x01 << 27 BARS = 0x01 << 28 # additionally needs bar values in other bits ICON_DISC_IN = 0x01 << 29 + ICON_DUMMY = 0x01 << 30 # Dummy icon so bars won't reset # clear masks ICON_CLEAR_TOPROW = 0xffffffff &~ ((0x01 << 1) | (0x01 << 2) | (0x01 << 3)) - ICON_CLEAR_CHANNELS = 0xffffffff &~ ((0x01 << 4) | (0x01 << 5)) + ICON_CLEAR_OUTSCALE = 0xffffffff &~ ((0x01 << 7) | (0x01 << 8) | (0x01 << 9) | (0x01 << 10)) + ICON_CLEAR_CHANNELS = 0xffffffff &~ ((0x01 << 4) | (0x01 << 5) | (0x01 << 6)) ICON_CLEAR_BR = 0xffffffff &~ ((0x01 << 13) | (0x01 << 14) | (0x01 << 15)) ICON_CLEAR_BM = 0xffffffff &~ ((0x01 << 16) | (0x01 << 17) | (0x01 << 18)) ICON_CLEAR_BL = 0xffffffff &~ ((0x01 << 19) | (0x01 << 20) | (0x01 << 21)) @@ -110,13 +112,9 @@ def _SetBar(self, barnum, value): else: return - log(xbmc.LOGNOTICE, "ifdone") self.m_iOutputValueBars = (self.m_iOutputValueBars &~ bitmask) - log(xbmc.LOGNOTICE, "reset") self.m_iOutputValueBars |= (int(32 * (value / 100)) << bitshift) & bitmask - log(xbmc.LOGNOTICE, "set") self.m_iOutputValueBars |= IMON_ICONS.BARS - log(xbmc.LOGNOTICE, "mask") # private def _SetIconStateDo(self, bitmask, state): @@ -132,6 +130,9 @@ def Initialize(self): def SetOutputIcons(self): ret = "" + # Make sure we don't send "0" to LCDproc, this would reset bars + self.m_iOutputValueIcons |= IMON_ICONS.ICON_DUMMY + if self.m_iOutputValueIcons != self.m_iOutputValueOldIcons: self.m_iOutputValueOldIcons = self.m_iOutputValueIcons ret += "output %d\n" % (self.m_iOutputValueIcons) @@ -151,3 +152,93 @@ def SetIconState(self, icon, state): if icon == LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING: self._SetIconStateDo(IMON_ICONS.ICON_SPINDISC, state) + # Icons used for "Modes" category + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_MOVIE: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_TOPROW + self._SetIconStateDo(IMON_ICONS.ICON_TOP_MOVIE, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_MUSIC: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_TOPROW + self._SetIconStateDo(IMON_ICONS.ICON_TOP_MUSIC, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_WEATHER: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_TOPROW + self._SetIconStateDo(IMON_ICONS.ICON_TOP_NEWSWEATHER, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_TV: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_TOPROW + self._SetIconStateDo(IMON_ICONS.ICON_TOP_TV, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_PHOTO: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_TOPROW + self._SetIconStateDo(IMON_ICONS.ICON_TOP_PHOTO, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_RESOLUTION_SD: + self._SetIconStateDo(IMON_ICONS.ICON_OUT_SD, state) + self._SetIconStateDo(IMON_ICONS.ICON_OUT_HDTV, False) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_RESOLUTION_HD: + self._SetIconStateDo(IMON_ICONS.ICON_OUT_SD, False) + self._SetIconStateDo(IMON_ICONS.ICON_OUT_HDTV, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_OUTSOURCE: + self._SetIconStateDo(IMON_ICONS.ICON_OUT_SRC, state) + self._SetIconStateDo(IMON_ICONS.ICON_OUT_FIT, False) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_OUTFIT: + self._SetIconStateDo(IMON_ICONS.ICON_OUT_SRC, False) + self._SetIconStateDo(IMON_ICONS.ICON_OUT_FIT, state) + + # Codec/Channel information + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF: + self._SetIconStateDo(IMON_ICONS.ICON_SPDIF, state) + + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_OUT_2_0: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_CHANNELS + self._SetIconStateDo(IMON_ICONS.ICON_CH_2_0, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_OUT_5_1: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_CHANNELS + self._SetIconStateDo(IMON_ICONS.ICON_CH_5_1, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_OUT_7_1: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_CHANNELS + self._SetIconStateDo(IMON_ICONS.ICON_CH_7_1, state) + + # Generic application state icons + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_RECORD: + self._SetIconStateDo(IMON_ICONS.ICON_REC, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_SHUFFLE: + self._SetIconStateDo(IMON_ICONS.ICON_SHUFFLE, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_REPEAT: + self._SetIconStateDo(IMON_ICONS.ICON_REPEAT, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_DISC_IN: + self._SetIconStateDo(IMON_ICONS.ICON_DISC_IN, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_TIME: + self._SetIconStateDo(IMON_ICONS.ICON_TIME, state) + + def ClearIconStates(self, category): + if category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_MODES: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_TOPROW + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_OUTSCALE + + elif category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_CODECS: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_CHANNELS + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BL + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BM + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BR + + elif category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_VIDEOCODECS: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BL + + elif category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_AUDIOCODECS: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BM + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BR + + elif category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_AUDIOCHANNELS: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_CHANNELS From c3625bf5785b273de1c421148969b734c60b040d Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 21:16:02 +0200 Subject: [PATCH 082/337] Fix some uninitialised value problems --- script.xbmc.lcd/resources/lib/lcdbase.py | 34 +++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 035d60d..0c3207b 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -424,6 +424,10 @@ def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): ###FIXME###TODO### ID = g_windowManager.GetActiveWindow() translation for navigation def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): + strVideoCodec = "" + strAudioCodec = "" + iAudioChannels = 0 + if isplaying: if xbmc.getCondVisibility("Player.PassThrough"): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, True) @@ -431,26 +435,26 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, False) if isvideo: - videocodec = xbmc.getInfoLabel("VideoPlayer.VideoCodec") - audiocodec = xbmc.getInfoLabel("VideoPlayer.AudioCodec") - audiochannels = xbmc.getInfoLabel("VideoPlayer.AudioChannels") + strVideoCodecc = xbmc.getInfoLabel("VideoPlayer.VideoCodec") + strAudioCodec = xbmc.getInfoLabel("VideoPlayer.AudioCodec") + iAudioChannels = xbmc.getInfoLabel("VideoPlayer.AudioChannels") elif isaudio: - videocodec = "" - audiocodec = xbmc.getInfoLabel("MusicPlayer.Codec") - audiochannels = xbmc.getInfoLabel("MusicPlayer.Channels") - - if audiochannels == "" and audiocodec != "": - audiochannels = 2 - elif audiochannels == "": - audiochannels = 0 + strVideoCodec = "" + strAudioCodec = xbmc.getInfoLabel("MusicPlayer.Codec") + iAudioChannels = xbmc.getInfoLabel("MusicPlayer.Channels") + + if iAudioChannels == "" and strAudioCodec != "": + iAudioChannels = 2 + elif iAudioChannels == "": + iAudioChannels = 0 else: - audiochannels = int(audiochannels) + iAudioChannels = int(iAudioChannels) - if audiochannels > 0 and audiochannels <= 3: + if iAudioChannels > 0 and iAudioChannels <= 3: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_2_0, True) - elif audiochannels <= 6: + elif iAudioChannels <= 6: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_5_1, True) - elif audiochannels <= 8: + elif iAudioChannels <= 8: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_7_1, True) else: self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_AUDIOCHANNELS) From 8a99f1755377514888b108782400a1ba6948c95f Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 21:54:34 +0200 Subject: [PATCH 083/337] Bugfixes: "output" only every second, channelmap set/clear --- script.xbmc.lcd/resources/lib/lcdbase.py | 7 ++--- .../resources/lib/lcdproc_extra_base.py | 4 +++ .../resources/lib/lcdproc_extra_imon.py | 29 +++++++++++++++++-- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 0c3207b..4a9feb0 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -373,9 +373,8 @@ def Render(self, mode, bForce): if self.m_cExtraIcons is not None: self.SetExtraInformation() - self.m_strSetLineCmds += self.m_cExtraIcons.SetOutputIcons() - self.m_strSetLineCmds += self.m_cExtraIcons.SetOutputBars() - + self.m_strSetLineCmds += self.m_cExtraIcons.GetOutputCommands() + self.FlushLines() def DisableOnPlayback(self, playingVideo, playingAudio): @@ -429,7 +428,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): iAudioChannels = 0 if isplaying: - if xbmc.getCondVisibility("Player.PassThrough"): + if xbmc.getCondVisibility("Player.Passthrough"): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, False) diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py index 345f1d3..0d782d4 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py @@ -43,6 +43,10 @@ def SetOutputIcons(self): def SetOutputBars(self): pass +# @abstractmethod + def GetOutputCommands(self): + pass + # @abstractmethod def SetIconState(self, icon, state): pass diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index eb01a7b..9b12252 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -22,6 +22,7 @@ import xbmc import sys +import time __scriptname__ = sys.modules[ "__main__" ].__scriptname__ __settings__ = sys.modules[ "__main__" ].__settings__ @@ -33,6 +34,8 @@ from extraicons import * from lcdproc_extra_base import * +IMON_OUTPUT_TIMEOUT = 1 + def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) @@ -81,7 +84,7 @@ class IMON_ICONS: # clear masks ICON_CLEAR_TOPROW = 0xffffffff &~ ((0x01 << 1) | (0x01 << 2) | (0x01 << 3)) ICON_CLEAR_OUTSCALE = 0xffffffff &~ ((0x01 << 7) | (0x01 << 8) | (0x01 << 9) | (0x01 << 10)) - ICON_CLEAR_CHANNELS = 0xffffffff &~ ((0x01 << 4) | (0x01 << 5) | (0x01 << 6)) + ICON_CLEAR_CHANNELS = 0xffffffff &~ ((0x01 << 4) | (0x01 << 5)) ICON_CLEAR_BR = 0xffffffff &~ ((0x01 << 13) | (0x01 << 14) | (0x01 << 15)) ICON_CLEAR_BM = 0xffffffff &~ ((0x01 << 16) | (0x01 << 17) | (0x01 << 18)) ICON_CLEAR_BL = 0xffffffff &~ ((0x01 << 19) | (0x01 << 20) | (0x01 << 21)) @@ -92,9 +95,20 @@ def __init__(self): self.m_iOutputValueOldBars = 1 self.m_iOutputValueIcons = 0 self.m_iOutputValueBars = 0 + self.m_iOutputTimer = time.time() LCDproc_extra_base.__init__(self) + # private + def _DoOutputCommand(self): + ret = False + + if self.m_iOutputTimer < time.time(): + ret = True + self.m_iOutputTimer = time.time() + + return ret + # private def _SetBar(self, barnum, value): if barnum == 1: @@ -148,6 +162,17 @@ def SetOutputBars(self): return ret + def GetOutputCommands(self): + ret = "" + + if self._DoOutputCommand(): + ret += self.SetOutputIcons() + + if self._DoOutputCommand() and ret == "": + ret += self.SetOutputBars() + + return ret + def SetIconState(self, icon, state): if icon == LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING: self._SetIconStateDo(IMON_ICONS.ICON_SPINDISC, state) @@ -193,7 +218,6 @@ def SetIconState(self, icon, state): elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF: self._SetIconStateDo(IMON_ICONS.ICON_SPDIF, state) - elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_OUT_2_0: self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_CHANNELS self._SetIconStateDo(IMON_ICONS.ICON_CH_2_0, state) @@ -229,6 +253,7 @@ def ClearIconStates(self, category): elif category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_CODECS: self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_CHANNELS + self.m_iOutputValueIcons &= ~IMON_ICONS.ICON_SPDIF self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BL self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BM self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BR From 3b30a8f35680c5330c2b5b2b7b9bf1ca1df22bf5 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 22:01:55 +0200 Subject: [PATCH 084/337] Fix primary/secondary output handling, actually use OUTPUT_INTERVAL --- script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index 9b12252..db3a7be 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -34,7 +34,7 @@ from extraicons import * from lcdproc_extra_base import * -IMON_OUTPUT_TIMEOUT = 1 +IMON_OUTPUT_INTERVAL = 1 # seconds def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) @@ -103,7 +103,7 @@ def __init__(self): def _DoOutputCommand(self): ret = False - if self.m_iOutputTimer < time.time(): + if (self.m_iOutputTimer + IMON_OUTPUT_INTERVAL) < time.time(): ret = True self.m_iOutputTimer = time.time() @@ -168,8 +168,8 @@ def GetOutputCommands(self): if self._DoOutputCommand(): ret += self.SetOutputIcons() - if self._DoOutputCommand() and ret == "": - ret += self.SetOutputBars() + if ret == "": + ret += self.SetOutputBars() return ret From ad867dc539a6d0eb2238e238ebc6518ed5012d2f Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 22:04:47 +0200 Subject: [PATCH 085/337] Output every 0.2 seconds is sufficient --- script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index db3a7be..82a3977 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -34,7 +34,7 @@ from extraicons import * from lcdproc_extra_base import * -IMON_OUTPUT_INTERVAL = 1 # seconds +IMON_OUTPUT_INTERVAL = 0.2 # seconds def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) From d2652c4ba49141d95cb781dcac04975ad3d8a63a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 22:44:42 +0200 Subject: [PATCH 086/337] Finish up codec icons --- script.xbmc.lcd/resources/lib/lcdbase.py | 66 ++++++++++++++++++- .../resources/lib/lcdproc_extra_imon.py | 63 +++++++++++++++++- 2 files changed, 124 insertions(+), 5 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 4a9feb0..99b5571 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -423,6 +423,7 @@ def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): ###FIXME###TODO### ID = g_windowManager.GetActiveWindow() translation for navigation def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): + # initialise stuff to avoid uninitialised var stuff strVideoCodec = "" strAudioCodec = "" iAudioChannels = 0 @@ -434,14 +435,72 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, False) if isvideo: - strVideoCodecc = xbmc.getInfoLabel("VideoPlayer.VideoCodec") - strAudioCodec = xbmc.getInfoLabel("VideoPlayer.AudioCodec") + strVideoCodec = str(xbmc.getInfoLabel("VideoPlayer.VideoCodec")).lower() + strAudioCodec = str(xbmc.getInfoLabel("VideoPlayer.AudioCodec")).lower() iAudioChannels = xbmc.getInfoLabel("VideoPlayer.AudioChannels") elif isaudio: strVideoCodec = "" - strAudioCodec = xbmc.getInfoLabel("MusicPlayer.Codec") + strAudioCodec = str(xbmc.getInfoLabel("MusicPlayer.Codec")).lower() iAudioChannels = xbmc.getInfoLabel("MusicPlayer.Channels") + # check video codec + # any mpeg video + if strVideoCodec in ["mpg", "mpeg", "mpeg2video", "h264", "x264", "mpeg4"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_MPEG, True) + + # any divx + elif strVideoCodec in ["divx", "dx50", "div3"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_DIVX, True) + + # xvid + elif strVideoCodec == "xvid": + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_XVID, True) + + # wmv + elif strVideoCodec == "wmv": + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_WMV, True) + + # anything else + else: + self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_VIDEOCODECS) + + # check audio codec + # any mpeg audio + if strAudioCodec in ["mpga", "mp2"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_MPEG, True) + + # any ac3/dolby digital + elif strAudioCodec in ["ac3", "truehd"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_AC3, True) + + # any dts + elif strAudioCodec in ["dts", "dca", "dtshd_ma"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_DTS, True) + + # mp3 + elif strAudioCodec == "mp3": + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_MP3, True) + + # any ogg vorbis + elif strAudioCodec in ["ogg", "vorbis"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_OGG, True) + + # any wma + elif strAudioCodec in ["wma", "wmav2"]: + if isvideo: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_VWMA, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_AWMA, True) + + # any pcm, wav or flac + elif strAudioCodec in ["wav", "pcm", "flac"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_WAV, True) + + # anything else + else: + self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_AUDIOCODECS) + + # make sure iAudioChannels contains something useful if iAudioChannels == "" and strAudioCodec != "": iAudioChannels = 2 elif iAudioChannels == "": @@ -449,6 +508,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): else: iAudioChannels = int(iAudioChannels) + # decide which icon (set) to activate if iAudioChannels > 0 and iAudioChannels <= 3: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_2_0, True) elif iAudioChannels <= 6: diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index 82a3977..e21d72a 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -215,9 +215,65 @@ def SetIconState(self, icon, state): self._SetIconStateDo(IMON_ICONS.ICON_OUT_FIT, state) # Codec/Channel information - elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF: - self._SetIconStateDo(IMON_ICONS.ICON_SPDIF, state) + # Video Codecs + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_MPEG: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BL + self._SetIconStateDo(IMON_ICONS.ICON_VCODEC_MPEG, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_DIVX: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BL + self._SetIconStateDo(IMON_ICONS.ICON_VCODEC_DIVX, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_XVID: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BL + self._SetIconStateDo(IMON_ICONS.ICON_VCODEC_XVID, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_WMV: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BL + self._SetIconStateDo(IMON_ICONS.ICON_VCODEC_WMV, state) + + # Audio Codecs + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_MPEG: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BM + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BR + self._SetIconStateDo(IMON_ICONS.ICON_ACODEC_MPEG, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_AC3: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BM + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BR + self._SetIconStateDo(IMON_ICONS.ICON_ACODEC_AC3, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_DTS: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BM + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BR + self._SetIconStateDo(IMON_ICONS.ICON_ACODEC_DTS, state) + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_MP3: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BM + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BR + self._SetIconStateDo(IMON_ICONS.ICON_ACODEC_MP3, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_VWMA: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BM + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BR + self._SetIconStateDo(IMON_ICONS.ICON_ACODEC_VWMA, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_AWMA: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BM + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BR + self._SetIconStateDo(IMON_ICONS.ICON_ACODEC_AWMA, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_OGG: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BM + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BR + self._SetIconStateDo(IMON_ICONS.ICON_ACODEC_OGG, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_WAV: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BM + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_BR + self._SetIconStateDo(IMON_ICONS.ICON_ACODEC_WAV, state) + + # Output channels elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_OUT_2_0: self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_CHANNELS self._SetIconStateDo(IMON_ICONS.ICON_CH_2_0, state) @@ -230,6 +286,9 @@ def SetIconState(self, icon, state): self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_CHANNELS self._SetIconStateDo(IMON_ICONS.ICON_CH_7_1, state) + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF: + self._SetIconStateDo(IMON_ICONS.ICON_SPDIF, state) + # Generic application state icons elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_RECORD: self._SetIconStateDo(IMON_ICONS.ICON_REC, state) From 612e251d64e0ecb638cb70246dd76caccd6c3abd Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 20 Oct 2012 23:55:10 +0200 Subject: [PATCH 087/337] Implement Bars setting and finalize extra display as far as possible --- script.xbmc.lcd/resources/lib/extraicons.py | 2 + script.xbmc.lcd/resources/lib/lcdbase.py | 42 +++++++++++++++++-- .../resources/lib/lcdproc_extra_base.py | 4 ++ .../resources/lib/lcdproc_extra_imon.py | 14 ++++++- 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/extraicons.py b/script.xbmc.lcd/resources/lib/extraicons.py index 7cf0a41..28fb285 100644 --- a/script.xbmc.lcd/resources/lib/extraicons.py +++ b/script.xbmc.lcd/resources/lib/extraicons.py @@ -21,6 +21,8 @@ def enum(*sequential, **named): enums = dict(zip(sequential, range(len(sequential))), **named) return type('Enum', (), enums) +LCD_EXTRABARS_MAX = 4 + LCD_EXTRAICONS = enum( 'LCD_EXTRAICON_NONE', 'LCD_EXTRAICON_PLAYING', diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 99b5571..26c1982 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -79,6 +79,7 @@ class LcdBase(): def __init__(self): self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE self.m_lcdMode = [None] * LCD_MODE.LCD_MODE_MAX + self.m_extraBars = [None] * (LCD_EXTRABARS_MAX + 1) self.m_bDimmedOnPlayback = False self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! @@ -216,6 +217,16 @@ def LoadSkin(self, xmlFile): if str(allowemptylines.text) == "on": self.m_bAllowEmptyLines = True + # extra progress bars + for i in range(1, LCD_EXTRABARS_MAX + 1): + extrabar = None + extrabar = element.find("extrabar%i" % (i)) + if extrabar != None: + if str(extrabar.text).strip() in ["progress", "volume", "menu"]: + self.m_extraBars[i] = str(extrabar.text).strip() + else: + self.m_extraBars[i] = "" + #load modes tmpMode = element.find("music") self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_MUSIC) @@ -337,6 +348,15 @@ def getCurrentDurationSecs(self): return self.timeToSecs(currentDurationAr) + def GetProgress(self): + currentSecs = self.getCurrentTimeSecs() + durationSecs = self.getCurrentDurationSecs() + return self.GetProgressBarPercent(currentSecs,durationSecs) + + def GetVolumePercent(self): + volumedb = float(string.replace(string.replace(xbmc.getInfoLabel("Player.Volume"), ",", "."), " dB", "")) + return (100 * (60.0 + volumedb) / 60) + def Render(self, mode, bForce): outLine = 0 inLine = 0 @@ -345,9 +365,7 @@ def Render(self, mode, bForce): #parse the progressbar infolabel by ourselfs! if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS: # get playtime and duration and convert into seconds - currentSecs = self.getCurrentTimeSecs() - durationSecs = self.getCurrentDurationSecs() - percent = self.GetProgressBarPercent(currentSecs,durationSecs) + percent = self.GetProgress() pixelsWidth = self.SetProgressBar(percent, self.m_lcdMode[mode][inLine]['endx']) line = "p" + str(pixelsWidth) else: @@ -559,7 +577,22 @@ def SetExtraInfoGeneric(self, ispaused): ###FIXME###TODO### g_windowManager.IsWindowActive(WINDOW_DIALOG_VOLUME_BAR) : ICON_VOLUME ###FIXME###TODO### g_windowManager.IsWindowActive(WINDOW_DIALOG_KAI_TOAST) : ICON_ALARM - + + def SetExtraInfoBars(self, isplaying): + for i in range(1, LCD_EXTRABARS_MAX): + if self.m_extraBars[i] == "progress": + if isplaying: + self.m_cExtraIcons.SetBar(i, (self.GetProgress() * 100)) + else: + self.m_cExtraIcons.SetBar(i, 0) + elif self.m_extraBars[i] == "volume": + self.m_cExtraIcons.SetBar(i, self.GetVolumePercent()) + elif self.m_extraBars[i] == "menu": + if isplaying: + self.m_cExtraIcons.SetBar(i, 0) + else: + self.m_cExtraIcons.SetBar(i, 100) + def SetExtraInformation(self): # These four states count for "isplayinganything" bPaused = xbmc.getCondVisibility("Player.Paused") @@ -576,6 +609,7 @@ def SetExtraInformation(self): self.SetExtraInfoPlaying(bPlaying, bIsVideo, bIsAudio) self.SetExtraInfoCodecs(bPlaying, bIsVideo, bIsAudio) self.SetExtraInfoGeneric(bPaused) + self.SetExtraInfoBars(bPlaying) diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py index 0d782d4..54c7828 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py @@ -47,6 +47,10 @@ def SetOutputBars(self): def GetOutputCommands(self): pass +# @abstractmethod + def SetBar(self, barnum, percent): + pass + # @abstractmethod def SetIconState(self, icon, state): pass diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index e21d72a..d4a0da2 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -110,7 +110,7 @@ def _DoOutputCommand(self): return ret # private - def _SetBar(self, barnum, value): + def _SetBarDo(self, barnum, percent): if barnum == 1: bitmask = 0x00000FC0 bitshift = 6 @@ -126,8 +126,15 @@ def _SetBar(self, barnum, value): else: return + if percent < 0: + rpercent = 0 + elif percent > 100: + rpercent = 100 + else: + rpercent = percent + self.m_iOutputValueBars = (self.m_iOutputValueBars &~ bitmask) - self.m_iOutputValueBars |= (int(32 * (value / 100)) << bitshift) & bitmask + self.m_iOutputValueBars |= (int(32 * (rpercent / 100)) << bitshift) & bitmask self.m_iOutputValueBars |= IMON_ICONS.BARS # private @@ -173,6 +180,9 @@ def GetOutputCommands(self): return ret + def SetBar(self, barnum, percent): + self._SetBarDo(barnum, percent) + def SetIconState(self, icon, state): if icon == LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING: self._SetIconStateDo(IMON_ICONS.ICON_SPINDISC, state) From c0d46064740839de895a217e798c82938ed544c0 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 21 Oct 2012 00:03:18 +0200 Subject: [PATCH 088/337] Fix: also set bars when no bar content is set --- script.xbmc.lcd/resources/lib/lcdbase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 26c1982..e5dae4d 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -592,6 +592,8 @@ def SetExtraInfoBars(self, isplaying): self.m_cExtraIcons.SetBar(i, 0) else: self.m_cExtraIcons.SetBar(i, 100) + else: + self.m_cExtraIcons.SetBar(i, 0) def SetExtraInformation(self): # These four states count for "isplayinganything" From 0eabeb9600835093b93abb73c1fe1ccebd503204 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 21 Oct 2012 00:45:31 +0200 Subject: [PATCH 089/337] Implement and use mdm166a extra icons/bars --- script.xbmc.lcd/resources/lib/lcdproc.py | 3 + .../resources/lib/lcdproc_extra_mdm166a.py | 155 ++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index a09b9be..b85839a 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -41,6 +41,7 @@ from lcdbase import * from lcdproc_extra_imon import * +from lcdproc_extra_mdm166a import * def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) @@ -248,6 +249,8 @@ def DetermineExtraSupport(self): elif re.match(rematch_mdm166a, reply): log(xbmc.LOGNOTICE, "Futaba/Targa USB mdm166a VFD detected") + self.m_cExtraIcons = LCDproc_extra_mdm166a() + self.m_cExtraIcons.Initialize() except: pass diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py new file mode 100644 index 0000000..d4d6b58 --- /dev/null +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py @@ -0,0 +1,155 @@ +''' + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC + + Support for extra symbols on Futaba/Targa USB mdm166a VFD displays + Copyright (C) 2012 Daniel Scheller + Original C implementation (C) 2010 theonlychrizz + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +import xbmc +import sys + +__scriptname__ = sys.modules[ "__main__" ].__scriptname__ +__settings__ = sys.modules[ "__main__" ].__settings__ +__cwd__ = sys.modules[ "__main__" ].__cwd__ +__icon__ = sys.modules[ "__main__" ].__icon__ + +from lcdproc import * +from lcdbase import LCD_EXTRAICONS +from extraicons import * +from lcdproc_extra_base import * + +def log(loglevel, msg): + xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) + +# extra icon bitmasks +class MDM166A_ICONS: + ICON_PLAY = 0x01 << 0 + ICON_PAUSE = 0x01 << 1 + ICON_RECORD = 0x01 << 2 + ICON_MESSAGE = 0x01 << 3 + ICON_AT = 0x01 << 4 + ICON_MUTE = 0x01 << 5 + ICON_ANTENNA = 0x01 << 6 + ICON_VOLUME = 0x01 << 7 + ICON_ANTLOW = 0x01 << 13 + ICON_ANTMED = 0x01 << 14 + ICON_ANTHIGH = (0x01 << 13) | (0x01 << 14) + + # clear masks + ICON_CLEAR_ANTENNABAR = 0xffffffff &~ ((0x01 << 13) | (0x01 << 14)) + +class LCDproc_extra_mdm166a(LCDproc_extra_base): + def __init__(self): + self.m_iOutputValueOldIcons = 1 + self.m_iOutputValueIcons = 0 + + LCDproc_extra_base.__init__(self) + + # private + def _SetBarDo(self, barnum, percent): + # progress bar + if barnum == 1: + bitmask = 0x003F8000 + bitshift = 15 + scale = 96 + # volume indicator + elif barnum == 2: + bitmask = 0x00001F00 + bitshift = 8 + scale = 28 + else: + return + + if percent < 0: + rpercent = 0 + elif percent > 100: + rpercent = 100 + else: + rpercent = percent + + self.m_iOutputValueBars = (self.m_iOutputValueBars &~ bitmask) + self.m_iOutputValueBars |= (int(scale * (rpercent / 100)) << bitshift) & bitmask + + # private + def _SetIconStateDo(self, bitmask, state): + if state: + self.m_iOutputValueIcons |= bitmask + else: + self.m_iOutputValueIcons &= ~bitmask + + def Initialize(self): + for i in range(1, 5): + self._SetBar(i, float(0)) + + def SetOutputIcons(self): + ret = "" + + if self.m_iOutputValueIcons != self.m_iOutputValueOldIcons: + self.m_iOutputValueOldIcons = self.m_iOutputValueIcons + ret += "output %d\n" % (self.m_iOutputValueIcons) + + return ret + + def GetOutputCommands(self): + return self.SetOutputIcons() + + def SetBar(self, barnum, percent): + self._SetBarDo(barnum, percent) + + def SetIconState(self, icon, state): + # General states + if icon == LCD_EXTRAICONS.LCD_EXTRAICON_MUTE: + self._SetIconStateDo(MDM166A_ICONS.ICON_MUTE, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING: + self._SetIconStateDo(MDM166A_ICONS.ICON_PLAY, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_PAUSE: + self._SetIconStateDo(MDM166A_ICONS.ICON_PAUSE, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_ALARM: + self._SetIconStateDo(MDM166A_ICONS.ICON_MESSAGE, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_RECORD: + self._SetIconStateDo(MDM166A_ICONS.ICON_RECORD, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_VOLUME: + self._SetIconStateDo(MDM166A_ICONS.ICON_VOLUME, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF: + self._SetIconStateDo(MDM166A_ICONS.ICON_ANTENNA, state) + + # Output channels + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_OUT_2_0: + self.m_iOutputValueIcons &= MDM166A_ICONS.ICON_CLEAR_ANTENNABAR + self._SetIconStateDo(MDM166A_ICONS.ICON_ANTLOW, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_OUT_5_1: + self.m_iOutputValueIcons &= MDM166A_ICONS.ICON_CLEAR_ANTENNABAR + self._SetIconStateDo(MDM166A_ICONS.ICON_ANTMED, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_OUT_7_1: + self.m_iOutputValueIcons &= MDM166A_ICONS.ICON_CLEAR_ANTENNABAR + self._SetIconStateDo(MDM166A_ICONS.ICON_ANTHIGH, state) + + def ClearIconStates(self, category): + if category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_CODECS: + self.m_iOutputValueIcons &= MDM166A_ICONS.ICON_CLEAR_ANTENNABAR + + elif category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_AUDIOCHANNELS: + self.m_iOutputValueIcons &= MDM166A_ICONS.ICON_CLEAR_ANTENNABAR From 0da4c7df7dcb87cba1139c882829d08cbaa81738 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 21 Oct 2012 00:45:55 +0200 Subject: [PATCH 090/337] Use parsed value from GetVolumePercent() instead of InfoLabel "x.yz dB" output --- script.xbmc.lcd/resources/lib/lcdbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index e5dae4d..efb3570 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -540,7 +540,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_CODECS) def SetExtraInfoGeneric(self, ispaused): - if xbmc.getInfoLabel("Player.Volume") == 0.0: + if self.GetVolumePercent() == 0.0: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUTE, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUTE, False) From a6e0ec0d65acca1851ca3e68d256c2a4a1da057d Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 21 Oct 2012 12:28:31 +0200 Subject: [PATCH 091/337] Little header description update/fix --- script.xbmc.lcd/resources/lib/lcdproc_extra_base.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py index 54c7828..330facd 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py @@ -2,9 +2,8 @@ XBMC LCDproc addon Copyright (C) 2012 Team XBMC - Support for extra symbols on SoundGraph iMON LCD displays + Stub class for extra symbol support e.g. on SoundGraph iMON or mdm166a LCDs/VFDs Copyright (C) 2012 Daniel Scheller - Original C implementation (C) 2010 theonlychrizz This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From 169f5b120bdf3296a696519cd3ca317608cd197b Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 1 Nov 2012 17:20:58 +0100 Subject: [PATCH 092/337] Prepare as version 1.2.0 --- script.xbmc.lcd/addon.xml | 2 +- script.xbmc.lcd/changelog.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/script.xbmc.lcd/addon.xml b/script.xbmc.lcd/addon.xml index 6f83020..17c51a6 100644 --- a/script.xbmc.lcd/addon.xml +++ b/script.xbmc.lcd/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/script.xbmc.lcd/changelog.txt b/script.xbmc.lcd/changelog.txt index fbaa019..576ef61 100644 --- a/script.xbmc.lcd/changelog.txt +++ b/script.xbmc.lcd/changelog.txt @@ -1,3 +1,7 @@ +1.2.0 +- Support for extra stuff (icons, bars) on supporting displays +- Extra stuff handling for SoundGraph iMON LCD and Futaba/Targa mdm166a VFD + devices (presence will be autodetected) 1.1.0 - greatly improved client/server communication - native widgets for bars, icons and bignumbers From decc5c2ccdee080e1cfe9ce13c3f695da89b0998 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 1 Nov 2012 17:26:30 +0100 Subject: [PATCH 093/337] Fix up licensing blahblah --- script.xbmc.lcd/resources/lib/extraicons.py | 15 +++++++++++---- .../resources/lib/lcdproc_extra_base.py | 14 +++++++++----- .../resources/lib/lcdproc_extra_imon.py | 14 +++++++++----- .../resources/lib/lcdproc_extra_mdm166a.py | 14 +++++++++----- 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/extraicons.py b/script.xbmc.lcd/resources/lib/extraicons.py index 28fb285..3241aa1 100644 --- a/script.xbmc.lcd/resources/lib/extraicons.py +++ b/script.xbmc.lcd/resources/lib/extraicons.py @@ -1,17 +1,24 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - - This program is free software: you can redistribute it and/or modify + + Extra icon defines/enums + Copyright (C) 2012 Daniel Scheller + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or + the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py index 330facd..383da0c 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py @@ -1,20 +1,24 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - + Stub class for extra symbol support e.g. on SoundGraph iMON or mdm166a LCDs/VFDs Copyright (C) 2012 Daniel Scheller - - This program is free software: you can redistribute it and/or modify + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or + the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index d4a0da2..f90f741 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -1,21 +1,25 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - + Support for extra symbols on SoundGraph iMON LCD displays Copyright (C) 2012 Daniel Scheller Original C implementation (C) 2010 theonlychrizz - - This program is free software: you can redistribute it and/or modify + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or + the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py index d4d6b58..0dd5c41 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py @@ -1,21 +1,25 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - + Support for extra symbols on Futaba/Targa USB mdm166a VFD displays Copyright (C) 2012 Daniel Scheller Original C implementation (C) 2010 theonlychrizz - - This program is free software: you can redistribute it and/or modify + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or + the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' From 29d908f43180c7ec32bf69b0dc679c197c32cd21 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 1 Nov 2012 22:22:00 +0100 Subject: [PATCH 094/337] Introduce shutdown handler, clear extra stuff on shutdown --- script.xbmc.lcd/lcdmain.py | 2 ++ script.xbmc.lcd/resources/lib/lcdbase.py | 7 +++++++ script.xbmc.lcd/resources/lib/lcdproc_extra_base.py | 4 ++++ script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py | 8 ++++++++ script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py | 6 ++++++ 5 files changed, 27 insertions(+) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index ec0bc66..791527d 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -136,6 +136,8 @@ def process_lcd(): time.sleep(1.0 / float(settings_getRefreshRate())) # refresh after configured rate + g_lcdproc.Shutdown() + def handleConnectLCD(): global g_failedConnectionNotified global g_initialConnectAttempt diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index efb3570..01b4726 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -324,6 +324,13 @@ def Reset(self): for i in range(0,LCD_MODE.LCD_MODE_MAX): self.m_lcdMode[i] = [] #clear list + def Shutdown(self): + log(xbmc.LOGNOTICE, "Shutting down") + + if self.m_cExtraIcons is not None: + if not self.SendCommand(self.m_cExtraIcons.GetClearAllCmd(), True): + log(xbmc.LOGERROR, "Shutdown(): Cannot clear extra icons") + def timeToSecs(self, timeAr): arLen = len(timeAr) if arLen == 1: diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py index 383da0c..adbcae7 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py @@ -61,3 +61,7 @@ def SetIconState(self, icon, state): # @abstractmethod def ClearIconStates(self, category): pass + +# @abstractmethod + def GetClearAllCmd(self): + pass diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index f90f741..a8ab625 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -340,3 +340,11 @@ def ClearIconStates(self, category): elif category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_AUDIOCHANNELS: self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_CHANNELS + + def GetClearAllCmd(self): + self.m_iOutputValueOldIcons = 0 + self.m_iOutputValueOldBars = 0 + self.m_iOutputValueIcons = 0 + self.m_iOutputValueBars = 0 + + return "output 0\n" diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py index 0dd5c41..4a603f6 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py @@ -157,3 +157,9 @@ def ClearIconStates(self, category): elif category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_AUDIOCHANNELS: self.m_iOutputValueIcons &= MDM166A_ICONS.ICON_CLEAR_ANTENNABAR + + def GetClearAllCmd(self): + self.m_iOutputValueOldIcons = 0 + self.m_iOutputValueIcons = 0 + + return "output 0\n" From 0f7b38670d1f26d4e4f32ba12216abd05f082491 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 1 Nov 2012 22:25:02 +0100 Subject: [PATCH 095/337] mdm166a: Barsetting goes to Icons Value (... really need testers/feedback for this code) --- script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py index 4a603f6..fa3fda9 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py @@ -86,8 +86,8 @@ def _SetBarDo(self, barnum, percent): else: rpercent = percent - self.m_iOutputValueBars = (self.m_iOutputValueBars &~ bitmask) - self.m_iOutputValueBars |= (int(scale * (rpercent / 100)) << bitshift) & bitmask + self.m_iOutputValueIcons = (self.m_iOutputValueIcons &~ bitmask) + self.m_iOutputValueIcons |= (int(scale * (rpercent / 100)) << bitshift) & bitmask # private def _SetIconStateDo(self, bitmask, state): From 1037cdc9f5456901a18d9b988ec914d05e40f5df Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 1 Nov 2012 22:35:21 +0100 Subject: [PATCH 096/337] New DimOnShutdown GUI setting turns off backlight on shutdown, closesocket() at last --- .../resources/language/English/strings.xml | 5 +++-- .../resources/language/German/strings.xml | 5 +++-- script.xbmc.lcd/resources/lib/lcdbase.py | 5 +++++ script.xbmc.lcd/resources/lib/settings.py | 15 ++++++++++++++- script.xbmc.lcd/resources/settings.xml | 5 +++-- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/script.xbmc.lcd/resources/language/English/strings.xml b/script.xbmc.lcd/resources/language/English/strings.xml index d624a56..dfc0501 100644 --- a/script.xbmc.lcd/resources/language/English/strings.xml +++ b/script.xbmc.lcd/resources/language/English/strings.xml @@ -12,8 +12,9 @@ Delay for scrolling text Scroll mode Dim backlight on screensaver - Navigation display duration (s) - Display refresh rate (Hz) + Dim backlight on shutdown + Navigation display duration (s) + Display refresh rate (Hz) Marquee diff --git a/script.xbmc.lcd/resources/language/German/strings.xml b/script.xbmc.lcd/resources/language/German/strings.xml index a37dd86..13ed3d4 100644 --- a/script.xbmc.lcd/resources/language/German/strings.xml +++ b/script.xbmc.lcd/resources/language/German/strings.xml @@ -12,8 +12,9 @@ Geschwindigkeit für gescrollten Text Scroll-Modus Hintergrundbeleuchtung ausschalten, wenn Bildschirmschoner aktiv - Anzeigedauer der Navigationsansicht (s) - Display-Aktualisierungsrate (Hz) + Hintergrundbeleuchtung beim Herunterfahren ausschalten + Anzeigedauer der Navigationsansicht (s) + Display-Aktualisierungsrate (Hz) Durchlaufend diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 01b4726..4eb2d18 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -327,10 +327,15 @@ def Reset(self): def Shutdown(self): log(xbmc.LOGNOTICE, "Shutting down") + if settings_getDimOnShutdown(): + self.SetBackLight(0) + if self.m_cExtraIcons is not None: if not self.SendCommand(self.m_cExtraIcons.GetClearAllCmd(), True): log(xbmc.LOGERROR, "Shutdown(): Cannot clear extra icons") + self.CloseSocket() + def timeToSecs(self, timeAr): arLen = len(timeAr) if arLen == 1: diff --git a/script.xbmc.lcd/resources/lib/settings.py b/script.xbmc.lcd/resources/lib/settings.py index 3911267..3913fa1 100644 --- a/script.xbmc.lcd/resources/lib/settings.py +++ b/script.xbmc.lcd/resources/lib/settings.py @@ -42,6 +42,7 @@ global g_scrollmode global g_settingsChanged global g_dimonscreensaver +global g_dimonshutdown global g_navtimeout global g_refreshrate @@ -55,6 +56,7 @@ def settings_initGlobals(): global g_scrollmode global g_settingsChanged global g_dimonscreensaver + global g_dimonshutdown global g_navtimeout global g_refreshrate @@ -66,6 +68,7 @@ def settings_initGlobals(): g_scrollmode = "0" g_settigsChanged = True g_dimonscreensaver = False + g_dimonshutdown = False g_navtimeout = 3 g_refreshrate = 1 @@ -100,6 +103,10 @@ def settings_getDimOnScreensaver(): global g_dimonscreensaver return g_dimonscreensaver +def settings_getDimOnShutdown(): + global g_dimonshutdown + return g_dimonshutdown + def settings_getNavTimeout(): global g_navtimeout return g_navtimeout @@ -158,6 +165,7 @@ def settings_handleLcdSettings(): global g_heartbeat global g_settingsChanged global g_dimonscreensaver + global g_dimonshutdown global g_navtimeout global g_refreshrate @@ -167,6 +175,7 @@ def settings_handleLcdSettings(): scrollmode = __settings__.getSetting("scrollmode") heartbeat = __settings__.getSetting("heartbeat") == "true" dimonscreensaver = __settings__.getSetting("dimonscreensaver") == "true" + dimonshutdown = __settings__.getSetting("dimonshutdown") == "true" navtimeout = int(float(string.replace(__settings__.getSetting("navtimeout"), ",", "."))) refreshrate = int(float(string.replace(__settings__.getSetting("refreshrate"), ",", "."))) @@ -185,6 +194,10 @@ def settings_handleLcdSettings(): if g_dimonscreensaver != dimonscreensaver: g_dimonscreensaver = dimonscreensaver g_settingsChanged = True + + if g_dimonshutdown != dimonshutdown: + g_dimonshutdown = dimonshutdown + g_settingsChanged = True if g_navtimeout != navtimeout: g_navtimeout = navtimeout @@ -206,4 +219,4 @@ def settings_setup(): settings_handleLcdSettings() return reconnect - + \ No newline at end of file diff --git a/script.xbmc.lcd/resources/settings.xml b/script.xbmc.lcd/resources/settings.xml index 46829c9..692e42b 100644 --- a/script.xbmc.lcd/resources/settings.xml +++ b/script.xbmc.lcd/resources/settings.xml @@ -8,7 +8,8 @@ - - + + + From a95f3c0a81375a2ef38740699adae2df0e1277de Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 1 Nov 2012 22:47:40 +0100 Subject: [PATCH 097/337] Import needed method from file --- script.xbmc.lcd/resources/lib/lcdbase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 4eb2d18..b50073e 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -325,6 +325,8 @@ def Reset(self): self.m_lcdMode[i] = [] #clear list def Shutdown(self): + from settings import settings_getDimOnShutdown + log(xbmc.LOGNOTICE, "Shutting down") if settings_getDimOnShutdown(): From e3ca176d18a94e2e06164ef2d9c2152f8b3ceb96 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 1 Nov 2012 22:48:18 +0100 Subject: [PATCH 098/337] housekeeping --- script.xbmc.lcd/resources/lib/extraicons.py | 42 --------------------- 1 file changed, 42 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/extraicons.py b/script.xbmc.lcd/resources/lib/extraicons.py index 3241aa1..cf9142c 100644 --- a/script.xbmc.lcd/resources/lib/extraicons.py +++ b/script.xbmc.lcd/resources/lib/extraicons.py @@ -79,45 +79,3 @@ def enum(*sequential, **named): 'LCD_ICONCAT_AUDIOCODECS', 'LCD_ICONCAT_AUDIOCHANNELS' ) - -''' -class LCD_EXTRAICONS_CLASS: - LCD_EXTRAICON_BLANK = 0 - LCD_EXTRAICON_PLAYING = 1 - LCD_EXTRAICON_PAUSE = 2 - LCD_EXTRAICON_MOVIE = 3 - LCD_EXTRAICON_MUSIC = 4 - LCD_EXTRAICON_WEATHER = 5 - LCD_EXTRAICON_TV = 6 - LCD_EXTRAICON_PHOTO = 7 - LCD_EXTRAICON_RESOLUTION_SD = 8 - LCD_EXTRAICON_RESOLUTION_HD = 9 - LCD_EXTRAICON_MUTE = 10 - LCD_EXTRAICON_REPEAT = 11 - LCD_EXTRAICON_SHUFFLE = 12 - LCD_EXTRAICON_ALARM = 13 - LCD_EXTRAICON_RECORD = 14 - LCD_EXTRAICON_VOLUME = 15 - LCD_EXTRAICON_TIME = 16 - LCD_EXTRAICON_SPDIF = 17 - LCD_EXTRAICON_DISC_IN = 18 - LCD_EXTRAICON_OUTSOURCE = 19 - LCD_EXTRAICON_OUTFIT = 20 - LCD_EXTRAICON_SCR1 = 21 - LCD_EXTRAICON_SCR2 = 22 - LCD_EXTRAICON_VCODEC_MPEG = 23 - LCD_EXTRAICON_VCODEC_DIVX = 24 - LCD_EXTRAICON_VCODEC_XVID = 25 - LCD_EXTRAICON_VCODEC_WMV = 26 - LCD_EXTRAICON_ACODEC_MPEG = 27 - LCD_EXTRAICON_ACODEC_AC3 = 28 - LCD_EXTRAICON_ACODEC_DTS = 29 - LCD_EXTRAICON_ACODEC_VWMA = 30 # e.g. iMON has video-WMA AND audio-WMA... - LCD_EXTRAICON_ACODEC_MP3 = 31 - LCD_EXTRAICON_ACODEC_OGG = 32 - LCD_EXTRAICON_ACODEC_AWMA = 33 # see ACODEC_VWMA - LCD_EXTRAICON_ACODEC_WAV = 34 - LCD_EXTRAICON_OUT_2_0 = 35 - LCD_EXTRAICON_OUT_5_1 = 36 - LCD_EXTRAICON_OUT_7_1 = 37 -''' From c86cd5373e41bdd9ed0425b4dc1fb2abe1e450ef Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 1 Nov 2012 23:08:39 +0100 Subject: [PATCH 099/337] Fix single command counting in SendCommand() (this also fixes the needless reconnect on screensaver resume) --- script.xbmc.lcd/resources/lib/lcdproc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index b85839a..c50b175 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -84,7 +84,7 @@ def SendCommand(self, strCmd, bCheckRet): # Single command without lf if countcmds < 1: - #countcmds = 1 + countcmds = 1 sendcmd += "\n" try: From 16654a7109609c64c960bb6b1254a5fd55091596 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 1 Nov 2012 23:25:13 +0100 Subject: [PATCH 100/337] Use command list to speed up initialisation (correctness vs speed since last commit) --- script.xbmc.lcd/resources/lib/lcdproc.py | 27 ++++++++++++------------ 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index c50b175..390a95e 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -154,27 +154,25 @@ def SetupScreen(self): if not self.SendCommand("screen_set xbmc -heartbeat off", True): return False + # Initialize command list var + strInitCommandList = "" + # Setup widgets for i in range(1,int(self.m_iRows)+1): # Text widgets - if not self.SendCommand("widget_add xbmc lineScroller" + str(i) + " scroller", True): - return False + strInitCommandList += "widget_add xbmc lineScroller" + str(i) + " scroller\n" # Progress bars - if not self.SendCommand("widget_add xbmc lineProgress" + str(i) + " hbar", True): - return False + strInitCommandList += "widget_add xbmc lineProgress" + str(i) + " hbar\n" # Reset bars to zero - if not self.SendCommand("widget_set xbmc lineProgress" + str(i) + " 0 0 0", True): - return False + strInitCommandList += "widget_set xbmc lineProgress" + str(i) + " 0 0 0\n" # Icons - if not self.SendCommand("widget_add xbmc lineIcon" + str(i) + " icon", True): - return False + strInitCommandList += "widget_add xbmc lineIcon" + str(i) + " icon\n" # Default icon - if not self.SendCommand("widget_set xbmc lineIcon" + str(i) + " 0 0 BLOCK_FILLED", True): - return False + strInitCommandList += "widget_set xbmc lineIcon" + str(i) + " 0 0 BLOCK_FILLED\n" self.m_strLineText[i-1] = "" self.m_strLineType[i-1] = "" @@ -182,15 +180,16 @@ def SetupScreen(self): for i in range(1,int(self.m_iBigDigits + 1)): # Big Digit - if not self.SendCommand("widget_add xbmc lineBigDigit" + str(i) + " num", True): - return False + strInitCommandList += "widget_add xbmc lineBigDigit" + str(i) + " num\n" # Set Digit - if not self.SendCommand("widget_set xbmc lineBigDigit" + str(i) + " 0 0", True): - return False + strInitCommandList += "widget_set xbmc lineBigDigit" + str(i) + " 0 0\n" self.m_strDigits[i] = "" + if not self.SendCommand(strInitCommandList, True): + return False + return True def Initialize(self): From 7a4525bb58472112de51ffbc3d022873ea120667 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 1 Nov 2012 23:41:49 +0100 Subject: [PATCH 101/337] Do LCD stuff only when handleConnectLCD() returns true, make handleConnectLCD() return state (fixes script error on unload when screen setup failed) --- script.xbmc.lcd/lcdmain.py | 40 ++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 791527d..709adf1 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -112,35 +112,36 @@ def process_lcd(): bBacklightDimmed = False while not xbmc.abortRequested: - handleConnectLCD() - settingsChanged = settings_didSettingsChange() - mode = getLcdMode() + if handleConnectLCD(): + settingsChanged = settings_didSettingsChange() + mode = getLcdMode() - if mode == LCD_MODE.LCD_MODE_SCREENSAVER and settings_getDimOnScreensaver() and not bBacklightDimmed: - g_lcdproc.SetBackLight(0) - bBacklightDimmed = True + if mode == LCD_MODE.LCD_MODE_SCREENSAVER and settings_getDimOnScreensaver() and not bBacklightDimmed: + g_lcdproc.SetBackLight(0) + bBacklightDimmed = True - g_lcdproc.Render(mode, settingsChanged) + g_lcdproc.Render(mode, settingsChanged) - # turn the backlight on when leaving screensaver and it was dimmed - if mode != LCD_MODE.LCD_MODE_SCREENSAVER and bBacklightDimmed: - g_lcdproc.SetBackLight(1) - bBacklightDimmed = False + # turn the backlight on when leaving screensaver and it was dimmed + if mode != LCD_MODE.LCD_MODE_SCREENSAVER and bBacklightDimmed: + g_lcdproc.SetBackLight(1) + bBacklightDimmed = False - if mode == LCD_MODE.LCD_MODE_MUSIC: - g_lcdproc.DisableOnPlayback(False, True) - elif mode == LCD_MODE.LCD_MODE_VIDEO: - g_lcdproc.DisableOnPlayback(True, False) - else: - g_lcdproc.DisableOnPlayback(False, False) + if mode == LCD_MODE.LCD_MODE_MUSIC: + g_lcdproc.DisableOnPlayback(False, True) + elif mode == LCD_MODE.LCD_MODE_VIDEO: + g_lcdproc.DisableOnPlayback(True, False) + else: + g_lcdproc.DisableOnPlayback(False, False) - time.sleep(1.0 / float(settings_getRefreshRate())) # refresh after configured rate + time.sleep(1.0 / float(settings_getRefreshRate())) # refresh after configured rate g_lcdproc.Shutdown() def handleConnectLCD(): global g_failedConnectionNotified global g_initialConnectAttempt + ret = True while not xbmc.abortRequested: #check for new settings @@ -161,6 +162,7 @@ def handleConnectLCD(): while (not xbmc.abortRequested) and (count > 0): time.sleep(1) count -= 1 + ret = False else: text = __settings__.getLocalizedString(501) if not g_failedConnectionNotified and not g_initialConnectAttempt: @@ -170,7 +172,7 @@ def handleConnectLCD(): # initial connection attempt done, update flag g_initialConnectAttempt = False - return True + return ret #MAIN - entry point initGlobals() From 305ab9b1205d86454efdcf14a584525daff3b89e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 4 Nov 2012 19:18:13 +0100 Subject: [PATCH 102/337] Pass DimOnShutdown value as parameter to Shutdown() to remove import clutter from lcdbase --- script.xbmc.lcd/lcdmain.py | 2 +- script.xbmc.lcd/resources/lib/lcdbase.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 709adf1..cce6e5e 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -136,7 +136,7 @@ def process_lcd(): time.sleep(1.0 / float(settings_getRefreshRate())) # refresh after configured rate - g_lcdproc.Shutdown() + g_lcdproc.Shutdown(settings_getDimOnShutdown()) def handleConnectLCD(): global g_failedConnectionNotified diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index b50073e..918cdb3 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -324,12 +324,10 @@ def Reset(self): for i in range(0,LCD_MODE.LCD_MODE_MAX): self.m_lcdMode[i] = [] #clear list - def Shutdown(self): - from settings import settings_getDimOnShutdown - + def Shutdown(self, bDimOnShutdown): log(xbmc.LOGNOTICE, "Shutting down") - if settings_getDimOnShutdown(): + if bDimOnShutdown: self.SetBackLight(0) if self.m_cExtraIcons is not None: From 3d95b5dd48f1d9778dfda0a03f2d3ee8ae8875c8 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 4 Nov 2012 20:05:40 +0100 Subject: [PATCH 103/337] Begin centralised InfoLabel handling to remove/prevent clutter a bit --- script.xbmc.lcd/resources/lib/infolabels.py | 40 +++++++++++++++++++++ script.xbmc.lcd/resources/lib/lcdbase.py | 3 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 script.xbmc.lcd/resources/lib/infolabels.py diff --git a/script.xbmc.lcd/resources/lib/infolabels.py b/script.xbmc.lcd/resources/lib/infolabels.py new file mode 100644 index 0000000..63d5d73 --- /dev/null +++ b/script.xbmc.lcd/resources/lib/infolabels.py @@ -0,0 +1,40 @@ +''' + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC + + InfoLabel handling + Copyright (C) 2012 Daniel Scheller + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +import xbmc +import xbmcgui + +# enum snippet from http://stackoverflow.com/a/1695250 - thanks! +def enum(*sequential, **named): + enums = dict(zip(sequential, range(len(sequential))), **named) + return type('Enum', (), enums) + +# interesting XBMC GUI Window IDs (no defines seem to exist for this) +class WINDOW_IDS: + WINDOW_DIALOG_VOLUME_BAR = 10104 + WINDOW_DIALOG_KAI_TOAST = 10107 + +def InfoLabel_WindowIsActive(WindowID): + return xbmc.getCondVisibility("Window.IsActive(" + str(WindowID) + ")") diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 918cdb3..b42ac5d 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -41,6 +41,7 @@ from settings import * from extraicons import * +from infolabels import * g_dictEmptyLineDescriptor = {} g_dictEmptyLineDescriptor['type'] = str("text") @@ -586,7 +587,7 @@ def SetExtraInfoGeneric(self, ispaused): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TIME, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TIME, False) - + ###FIXME###TODO### g_windowManager.IsWindowActive(WINDOW_DIALOG_VOLUME_BAR) : ICON_VOLUME ###FIXME###TODO### g_windowManager.IsWindowActive(WINDOW_DIALOG_KAI_TOAST) : ICON_ALARM From 6da9a222eb26a6618f00b79c4dce446b3cbba77d Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 4 Nov 2012 20:10:55 +0100 Subject: [PATCH 104/337] Implement VOLUME and ALARM icon handling --- script.xbmc.lcd/resources/lib/lcdbase.py | 11 +++++++++-- script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py | 6 ++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index b42ac5d..3aca751 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -588,8 +588,15 @@ def SetExtraInfoGeneric(self, ispaused): else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TIME, False) - ###FIXME###TODO### g_windowManager.IsWindowActive(WINDOW_DIALOG_VOLUME_BAR) : ICON_VOLUME - ###FIXME###TODO### g_windowManager.IsWindowActive(WINDOW_DIALOG_KAI_TOAST) : ICON_ALARM + if InfoLabel_WindowIsActive(WINDOW_IDS.WINDOW_DIALOG_VOLUME_BAR): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VOLUME, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VOLUME, False) + + if InfoLabel_WindowIsActive(WINDOW_IDS.WINDOW_DIALOG_KAI_TOAST): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ALARM, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ALARM, False) def SetExtraInfoBars(self, isplaying): for i in range(1, LCD_EXTRABARS_MAX): diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index a8ab625..b672cbf 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -319,6 +319,12 @@ def SetIconState(self, icon, state): elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_TIME: self._SetIconStateDo(IMON_ICONS.ICON_TIME, state) + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_VOLUME: + self._SetIconStateDo(IMON_ICONS.ICON_VOLUME, state) + + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_ALARM: + self._SetIconStateDo(IMON_ICONS.ICON_ALARM, state) + def ClearIconStates(self, category): if category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_MODES: self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_TOPROW From 2bb1e66a5708cac2ecaf554560577a130adc05be Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 4 Nov 2012 21:04:51 +0100 Subject: [PATCH 105/337] Move info retrieval workings over to infolabels.py InfoLabel_*() functions --- script.xbmc.lcd/resources/lib/infolabels.py | 27 +++++++++++++++++++++ script.xbmc.lcd/resources/lib/lcdbase.py | 16 +++++------- script.xbmc.lcd/resources/lib/lcdproc.py | 12 +++++---- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/infolabels.py b/script.xbmc.lcd/resources/lib/infolabels.py index 63d5d73..a7deae6 100644 --- a/script.xbmc.lcd/resources/lib/infolabels.py +++ b/script.xbmc.lcd/resources/lib/infolabels.py @@ -38,3 +38,30 @@ class WINDOW_IDS: def InfoLabel_WindowIsActive(WindowID): return xbmc.getCondVisibility("Window.IsActive(" + str(WindowID) + ")") + +def InfoLabel_PlayingVideo(): + return xbmc.getCondVisibility("Player.HasVideo") + +def InfoLabel_PlayingAudio(): + return xbmc.getCondVisibility("Player.HasAudio") + +def InfoLabel_GetPlayerTime(): + return xbmc.getInfoLabel("Player.Time") + +def InfoLabel_IsPlayerPlaying(): + return xbmc.getCondVisibility("Player.Playing") + +def InfoLabel_IsPlayerPaused(): + return xbmc.getCondVisibility("Player.Paused") + +def InfoLabel_IsPlayerForwarding(): + return xbmc.getCondVisibility("Player.Forwarding") + +def InfoLabel_IsPlayerRewinding(): + return xbmc.getCondVisibility("Player.Rewinding") + +def InfoLabel_IsPlayingAny(): + return (InfoLabel_IsPlayerPlaying() | + InfoLabel_IsPlayerPaused() | + InfoLabel_IsPlayerForwarding() | + InfoLabel_IsPlayerRewinding()) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 3aca751..bb543db 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -616,16 +616,12 @@ def SetExtraInfoBars(self, isplaying): self.m_cExtraIcons.SetBar(i, 0) def SetExtraInformation(self): - # These four states count for "isplayinganything" - bPaused = xbmc.getCondVisibility("Player.Paused") - bPlaying = (xbmc.getCondVisibility("Player.Playing") | - bPaused | - xbmc.getCondVisibility("Player.Forwarding") | - xbmc.getCondVisibility("Player.Rewinding")) - - bIsVideo = xbmc.getCondVisibility("Player.HasVideo") - bIsAudio = xbmc.getCondVisibility("Player.HasAudio") - + bPaused = InfoLabel_IsPlayerPaused() + bPlaying = InfoLabel_IsPlayingAny() + + bIsVideo = InfoLabel_PlayingVideo() + bIsAudio = InfoLabel_PlayingAudio() + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING, bPlaying) self.SetExtraInfoPlaying(bPlaying, bIsVideo, bIsAudio) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 390a95e..b9c5271 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -43,6 +43,8 @@ from lcdproc_extra_imon import * from lcdproc_extra_mdm166a import * +from infolabels import * + def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) @@ -382,7 +384,7 @@ def GetColumns(self): return int(self.m_iColumns) def GetBigDigitTime(self): - ret = xbmc.getInfoLabel("Player.Time") + ret = InfoLabel_GetPlayerTime() if ret == "": # no usable timestring, e.g. not playing anything if self.m_iBigDigits < 8: # return only h:m when display too small @@ -434,10 +436,10 @@ def SetProgressBar(self, percent, pxWidth): return self.m_iProgressBarWidth def SetPlayingStateIcon(self): - bPlaying = xbmc.getCondVisibility("Player.Playing") - bPaused = xbmc.getCondVisibility("Player.Paused") - bForwarding = xbmc.getCondVisibility("Player.Forwarding") - bRewinding = xbmc.getCondVisibility("Player.Rewinding") + bPlaying = InfoLabel_IsPlayerPlaying() + bPaused = InfoLabel_IsPlayerPaused() + bForwarding = InfoLabel_IsPlayerForwarding() + bRewinding = InfoLabel_IsPlayerRewinding() self.m_strIconName = "STOP" From 04f10c075696da9fb1c64491ead878035237379d Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 4 Nov 2012 22:03:37 +0100 Subject: [PATCH 106/337] Let InfoLabel_* do all the (calculation) magic in retrieving various values for display --- script.xbmc.lcd/resources/lib/infolabels.py | 72 +++++++++++++++++++ script.xbmc.lcd/resources/lib/lcdbase.py | 79 ++++++--------------- 2 files changed, 92 insertions(+), 59 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/infolabels.py b/script.xbmc.lcd/resources/lib/infolabels.py index a7deae6..f66b368 100644 --- a/script.xbmc.lcd/resources/lib/infolabels.py +++ b/script.xbmc.lcd/resources/lib/infolabels.py @@ -23,6 +23,8 @@ along with this program. If not, see . ''' +import string + import xbmc import xbmcgui @@ -36,6 +38,16 @@ class WINDOW_IDS: WINDOW_DIALOG_VOLUME_BAR = 10104 WINDOW_DIALOG_KAI_TOAST = 10107 +def InfoLabel_timeToSecs(timeAr): + arLen = len(timeAr) + if arLen == 1: + currentSecs = int(timeAr[0]) + elif arLen == 2: + currentSecs = int(timeAr[0]) * 60 + int(timeAr[1]) + elif arLen == 3: + currentSecs = int(timeAr[0]) * 60 * 60 + int(timeAr[1]) * 60 + int(timeAr[2]) + return currentSecs + def InfoLabel_WindowIsActive(WindowID): return xbmc.getCondVisibility("Window.IsActive(" + str(WindowID) + ")") @@ -45,9 +57,15 @@ def InfoLabel_PlayingVideo(): def InfoLabel_PlayingAudio(): return xbmc.getCondVisibility("Player.HasAudio") +def InfoLabel_PlayingLiveTV(): + return xbmc.getCondVisibility("PVR.IsPlayingTV") + def InfoLabel_GetPlayerTime(): return xbmc.getInfoLabel("Player.Time") +def InfoLabel_GetPlayerDuration(): + return xbmc.getInfoLabel("Player.Duration") + def InfoLabel_IsPlayerPlaying(): return xbmc.getCondVisibility("Player.Playing") @@ -65,3 +83,57 @@ def InfoLabel_IsPlayingAny(): InfoLabel_IsPlayerPaused() | InfoLabel_IsPlayerForwarding() | InfoLabel_IsPlayerRewinding()) + +def InfoLabel_IsPassthroughAudio(): + return xbmc.getCondVisibility("Player.Passthrough") + +def InfoLabel_IsPVRRecording(): + return xbmc.getCondVisibility("PVR.IsRecording") + +def InfoLabel_IsPlaylistRandom(): + return xbmc.getCondVisibility("Playlist.IsRandom") + +def InfoLabel_IsPlaylistRepeatAll(): + return xbmc.getCondVisibility("Playlist.IsRepeat") + +def InfoLabel_IsPlaylistRepeatOne(): + return xbmc.getCondVisibility("Playlist.IsRepeatOne") + +def InfoLabel_IsPlaylistRepeatAny(): + return (InfoLabel_IsPlaylistRepeatAll() | InfoLabel_IsPlaylistRepeatOne()) + +def InfoLabel_IsDiscInDrive(): + return xbmc.getCondVisibility("System.HasMediaDVD") + +def InfoLabel_IsScreenSaverActive(): + return xbmc.getCondVisibility("System.ScreenSaverActive") + +def InfoLabel_GetInfoLabel(strLabel): + return xbmc.getInfoLabel(strLabel) + +def InfoLabel_GetVolumePercent(): + volumedb = float(string.replace(string.replace(xbmc.getInfoLabel("Player.Volume"), ",", "."), " dB", "")) + return (100 * (60.0 + volumedb) / 60) + +def InfoLabel_GetPlayerTimeSecs(): + currentTimeAr = InfoLabel_GetPlayerTime().split(":") + if currentTimeAr[0] == "": + return 0 + + return InfoLabel_timeToSecs(currentTimeAr) + +def InfoLabel_GetPlayerDurationSecs(): + currentDurationAr = InfoLabel_GetPlayerDuration().split(":") + if currentDurationAr[0] == "": + return 0 + + return InfoLabel_timeToSecs(currentDurationAr) + +def InfoLabel_GetProgressPercent(): + tCurrent = InfoLabel_GetPlayerTimeSecs() + tTotal = InfoLabel_GetPlayerDurationSecs() + + if float(tTotal) == 0.0: + return 0 + + return float(tCurrent)/float(tTotal) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index bb543db..b0e0d2f 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -153,12 +153,6 @@ def SetPlayingStateIcon(self): def SetProgressBar(self, percent, lineIdx): pass - def GetProgressBarPercent(self, tCurrent, tTotal): - if float(tTotal) == 0.0: - return 0 - - return float(tCurrent)/float(tTotal) - def Initialize(self): self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE self.LoadSkin(__lcdxml__) @@ -337,39 +331,6 @@ def Shutdown(self, bDimOnShutdown): self.CloseSocket() - def timeToSecs(self, timeAr): - arLen = len(timeAr) - if arLen == 1: - currentSecs = int(timeAr[0]) - elif arLen == 2: - currentSecs = int(timeAr[0]) * 60 + int(timeAr[1]) - elif arLen == 3: - currentSecs = int(timeAr[0]) * 60 * 60 + int(timeAr[1]) * 60 + int(timeAr[2]) - return currentSecs - - def getCurrentTimeSecs(self): - currentTimeAr = xbmc.getInfoLabel("Player.Time").split(":") - if currentTimeAr[0] == "": - return 0 - - return self.timeToSecs(currentTimeAr) - - def getCurrentDurationSecs(self): - currentDurationAr = xbmc.getInfoLabel("Player.Duration").split(":") - if currentDurationAr[0] == "": - return 0 - - return self.timeToSecs(currentDurationAr) - - def GetProgress(self): - currentSecs = self.getCurrentTimeSecs() - durationSecs = self.getCurrentDurationSecs() - return self.GetProgressBarPercent(currentSecs,durationSecs) - - def GetVolumePercent(self): - volumedb = float(string.replace(string.replace(xbmc.getInfoLabel("Player.Volume"), ",", "."), " dB", "")) - return (100 * (60.0 + volumedb) / 60) - def Render(self, mode, bForce): outLine = 0 inLine = 0 @@ -378,14 +339,14 @@ def Render(self, mode, bForce): #parse the progressbar infolabel by ourselfs! if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS: # get playtime and duration and convert into seconds - percent = self.GetProgress() + percent = InfoLabel_GetProgressPercent() pixelsWidth = self.SetProgressBar(percent, self.m_lcdMode[mode][inLine]['endx']) line = "p" + str(pixelsWidth) else: if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_ICONTEXT: self.SetPlayingStateIcon() - line = xbmc.getInfoLabel(self.m_lcdMode[mode][inLine]['text']) + line = InfoLabel_GetInfoLabel(self.m_lcdMode[mode][inLine]['text']) if self.m_strInfoLabelEncoding != self.m_strLCDEncoding: line = line.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") self.SetProgressBar(0, -1) @@ -422,16 +383,16 @@ def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): if isplaying: if isvideo: try: - iVideoRes = int(xbmc.getInfoLabel("VideoPlayer.VideoResolution")) + iVideoRes = int(InfoLabel_GetInfoLabel("VideoPlayer.VideoResolution")) except: iVideoRes = int(0) try: - iScreenRes = int(xbmc.getInfoLabel("System.ScreenHeight")) + iScreenRes = int(InfoLabel_GetInfoLabel("System.ScreenHeight")) except: iScreenRes = int(0) - if xbmc.getCondVisibility("PVR.IsPlayingTV"): + if InfoLabel_PlayingLiveTV(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TV, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MOVIE, True) @@ -460,19 +421,19 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): iAudioChannels = 0 if isplaying: - if xbmc.getCondVisibility("Player.Passthrough"): + if InfoLabel_IsPassthroughAudio(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, False) if isvideo: - strVideoCodec = str(xbmc.getInfoLabel("VideoPlayer.VideoCodec")).lower() - strAudioCodec = str(xbmc.getInfoLabel("VideoPlayer.AudioCodec")).lower() - iAudioChannels = xbmc.getInfoLabel("VideoPlayer.AudioChannels") + strVideoCodec = str(InfoLabel_GetInfoLabel("VideoPlayer.VideoCodec")).lower() + strAudioCodec = str(InfoLabel_GetInfoLabel("VideoPlayer.AudioCodec")).lower() + iAudioChannels = InfoLabel_GetInfoLabel("VideoPlayer.AudioChannels") elif isaudio: strVideoCodec = "" - strAudioCodec = str(xbmc.getInfoLabel("MusicPlayer.Codec")).lower() - iAudioChannels = xbmc.getInfoLabel("MusicPlayer.Channels") + strAudioCodec = str(InfoLabel_GetInfoLabel("MusicPlayer.Codec")).lower() + iAudioChannels = InfoLabel_GetInfoLabel("MusicPlayer.Channels") # check video codec # any mpeg video @@ -553,37 +514,37 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_CODECS) def SetExtraInfoGeneric(self, ispaused): - if self.GetVolumePercent() == 0.0: + if InfoLabel_GetVolumePercent() == 0.0: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUTE, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUTE, False) - if xbmc.getCondVisibility("Player.Paused"): + if ispaused: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PAUSE, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PAUSE, False) - if xbmc.getCondVisibility("PVR.IsRecording"): + if InfoLabel_IsPVRRecording(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_RECORD, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_RECORD, False) - if xbmc.getCondVisibility("Playlist.IsRandom"): + if InfoLabel_IsPlaylistRandom(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SHUFFLE, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SHUFFLE, False) - if xbmc.getCondVisibility("Playlist.IsRepeat") or xbmc.getCondVisibility("Playlist.IsRepeatOne"): + if InfoLabel_IsPlaylistRepeatAny(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_REPEAT, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_REPEAT, False) - if xbmc.getCondVisibility("System.HasMediaDVD"): + if InfoLabel_IsDiscInDrive(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_DISC_IN, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_DISC_IN, False) - if xbmc.getCondVisibility("System.ScreenSaverActive"): + if InfoLabel_IsScreenSaverActive(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TIME, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TIME, False) @@ -602,11 +563,11 @@ def SetExtraInfoBars(self, isplaying): for i in range(1, LCD_EXTRABARS_MAX): if self.m_extraBars[i] == "progress": if isplaying: - self.m_cExtraIcons.SetBar(i, (self.GetProgress() * 100)) + self.m_cExtraIcons.SetBar(i, (InfoLabel_GetProgressPercent() * 100)) else: self.m_cExtraIcons.SetBar(i, 0) elif self.m_extraBars[i] == "volume": - self.m_cExtraIcons.SetBar(i, self.GetVolumePercent()) + self.m_cExtraIcons.SetBar(i, InfoLabel_GetVolumePercent()) elif self.m_extraBars[i] == "menu": if isplaying: self.m_cExtraIcons.SetBar(i, 0) From 1d1c7f7041dc17bee0b94f5b3c01327081e2b921 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 4 Nov 2012 22:37:11 +0100 Subject: [PATCH 107/337] Make navigation determination an InfoLabel function and do housekeeping --- script.xbmc.lcd/lcdmain.py | 43 ++++---------------- script.xbmc.lcd/resources/lib/infolabels.py | 44 +++++++++++++++++++++ script.xbmc.lcd/resources/lib/lcdbase.py | 1 - script.xbmc.lcd/resources/lib/settings.py | 4 +- 4 files changed, 53 insertions(+), 39 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index cce6e5e..585f87d 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -37,61 +37,34 @@ from settings import * from lcdproc import * +from infolabels import * global g_failedConnectionNotified global g_initialConnectAttempt global g_lcdproc -global g_oldMenu -global g_oldSubMenu -global g_timer - def initGlobals(): global g_failedConnectionNotified global g_initialConnectAttempt global g_lcdproc - global g_oldMenu - global g_oldSubMenu - global g_timer g_failedConnectionNotified = False g_initialConnectAttempt = True settings_initGlobals() g_lcdproc = LCDProc() - g_oldMenu = "" - g_oldSubMenu = "" - g_timer = time.time() - -def isNavigationActive(): - global g_oldMenu - global g_oldSubMenu - global g_timer - - ret = False - navtimeout = settings_getNavTimeout() - menu = xbmc.getInfoLabel("$INFO[System.CurrentWindow]") - subMenu = xbmc.getInfoLabel("$INFO[System.CurrentControl]") - - if menu != g_oldMenu or subMenu != g_oldSubMenu or (g_timer + navtimeout) > time.time(): - ret = True - if menu != g_oldMenu or subMenu != g_oldSubMenu: - g_timer = time.time() - g_oldMenu = menu - g_oldSubMenu = subMenu - - return ret + InfoLabel_Initialize() # returns mode identifier based on currently playing media/active navigation def getLcdMode(): ret = LCD_MODE.LCD_MODE_GENERAL - navActive = isNavigationActive() - screenSaver = xbmc.getCondVisibility("System.ScreenSaverActive") - playingVideo = xbmc.getCondVisibility("Player.HasVideo") - playingMusic = xbmc.getCondVisibility("Player.HasAudio") - playingPVRTV = xbmc.getCondVisibility("PVR.IsPlayingTV") - playingPVRRadio = xbmc.getCondVisibility("PVR.IsPlayingRadio") + navActive = InfoLabel_IsNavigationActive() + screenSaver = InfoLabel_IsScreenSaverActive() + playingVideo = InfoLabel_PlayingVideo() + playingMusic = InfoLabel_PlayingAudio() + playingPVRTV = InfoLabel_PlayingLiveTV() + playingPVRRadio = InfoLabel_PlayingLiveRadio() if navActive: ret = LCD_MODE.LCD_MODE_NAVIGATION diff --git a/script.xbmc.lcd/resources/lib/infolabels.py b/script.xbmc.lcd/resources/lib/infolabels.py index f66b368..be9cad6 100644 --- a/script.xbmc.lcd/resources/lib/infolabels.py +++ b/script.xbmc.lcd/resources/lib/infolabels.py @@ -23,11 +23,17 @@ along with this program. If not, see . ''' +import os import string +import sys +import time import xbmc +import xbmcaddon import xbmcgui +__settingshandler__ = sys.modules[ "settings" ] + # enum snippet from http://stackoverflow.com/a/1695250 - thanks! def enum(*sequential, **named): enums = dict(zip(sequential, range(len(sequential))), **named) @@ -38,6 +44,19 @@ class WINDOW_IDS: WINDOW_DIALOG_VOLUME_BAR = 10104 WINDOW_DIALOG_KAI_TOAST = 10107 +global g_InfoLabel_oldMenu +global g_InfoLabel_oldSubMenu +global g_InfoLabel_navTimer + +def InfoLabel_Initialize(): + global g_InfoLabel_oldMenu + global g_InfoLabel_oldSubMenu + global g_InfoLabel_navTimer + + g_InfoLabel_oldMenu = "" + g_InfoLabel_oldSubMenu = "" + g_InfoLabel_navTimer = time.time() + def InfoLabel_timeToSecs(timeAr): arLen = len(timeAr) if arLen == 1: @@ -60,6 +79,9 @@ def InfoLabel_PlayingAudio(): def InfoLabel_PlayingLiveTV(): return xbmc.getCondVisibility("PVR.IsPlayingTV") +def InfoLabel_PlayingLiveRadio(): + return xbmc.getCondVisibility("PVR.IsPlayingRadio") + def InfoLabel_GetPlayerTime(): return xbmc.getInfoLabel("Player.Time") @@ -137,3 +159,25 @@ def InfoLabel_GetProgressPercent(): return 0 return float(tCurrent)/float(tTotal) + +def InfoLabel_IsNavigationActive(): + global g_InfoLabel_oldMenu + global g_InfoLabel_oldSubMenu + global g_InfoLabel_navTimer + + #from settings import settings_getNavTimeout + + ret = False + + navtimeout = __settingshandler__.settings_getNavTimeout() + menu = InfoLabel_GetInfoLabel("$INFO[System.CurrentWindow]") + subMenu = InfoLabel_GetInfoLabel("$INFO[System.CurrentControl]") + + if menu != g_InfoLabel_oldMenu or subMenu != g_InfoLabel_oldSubMenu or (g_InfoLabel_navTimer + navtimeout) > time.time(): + ret = True + if menu != g_InfoLabel_oldMenu or subMenu != g_InfoLabel_oldSubMenu: + g_InfoLabel_navTimer = time.time() + g_InfoLabel_oldMenu = menu + g_InfoLabel_oldSubMenu = subMenu + + return ret diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index b0e0d2f..a72a849 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -39,7 +39,6 @@ __icon__ = sys.modules[ "__main__" ].__icon__ __lcdxml__ = xbmc.translatePath( os.path.join("special://masterprofile","LCD.xml")) -from settings import * from extraicons import * from infolabels import * diff --git a/script.xbmc.lcd/resources/lib/settings.py b/script.xbmc.lcd/resources/lib/settings.py index 3913fa1..2898986 100644 --- a/script.xbmc.lcd/resources/lib/settings.py +++ b/script.xbmc.lcd/resources/lib/settings.py @@ -25,14 +25,13 @@ import sys import time import xbmc + __scriptname__ = sys.modules[ "__main__" ].__scriptname__ __settings__ = sys.modules[ "__main__" ].__settings__ __cwd__ = sys.modules[ "__main__" ].__cwd__ __icon__ = sys.modules[ "__main__" ].__icon__ sys.path.append (__cwd__) -from lcdbase import LCD_MODE - #general global g_hostip global g_hostport @@ -72,7 +71,6 @@ def settings_initGlobals(): g_navtimeout = 3 g_refreshrate = 1 - def settings_getHostIp(): global g_hostip return g_hostip From fbbb1cc4e294fcaab518703f23d3ce7f050ffac5 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 4 Nov 2012 22:39:01 +0100 Subject: [PATCH 108/337] comment --- script.xbmc.lcd/resources/lib/infolabels.py | 1 + 1 file changed, 1 insertion(+) diff --git a/script.xbmc.lcd/resources/lib/infolabels.py b/script.xbmc.lcd/resources/lib/infolabels.py index be9cad6..989903f 100644 --- a/script.xbmc.lcd/resources/lib/infolabels.py +++ b/script.xbmc.lcd/resources/lib/infolabels.py @@ -32,6 +32,7 @@ import xbmcaddon import xbmcgui +# wonder why "from settings import *" does not work... __settingshandler__ = sys.modules[ "settings" ] # enum snippet from http://stackoverflow.com/a/1695250 - thanks! From 57f1651536059ae3d18bf3df30c8c5aaab2fbe4a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 4 Nov 2012 22:54:39 +0100 Subject: [PATCH 109/337] Save some cycles by only updating codec/channel icons when codec info changed --- script.xbmc.lcd/resources/lib/lcdbase.py | 136 +++++++++++++---------- 1 file changed, 80 insertions(+), 56 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index a72a849..3a3b2b4 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -87,6 +87,10 @@ def __init__(self): self.m_bProgressbarSurroundings = False self.m_iIconTextOffset = 2 self.m_bAllowEmptyLines = False + self.m_strOldVideoCodec = "" + self.m_strOldAudioCodec = "" + self.m_iOldAudioChannelsVar = 0 + self.m_bWasStopped = True # @abstractmethod def _concrete_method(self): @@ -434,62 +438,76 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): strAudioCodec = str(InfoLabel_GetInfoLabel("MusicPlayer.Codec")).lower() iAudioChannels = InfoLabel_GetInfoLabel("MusicPlayer.Channels") + if self.m_bWasStopped: + self.m_bWasStopped = False + self.m_strOldVideoCodec = "" + self.m_strOldAudioCodec = "" + self.m_iOldAudioChannelsVar = 0 + # check video codec - # any mpeg video - if strVideoCodec in ["mpg", "mpeg", "mpeg2video", "h264", "x264", "mpeg4"]: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_MPEG, True) + if self.m_strOldVideoCodec != strVideoCodec: + # work only when video codec changed + self.m_strOldVideoCodec = strVideoCodec - # any divx - elif strVideoCodec in ["divx", "dx50", "div3"]: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_DIVX, True) + # any mpeg video + if strVideoCodec in ["mpg", "mpeg", "mpeg2video", "h264", "x264", "mpeg4"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_MPEG, True) - # xvid - elif strVideoCodec == "xvid": - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_XVID, True) + # any divx + elif strVideoCodec in ["divx", "dx50", "div3"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_DIVX, True) - # wmv - elif strVideoCodec == "wmv": - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_WMV, True) + # xvid + elif strVideoCodec == "xvid": + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_XVID, True) - # anything else - else: - self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_VIDEOCODECS) + # wmv + elif strVideoCodec == "wmv": + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_WMV, True) - # check audio codec - # any mpeg audio - if strAudioCodec in ["mpga", "mp2"]: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_MPEG, True) - - # any ac3/dolby digital - elif strAudioCodec in ["ac3", "truehd"]: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_AC3, True) - - # any dts - elif strAudioCodec in ["dts", "dca", "dtshd_ma"]: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_DTS, True) - - # mp3 - elif strAudioCodec == "mp3": - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_MP3, True) - - # any ogg vorbis - elif strAudioCodec in ["ogg", "vorbis"]: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_OGG, True) - - # any wma - elif strAudioCodec in ["wma", "wmav2"]: - if isvideo: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_VWMA, True) + # anything else else: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_AWMA, True) + self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_VIDEOCODECS) - # any pcm, wav or flac - elif strAudioCodec in ["wav", "pcm", "flac"]: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_WAV, True) + # check audio codec + if self.m_strOldAudioCodec != strAudioCodec: + # work only when audio codec changed + self.m_strOldAudioCodec = strAudioCodec + + # any mpeg audio + if strAudioCodec in ["mpga", "mp2"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_MPEG, True) + + # any ac3/dolby digital + elif strAudioCodec in ["ac3", "truehd"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_AC3, True) + + # any dts + elif strAudioCodec in ["dts", "dca", "dtshd_ma"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_DTS, True) + + # mp3 + elif strAudioCodec == "mp3": + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_MP3, True) + + # any ogg vorbis + elif strAudioCodec in ["ogg", "vorbis"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_OGG, True) + + # any wma + elif strAudioCodec in ["wma", "wmav2"]: + if isvideo: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_VWMA, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_AWMA, True) - # anything else - else: - self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_AUDIOCODECS) + # any pcm, wav or flac + elif strAudioCodec in ["wav", "pcm", "flac"]: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_WAV, True) + + # anything else + else: + self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_AUDIOCODECS) # make sure iAudioChannels contains something useful if iAudioChannels == "" and strAudioCodec != "": @@ -499,18 +517,24 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): else: iAudioChannels = int(iAudioChannels) - # decide which icon (set) to activate - if iAudioChannels > 0 and iAudioChannels <= 3: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_2_0, True) - elif iAudioChannels <= 6: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_5_1, True) - elif iAudioChannels <= 8: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_7_1, True) - else: - self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_AUDIOCHANNELS) + # update audio channels indicator + if self.m_iOldAudioChannelsVar != iAudioChannels: + # work only when audio channels changed + self.m_iOldAudioChannelsVar = iAudioChannels + + # decide which icon (set) to activate + if iAudioChannels > 0 and iAudioChannels <= 3: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_2_0, True) + elif iAudioChannels <= 6: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_5_1, True) + elif iAudioChannels <= 8: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUT_7_1, True) + else: + self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_AUDIOCHANNELS) else: self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_CODECS) + self.m_bWasStopped = True def SetExtraInfoGeneric(self, ispaused): if InfoLabel_GetVolumePercent() == 0.0: From a57a37e1c4ce3821886c78685261ba47c1df1ca9 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 4 Nov 2012 22:56:17 +0100 Subject: [PATCH 110/337] whitespace --- script.xbmc.lcd/resources/lib/lcdbase.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 3a3b2b4..ea4ddfc 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -612,12 +612,3 @@ def SetExtraInformation(self): self.SetExtraInfoCodecs(bPlaying, bIsVideo, bIsAudio) self.SetExtraInfoGeneric(bPaused) self.SetExtraInfoBars(bPlaying) - - - - - - - - - From 279373ceb2d18eba0a2d6a1d5987d1585d3839dd Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 4 Nov 2012 23:24:53 +0100 Subject: [PATCH 111/337] Implement icon setting when idle (based on active navigation/window id), do window type determination via InfoLabel_* functions --- script.xbmc.lcd/resources/lib/infolabels.py | 54 +++++++++++++++++++-- script.xbmc.lcd/resources/lib/lcdbase.py | 20 ++++++-- 2 files changed, 68 insertions(+), 6 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/infolabels.py b/script.xbmc.lcd/resources/lib/infolabels.py index 989903f..b2556a9 100644 --- a/script.xbmc.lcd/resources/lib/infolabels.py +++ b/script.xbmc.lcd/resources/lib/infolabels.py @@ -42,9 +42,21 @@ def enum(*sequential, **named): # interesting XBMC GUI Window IDs (no defines seem to exist for this) class WINDOW_IDS: - WINDOW_DIALOG_VOLUME_BAR = 10104 - WINDOW_DIALOG_KAI_TOAST = 10107 - + WINDOW_WEATHER = 12600 + WINDOW_PVR = 10601 + WINDOW_PVR_MAX = 10699 + WINDOW_VIDEOS = 10006 + WINDOW_VIDEO_FILES = 10024 + WINDOW_VIDEO_NAV = 10025 + WINDOW_VIDEO_PLAYLIST = 10028 + WINDOW_MUSIC = 10005 + WINDOW_MUSIC_PLAYLIST = 10500 + WINDOW_MUSIC_FILES = 10501 + WINDOW_MUSIC_NAV = 10502 + WINDOW_MUSIC_PLAYLIST_EDITOR = 10503 + WINDOW_DIALOG_VOLUME_BAR = 10104 + WINDOW_DIALOG_KAI_TOAST = 10107 + global g_InfoLabel_oldMenu global g_InfoLabel_oldSubMenu global g_InfoLabel_navTimer @@ -89,6 +101,9 @@ def InfoLabel_GetPlayerTime(): def InfoLabel_GetPlayerDuration(): return xbmc.getInfoLabel("Player.Duration") +def InfoLabel_GetActiveWindowID(): + return int(xbmcgui.getCurrentWindowId()) + def InfoLabel_IsPlayerPlaying(): return xbmc.getCondVisibility("Player.Playing") @@ -182,3 +197,36 @@ def InfoLabel_IsNavigationActive(): g_InfoLabel_oldSubMenu = subMenu return ret + +def InfoLabel_IsWindowIDPVR(iWindowID): + if iWindowID >= WINDOW_IDS.WINDOW_PVR and iWindowID <= WINDOW_IDS.WINDOW_PVR_MAX: + return True + + return False + +def InfoLabel_IsWindowIDVideo(iWindowID): + if iWindowID in [WINDOW_IDS.WINDOW_VIDEOS, WINDOW_IDS.WINDOW_VIDEO_FILES, + WINDOW_IDS.WINDOW_VIDEO_NAV, WINDOW_IDS.WINDOW_VIDEO_PLAYLIST]: + return True + + return False + +def InfoLabel_IsWindowIDMusic(iWindowID): + if iWindowID in [WINDOW_IDS.WINDOW_MUSIC, WINDOW_IDS.WINDOW_MUSIC_PLAYLIST, + WINDOW_IDS.WINDOW_MUSIC_FILES, WINDOW_IDS.WINDOW_MUSIC_NAV, + WINDOW_IDS.WINDOW_MUSIC_PLAYLIST_EDITOR]: + return True + + return False + +def InfoLabel_IsWindowIDPictures(iWindowID): + if iWindowID == WINDOW_IDS.WINDOW_PICTURES: + return True + + return False + +def InfoLabel_IsWindowIDWeather(iWindowID): + if iWindowID == WINDOW_IDS.WINDOW_WEATHER: + return True + + return False diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index ea4ddfc..656bcec 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -413,9 +413,23 @@ def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): elif isaudio: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUSIC, True) - else: - self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_MODES) - ###FIXME###TODO### ID = g_windowManager.GetActiveWindow() translation for navigation + else: # not playing + + # Set active mode indicator based on current active window + iWindowID = InfoLabel_GetActiveWindowID() + + if InfoLabel_IsWindowIDPVR(iWindowID): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TV, True) + elif InfoLabel_IsWindowIDVideo(iWindowID): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MOVIE, True) + elif InfoLabel_IsWindowIDMusic(iWindowID): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUSIC, True) + elif InfoLabel_IsWindowIDPictures(iWindowID): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PHOTO, True) + elif InfoLabel_IsWindowIDWeather(iWindowID): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_WEATHER, True) + else: + self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_MODES) def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): # initialise stuff to avoid uninitialised var stuff From 2279eee9b29bceb0ebf5dfabbd1410f97c4ee3f6 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 4 Nov 2012 23:32:11 +0100 Subject: [PATCH 112/337] missed WINDOW_PICTURES --- script.xbmc.lcd/resources/lib/infolabels.py | 1 + 1 file changed, 1 insertion(+) diff --git a/script.xbmc.lcd/resources/lib/infolabels.py b/script.xbmc.lcd/resources/lib/infolabels.py index b2556a9..bd5c228 100644 --- a/script.xbmc.lcd/resources/lib/infolabels.py +++ b/script.xbmc.lcd/resources/lib/infolabels.py @@ -54,6 +54,7 @@ class WINDOW_IDS: WINDOW_MUSIC_FILES = 10501 WINDOW_MUSIC_NAV = 10502 WINDOW_MUSIC_PLAYLIST_EDITOR = 10503 + WINDOW_PICTURES = 10002 WINDOW_DIALOG_VOLUME_BAR = 10104 WINDOW_DIALOG_KAI_TOAST = 10107 From 9cd337982e5b0f1293cef18f5713bccc2af15079 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 10 Nov 2012 19:23:33 +0100 Subject: [PATCH 113/337] Add disableonplaydelay option to delay display dim for disableonplay option, don't clear display on dim --- script.xbmc.lcd/resources/lib/lcdbase.py | 33 +++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 656bcec..7b86387 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -78,9 +78,11 @@ class LCD_LINETYPE: class LcdBase(): def __init__(self): self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE + self.m_timeDisableOnPlayTimer = time.time() self.m_lcdMode = [None] * LCD_MODE.LCD_MODE_MAX self.m_extraBars = [None] * (LCD_EXTRABARS_MAX + 1) self.m_bDimmedOnPlayback = False + self.m_iDimOnPlayDelay = 0 self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! self.m_strScrollSeparator = " " @@ -167,6 +169,8 @@ def LoadSkin(self, xmlFile): #PARSE LCD infos if element.tag == "lcd": # load our settings + + # disable on play disableOnPlay = element.find("disableonplay") if disableOnPlay != None: self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE @@ -175,6 +179,21 @@ def LoadSkin(self, xmlFile): if str(disableOnPlay.text).find("music") >= 0: self.m_disableOnPlay += DISABLE_ON_PLAY.DISABLE_ON_PLAY_MUSIC + # disable on play delay + self.m_iDimOnPlayDelay = 0 + + disableonplaydelay = element.find("disableonplaydelay") + if disableonplaydelay != None and disableonplaydelay.text != None: + try: + intdelay = int(disableonplaydelay.text) + except ValueError, TypeError: + log(xbmc.LOGERROR, "Value for disableonplaydelay must be integer (got: %s)" % (disableonplaydelay.text)) + else: + if intdelay < 0: + log(xbmc.LOGERROR, "Value %d for disableonplaydelay smaller than zero, ignoring" % (intdelay)) + else: + self.m_iDimOnPlayDelay = intdelay + # apply scrollseparator scrollSeparator = element.find("scrollseparator") if scrollSeparator != None: @@ -375,12 +394,14 @@ def Render(self, mode, bForce): def DisableOnPlayback(self, playingVideo, playingAudio): if (playingVideo and (self.m_disableOnPlay & DISABLE_ON_PLAY.DISABLE_ON_PLAY_VIDEO)) or (playingAudio and (self.m_disableOnPlay & DISABLE_ON_PLAY.DISABLE_ON_PLAY_MUSIC)): if not self.m_bDimmedOnPlayback: - self.SetBackLight(0) - self.m_bDimmedOnPlayback = True - self.ClearDisplay() - elif self.m_bDimmedOnPlayback: - self.SetBackLight(1) - self.m_bDimmedOnPlayback = False + if (self.m_timeDisableOnPlayTimer + self.m_iDimOnPlayDelay) < time.time(): + self.SetBackLight(0) + self.m_bDimmedOnPlayback = True + else: + self.m_timeDisableOnPlayTimer = time.time() + if self.m_bDimmedOnPlayback: + self.SetBackLight(1) + self.m_bDimmedOnPlayback = False def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): if isplaying: From b99a40824c4ce973ec74d0bc428ae1ac74cdf05d Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 12 Nov 2012 18:35:39 +0100 Subject: [PATCH 114/337] Fix author name --- script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py | 2 +- script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index b672cbf..0d4d22b 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -4,7 +4,7 @@ Support for extra symbols on SoundGraph iMON LCD displays Copyright (C) 2012 Daniel Scheller - Original C implementation (C) 2010 theonlychrizz + Original C implementation (C) 2010 theonlychriss This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py index fa3fda9..81fc5e2 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py @@ -4,7 +4,7 @@ Support for extra symbols on Futaba/Targa USB mdm166a VFD displays Copyright (C) 2012 Daniel Scheller - Original C implementation (C) 2010 theonlychrizz + Original C implementation (C) 2010 theonlychriss This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From 6b088487e4f2f74d0477eae29145bc63959c3fff Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 12 Nov 2012 19:25:08 +0100 Subject: [PATCH 115/337] DisableOnPlayback(): Dim only when really playing (pause should activate the backlight) --- script.xbmc.lcd/resources/lib/lcdbase.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 7b86387..c32481e 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -392,7 +392,14 @@ def Render(self, mode, bForce): self.FlushLines() def DisableOnPlayback(self, playingVideo, playingAudio): - if (playingVideo and (self.m_disableOnPlay & DISABLE_ON_PLAY.DISABLE_ON_PLAY_VIDEO)) or (playingAudio and (self.m_disableOnPlay & DISABLE_ON_PLAY.DISABLE_ON_PLAY_MUSIC)): + # check if any dimming is requested and matching config + dodim = (playingVideo and (self.m_disableOnPlay & DISABLE_ON_PLAY.DISABLE_ON_PLAY_VIDEO)) or (playingAudio and (self.m_disableOnPlay & DISABLE_ON_PLAY.DISABLE_ON_PLAY_MUSIC)) + + # if dimrequest matches, check if pause is active (don't dim then) + if dodim: + dodim = dodim and not InfoLabel_IsPlayerPaused() + + if dodim: if not self.m_bDimmedOnPlayback: if (self.m_timeDisableOnPlayTimer + self.m_iDimOnPlayDelay) < time.time(): self.SetBackLight(0) From 546dc7a8938daef15a1f671f9c691f58aa4a9a9d Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 18 Nov 2012 13:38:33 +0100 Subject: [PATCH 116/337] CloseSocket(): announce disconnect to LCDd --- script.xbmc.lcd/resources/lib/lcdproc.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index b9c5271..837548e 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -312,7 +312,17 @@ def Connect(self): return True def CloseSocket(self): - self.tn.close() + if self.tn.get_socket() != None: + # no pyexceptions, please, we're disconnecting anyway + try: + # do gracefully disconnect (send directly as we won't get any response on this) + self.tn.write("bye\n") + # and close socket afterwards + self.tn.close() + except: + # exception caught on this, so what? :) + pass + del self.tn self.tn = telnetlib.Telnet() From bc30503429a8ec845ad4f292dd77cdf483ef6080 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 18 Nov 2012 13:55:39 +0100 Subject: [PATCH 117/337] cleanup connection notification popup handling and move functionality to function --- script.xbmc.lcd/lcdmain.py | 42 +++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 585f87d..947d7e1 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -55,6 +55,23 @@ def initGlobals(): InfoLabel_Initialize() +# handle dispay of connection notificaiton popups +def HandleConnectionNotification(bConnectSuccess): + global g_failedConnectionNotified + global g_initialConnectAttempt + + if not bConnectSuccess: + if not g_failedConnectionNotified: + g_failedConnectionNotified = True + g_initialConnectAttempt = False + text = __settings__.getLocalizedString(500) + xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) + else: + text = __settings__.getLocalizedString(501) + if not g_initialConnectAttempt: + xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) + g_failedConnectionNotified = True + # returns mode identifier based on currently playing media/active navigation def getLcdMode(): ret = LCD_MODE.LCD_MODE_GENERAL @@ -112,10 +129,8 @@ def process_lcd(): g_lcdproc.Shutdown(settings_getDimOnShutdown()) def handleConnectLCD(): - global g_failedConnectionNotified - global g_initialConnectAttempt ret = True - + while not xbmc.abortRequested: #check for new settings if settings_checkForNewSettings() or not g_lcdproc.IsConnected(): #networksettings changed? @@ -124,27 +139,8 @@ def handleConnectLCD(): return True ret = g_lcdproc.Initialize() + HandleConnectionNotification(ret) - if not ret: - count = 10 - if not g_failedConnectionNotified: - g_failedConnectionNotified = True - g_initialConnectAttempt = False - text = __settings__.getLocalizedString(500) - xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) - while (not xbmc.abortRequested) and (count > 0): - time.sleep(1) - count -= 1 - ret = False - else: - text = __settings__.getLocalizedString(501) - if not g_failedConnectionNotified and not g_initialConnectAttempt: - xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) - g_failedConnectionNotified = True - break - - # initial connection attempt done, update flag - g_initialConnectAttempt = False return ret #MAIN - entry point From 561ecbfa9c42abc209d7bf62a954d98ce957d601 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 18 Nov 2012 14:22:58 +0100 Subject: [PATCH 118/337] Made connection notification popup display a user-toggleable option --- script.xbmc.lcd/lcdmain.py | 3 ++- .../resources/language/English/strings.xml | 1 + .../resources/language/German/strings.xml | 1 + script.xbmc.lcd/resources/lib/settings.py | 13 +++++++++++++ script.xbmc.lcd/resources/settings.xml | 5 +++-- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 947d7e1..3d7eb26 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -139,7 +139,8 @@ def handleConnectLCD(): return True ret = g_lcdproc.Initialize() - HandleConnectionNotification(ret) + if not settings_getHideConnPopups(): + HandleConnectionNotification(ret) return ret diff --git a/script.xbmc.lcd/resources/language/English/strings.xml b/script.xbmc.lcd/resources/language/English/strings.xml index dfc0501..31fb9ad 100644 --- a/script.xbmc.lcd/resources/language/English/strings.xml +++ b/script.xbmc.lcd/resources/language/English/strings.xml @@ -15,6 +15,7 @@ Dim backlight on shutdown Navigation display duration (s) Display refresh rate (Hz) + Hide connection error notifications Marquee diff --git a/script.xbmc.lcd/resources/language/German/strings.xml b/script.xbmc.lcd/resources/language/German/strings.xml index 13ed3d4..c49bf10 100644 --- a/script.xbmc.lcd/resources/language/German/strings.xml +++ b/script.xbmc.lcd/resources/language/German/strings.xml @@ -15,6 +15,7 @@ Hintergrundbeleuchtung beim Herunterfahren ausschalten Anzeigedauer der Navigationsansicht (s) Display-Aktualisierungsrate (Hz) + Verbindungsfehler-Benachrichtigung verstecken Durchlaufend diff --git a/script.xbmc.lcd/resources/lib/settings.py b/script.xbmc.lcd/resources/lib/settings.py index 2898986..5a5b082 100644 --- a/script.xbmc.lcd/resources/lib/settings.py +++ b/script.xbmc.lcd/resources/lib/settings.py @@ -44,6 +44,7 @@ global g_dimonshutdown global g_navtimeout global g_refreshrate +global g_hideconnpopups #init globals with defaults def settings_initGlobals(): @@ -58,6 +59,7 @@ def settings_initGlobals(): global g_dimonshutdown global g_navtimeout global g_refreshrate + global g_hideconnpopups g_hostip = "127.0.0.1" g_hostport = 13666 @@ -70,6 +72,7 @@ def settings_initGlobals(): g_dimonshutdown = False g_navtimeout = 3 g_refreshrate = 1 + g_hideconnpopups = True def settings_getHostIp(): global g_hostip @@ -113,6 +116,10 @@ def settings_getRefreshRate(): global g_refreshrate return g_refreshrate +def settings_getHideConnPopups(): + global g_hideconnpopups + return g_hideconnpopups + #check for new settings and handle them if anything changed #only checks if the last check is 5 secs old #returns if a reconnect is needed due to settings change @@ -166,6 +173,7 @@ def settings_handleLcdSettings(): global g_dimonshutdown global g_navtimeout global g_refreshrate + global g_hideconnpopups g_settingsChanged = False @@ -176,6 +184,7 @@ def settings_handleLcdSettings(): dimonshutdown = __settings__.getSetting("dimonshutdown") == "true" navtimeout = int(float(string.replace(__settings__.getSetting("navtimeout"), ",", "."))) refreshrate = int(float(string.replace(__settings__.getSetting("refreshrate"), ",", "."))) + hideconnpopups = __settings__.getSetting("hideconnpopups") == "true" if g_scrolldelay != scrolldelay: g_scrolldelay = scrolldelay @@ -209,6 +218,10 @@ def settings_handleLcdSettings(): g_settingsChanged = True + if g_hideconnpopups != hideconnpopups: + g_hideconnpopups = hideconnpopups + g_settingsChanged = True + #handles all settings of boblight and applies them as needed #returns if a reconnect is needed due to settings changes def settings_setup(): diff --git a/script.xbmc.lcd/resources/settings.xml b/script.xbmc.lcd/resources/settings.xml index 692e42b..a6f49d1 100644 --- a/script.xbmc.lcd/resources/settings.xml +++ b/script.xbmc.lcd/resources/settings.xml @@ -9,7 +9,8 @@ - - + + + From 7bf4a5a68d621193f36cfcfadd72ab11b5179cdb Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 18 Nov 2012 15:22:26 +0100 Subject: [PATCH 119/337] put GUI-settings into categories, add hostport configuration option, do cleanup --- .../resources/language/English/strings.xml | 38 +++++++++--------- .../resources/language/German/strings.xml | 39 +++++++++++-------- script.xbmc.lcd/resources/lib/settings.py | 36 +++++++++++------ script.xbmc.lcd/resources/settings.xml | 28 +++++++------ 4 files changed, 83 insertions(+), 58 deletions(-) diff --git a/script.xbmc.lcd/resources/language/English/strings.xml b/script.xbmc.lcd/resources/language/English/strings.xml index 31fb9ad..f89bcaa 100644 --- a/script.xbmc.lcd/resources/language/English/strings.xml +++ b/script.xbmc.lcd/resources/language/English/strings.xml @@ -1,21 +1,25 @@ - - - - - - General - Use remote LCDProc - LCDd IP - Show heartbeat symbol - Delay for scrolling text - Scroll mode - Dim backlight on screensaver - Dim backlight on shutdown - Navigation display duration (s) - Display refresh rate (Hz) - Hide connection error notifications + + + Behaviour + Delay for scrolling text + Scroll mode + Navigation display duration (s) + Display refresh rate (Hz) + + + Backlight + Dim backlight on screensaver + Dim backlight on shutdown + + + Connection + Use remote LCDProc + LCDd IP + LCDd port + Show heartbeat symbol + Hide connection error notifications Marquee @@ -27,5 +31,3 @@ Settings changed! - - diff --git a/script.xbmc.lcd/resources/language/German/strings.xml b/script.xbmc.lcd/resources/language/German/strings.xml index c49bf10..628d6ac 100644 --- a/script.xbmc.lcd/resources/language/German/strings.xml +++ b/script.xbmc.lcd/resources/language/German/strings.xml @@ -1,28 +1,33 @@ - - - - - - Allgemein - Entfernten LCDproc-Server benutzen - LCDd IP - Heartbeatsymbol anzeigen - Geschwindigkeit für gescrollten Text - Scroll-Modus - Hintergrundbeleuchtung ausschalten, wenn Bildschirmschoner aktiv - Hintergrundbeleuchtung beim Herunterfahren ausschalten - Anzeigedauer der Navigationsansicht (s) - Display-Aktualisierungsrate (Hz) - Verbindungsfehler-Benachrichtigung verstecken + + + Verhalten + Geschwindigkeit für gescrollten Text + Scroll-Modus + Anzeigedauer der Navigationsansicht (s) + Display-Aktualisierungsrate (Hz) + + + Beleuchtung + Hintergrundbeleuchtung ausschalten, wenn Bildschirmschoner aktiv + Hintergrundbeleuchtung beim Herunterfahren ausschalten + + + Verbindung + Entfernten LCDproc-Server benutzen + LCDd IP + LCDd Port + Heartbeatsymbol anzeigen + Verbindungsfehler-Benachrichtigung verstecken Durchlaufend Links/Rechts - + Fehler beim Verbinden zu LCDproc! Verbunden mit LCDproc! Einstellungen geändert! + diff --git a/script.xbmc.lcd/resources/lib/settings.py b/script.xbmc.lcd/resources/lib/settings.py index 5a5b082..68193db 100644 --- a/script.xbmc.lcd/resources/lib/settings.py +++ b/script.xbmc.lcd/resources/lib/settings.py @@ -145,23 +145,40 @@ def settings_didSettingsChange(): def settings_handleNetworkSettings(): global g_hostip global g_hostport + global g_heartbeat + reconnect = False - hostip = __settings__.getSetting("hostip") - hostport = g_hostport + hostip = __settings__.getSetting("hostip") + hostport = int(__settings__.getSetting("hostport")) + heartbeat = __settings__.getSetting("heartbeat") == "true" #server settings #we need to reconnect if networkaccess bool changes #or if network access is enabled and ip or port have changed - if g_hostip != hostip or g_hostport != hostport: + if g_hostip != hostip or g_hostport != hostport or g_heartbeat != heartbeat: if g_hostip != hostip: print "lcd: changed hostip to " + str(hostip) g_hostip = hostip - + reconnect = True + if g_hostport != hostport: - print "lcd: changed hostport to " + str(hostport) - g_hostport = hostport - reconnect = True + + # make sure valid port number was given + if hostport > 0 and hostport < 65536: + print "lcd: changed hostport to " + str(hostport) + g_hostport = hostport + reconnect = True + else: + print "lcd: invalid hostport value " + str(hostport) + ", resetting to old value " + str(g_hostport) + + __settings__.setSetting("hostport", str(g_hostport)) + + if g_heartbeat != heartbeat: + print "lcd: toggled heartbeat bool" + g_heartbeat = heartbeat + reconnect = True + return reconnect def settings_handleLcdSettings(): @@ -179,7 +196,6 @@ def settings_handleLcdSettings(): scrolldelay = int(float(string.replace(__settings__.getSetting("scrolldelay"), ",", "."))) scrollmode = __settings__.getSetting("scrollmode") - heartbeat = __settings__.getSetting("heartbeat") == "true" dimonscreensaver = __settings__.getSetting("dimonscreensaver") == "true" dimonshutdown = __settings__.getSetting("dimonshutdown") == "true" navtimeout = int(float(string.replace(__settings__.getSetting("navtimeout"), ",", "."))) @@ -194,10 +210,6 @@ def settings_handleLcdSettings(): g_scrollmode = scrollmode g_settingsChanged = True - if g_heartbeat != heartbeat: - g_heartbeat = heartbeat - g_settingsChanged = True - if g_dimonscreensaver != dimonscreensaver: g_dimonscreensaver = dimonscreensaver g_settingsChanged = True diff --git a/script.xbmc.lcd/resources/settings.xml b/script.xbmc.lcd/resources/settings.xml index a6f49d1..f42c487 100644 --- a/script.xbmc.lcd/resources/settings.xml +++ b/script.xbmc.lcd/resources/settings.xml @@ -1,16 +1,22 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + From 11be9e2c3fffb8f2d2d52578d27be68406e68ffb Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 18 Nov 2012 15:42:35 +0100 Subject: [PATCH 120/337] changelog, license in README --- README | 7 +++++++ script.xbmc.lcd/changelog.txt | 2 ++ 2 files changed, 9 insertions(+) diff --git a/README b/README index 90d3c54..069421f 100644 --- a/README +++ b/README @@ -9,3 +9,10 @@ the LCD support in XBMC core. See https://github.com/herrnst/script.xbmc.lcd/wiki for details and usage information. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +See LICENSE.txt for more information. diff --git a/script.xbmc.lcd/changelog.txt b/script.xbmc.lcd/changelog.txt index 576ef61..f3b4375 100644 --- a/script.xbmc.lcd/changelog.txt +++ b/script.xbmc.lcd/changelog.txt @@ -2,6 +2,8 @@ - Support for extra stuff (icons, bars) on supporting displays - Extra stuff handling for SoundGraph iMON LCD and Futaba/Targa mdm166a VFD devices (presence will be autodetected) +- Fixed connection problem popup annoyance +- GUI settings cleanup and some more LCD.xml configurables 1.1.0 - greatly improved client/server communication - native widgets for bars, icons and bignumbers From b899cd2f747890882b0f3c9a69b4dd9ce4d1d0d8 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 18 Nov 2012 18:39:58 +0100 Subject: [PATCH 121/337] Fix sleep not being executed when no connection to LCDproc can be made --- script.xbmc.lcd/lcdmain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 3d7eb26..0c08082 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -124,7 +124,7 @@ def process_lcd(): else: g_lcdproc.DisableOnPlayback(False, False) - time.sleep(1.0 / float(settings_getRefreshRate())) # refresh after configured rate + time.sleep(1.0 / float(settings_getRefreshRate())) # refresh after configured rate g_lcdproc.Shutdown(settings_getDimOnShutdown()) From 33edd031e6c21ef22bae91a85d1e4fca02f2042a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 28 Nov 2012 20:30:36 +0100 Subject: [PATCH 122/337] don't fill short strings with blanks --- script.xbmc.lcd/resources/lib/lcdproc.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 837548e..d620e3f 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -518,11 +518,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): iScrollSpeed = settings_getScrollDelay() strScrollMode = settings_getLCDprocScrollMode() - # make string fit the display if it's smaller than the width - if len(strLineLong) < int(self.m_iColumns): - numSpaces = int(iMaxLineLen) - len(strLineLong) - strLineLong.ljust(numSpaces) #pad with spaces - elif len(strLineLong) > int(self.m_iColumns): #else if the string doesn't fit the display... + if len(strLineLong) > int(self.m_iColumns): # if the string doesn't fit the display... if iScrollSpeed != 0: # add separator when scrolling enabled if strScrollMode == "m": # and scrollmode is marquee strLineLong += self.m_strScrollSeparator From 52564e5e6baa6bff339802727d465600d7c085cc Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 28 Nov 2012 20:37:32 +0100 Subject: [PATCH 123/337] alignment pseudo-enum, add dict member for alignment --- script.xbmc.lcd/resources/lib/lcdbase.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index c32481e..a402a7b 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -42,12 +42,6 @@ from extraicons import * from infolabels import * -g_dictEmptyLineDescriptor = {} -g_dictEmptyLineDescriptor['type'] = str("text") -g_dictEmptyLineDescriptor['startx'] = int(0) -g_dictEmptyLineDescriptor['text'] = str("") -g_dictEmptyLineDescriptor['endx'] = int(0) - # global functions def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,),level=loglevel ) @@ -75,6 +69,18 @@ class LCD_LINETYPE: LCD_LINETYPE_ICONTEXT = "icontext" LCD_LINETYPE_BIGSCREEN = "bigscreen" +class LCD_LINEALIGN: + LCD_LINEALIGN_LEFT = 0 + LCD_LINEALIGN_CENTER = 1 + LCD_LINEALIGN_RIGHT = 2 + +g_dictEmptyLineDescriptor = {} +g_dictEmptyLineDescriptor['type'] = str("text") +g_dictEmptyLineDescriptor['startx'] = int(0) +g_dictEmptyLineDescriptor['text'] = str("") +g_dictEmptyLineDescriptor['endx'] = int(0) +g_dictEmptyLineDescriptor['align'] = LCD_LINEALIGN.LCD_LINEALIGN_LEFT + class LcdBase(): def __init__(self): self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE From d9fb571fae297df8ee81103bd77756eeff76d1dc Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 28 Nov 2012 21:08:24 +0100 Subject: [PATCH 124/337] initialize linedescriptor with empty globally-defined desc and set needed values per linetype only --- script.xbmc.lcd/resources/lib/lcdbase.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index a402a7b..915108d 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -290,7 +290,12 @@ def LoadMode(self, node, mode): timeregex = r'' + re.escape('$INFO[LCD.') + 'Time((Wide)?\d?\d?)' + re.escape(']') for line in node.findall("line"): - linedescriptor = {} + # initialize line with empty descriptor + linedescriptor = g_dictEmptyLineDescriptor.copy() + + linedescriptor['startx'] = int(1) + linedescriptor['endx'] = int(self.GetColumns()) + if line.text == None: linetext = "" else: @@ -303,9 +308,7 @@ def LoadMode(self, node, mode): # if line matches, throw away mode, add BigDigit descriptor and end processing for this mode if timematch != None: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN - linedescriptor['startx'] = int(1) linedescriptor['text'] = "Time" - linedescriptor['endx'] = int(self.GetColumns()) self.m_lcdMode[mode] = [] self.m_lcdMode[mode].append(linedescriptor) @@ -314,8 +317,6 @@ def LoadMode(self, node, mode): # progressbar line if InfoLabel exists if str(linetext).lower().find("$info[lcd.progressbar]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_PROGRESS - linedescriptor['startx'] = int(1) - linedescriptor['text'] = "" linedescriptor['endx'] = int(self.m_iCellWidth) * int(self.m_iColumns) if self.m_bProgressbarSurroundings == True: @@ -332,13 +333,11 @@ def LoadMode(self, node, mode): linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', str(linetext))).strip() else: linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', str(linetext), flags=re.IGNORECASE)).strip() - linedescriptor['endx'] = int(self.GetColumns()) + # standard (scrolling) text line else: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_TEXT - linedescriptor['startx'] = int(1) linedescriptor['text'] = str(linetext) - linedescriptor['endx'] = int(self.GetColumns()) self.m_lcdMode[mode].append(linedescriptor) From 6fc1c83932b364789aa44a66b331b346c50b309c Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 28 Nov 2012 21:09:13 +0100 Subject: [PATCH 125/337] set empty desc type to pseudo-enum type --- script.xbmc.lcd/resources/lib/lcdbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 915108d..157be89 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -75,7 +75,7 @@ class LCD_LINEALIGN: LCD_LINEALIGN_RIGHT = 2 g_dictEmptyLineDescriptor = {} -g_dictEmptyLineDescriptor['type'] = str("text") +g_dictEmptyLineDescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_TEXT g_dictEmptyLineDescriptor['startx'] = int(0) g_dictEmptyLineDescriptor['text'] = str("") g_dictEmptyLineDescriptor['endx'] = int(0) From 6b2ed7a708e018f20ca6743a49c081ddc3f2dc92 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 28 Nov 2012 21:15:58 +0100 Subject: [PATCH 126/337] find, apply and strip pseudo alignment-labels --- script.xbmc.lcd/resources/lib/lcdbase.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 157be89..fb1a235 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -339,6 +339,19 @@ def LoadMode(self, node, mode): linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_TEXT linedescriptor['text'] = str(linetext) + # check for alignment pseudo-labels + if str(linetext).lower().find("$info[lcd.aligncenter]") >= 0: + linedescriptor['type'] = LCD_LINEALIGN.LCD_LINEALIGN_CENTER + if str(linetext).lower().find("$info[lcd.alignright]") >= 0: + linedescriptor['type'] = LCD_LINEALIGN.LCD_LINEALIGN_RIGHT + + if self.m_vPythonVersion < (2, 7): + linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.AlignCenter]") + '\s?', ' ', linedescriptor['text'])).strip() + linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.AlignRight]") + '\s?', ' ', linedescriptor['text'])).strip() + else: + linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.AlignCenter]") + '\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE)).strip() + linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.AlignRight]") + '\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE)).strip() + self.m_lcdMode[mode].append(linedescriptor) def Reset(self): From db4b727b4a98deef0be0726c4b8d94f45b92663a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 28 Nov 2012 21:22:19 +0100 Subject: [PATCH 127/337] x offset in separate var --- script.xbmc.lcd/resources/lib/lcdproc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index d620e3f..370c40a 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -526,6 +526,8 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): strLineLong = strLineLong[:iMaxLineLen] iScrollSpeed = 1 + iStartX = dictDescriptor['startx'] + # check if update is required if strLineLong != self.m_strLineText[iLine] or bForce: # bigscreen @@ -533,10 +535,10 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): self.SetBigDigits(strLineLong, bExtraForce) # progressbar line elif dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS: - self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, dictDescriptor['startx'], ln, self.m_iProgressBarWidth) + self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, iStartX, ln, self.m_iProgressBarWidth) # everything else (text, icontext) else: - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i %s %i \"%s\"\n" % (ln, dictDescriptor['startx'], ln, self.m_iColumns, ln, strScrollMode, iScrollSpeed, re.escape(strLineLong)) + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i %s %i \"%s\"\n" % (ln, iStartX, ln, self.m_iColumns, ln, strScrollMode, iScrollSpeed, re.escape(strLineLong)) # cache contents self.m_strLineText[iLine] = strLineLong From 0d0b58c05595d568e47001f2bf5701e6f8e9ef09 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 28 Nov 2012 21:24:46 +0100 Subject: [PATCH 128/337] fix: compare line length against maxlen instead of display len (correctly adds separator for icontext lines) --- script.xbmc.lcd/resources/lib/lcdproc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 370c40a..67bdb7e 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -518,7 +518,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): iScrollSpeed = settings_getScrollDelay() strScrollMode = settings_getLCDprocScrollMode() - if len(strLineLong) > int(self.m_iColumns): # if the string doesn't fit the display... + if len(strLineLong) > iMaxLineLen: # if the string doesn't fit the display... if iScrollSpeed != 0: # add separator when scrolling enabled if strScrollMode == "m": # and scrollmode is marquee strLineLong += self.m_strScrollSeparator From f65655c86ae6b7c4e1751f8a652651da9b649fc6 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 28 Nov 2012 21:43:06 +0100 Subject: [PATCH 129/337] put alignment to correct dict member (copy/paste-bitch) --- script.xbmc.lcd/resources/lib/lcdbase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index fb1a235..482b101 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -341,9 +341,9 @@ def LoadMode(self, node, mode): # check for alignment pseudo-labels if str(linetext).lower().find("$info[lcd.aligncenter]") >= 0: - linedescriptor['type'] = LCD_LINEALIGN.LCD_LINEALIGN_CENTER + linedescriptor['align'] = LCD_LINEALIGN.LCD_LINEALIGN_CENTER if str(linetext).lower().find("$info[lcd.alignright]") >= 0: - linedescriptor['type'] = LCD_LINEALIGN.LCD_LINEALIGN_RIGHT + linedescriptor['align'] = LCD_LINEALIGN.LCD_LINEALIGN_RIGHT if self.m_vPythonVersion < (2, 7): linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.AlignCenter]") + '\s?', ' ', linedescriptor['text'])).strip() From 847f774e484c1f7aed4524a452bb1ddea84fefc8 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 28 Nov 2012 21:43:54 +0100 Subject: [PATCH 130/337] apply aligning to x-offset of scroller widget --- script.xbmc.lcd/resources/lib/lcdproc.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 67bdb7e..5e7d345 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -538,6 +538,13 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, iStartX, ln, self.m_iProgressBarWidth) # everything else (text, icontext) else: + if len(strLineLong) < iMaxLineLen and dictDescriptor['align'] != LCD_LINEALIGN.LCD_LINEALIGN_LEFT: + iSpaces = iMaxLineLen - len(strLineLong) + if dictDescriptor['align'] == LCD_LINEALIGN.LCD_LINEALIGN_RIGHT: + iStartX += iSpaces + elif dictDescriptor['align'] == LCD_LINEALIGN.LCD_LINEALIGN_CENTER: + iStartX += int(iSpaces / 2) + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i %s %i \"%s\"\n" % (ln, iStartX, ln, self.m_iColumns, ln, strScrollMode, iScrollSpeed, re.escape(strLineLong)) # cache contents From 0c6ccd9a67d90e8fc702f67dac35101ac4786282 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 2 Dec 2012 18:40:22 +0100 Subject: [PATCH 131/337] update addon changelog --- script.xbmc.lcd/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/script.xbmc.lcd/changelog.txt b/script.xbmc.lcd/changelog.txt index f3b4375..9b07ee1 100644 --- a/script.xbmc.lcd/changelog.txt +++ b/script.xbmc.lcd/changelog.txt @@ -2,6 +2,7 @@ - Support for extra stuff (icons, bars) on supporting displays - Extra stuff handling for SoundGraph iMON LCD and Futaba/Targa mdm166a VFD devices (presence will be autodetected) +- Align each line either left (default), centered or right - Fixed connection problem popup annoyance - GUI settings cleanup and some more LCD.xml configurables 1.1.0 From 20e4b75ff718bca496fc356144acb4579e429447 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 9 Dec 2012 16:56:40 +0100 Subject: [PATCH 132/337] make log prefix correctly resemble addon name --- script.xbmc.lcd/lcdmain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 0c08082..4904d04 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -30,7 +30,7 @@ __settings__ = xbmcaddon.Addon(id='script.xbmc.lcd') __cwd__ = __settings__.getAddonInfo('path') __icon__ = os.path.join(__cwd__,"icon.png") -__scriptname__ = "XBMC LCD/VFD" +__scriptname__ = "XBMC LCDproc" BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'lib' ) ) sys.path.append (BASE_RESOURCE_PATH) From 6dad94a4acd1e760b84fbd2be279b13fdef7cd40 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 9 Dec 2012 17:34:49 +0100 Subject: [PATCH 133/337] update addon metadata, german description --- script.xbmc.lcd/addon.xml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/script.xbmc.lcd/addon.xml b/script.xbmc.lcd/addon.xml index 17c51a6..9f9dfca 100644 --- a/script.xbmc.lcd/addon.xml +++ b/script.xbmc.lcd/addon.xml @@ -1,12 +1,16 @@ - + - XBMC LCD/VFD - This addon will add the LCD/VFD feature which was integrated into XBMC before. There has to be an lcdproc daemon (LCDd) running somewhere in the network or local to use the addon. + + XBMC LCDproc + Displays configurable information e.g. about playing media or XBMC status on any LC/VF-display driven by LCDproc, and acts as direct drop-in replacement to the LCD/VFD-feature previously available in XBMC's core. Supports additional display elements (icons, bars) on SoundGraph iMON LCD and Targa/Futaba mdm166a VFD hardware. Requires a properly configured and running LCDd either locally or somewhere on the network. + Zeigt konfigurierbare Informationen z.B. über aktuelle Wiedergabe oder XBMC Stati auf beliebigen von LCDproc angesteuerten LC/VF-Displays, ersetzt die zuvor im XBMC-Kern enthaltene LCD/VFD-Funktion. Unterstützt zusätzliche Elemente (Icons, Balken) von SoundGraph iMON LCD und Targa/Futaba mdm166a VFD Hardware. Benötigt einen konfigurierten, laufenden LCDd auf dem lokalen System oder im Netzwerk. + Works with LCDproc only. Other LCD services like LCD4Linux or iMON Manager on Win32 are not supported. No liability taken for damaged hardware and/or software caused by this addon. + Funktioniert ausschliesslich mit LCDproc. Andere LCD-Dienste wie LCD4Linux, iMON Manager unter Win32 u.a. sind nicht unterstützt. Keine Haftung für durch dieses Addon beschädigte Hard-/Software. all From ad80016d69e11bbbaf6e1493b1689031cd0e0ca6 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 9 Dec 2012 17:41:27 +0100 Subject: [PATCH 134/337] update copyright info --- README | 2 +- script.xbmc.lcd/lcdmain.py | 2 +- script.xbmc.lcd/resources/lib/extraicons.py | 2 +- script.xbmc.lcd/resources/lib/infolabels.py | 2 +- script.xbmc.lcd/resources/lib/lcdbase.py | 2 +- script.xbmc.lcd/resources/lib/lcdproc.py | 2 +- script.xbmc.lcd/resources/lib/lcdproc_extra_base.py | 2 +- script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py | 4 ++-- script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py | 4 ++-- script.xbmc.lcd/resources/lib/settings.py | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README b/README index 069421f..cd2d752 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ XBMC LCDproc Python addon ========================== -Copyright (C) 2012 Daniel Scheller +Copyright (C) 2012 Team XBMC, Daniel 'herrnst' Scheller Based on initial work (C) 2012 Memphiz/Team XBMC LCDproc support for XBMC implemented in Python, direct drop-in replacement for diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 4904d04..9596824 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -1,7 +1,7 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - Copyright (C) 2012 Daniel Scheller + Copyright (C) 2012 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/script.xbmc.lcd/resources/lib/extraicons.py b/script.xbmc.lcd/resources/lib/extraicons.py index cf9142c..96a311b 100644 --- a/script.xbmc.lcd/resources/lib/extraicons.py +++ b/script.xbmc.lcd/resources/lib/extraicons.py @@ -3,7 +3,7 @@ Copyright (C) 2012 Team XBMC Extra icon defines/enums - Copyright (C) 2012 Daniel Scheller + Copyright (C) 2012 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/script.xbmc.lcd/resources/lib/infolabels.py b/script.xbmc.lcd/resources/lib/infolabels.py index bd5c228..150862c 100644 --- a/script.xbmc.lcd/resources/lib/infolabels.py +++ b/script.xbmc.lcd/resources/lib/infolabels.py @@ -3,7 +3,7 @@ Copyright (C) 2012 Team XBMC InfoLabel handling - Copyright (C) 2012 Daniel Scheller + Copyright (C) 2012 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 482b101..d5f3d65 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -1,7 +1,7 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - Copyright (C) 2012 Daniel Scheller + Copyright (C) 2012 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 5e7d345..4455fae 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -1,7 +1,7 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - Copyright (C) 2012 Daniel Scheller + Copyright (C) 2012 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py index adbcae7..423b6fc 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py @@ -3,7 +3,7 @@ Copyright (C) 2012 Team XBMC Stub class for extra symbol support e.g. on SoundGraph iMON or mdm166a LCDs/VFDs - Copyright (C) 2012 Daniel Scheller + Copyright (C) 2012 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index 0d4d22b..3d70658 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -3,8 +3,8 @@ Copyright (C) 2012 Team XBMC Support for extra symbols on SoundGraph iMON LCD displays - Copyright (C) 2012 Daniel Scheller - Original C implementation (C) 2010 theonlychriss + Copyright (C) 2012 Daniel 'herrnst' Scheller + Original C implementation (C) 2010 theonlychriss@vdr-portal This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py index 81fc5e2..de6b936 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py @@ -3,8 +3,8 @@ Copyright (C) 2012 Team XBMC Support for extra symbols on Futaba/Targa USB mdm166a VFD displays - Copyright (C) 2012 Daniel Scheller - Original C implementation (C) 2010 theonlychriss + Copyright (C) 2012 Daniel 'herrnst' Scheller + Original C implementation (C) 2010 theonlychriss@vdr-portal This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/script.xbmc.lcd/resources/lib/settings.py b/script.xbmc.lcd/resources/lib/settings.py index 68193db..883f2ff 100644 --- a/script.xbmc.lcd/resources/lib/settings.py +++ b/script.xbmc.lcd/resources/lib/settings.py @@ -1,7 +1,7 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - Copyright (C) 2012 Daniel Scheller + Copyright (C) 2012 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From 3fc08d80da8e13e46669d9191a7e7cb9a5517090 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 26 Dec 2012 14:05:37 +0100 Subject: [PATCH 135/337] fix: avoid script error/crash when LCD.xml is missing, empty or invalid (e.g. won't properly parse) and show a warning (new string 503) if this is the case --- .../resources/language/English/strings.xml | 3 ++- .../resources/language/German/strings.xml | 1 + script.xbmc.lcd/resources/lib/lcdbase.py | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/language/English/strings.xml b/script.xbmc.lcd/resources/language/English/strings.xml index f89bcaa..206454e 100644 --- a/script.xbmc.lcd/resources/language/English/strings.xml +++ b/script.xbmc.lcd/resources/language/English/strings.xml @@ -29,5 +29,6 @@ Failed to connect to LCDProc! Connected to LCDProc! Settings changed! - + Warning! Errors in LCD.xml or LCD.xml not found! + diff --git a/script.xbmc.lcd/resources/language/German/strings.xml b/script.xbmc.lcd/resources/language/German/strings.xml index 628d6ac..858f208 100644 --- a/script.xbmc.lcd/resources/language/German/strings.xml +++ b/script.xbmc.lcd/resources/language/German/strings.xml @@ -29,5 +29,6 @@ Fehler beim Verbinden zu LCDproc! Verbunden mit LCDproc! Einstellungen geändert! + Warnung! Fehlerhafte LCD.xml oder LCD.xml nicht gefunden! diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index d5f3d65..2f4e6fa 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -99,6 +99,7 @@ def __init__(self): self.m_strOldAudioCodec = "" self.m_iOldAudioChannelsVar = 0 self.m_bWasStopped = True + self.m_bHaveSkin = False # @abstractmethod def _concrete_method(self): @@ -170,7 +171,14 @@ def Initialize(self): def LoadSkin(self, xmlFile): self.Reset() - doc = xmltree.parse(xmlFile) + + try: + doc = xmltree.parse(xmlFile) + except: + text = __settings__.getLocalizedString(503) + xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) + return + for element in doc.getiterator(): #PARSE LCD infos if element.tag == "lcd": @@ -274,6 +282,8 @@ def LoadSkin(self, xmlFile): tmpMode = element.find("pvrradio") self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_PVRRADIO) + + self.m_bHaveSkin = True def LoadMode(self, node, mode): if node == None: @@ -372,6 +382,9 @@ def Shutdown(self, bDimOnShutdown): self.CloseSocket() def Render(self, mode, bForce): + if not self.m_bHaveSkin: + return + outLine = 0 inLine = 0 From 896f2c53b11f4f6e30fb594dbde761dca6f31136 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 26 Dec 2012 14:51:50 +0100 Subject: [PATCH 136/337] make LCD.xml parse problems part of connection handling so Render() doesn't needs to check if a skin is loaded on every call, show popup only the first time an LCD.xml problem is detected (but show again after a subsequent try succeeded) --- script.xbmc.lcd/resources/lib/lcdbase.py | 30 ++++++++++++++++-------- script.xbmc.lcd/resources/lib/lcdproc.py | 18 +++++++------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 2f4e6fa..772cfc1 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -99,7 +99,7 @@ def __init__(self): self.m_strOldAudioCodec = "" self.m_iOldAudioChannelsVar = 0 self.m_bWasStopped = True - self.m_bHaveSkin = False + self.m_bXMLWarningDisplayed = False # @abstractmethod def _concrete_method(self): @@ -167,17 +167,25 @@ def SetProgressBar(self, percent, lineIdx): def Initialize(self): self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE - self.LoadSkin(__lcdxml__) + if not self.LoadSkin(__lcdxml__): + return False + + return True def LoadSkin(self, xmlFile): self.Reset() + bHaveSkin = False try: doc = xmltree.parse(xmlFile) except: - text = __settings__.getLocalizedString(503) - xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) - return + if not self.m_bXMLWarningDisplayed: + self.m_bXMLWarningDisplayed = True + text = __settings__.getLocalizedString(503) + xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,5000,__icon__)) + + log(xbmc.LOGERROR, "Parsing of %s failed" % (xmlFile)) + return False for element in doc.getiterator(): #PARSE LCD infos @@ -282,8 +290,13 @@ def LoadSkin(self, xmlFile): tmpMode = element.find("pvrradio") self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_PVRRADIO) - - self.m_bHaveSkin = True + + bHaveSkin = True + + # LCD.xml parsed successfully, so reset warning flag + self.m_bXMLWarningDisplayed = False + + return bHaveSkin def LoadMode(self, node, mode): if node == None: @@ -382,9 +395,6 @@ def Shutdown(self, bDimOnShutdown): self.CloseSocket() def Render(self, mode, bForce): - if not self.m_bHaveSkin: - return - outLine = 0 inLine = 0 diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 4455fae..63431b0 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -206,14 +206,18 @@ def Initialize(self): self.m_lastInitAttempt = now if self.Connect(): - # reset the retry interval after a successful connect - self.m_initRetryInterval = INIT_RETRY_INTERVAL - self.m_bStop = False - connected = True - else: - self.CloseSocket() + if LcdBase.Initialize(self): + # reset the retry interval after a successful connect + self.m_initRetryInterval = INIT_RETRY_INTERVAL + self.m_bStop = False + connected = True + else: + log(xbmc.LOGERROR, "Connection successful but LCD.xml has errors, aborting connect") if not connected: + # preventively close socket + self.CloseSocket() + # give up after 60 seconds if self.m_initRetryInterval > INIT_RETRY_INTERVAL_MAX: self.m_used = False @@ -221,8 +225,6 @@ def Initialize(self): else: self.m_initRetryInterval = self.m_initRetryInterval * 2 log(xbmc.LOGERROR,"Connect failed. Retry in %d seconds." % self.m_initRetryInterval) - else: - LcdBase.Initialize(self) return connected From cffe16b5ae970a95bc1e4199ef517280a379554d Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 26 Dec 2012 14:56:59 +0100 Subject: [PATCH 137/337] INIT_RETRY_INTERVAL_MAX is seconds, not milliseconds (so really stop trying after 60 seconds and not after 16.7 hours ;) --- script.xbmc.lcd/resources/lib/lcdproc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 63431b0..5e8c4bb 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -51,7 +51,7 @@ def log(loglevel, msg): MAX_ROWS = 20 MAX_BIGDIGITS = 20 INIT_RETRY_INTERVAL = 2 -INIT_RETRY_INTERVAL_MAX = 60000 +INIT_RETRY_INTERVAL_MAX = 60 class LCDProc(LcdBase): def __init__(self): @@ -218,7 +218,7 @@ def Initialize(self): # preventively close socket self.CloseSocket() - # give up after 60 seconds + # give up after INIT_RETRY_INTERVAL_MAX (60) seconds if self.m_initRetryInterval > INIT_RETRY_INTERVAL_MAX: self.m_used = False log(xbmc.LOGERROR,"Connect failed. Giving up.") From 88d4c3b24e64b64e6edf85294061e08d55097b59 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 26 Dec 2012 14:58:40 +0100 Subject: [PATCH 138/337] leave more detailed instructions in xbmc.log after giving up with connection attempts --- script.xbmc.lcd/resources/lib/lcdproc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcd/resources/lib/lcdproc.py index 5e8c4bb..384cec5 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc.py +++ b/script.xbmc.lcd/resources/lib/lcdproc.py @@ -221,7 +221,7 @@ def Initialize(self): # give up after INIT_RETRY_INTERVAL_MAX (60) seconds if self.m_initRetryInterval > INIT_RETRY_INTERVAL_MAX: self.m_used = False - log(xbmc.LOGERROR,"Connect failed. Giving up.") + log(xbmc.LOGERROR,"Connect failed. Giving up. Please fix any connection problems and restart the addon.") else: self.m_initRetryInterval = self.m_initRetryInterval * 2 log(xbmc.LOGERROR,"Connect failed. Retry in %d seconds." % self.m_initRetryInterval) From 6db15cbaacda4a88f0267261df0adabf4acc352c Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 26 Dec 2012 15:37:20 +0100 Subject: [PATCH 139/337] [extra_imon] fix: make sure scaling icons are off when not playing video (this caused them to stay lit when a video ended and the GUI returns to the video menu) --- script.xbmc.lcd/resources/lib/extraicons.py | 1 + script.xbmc.lcd/resources/lib/lcdbase.py | 4 ++++ script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py | 2 ++ 3 files changed, 7 insertions(+) diff --git a/script.xbmc.lcd/resources/lib/extraicons.py b/script.xbmc.lcd/resources/lib/extraicons.py index 96a311b..1de8164 100644 --- a/script.xbmc.lcd/resources/lib/extraicons.py +++ b/script.xbmc.lcd/resources/lib/extraicons.py @@ -74,6 +74,7 @@ def enum(*sequential, **named): LCD_EXTRAICONCATEGORIES = enum( 'LCD_ICONCAT_MODES', + 'LCD_ICONCAT_OUTSCALE', 'LCD_ICONCAT_CODECS', 'LCD_ICONCAT_VIDEOCODECS', 'LCD_ICONCAT_AUDIOCODECS', diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 772cfc1..2e60419 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -452,6 +452,10 @@ def DisableOnPlayback(self, playingVideo, playingAudio): self.m_bDimmedOnPlayback = False def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): + # make sure output scaling indicators are off when not playing and/or not playing video + if not isplaying or not isvideo: + self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_OUTSCALE) + if isplaying: if isvideo: try: diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index 3d70658..0a849ca 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -328,6 +328,8 @@ def SetIconState(self, icon, state): def ClearIconStates(self, category): if category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_MODES: self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_TOPROW + + elif category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_OUTSCALE: self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_OUTSCALE elif category == LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_CODECS: From 621df128c9b0c93d75984dadecec04d211a64726 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 26 Dec 2012 15:48:22 +0100 Subject: [PATCH 140/337] [extra_*] fix: SetBar function call in Initialize() (how was this working with the additional underscore anyway before?) --- script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py | 2 +- script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py index 0a849ca..49618a3 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py @@ -150,7 +150,7 @@ def _SetIconStateDo(self, bitmask, state): def Initialize(self): for i in range(1, 5): - self._SetBar(i, float(0)) + self.SetBar(i, float(0)) def SetOutputIcons(self): ret = "" diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py index de6b936..25285d4 100644 --- a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py +++ b/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py @@ -98,7 +98,7 @@ def _SetIconStateDo(self, bitmask, state): def Initialize(self): for i in range(1, 5): - self._SetBar(i, float(0)) + self.SetBar(i, float(0)) def SetOutputIcons(self): ret = "" From a74991b73f6678c67c7a35eef691be2323ab40dc Mon Sep 17 00:00:00 2001 From: theonlychriss Date: Sun, 13 Jan 2013 13:23:15 +0100 Subject: [PATCH 141/337] Turning display off while playing PVR-TV/PVR-radio --- script.xbmc.lcd/lcdmain.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcd/lcdmain.py index 9596824..f32b610 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcd/lcdmain.py @@ -117,9 +117,9 @@ def process_lcd(): g_lcdproc.SetBackLight(1) bBacklightDimmed = False - if mode == LCD_MODE.LCD_MODE_MUSIC: + if mode == LCD_MODE.LCD_MODE_MUSIC or mode == LCD_MODE.LCD_MODE_PVRRADIO: g_lcdproc.DisableOnPlayback(False, True) - elif mode == LCD_MODE.LCD_MODE_VIDEO: + elif mode == LCD_MODE.LCD_MODE_VIDEO or mode == LCD_MODE.LCD_MODE_PVRTV: g_lcdproc.DisableOnPlayback(True, False) else: g_lcdproc.DisableOnPlayback(False, False) From ff63c6bb66495c620d62510d7efb21c940191c19 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 14 Jan 2013 22:44:29 +0100 Subject: [PATCH 142/337] light up icons for vc1-video and dtshd-hra, and treat "hdmv" (bluray) as mpg - read code comment on this! --- script.xbmc.lcd/resources/lib/lcdbase.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 2e60419..57a10ce 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -537,7 +537,13 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_strOldVideoCodec = strVideoCodec # any mpeg video - if strVideoCodec in ["mpg", "mpeg", "mpeg2video", "h264", "x264", "mpeg4"]: + # FIXME: "hdmv" is returned as video codec for ANYTHING played directly + # from bluray media played via libbluray and friends, regardless of the + # real codec (mpeg2/h264/vc1). Ripping to e.g. MKV and playing that back + # returns the correct codec id. As the display is wrong for VC-1 only, + # accept that the codec icon is right only in maybe 70-80% of all playback + # cases. This needs fixing in XBMC! + if strVideoCodec in ["mpg", "mpeg", "mpeg2video", "h264", "x264", "mpeg4", "hdmv"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_MPEG, True) # any divx @@ -548,8 +554,8 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): elif strVideoCodec == "xvid": self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_XVID, True) - # wmv - elif strVideoCodec == "wmv": + # wmv and vc-1 + elif strVideoCodec in ["wmv", "wvc1"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_WMV, True) # anything else @@ -569,8 +575,8 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): elif strAudioCodec in ["ac3", "truehd"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_AC3, True) - # any dts - elif strAudioCodec in ["dts", "dca", "dtshd_ma"]: + # any dts including hires variants + elif strAudioCodec in ["dts", "dca", "dtshd_hra", "dtshd_ma"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_DTS, True) # mp3 From dc932baf437a527c9626affe58f3d53ea90da50a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 20 Jan 2013 16:30:44 +0100 Subject: [PATCH 143/337] add trac ticket reference for hdmv "mistake" --- script.xbmc.lcd/resources/lib/lcdbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 57a10ce..41683ea 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -542,7 +542,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): # real codec (mpeg2/h264/vc1). Ripping to e.g. MKV and playing that back # returns the correct codec id. As the display is wrong for VC-1 only, # accept that the codec icon is right only in maybe 70-80% of all playback - # cases. This needs fixing in XBMC! + # cases. This needs fixing in XBMC! See http://trac.xbmc.org/ticket/13969 if strVideoCodec in ["mpg", "mpeg", "mpeg2video", "h264", "x264", "mpeg4", "hdmv"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_MPEG, True) From 9661e5ba270c4b0180d051431e2aa1f0cc638bd7 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 20 Jan 2013 16:43:33 +0100 Subject: [PATCH 144/337] additional id's for vc1 and pcm matching bluray codecs --- script.xbmc.lcd/resources/lib/lcdbase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 41683ea..716c7f4 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -555,7 +555,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_XVID, True) # wmv and vc-1 - elif strVideoCodec in ["wmv", "wvc1"]: + elif strVideoCodec in ["wmv", "wvc1", "vc-1"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_WMV, True) # anything else @@ -595,7 +595,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_AWMA, True) # any pcm, wav or flac - elif strAudioCodec in ["wav", "pcm", "flac"]: + elif strAudioCodec in ["wav", "pcm", "pcm_bluray", "flac"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_WAV, True) # anything else From 309f3d71f3d010018fd3fdfc9352792d054c7cdd Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 20 Jan 2013 17:11:08 +0100 Subject: [PATCH 145/337] start 1.3.0 --- script.xbmc.lcd/addon.xml | 2 +- script.xbmc.lcd/changelog.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/script.xbmc.lcd/addon.xml b/script.xbmc.lcd/addon.xml index 9f9dfca..88fe1db 100644 --- a/script.xbmc.lcd/addon.xml +++ b/script.xbmc.lcd/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/script.xbmc.lcd/changelog.txt b/script.xbmc.lcd/changelog.txt index 9b07ee1..5dc9e14 100644 --- a/script.xbmc.lcd/changelog.txt +++ b/script.xbmc.lcd/changelog.txt @@ -1,3 +1,4 @@ +1.3.0 1.2.0 - Support for extra stuff (icons, bars) on supporting displays - Extra stuff handling for SoundGraph iMON LCD and Futaba/Targa mdm166a VFD From fcf9f12f2c242e16a792da893bce1ad9f932af57 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 Jan 2013 20:55:36 +0100 Subject: [PATCH 146/337] treat 'pcm_s24le' as wav --- script.xbmc.lcd/resources/lib/lcdbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 716c7f4..8d0c3f3 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -595,7 +595,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_AWMA, True) # any pcm, wav or flac - elif strAudioCodec in ["wav", "pcm", "pcm_bluray", "flac"]: + elif strAudioCodec in ["wav", "flac", "pcm", "pcm_bluray", "pcm_s24le"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_WAV, True) # anything else From cdd59069057fc72fff612f8a42fd64b11e01d413 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 Jan 2013 22:10:11 +0100 Subject: [PATCH 147/337] provide LCD.xml in a similar way to CopyUserDataIfNeeded(), have default LCD skin in resources/LCD.xml.defaults --- script.xbmc.lcd/resources/LCD.xml.defaults | 52 ++++++++++++++++++++++ script.xbmc.lcd/resources/lib/lcdbase.py | 27 ++++++++++- 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 script.xbmc.lcd/resources/LCD.xml.defaults diff --git a/script.xbmc.lcd/resources/LCD.xml.defaults b/script.xbmc.lcd/resources/LCD.xml.defaults new file mode 100644 index 0000000..7d50cc5 --- /dev/null +++ b/script.xbmc.lcd/resources/LCD.xml.defaults @@ -0,0 +1,52 @@ + + + video + + $INFO[System.CurrentWindow] + $INFO[System.CurrentControl] + Freemem: $INFO[System.FreeMemory] + $INFO[System.ScreenWidth]x$INFO[System.ScreenHeight] $INFO[System.ScreenMode] + + + $INFO[LCD.PlayIcon] $INFO[Player.Time]/$INFO[Player.Duration] + $INFO[MusicPlayer.Title] + $INFO[MusicPlayer.Artist] + $INFO[MusicPlayer.Album] ($INFO[MusicPlayer.Year]) + + + + XBMC running... + $INFO[System.Time] $INFO[System.Date] + Freemem: $INFO[System.FreeMemory] + $INFO[System.ScreenWidth]x$INFO[System.ScreenHeight] $INFO[System.ScreenMode] + + + $INFO[System.CurrentWindow] + $INFO[LCD.TimeWide21] + $INFO[LCD.TimeWide22] + Freemem: $INFO[System.FreeMemory] + + + + Playing + $INFO[System.LaunchXBE] + + + $INFO[VideoPlayer.ChannelName] + $INFO[VideoPlayer.Title] + $INFO[LCD.PlayIcon] $INFO[Player.Time]/$INFO[Player.Duration] + $INFO[LCD.ProgressBar] + + + $INFO[MusicPlayer.ChannelName] + $INFO[MusicPlayer.Title] + $INFO[LCD.PlayIcon] $INFO[Player.Time]/$INFO[Player.Duration] + $INFO[LCD.ProgressBar] + + diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcd/resources/lib/lcdbase.py index 8d0c3f3..eb4b338 100644 --- a/script.xbmc.lcd/resources/lib/lcdbase.py +++ b/script.xbmc.lcd/resources/lib/lcdbase.py @@ -26,6 +26,7 @@ import xbmcgui import sys import os +import shutil import re import telnetlib import time @@ -38,6 +39,7 @@ __cwd__ = sys.modules[ "__main__" ].__cwd__ __icon__ = sys.modules[ "__main__" ].__icon__ __lcdxml__ = xbmc.translatePath( os.path.join("special://masterprofile","LCD.xml")) +__lcddefaultxml__ = xbmc.translatePath( os.path.join(__cwd__, "resources", "LCD.xml.defaults")) from extraicons import * from infolabels import * @@ -165,9 +167,32 @@ def SetPlayingStateIcon(self): def SetProgressBar(self, percent, lineIdx): pass + def ManageLCDXML(self): + ret = False + + if not os.path.isfile(__lcdxml__): + if not os.path.isfile(__lcddefaultxml__): + log(xbmc.LOGERROR, "No LCD.xml found and LCD.xml.defaults missing, expect problems!") + else: + try: + shutil.copy2(__lcddefaultxml__, __lcdxml__) + log(xbmc.LOGNOTICE, "Initialised LCD.xml from defaults") + ret = True + except: + log(xbmc.LOGERROR, "Failed to copy LCD defaults!") + else: + ret = True + + return ret + def Initialize(self): + strXMLFile = __lcdxml__ self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE - if not self.LoadSkin(__lcdxml__): + + if not self.ManageLCDXML(): + strXMLFile = __lcddefaultxml__ + + if not self.LoadSkin(strXMLFile): return False return True From c61f4b42fe7c5aa378c5047fe5f2b4b29546c0dd Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 Jan 2013 22:23:23 +0100 Subject: [PATCH 148/337] add LCD.xml handling to changelog --- script.xbmc.lcd/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/script.xbmc.lcd/changelog.txt b/script.xbmc.lcd/changelog.txt index 5dc9e14..c71797c 100644 --- a/script.xbmc.lcd/changelog.txt +++ b/script.xbmc.lcd/changelog.txt @@ -6,6 +6,7 @@ - Align each line either left (default), centered or right - Fixed connection problem popup annoyance - GUI settings cleanup and some more LCD.xml configurables +- Take care of providing a default LCD.xml in the master profile 1.1.0 - greatly improved client/server communication - native widgets for bars, icons and bignumbers From 5cab3f43a4d80a42f0a06687e56a1643b43ba2f0 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Feb 2013 12:15:20 +0100 Subject: [PATCH 149/337] Rename things to script.xbmc.lcdproc --- README | 2 +- .../LICENSE.txt | 0 {script.xbmc.lcd => script.xbmc.lcdproc}/addon.xml | 2 +- .../changelog.txt | 0 {script.xbmc.lcd => script.xbmc.lcdproc}/icon.png | Bin {script.xbmc.lcd => script.xbmc.lcdproc}/lcdmain.py | 2 +- .../resources/LCD.xml.defaults | 0 .../resources/language/English/strings.xml | 0 .../resources/language/German/strings.xml | 0 .../resources/lib/extraicons.py | 0 .../resources/lib/infolabels.py | 0 .../resources/lib/lcdbase.py | 0 .../resources/lib/lcdproc.py | 0 .../resources/lib/lcdproc_extra_base.py | 0 .../resources/lib/lcdproc_extra_imon.py | 0 .../resources/lib/lcdproc_extra_mdm166a.py | 0 .../resources/lib/settings.py | 0 .../resources/settings.xml | 0 18 files changed, 3 insertions(+), 3 deletions(-) rename {script.xbmc.lcd => script.xbmc.lcdproc}/LICENSE.txt (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/addon.xml (92%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/changelog.txt (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/icon.png (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/lcdmain.py (98%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/resources/LCD.xml.defaults (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/resources/language/English/strings.xml (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/resources/language/German/strings.xml (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/resources/lib/extraicons.py (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/resources/lib/infolabels.py (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/resources/lib/lcdbase.py (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/resources/lib/lcdproc.py (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/resources/lib/lcdproc_extra_base.py (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/resources/lib/lcdproc_extra_imon.py (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/resources/lib/lcdproc_extra_mdm166a.py (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/resources/lib/settings.py (100%) rename {script.xbmc.lcd => script.xbmc.lcdproc}/resources/settings.xml (100%) diff --git a/README b/README index cd2d752..f9dfe38 100644 --- a/README +++ b/README @@ -7,7 +7,7 @@ Based on initial work (C) 2012 Memphiz/Team XBMC LCDproc support for XBMC implemented in Python, direct drop-in replacement for the LCD support in XBMC core. -See https://github.com/herrnst/script.xbmc.lcd/wiki for details and usage +See https://github.com/herrnst/script.xbmc.lcdproc/wiki for details and usage information. This program is free software; you can redistribute it and/or modify diff --git a/script.xbmc.lcd/LICENSE.txt b/script.xbmc.lcdproc/LICENSE.txt similarity index 100% rename from script.xbmc.lcd/LICENSE.txt rename to script.xbmc.lcdproc/LICENSE.txt diff --git a/script.xbmc.lcd/addon.xml b/script.xbmc.lcdproc/addon.xml similarity index 92% rename from script.xbmc.lcd/addon.xml rename to script.xbmc.lcdproc/addon.xml index 88fe1db..c37b7da 100644 --- a/script.xbmc.lcd/addon.xml +++ b/script.xbmc.lcdproc/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/script.xbmc.lcd/changelog.txt b/script.xbmc.lcdproc/changelog.txt similarity index 100% rename from script.xbmc.lcd/changelog.txt rename to script.xbmc.lcdproc/changelog.txt diff --git a/script.xbmc.lcd/icon.png b/script.xbmc.lcdproc/icon.png similarity index 100% rename from script.xbmc.lcd/icon.png rename to script.xbmc.lcdproc/icon.png diff --git a/script.xbmc.lcd/lcdmain.py b/script.xbmc.lcdproc/lcdmain.py similarity index 98% rename from script.xbmc.lcd/lcdmain.py rename to script.xbmc.lcdproc/lcdmain.py index f32b610..2e85285 100644 --- a/script.xbmc.lcd/lcdmain.py +++ b/script.xbmc.lcdproc/lcdmain.py @@ -27,7 +27,7 @@ import time import os -__settings__ = xbmcaddon.Addon(id='script.xbmc.lcd') +__settings__ = xbmcaddon.Addon(id='script.xbmc.lcdproc') __cwd__ = __settings__.getAddonInfo('path') __icon__ = os.path.join(__cwd__,"icon.png") __scriptname__ = "XBMC LCDproc" diff --git a/script.xbmc.lcd/resources/LCD.xml.defaults b/script.xbmc.lcdproc/resources/LCD.xml.defaults similarity index 100% rename from script.xbmc.lcd/resources/LCD.xml.defaults rename to script.xbmc.lcdproc/resources/LCD.xml.defaults diff --git a/script.xbmc.lcd/resources/language/English/strings.xml b/script.xbmc.lcdproc/resources/language/English/strings.xml similarity index 100% rename from script.xbmc.lcd/resources/language/English/strings.xml rename to script.xbmc.lcdproc/resources/language/English/strings.xml diff --git a/script.xbmc.lcd/resources/language/German/strings.xml b/script.xbmc.lcdproc/resources/language/German/strings.xml similarity index 100% rename from script.xbmc.lcd/resources/language/German/strings.xml rename to script.xbmc.lcdproc/resources/language/German/strings.xml diff --git a/script.xbmc.lcd/resources/lib/extraicons.py b/script.xbmc.lcdproc/resources/lib/extraicons.py similarity index 100% rename from script.xbmc.lcd/resources/lib/extraicons.py rename to script.xbmc.lcdproc/resources/lib/extraicons.py diff --git a/script.xbmc.lcd/resources/lib/infolabels.py b/script.xbmc.lcdproc/resources/lib/infolabels.py similarity index 100% rename from script.xbmc.lcd/resources/lib/infolabels.py rename to script.xbmc.lcdproc/resources/lib/infolabels.py diff --git a/script.xbmc.lcd/resources/lib/lcdbase.py b/script.xbmc.lcdproc/resources/lib/lcdbase.py similarity index 100% rename from script.xbmc.lcd/resources/lib/lcdbase.py rename to script.xbmc.lcdproc/resources/lib/lcdbase.py diff --git a/script.xbmc.lcd/resources/lib/lcdproc.py b/script.xbmc.lcdproc/resources/lib/lcdproc.py similarity index 100% rename from script.xbmc.lcd/resources/lib/lcdproc.py rename to script.xbmc.lcdproc/resources/lib/lcdproc.py diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_base.py b/script.xbmc.lcdproc/resources/lib/lcdproc_extra_base.py similarity index 100% rename from script.xbmc.lcd/resources/lib/lcdproc_extra_base.py rename to script.xbmc.lcdproc/resources/lib/lcdproc_extra_base.py diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py b/script.xbmc.lcdproc/resources/lib/lcdproc_extra_imon.py similarity index 100% rename from script.xbmc.lcd/resources/lib/lcdproc_extra_imon.py rename to script.xbmc.lcdproc/resources/lib/lcdproc_extra_imon.py diff --git a/script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py b/script.xbmc.lcdproc/resources/lib/lcdproc_extra_mdm166a.py similarity index 100% rename from script.xbmc.lcd/resources/lib/lcdproc_extra_mdm166a.py rename to script.xbmc.lcdproc/resources/lib/lcdproc_extra_mdm166a.py diff --git a/script.xbmc.lcd/resources/lib/settings.py b/script.xbmc.lcdproc/resources/lib/settings.py similarity index 100% rename from script.xbmc.lcd/resources/lib/settings.py rename to script.xbmc.lcdproc/resources/lib/settings.py diff --git a/script.xbmc.lcd/resources/settings.xml b/script.xbmc.lcdproc/resources/settings.xml similarity index 100% rename from script.xbmc.lcd/resources/settings.xml rename to script.xbmc.lcdproc/resources/settings.xml From 62ef7e6a04929367521b8cee7fe1e9051a2286a6 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Feb 2013 15:14:10 +0100 Subject: [PATCH 150/337] move addon files to repo root, rename README to README.md --- script.xbmc.lcdproc/LICENSE.txt => LICENSE.txt | 0 README => README.md | 0 script.xbmc.lcdproc/addon.xml => addon.xml | 0 script.xbmc.lcdproc/changelog.txt => changelog.txt | 0 script.xbmc.lcdproc/icon.png => icon.png | Bin script.xbmc.lcdproc/lcdmain.py => lcdmain.py | 0 .../resources => resources}/LCD.xml.defaults | 0 .../language/English/strings.xml | 0 .../language/German/strings.xml | 0 .../resources => resources}/lib/extraicons.py | 0 .../resources => resources}/lib/infolabels.py | 0 .../resources => resources}/lib/lcdbase.py | 0 .../resources => resources}/lib/lcdproc.py | 0 .../lib/lcdproc_extra_base.py | 0 .../lib/lcdproc_extra_imon.py | 0 .../lib/lcdproc_extra_mdm166a.py | 0 .../resources => resources}/lib/settings.py | 0 .../resources => resources}/settings.xml | 0 18 files changed, 0 insertions(+), 0 deletions(-) rename script.xbmc.lcdproc/LICENSE.txt => LICENSE.txt (100%) rename README => README.md (100%) rename script.xbmc.lcdproc/addon.xml => addon.xml (100%) rename script.xbmc.lcdproc/changelog.txt => changelog.txt (100%) rename script.xbmc.lcdproc/icon.png => icon.png (100%) rename script.xbmc.lcdproc/lcdmain.py => lcdmain.py (100%) rename {script.xbmc.lcdproc/resources => resources}/LCD.xml.defaults (100%) rename {script.xbmc.lcdproc/resources => resources}/language/English/strings.xml (100%) rename {script.xbmc.lcdproc/resources => resources}/language/German/strings.xml (100%) rename {script.xbmc.lcdproc/resources => resources}/lib/extraicons.py (100%) rename {script.xbmc.lcdproc/resources => resources}/lib/infolabels.py (100%) rename {script.xbmc.lcdproc/resources => resources}/lib/lcdbase.py (100%) rename {script.xbmc.lcdproc/resources => resources}/lib/lcdproc.py (100%) rename {script.xbmc.lcdproc/resources => resources}/lib/lcdproc_extra_base.py (100%) rename {script.xbmc.lcdproc/resources => resources}/lib/lcdproc_extra_imon.py (100%) rename {script.xbmc.lcdproc/resources => resources}/lib/lcdproc_extra_mdm166a.py (100%) rename {script.xbmc.lcdproc/resources => resources}/lib/settings.py (100%) rename {script.xbmc.lcdproc/resources => resources}/settings.xml (100%) diff --git a/script.xbmc.lcdproc/LICENSE.txt b/LICENSE.txt similarity index 100% rename from script.xbmc.lcdproc/LICENSE.txt rename to LICENSE.txt diff --git a/README b/README.md similarity index 100% rename from README rename to README.md diff --git a/script.xbmc.lcdproc/addon.xml b/addon.xml similarity index 100% rename from script.xbmc.lcdproc/addon.xml rename to addon.xml diff --git a/script.xbmc.lcdproc/changelog.txt b/changelog.txt similarity index 100% rename from script.xbmc.lcdproc/changelog.txt rename to changelog.txt diff --git a/script.xbmc.lcdproc/icon.png b/icon.png similarity index 100% rename from script.xbmc.lcdproc/icon.png rename to icon.png diff --git a/script.xbmc.lcdproc/lcdmain.py b/lcdmain.py similarity index 100% rename from script.xbmc.lcdproc/lcdmain.py rename to lcdmain.py diff --git a/script.xbmc.lcdproc/resources/LCD.xml.defaults b/resources/LCD.xml.defaults similarity index 100% rename from script.xbmc.lcdproc/resources/LCD.xml.defaults rename to resources/LCD.xml.defaults diff --git a/script.xbmc.lcdproc/resources/language/English/strings.xml b/resources/language/English/strings.xml similarity index 100% rename from script.xbmc.lcdproc/resources/language/English/strings.xml rename to resources/language/English/strings.xml diff --git a/script.xbmc.lcdproc/resources/language/German/strings.xml b/resources/language/German/strings.xml similarity index 100% rename from script.xbmc.lcdproc/resources/language/German/strings.xml rename to resources/language/German/strings.xml diff --git a/script.xbmc.lcdproc/resources/lib/extraicons.py b/resources/lib/extraicons.py similarity index 100% rename from script.xbmc.lcdproc/resources/lib/extraicons.py rename to resources/lib/extraicons.py diff --git a/script.xbmc.lcdproc/resources/lib/infolabels.py b/resources/lib/infolabels.py similarity index 100% rename from script.xbmc.lcdproc/resources/lib/infolabels.py rename to resources/lib/infolabels.py diff --git a/script.xbmc.lcdproc/resources/lib/lcdbase.py b/resources/lib/lcdbase.py similarity index 100% rename from script.xbmc.lcdproc/resources/lib/lcdbase.py rename to resources/lib/lcdbase.py diff --git a/script.xbmc.lcdproc/resources/lib/lcdproc.py b/resources/lib/lcdproc.py similarity index 100% rename from script.xbmc.lcdproc/resources/lib/lcdproc.py rename to resources/lib/lcdproc.py diff --git a/script.xbmc.lcdproc/resources/lib/lcdproc_extra_base.py b/resources/lib/lcdproc_extra_base.py similarity index 100% rename from script.xbmc.lcdproc/resources/lib/lcdproc_extra_base.py rename to resources/lib/lcdproc_extra_base.py diff --git a/script.xbmc.lcdproc/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py similarity index 100% rename from script.xbmc.lcdproc/resources/lib/lcdproc_extra_imon.py rename to resources/lib/lcdproc_extra_imon.py diff --git a/script.xbmc.lcdproc/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py similarity index 100% rename from script.xbmc.lcdproc/resources/lib/lcdproc_extra_mdm166a.py rename to resources/lib/lcdproc_extra_mdm166a.py diff --git a/script.xbmc.lcdproc/resources/lib/settings.py b/resources/lib/settings.py similarity index 100% rename from script.xbmc.lcdproc/resources/lib/settings.py rename to resources/lib/settings.py diff --git a/script.xbmc.lcdproc/resources/settings.xml b/resources/settings.xml similarity index 100% rename from script.xbmc.lcdproc/resources/settings.xml rename to resources/settings.xml From 6068fdec6ff86bc61ee8384a835122957852016c Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Feb 2013 15:34:12 +0100 Subject: [PATCH 151/337] add full depends and license-tag, bump version for eden/frodo compat --- addon.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addon.xml b/addon.xml index c37b7da..97e588e 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,9 @@ - + - + + + @@ -11,6 +13,7 @@ Zeigt konfigurierbare Informationen z.B. über aktuelle Wiedergabe oder XBMC Stati auf beliebigen von LCDproc angesteuerten LC/VF-Displays, ersetzt die zuvor im XBMC-Kern enthaltene LCD/VFD-Funktion. Unterstützt zusätzliche Elemente (Icons, Balken) von SoundGraph iMON LCD und Targa/Futaba mdm166a VFD Hardware. Benötigt einen konfigurierten, laufenden LCDd auf dem lokalen System oder im Netzwerk. Works with LCDproc only. Other LCD services like LCD4Linux or iMON Manager on Win32 are not supported. No liability taken for damaged hardware and/or software caused by this addon. Funktioniert ausschliesslich mit LCDproc. Andere LCD-Dienste wie LCD4Linux, iMON Manager unter Win32 u.a. sind nicht unterstützt. Keine Haftung für durch dieses Addon beschädigte Hard-/Software. + GNU GENERAL PUBLIC LICENSE. Version 2, June 1991 all From 3400b56d9cb2a9387bde96ac9f669ed54f2128de Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Feb 2013 15:41:50 +0100 Subject: [PATCH 152/337] changelog: Eden and Frodo versions --- changelog.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index c71797c..a3e9b15 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,6 @@ -1.3.0 -1.2.0 +1.3.0 / 2.3.0 +1.2.0 / 2.2.0 +- Maintain versions for Eden (1.x.x) and Frodo+ (2.x.x) - Support for extra stuff (icons, bars) on supporting displays - Extra stuff handling for SoundGraph iMON LCD and Futaba/Targa mdm166a VFD devices (presence will be autodetected) From bb3711917931e9dbf839cb9c91c198f12e404547 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Feb 2013 17:04:57 +0100 Subject: [PATCH 153/337] reduce while loops in main to one and fix a possible CPU hog when LCDd is missing (thanks Martijn!), update comments --- lcdmain.py | 16 +++++++++++----- resources/lib/settings.py | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lcdmain.py b/lcdmain.py index 2e85285..c5d5618 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -131,7 +131,8 @@ def process_lcd(): def handleConnectLCD(): ret = True - while not xbmc.abortRequested: + # make sure not to block things when shutdown is requested + if not xbmc.abortRequested: #check for new settings if settings_checkForNewSettings() or not g_lcdproc.IsConnected(): #networksettings changed? g_failedConnectionNotified = False #reset notification flag @@ -144,10 +145,15 @@ def handleConnectLCD(): return ret +######################################### + #MAIN - entry point + +# init vars and classes initGlobals() -#main loop -while not xbmc.abortRequested: - settings_setup() - process_lcd() #lcd loop +# initialise and load GUI settings +settings_setup() + +# do LCD processing loop (needs to catch xbmc.abortRequested !) +process_lcd() diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 883f2ff..07a9da2 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -234,7 +234,7 @@ def settings_handleLcdSettings(): g_hideconnpopups = hideconnpopups g_settingsChanged = True -#handles all settings of boblight and applies them as needed +#handles all settings and applies them as needed #returns if a reconnect is needed due to settings changes def settings_setup(): reconnect = False From 3db2d271820f20a6aa68cd273962127d30a4f7d7 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Feb 2013 17:50:35 +0100 Subject: [PATCH 154/337] make string IDs conform to standards --- lcdmain.py | 4 +-- resources/language/English/strings.xml | 39 +++++++++++++------------- resources/language/German/strings.xml | 39 +++++++++++++------------- resources/lib/lcdbase.py | 2 +- resources/settings.xml | 28 +++++++++--------- 5 files changed, 55 insertions(+), 57 deletions(-) diff --git a/lcdmain.py b/lcdmain.py index c5d5618..fbb19f9 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -64,10 +64,10 @@ def HandleConnectionNotification(bConnectSuccess): if not g_failedConnectionNotified: g_failedConnectionNotified = True g_initialConnectAttempt = False - text = __settings__.getLocalizedString(500) + text = __settings__.getLocalizedString(32500) xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) else: - text = __settings__.getLocalizedString(501) + text = __settings__.getLocalizedString(32501) if not g_initialConnectAttempt: xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) g_failedConnectionNotified = True diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 206454e..ac2b658 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -2,33 +2,32 @@ - Behaviour - Delay for scrolling text - Scroll mode - Navigation display duration (s) - Display refresh rate (Hz) + Behaviour + Delay for scrolling text + Scroll mode + Navigation display duration (s) + Display refresh rate (Hz) - Backlight - Dim backlight on screensaver - Dim backlight on shutdown + Backlight + Dim backlight on screensaver + Dim backlight on shutdown - Connection - Use remote LCDProc - LCDd IP - LCDd port - Show heartbeat symbol - Hide connection error notifications + Connection + Use remote LCDProc + LCDd IP + LCDd port + Show heartbeat symbol + Hide connection error notifications - Marquee - Left/Right + Marquee + Left/Right - Failed to connect to LCDProc! - Connected to LCDProc! - Settings changed! - Warning! Errors in LCD.xml or LCD.xml not found! + Failed to connect to LCDProc! + Connected to LCDProc! + Warning! Errors in LCD.xml or LCD.xml not found! diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml index 858f208..a589205 100644 --- a/resources/language/German/strings.xml +++ b/resources/language/German/strings.xml @@ -2,33 +2,32 @@ - Verhalten - Geschwindigkeit für gescrollten Text - Scroll-Modus - Anzeigedauer der Navigationsansicht (s) - Display-Aktualisierungsrate (Hz) + Verhalten + Geschwindigkeit für gescrollten Text + Scroll-Modus + Anzeigedauer der Navigationsansicht (s) + Display-Aktualisierungsrate (Hz) - Beleuchtung - Hintergrundbeleuchtung ausschalten, wenn Bildschirmschoner aktiv - Hintergrundbeleuchtung beim Herunterfahren ausschalten + Beleuchtung + Hintergrundbeleuchtung ausschalten, wenn Bildschirmschoner aktiv + Hintergrundbeleuchtung beim Herunterfahren ausschalten - Verbindung - Entfernten LCDproc-Server benutzen - LCDd IP - LCDd Port - Heartbeatsymbol anzeigen - Verbindungsfehler-Benachrichtigung verstecken + Verbindung + Entfernten LCDproc-Server benutzen + LCDd IP + LCDd Port + Heartbeatsymbol anzeigen + Verbindungsfehler-Benachrichtigung verstecken - Durchlaufend - Links/Rechts + Durchlaufend + Links/Rechts - Fehler beim Verbinden zu LCDproc! - Verbunden mit LCDproc! - Einstellungen geändert! - Warnung! Fehlerhafte LCD.xml oder LCD.xml nicht gefunden! + Fehler beim Verbinden zu LCDproc! + Verbunden mit LCDproc! + Warnung! Fehlerhafte LCD.xml oder LCD.xml nicht gefunden! diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index eb4b338..ae8b25c 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -206,7 +206,7 @@ def LoadSkin(self, xmlFile): except: if not self.m_bXMLWarningDisplayed: self.m_bXMLWarningDisplayed = True - text = __settings__.getLocalizedString(503) + text = __settings__.getLocalizedString(32502) xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,5000,__icon__)) log(xbmc.LOGERROR, "Parsing of %s failed" % (xmlFile)) diff --git a/resources/settings.xml b/resources/settings.xml index f42c487..3e3822b 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -1,22 +1,22 @@ - - - - - + + + + + - - - + + + - - - - + + + + - + - + From afa9e863a6dcd684ab43adda43b50b0fa61b8a5f Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Feb 2013 18:24:33 +0100 Subject: [PATCH 155/337] mark LCDd ip and port as subsetting to emphasize the dependency of the "use remote LCDproc server" option --- resources/settings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/settings.xml b/resources/settings.xml index 3e3822b..3a4e1a4 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -12,8 +12,8 @@ - - + + From 0fc46db7c8eab097da156e08a80f7e346f46b95a Mon Sep 17 00:00:00 2001 From: petrovse Date: Sun, 10 Feb 2013 16:19:13 +0300 Subject: [PATCH 156/337] Lcdproc telnet server doesn't support telnet command IAC. This leads to an incorrect display of character with code 255. To correctly display needs to use the raw socket instead telnet. --- resources/lib/lcdproc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 384cec5..cf69f9c 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -91,7 +91,9 @@ def SendCommand(self, strCmd, bCheckRet): try: # Send to server - self.tn.write(sendcmd) + sock = self.tn.get_socket() + if sock is not None: + sock.send(sendcmd) except: # Something bad happened, abort log(xbmc.LOGERROR, "SendCommand: Telnet exception - send") From 02b2eafdcce3342c9c3e8d3c04abb30380df7b8f Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 10 Feb 2013 19:27:37 +0100 Subject: [PATCH 157/337] handle socket object as class member to safe cycles in SendCommand() --- resources/lib/lcdproc.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index cf69f9c..da02cf7 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -60,6 +60,7 @@ def __init__(self): self.m_initRetryInterval = INIT_RETRY_INTERVAL self.m_used = True self.tn = telnetlib.Telnet() + self.tnsocket = None self.m_timeLastSockAction = time.time() self.m_timeSocketIdleTimeout = 2 self.m_strLineText = [None]*MAX_ROWS @@ -90,10 +91,9 @@ def SendCommand(self, strCmd, bCheckRet): sendcmd += "\n" try: - # Send to server - sock = self.tn.get_socket() - if sock is not None: - sock.send(sendcmd) + # Send to server via raw socket to prevent telnetlib tampering with + # certain chars (especially 0xFF -> telnet IAC) + self.tnsocket.send(sendcmd) except: # Something bad happened, abort log(xbmc.LOGERROR, "SendCommand: Telnet exception - send") @@ -213,6 +213,7 @@ def Initialize(self): self.m_initRetryInterval = INIT_RETRY_INTERVAL self.m_bStop = False connected = True + else: log(xbmc.LOGERROR, "Connection successful but LCD.xml has errors, aborting connect") @@ -309,6 +310,12 @@ def Connect(self): log(xbmc.LOGERROR,"Connect: Caught exception, aborting.") return False + # retrieve raw socket object + self.tnsocket = self.tn.get_socket() + if self.tnsocket is None: + log(xbmc.LOGERROR, "Retrieval of socket object failed!") + return False + if not self.SetupScreen(): log(xbmc.LOGERROR, "Screen setup failed!") return False @@ -327,6 +334,7 @@ def CloseSocket(self): # exception caught on this, so what? :) pass + self.tnsocket = None del self.tn self.tn = telnetlib.Telnet() From d3bd6b29e1698b24e948d0b6187dd87016245ec7 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 10 Feb 2013 19:35:39 +0100 Subject: [PATCH 158/337] remove an unneeded socket check and commented out code --- resources/lib/lcdproc.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index da02cf7..021a4e0 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -339,9 +339,6 @@ def CloseSocket(self): self.tn = telnetlib.Telnet() def IsConnected(self): - if self.tn.get_socket() == None: - return False - # Ping only every SocketIdleTimeout seconds if (self.m_timeLastSockAction + self.m_timeSocketIdleTimeout) > time.time(): return True @@ -359,10 +356,8 @@ def SetBackLight(self, iLight): # Build command if iLight == 0: - #self.m_bStop = True cmd = "screen_set xbmc -backlight off\n" elif iLight > 0: - #self.m_bStop = False cmd = "screen_set xbmc -backlight on\n" # Send to server From 3e2046df60caef246564ff2152427dfe8ecd5609 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 10 Feb 2013 19:43:30 +0100 Subject: [PATCH 159/337] partially revert d3bd6b2 causing exceptions on init/connect --- resources/lib/lcdproc.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 021a4e0..a5c09e5 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -339,6 +339,9 @@ def CloseSocket(self): self.tn = telnetlib.Telnet() def IsConnected(self): + if self.tn.get_socket() == None: + return False + # Ping only every SocketIdleTimeout seconds if (self.m_timeLastSockAction + self.m_timeSocketIdleTimeout) > time.time(): return True From 9f3253418958a12e8f349a8e41cec09983a95d35 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 10 Feb 2013 20:18:35 +0100 Subject: [PATCH 160/337] fix: do correct counting in SetExtraInfoBars() so all bars actually get updated --- resources/lib/lcdbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index ae8b25c..032e1a2 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -701,7 +701,7 @@ def SetExtraInfoGeneric(self, ispaused): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ALARM, False) def SetExtraInfoBars(self, isplaying): - for i in range(1, LCD_EXTRABARS_MAX): + for i in range(1, LCD_EXTRABARS_MAX + 1): if self.m_extraBars[i] == "progress": if isplaying: self.m_cExtraIcons.SetBar(i, (InfoLabel_GetProgressPercent() * 100)) From 32a42c532fc50d9ee81c8308f5e07dc1073bc81a Mon Sep 17 00:00:00 2001 From: Vanek <9175@mail.ru> Date: Mon, 31 Dec 2012 19:45:39 +0400 Subject: [PATCH 161/337] Native imon codepage added --- resources/language/English/strings.xml | 1 + resources/language/German/strings.xml | 1 + resources/lib/lcdbase.py | 4 - resources/lib/lcdproc.py | 17 +- resources/lib/settings.py | 15 +- resources/settings.xml | 1 + .../resources/lib/lcd_codepages.py | 625 ++++++++++++++++++ 7 files changed, 657 insertions(+), 7 deletions(-) create mode 100644 script.xbmc.lcd/resources/lib/lcd_codepages.py diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index ac2b658..45b1509 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -7,6 +7,7 @@ Scroll mode Navigation display duration (s) Display refresh rate (Hz) + Use native codepages (only for imon-like displays for now) Backlight diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml index a589205..2cd98b6 100644 --- a/resources/language/German/strings.xml +++ b/resources/language/German/strings.xml @@ -7,6 +7,7 @@ Scroll-Modus Anzeigedauer der Navigationsansicht (s) Display-Aktualisierungsrate (Hz) + Native codepages (für imon) Beleuchtung diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 032e1a2..a00bcf0 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -91,8 +91,6 @@ def __init__(self): self.m_extraBars = [None] * (LCD_EXTRABARS_MAX + 1) self.m_bDimmedOnPlayback = False self.m_iDimOnPlayDelay = 0 - self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 - self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! self.m_strScrollSeparator = " " self.m_bProgressbarSurroundings = False self.m_iIconTextOffset = 2 @@ -435,8 +433,6 @@ def Render(self, mode, bForce): self.SetPlayingStateIcon() line = InfoLabel_GetInfoLabel(self.m_lcdMode[mode][inLine]['text']) - if self.m_strInfoLabelEncoding != self.m_strLCDEncoding: - line = line.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") self.SetProgressBar(0, -1) if self.m_bAllowEmptyLines or len(line) > 0: diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index a5c09e5..38cd54f 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -44,6 +44,7 @@ from lcdproc_extra_mdm166a import * from infolabels import * +from lcd_codepages import * def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) @@ -74,6 +75,8 @@ def __init__(self): self.m_strSetLineCmds = "" self.m_cExtraIcons = None self.m_vPythonVersion = sys.version_info + self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 + self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants anything but utf-8. if self.m_vPythonVersion < (2, 7): log(xbmc.LOGWARNING, "Python < 2.7 detected. Upgrade your Python for optimal results.") @@ -234,6 +237,7 @@ def Initialize(self): def DetermineExtraSupport(self): rematch_imon = "SoundGraph iMON(.*)LCD" rematch_mdm166a = "Targa(.*)mdm166a" + rematch_imonvfd = "Soundgraph(.*)VFD" # Never cause script failure/interruption by this! This is totally optional! try: @@ -252,12 +256,21 @@ def DetermineExtraSupport(self): log(xbmc.LOGNOTICE, "SoundGraph iMON LCD detected") self.m_cExtraIcons = LCDproc_extra_imon() self.m_cExtraIcons.Initialize() + if settings_getNativecodepage(): + codecs.register(searchcp) + self.m_strLCDEncoding = 'imon' elif re.match(rematch_mdm166a, reply): log(xbmc.LOGNOTICE, "Futaba/Targa USB mdm166a VFD detected") self.m_cExtraIcons = LCDproc_extra_mdm166a() self.m_cExtraIcons.Initialize() + elif re.match(rematch_imonvfd, reply): + log(xbmc.LOGNOTICE, "SoundGraph iMON IR/VFD detected") + if settings_getNativecodepage(): + codecs.register(searchcp) + self.m_strLCDEncoding = 'imon' + except: pass @@ -491,7 +504,7 @@ def ClearLine(self, iLine): self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (iLine) self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (iLine) self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"\"\n" % (iLine, iLine, self.m_iColumns, iLine) - + def SetLine(self, iLine, strLine, dictDescriptor, bForce): if self.m_bStop or self.tn.get_socket() == None: return @@ -520,7 +533,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: strLineLong = self.GetBigDigitTime() else: - strLineLong = strLine + strLineLong = strLine.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") strLineLong.strip() diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 07a9da2..4639611 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -39,6 +39,7 @@ global g_heartbeat global g_scrolldelay global g_scrollmode +global g_nativecodepage global g_settingsChanged global g_dimonscreensaver global g_dimonshutdown @@ -54,6 +55,7 @@ def settings_initGlobals(): global g_heartbeat global g_scrolldelay global g_scrollmode + global g_nativecodepage global g_settingsChanged global g_dimonscreensaver global g_dimonshutdown @@ -67,6 +69,7 @@ def settings_initGlobals(): g_heartbeat = False g_scrolldelay = 1 g_scrollmode = "0" + g_nativecodepage = False g_settigsChanged = True g_dimonscreensaver = False g_dimonshutdown = False @@ -94,6 +97,10 @@ def settings_getScrollMode(): global g_scrollmode return g_scrollmode +def settings_getNativecodepage(): + global g_nativecodepage + return g_nativecodepage + def settings_getLCDprocScrollMode(): global g_scrollmode if g_scrollmode == "1": @@ -184,6 +191,7 @@ def settings_handleNetworkSettings(): def settings_handleLcdSettings(): global g_scrolldelay global g_scrollmode + global g_nativecodepage global g_heartbeat global g_settingsChanged global g_dimonscreensaver @@ -196,6 +204,7 @@ def settings_handleLcdSettings(): scrolldelay = int(float(string.replace(__settings__.getSetting("scrolldelay"), ",", "."))) scrollmode = __settings__.getSetting("scrollmode") + nativecodepage = __settings__.getSetting("nativecodepage") == "true" dimonscreensaver = __settings__.getSetting("dimonscreensaver") == "true" dimonshutdown = __settings__.getSetting("dimonshutdown") == "true" navtimeout = int(float(string.replace(__settings__.getSetting("navtimeout"), ",", "."))) @@ -210,6 +219,10 @@ def settings_handleLcdSettings(): g_scrollmode = scrollmode g_settingsChanged = True + if g_nativecodepage != nativecodepage: + g_nativecodepage = nativecodepage + g_settingsChanged = True + if g_dimonscreensaver != dimonscreensaver: g_dimonscreensaver = dimonscreensaver g_settingsChanged = True @@ -242,4 +255,4 @@ def settings_setup(): settings_handleLcdSettings() return reconnect - \ No newline at end of file + diff --git a/resources/settings.xml b/resources/settings.xml index 3a4e1a4..9f47959 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -5,6 +5,7 @@ + diff --git a/script.xbmc.lcd/resources/lib/lcd_codepages.py b/script.xbmc.lcd/resources/lib/lcd_codepages.py new file mode 100644 index 0000000..7f37bb3 --- /dev/null +++ b/script.xbmc.lcd/resources/lib/lcd_codepages.py @@ -0,0 +1,625 @@ +''' + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +import codecs + +imon_decoding_table = ( + u'\x00' # 0x00 -> NULL + u'\x01' # 0x01 -> START OF HEADING + u'\x02' # 0x02 -> START OF TEXT + u'\x03' # 0x03 -> END OF TEXT + u'\x04' # 0x04 -> END OF TRANSMISSION + u'\x05' # 0x05 -> ENQUIRY + u'\x06' # 0x06 -> ACKNOWLEDGE + u'\x07' # 0x07 -> BELL + u'\x08' # 0x08 -> BACKSPACE + u'\t' # 0x09 -> HORIZONTAL TABULATION + u'\n' # 0x0A -> LINE FEED + u'\x0b' # 0x0B -> VERTICAL TABULATION + u'\x0c' # 0x0C -> FORM FEED + u'\r' # 0x0D -> CARRIAGE RETURN + u'\x0e' # 0x0E -> SHIFT OUT + u'\x0f' # 0x0F -> SHIFT IN + u'\u25b6' # 0x10 -> BLACK RIGHT-POINTING TRIANGLE + u'\u25c0' # 0x11 -> BLACK LEFT-POINTING TRIANGLE + u'\u201C' # 0x12 -> LEFT DOUBLE QUOTATION MARK + u'\u201D' # 0x13 -> RIGHT DOUBLE QUOTATION MARK + u'\u23eb' # 0x14 -> BLACK UP-POINTING DOUBLE TRIANGLE + u'\u23ec' # 0x15 -> BLACK DOWN-POINTING DOUBLE TRIANGLE + u'\u2b24' # 0x16 -> BLACK LARGE CIRCLE + u'\u21b2' # 0x17 -> DOWNWARDS ARROW WITH TIP LEFTWARDS + u'\u2191' # 0x18 -> UPWARDS ARROW + u'\u2193' # 0x19 -> DOWNWARDS ARROW + u'\u2192' # 0x1A -> RIGHTWARDS ARROW + u'\u2190' # 0x1B -> LEFTWARDS ARROW + u'\u2264' # 0x1C -> LESS-THAN OR EQUAL TO + u'\u2265' # 0x1D -> GREATER-THAN OR EQUAL TO + u'\u25b2' # 0x1E -> BLACK UP-POINTING TRIANGLE + u'\u25bc' # 0x1F -> BLACK DOWN-POINTING TRIANGLE + u' ' # 0x20 -> SPACE + u'!' # 0x21 -> EXCLAMATION MARK + u'"' # 0x22 -> QUOTATION MARK + u'#' # 0x23 -> NUMBER SIGN + u'$' # 0x24 -> DOLLAR SIGN + u'%' # 0x25 -> PERCENT SIGN + u'&' # 0x26 -> AMPERSAND + u"'" # 0x27 -> APOSTROPHE + u'(' # 0x28 -> LEFT PARENTHESIS + u')' # 0x29 -> RIGHT PARENTHESIS + u'*' # 0x2A -> ASTERISK + u'+' # 0x2B -> PLUS SIGN + u',' # 0x2C -> COMMA + u'-' # 0x2D -> HYPHEN-MINUS + u'.' # 0x2E -> FULL STOP + u'/' # 0x2F -> SOLIDUS + u'0' # 0x30 -> DIGIT ZERO + u'1' # 0x31 -> DIGIT ONE + u'2' # 0x32 -> DIGIT TWO + u'3' # 0x33 -> DIGIT THREE + u'4' # 0x34 -> DIGIT FOUR + u'5' # 0x35 -> DIGIT FIVE + u'6' # 0x36 -> DIGIT SIX + u'7' # 0x37 -> DIGIT SEVEN + u'8' # 0x38 -> DIGIT EIGHT + u'9' # 0x39 -> DIGIT NINE + u':' # 0x3A -> COLON + u';' # 0x3B -> SEMICOLON + u'<' # 0x3C -> LESS-THAN SIGN + u'=' # 0x3D -> EQUALS SIGN + u'>' # 0x3E -> GREATER-THAN SIGN + u'?' # 0x3F -> QUESTION MARK + u'@' # 0x40 -> COMMERCIAL AT + u'A' # 0x41 -> LATIN CAPITAL LETTER A + u'B' # 0x42 -> LATIN CAPITAL LETTER B + u'C' # 0x43 -> LATIN CAPITAL LETTER C + u'D' # 0x44 -> LATIN CAPITAL LETTER D + u'E' # 0x45 -> LATIN CAPITAL LETTER E + u'F' # 0x46 -> LATIN CAPITAL LETTER F + u'G' # 0x47 -> LATIN CAPITAL LETTER G + u'H' # 0x48 -> LATIN CAPITAL LETTER H + u'I' # 0x49 -> LATIN CAPITAL LETTER I + u'J' # 0x4A -> LATIN CAPITAL LETTER J + u'K' # 0x4B -> LATIN CAPITAL LETTER K + u'L' # 0x4C -> LATIN CAPITAL LETTER L + u'M' # 0x4D -> LATIN CAPITAL LETTER M + u'N' # 0x4E -> LATIN CAPITAL LETTER N + u'O' # 0x4F -> LATIN CAPITAL LETTER O + u'P' # 0x50 -> LATIN CAPITAL LETTER P + u'Q' # 0x51 -> LATIN CAPITAL LETTER Q + u'R' # 0x52 -> LATIN CAPITAL LETTER R + u'S' # 0x53 -> LATIN CAPITAL LETTER S + u'T' # 0x54 -> LATIN CAPITAL LETTER T + u'U' # 0x55 -> LATIN CAPITAL LETTER U + u'V' # 0x56 -> LATIN CAPITAL LETTER V + u'W' # 0x57 -> LATIN CAPITAL LETTER W + u'X' # 0x58 -> LATIN CAPITAL LETTER X + u'Y' # 0x59 -> LATIN CAPITAL LETTER Y + u'Z' # 0x5A -> LATIN CAPITAL LETTER Z + u'[' # 0x5B -> LEFT SQUARE BRACKET + u'\\' # 0x5C -> REVERSE SOLIDUS + u']' # 0x5D -> RIGHT SQUARE BRACKET + u'^' # 0x5E -> CIRCUMFLEX ACCENT + u'_' # 0x5F -> LOW LINE + u'`' # 0x60 -> GRAVE ACCENT + u'a' # 0x61 -> LATIN SMALL LETTER A + u'b' # 0x62 -> LATIN SMALL LETTER B + u'c' # 0x63 -> LATIN SMALL LETTER C + u'd' # 0x64 -> LATIN SMALL LETTER D + u'e' # 0x65 -> LATIN SMALL LETTER E + u'f' # 0x66 -> LATIN SMALL LETTER F + u'g' # 0x67 -> LATIN SMALL LETTER G + u'h' # 0x68 -> LATIN SMALL LETTER H + u'i' # 0x69 -> LATIN SMALL LETTER I + u'j' # 0x6A -> LATIN SMALL LETTER J + u'k' # 0x6B -> LATIN SMALL LETTER K + u'l' # 0x6C -> LATIN SMALL LETTER L + u'm' # 0x6D -> LATIN SMALL LETTER M + u'n' # 0x6E -> LATIN SMALL LETTER N + u'o' # 0x6F -> LATIN SMALL LETTER O + u'p' # 0x70 -> LATIN SMALL LETTER P + u'q' # 0x71 -> LATIN SMALL LETTER Q + u'r' # 0x72 -> LATIN SMALL LETTER R + u's' # 0x73 -> LATIN SMALL LETTER S + u't' # 0x74 -> LATIN SMALL LETTER T + u'u' # 0x75 -> LATIN SMALL LETTER U + u'v' # 0x76 -> LATIN SMALL LETTER V + u'w' # 0x77 -> LATIN SMALL LETTER W + u'x' # 0x78 -> LATIN SMALL LETTER X + u'y' # 0x79 -> LATIN SMALL LETTER Y + u'z' # 0x7A -> LATIN SMALL LETTER Z + u'{' # 0x7B -> LEFT CURLY BRACKET + u'|' # 0x7C -> VERTICAL LINE + u'}' # 0x7D -> RIGHT CURLY BRACKET + u'~' # 0x7E -> TILDE + u'\x7f' # 0x7F -> DELETE + u'\u0411' # 0x80 -> CYRILLIC CAPITAL LETTER BE + u'\u0414' # 0x81 -> CYRILLIC CAPITAL LETTER DE + u'\u0417' # 0x82 -> CYRILLIC CAPITAL LETTER GJE + u'\u0453' # 0x83 -> CYRILLIC CAPITAL LETTER ZE + u'\u0418' # 0x84 -> CYRILLIC CAPITAL LETTER I + u'\u0419' # 0x85 -> CYRILLIC CAPITAL LETTER SHORT I + u'\u041b' # 0x86 -> CYRILLIC CAPITAL LETTER EL + u'\u041f' # 0x87 -> CYRILLIC CAPITAL LETTER PE + u'\u0423' # 0x88 -> CYRILLIC CAPITAL LETTER U + u'\u0426' # 0x89 -> CYRILLIC CAPITAL LETTER TSE + u'\u0427' # 0x8A -> CYRILLIC CAPITAL LETTER CHE + u'\u0428' # 0x8B -> CYRILLIC CAPITAL LETTER SHA + u'\u0429' # 0x8C -> CYRILLIC CAPITAL LETTER SHCHA + u'\u042A' # 0x8D -> CYRILLIC CAPITAL LETTER HARD SIGN + u'\u042B' # 0x8E -> CYRILLIC CAPITAL LETTER YERU + u'\u042d' # 0x8F -> CYRILLIC CAPITAL LETTER E + u'\u03b1' # 0x90 -> GREEK SMALL LETTER ALPHA + u'\u266a' # 0x91 -> EIGHTH NOTE + u'\u0413' # 0x92 -> CYRILLIC CAPITAL LETTER GHE + u'\u03c0' # 0x93 -> GREEK SMALL LETTER PI + u'\u03a3' # 0x94 -> GREEK CAPITAL LETTER SIGMA + u'\u03c3' # 0x95 -> GREEK SMALL LETTER SIGMA + u'\u266c' # 0x96 -> BEAMED SIXTEENTH NOTES + u'\u03c4' # 0x97 -> GREEK SMALL LETTER TAU + u'\uf0f3' # 0x98 -> BELL ICON (not sure) + u'\u0398' # 0x99 -> GREEK CAPITAL LETTER THETA + u'\u03a9' # 0x9A -> GREEK CAPITAL LETTER OMEGA + u'\u03b4' # 0x9B -> GREEK SMALL LETTER DELTA + u'\u221e' # 0x9C -> INFINITY + u'\u2664' # 0x9D -> HEAVY BLACK HEART + u'\u03b5' # 0x9E -> GREEK SMALL LETTER EPSILON + u'\u2229' # 0x9F -> INTERSECTION + u'\u2016' # 0xA0 -> DOUBLE VERTICAL LINE + u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK + u'\xa2' # 0xA2 -> CENT SIGN + u'\xa3' # 0xA3 -> POUND SIGN + u'\xa4' # 0xA4 -> CURRENCY SIGN + u'\xa5' # 0xA5 -> YEN SIGN + u'\xa6' # 0xA6 -> BROKEN BAR + u'\xa7' # 0xA7 -> SECTION SIGN + u'\u0192' # 0xA8 -> LATIN SMALL LETTER F WITH HOOK + u'\xa9' # 0xA9 -> COPYRIGHT SIGN + u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR + u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + u'\u042e' # 0xAC -> CYRILLIC CAPITAL LETTER YU + u'\u042f' # 0xAD -> CYRILLIC CAPITAL LETTER YA + u'\xae' # 0xAE -> REGISTERED SIGN + u'\u2018' # 0xAF -> LEFT SINGLE QUOTATION MARK + u'\xb0' # 0xB0 -> DEGREE SIGN + u'\xb1' # 0xB1 -> PLUS-MINUS SIGN + u'\xb2' # 0xB2 -> SUPERSCRIPT TWO + u'\xb3' # 0xB3 -> SUPERSCRIPT THREE + u'\u2109' # 0xB4 -> DEGREE FAHRENHEIT + u'\xb5' # 0xB5 -> MICRO SIGN + u'\xb6' # 0xB6 -> PILCROW SIGN + u'\xb7' # 0xB7 -> MIDDLE DOT + u'\u03c9' # 0xB8 -> GREEK SMALL LETTER OMEGA + u'\xb9' # 0xB9 -> SUPERSCRIPT ONE + u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR + u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER + u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS + u'\xbf' # 0xBF -> INVERTED QUESTION MARK + u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE + u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE + u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE + u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE + u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA + u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE + u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE + u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS + u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH + u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE + u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE + u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE + u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + u'\xd7' # 0xD7 -> MULTIPLICATION SIGN + u'\u0424' # 0xD8 -> CYRILLIC CAPITAL LETTER EF + u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE + u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE + u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN + u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP + u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE + u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE + u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE + u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE + u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE + u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX + u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE + u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS + u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH + u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE + u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE + u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE + u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + u'\xf7' # 0xF7 -> DIVISION SIGN + u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE + u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE + u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE + u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN + u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS +) + +imon_encoding_map = { + 0x0000: 0x0000, # NULL + 0x0001: 0x0001, # START OF HEADING + 0x0002: 0x0002, # START OF TEXT + 0x0003: 0x0003, # END OF TEXT + 0x0004: 0x0004, # END OF TRANSMISSION + 0x0005: 0x0005, # ENQUIRY + 0x0006: 0x0006, # ACKNOWLEDGE + 0x0007: 0x0007, # BELL + 0x0008: 0x0008, # BACKSPACE + 0x0009: 0x0009, # HORIZONTAL TABULATION + 0x000a: 0x000a, # LINE FEED + 0x000b: 0x000b, # VERTICAL TABULATION + 0x000c: 0x000c, # FORM FEED + 0x000d: 0x000d, # CARRIAGE RETURN + 0x000e: 0x000e, # SHIFT OUT + 0x000f: 0x000f, # SHIFT IN + 0x25b6: 0x0010, # BLACK RIGHT-POINTING TRIANGLE + 0x25c0: 0x0011, # BLACK LEFT-POINTING TRIANGLE + 0x201c: 0x0012, # LEFT DOUBLE QUOTATION MARK + 0x201d: 0x0013, # RIGHT DOUBLE QUOTATION MARK + 0x23eb: 0x0014, # BLACK UP-POINTING DOUBLE TRIANGLE + 0x23ec: 0x0015, # BLACK DOWN-POINTING DOUBLE TRIANGLE + 0x2b24: 0x0016, # BLACK LARGE CIRCLE + 0x21b2: 0x0017, # DOWNWARDS ARROW WITH TIP LEFTWARDS + 0x2191: 0x0018, # UPWARDS ARROW + 0x2193: 0x0019, # DOWNWARDS ARROW + 0x2192: 0x001a, # RIGHTWARDS ARROW + 0x2190: 0x001b, # LEFTWARDS ARROW + 0x2264: 0x001c, # LESS-THAN OR EQUAL TO + 0x2265: 0x001d, # GREATER-THAN OR EQUAL TO + 0x25b2: 0x001e, # BLACK UP-POINTING TRIANGLE + 0x25bc: 0x001f, # BLACK DOWN-POINTING TRIANGLE + 0x0020: 0x0020, # SPACE + 0x0021: 0x0021, # EXCLAMATION MARK + 0x0022: 0x0022, # QUOTATION MARK + 0x0023: 0x0023, # NUMBER SIGN + 0x0024: 0x0024, # DOLLAR SIGN + 0x0025: 0x0025, # PERCENT SIGN + 0x0026: 0x0026, # AMPERSAND + 0x0027: 0x0027, # APOSTROPHE + 0x0028: 0x0028, # LEFT PARENTHESIS + 0x0029: 0x0029, # RIGHT PARENTHESIS + 0x002a: 0x002a, # ASTERISK + 0x002b: 0x002b, # PLUS SIGN + 0x002c: 0x002c, # COMMA + 0x002d: 0x002d, # HYPHEN-MINUS + 0x002e: 0x002e, # FULL STOP + 0x002f: 0x002f, # SOLIDUS + 0x0030: 0x0030, # DIGIT ZERO + 0x0031: 0x0031, # DIGIT ONE + 0x0032: 0x0032, # DIGIT TWO + 0x0033: 0x0033, # DIGIT THREE + 0x0034: 0x0034, # DIGIT FOUR + 0x0035: 0x0035, # DIGIT FIVE + 0x0036: 0x0036, # DIGIT SIX + 0x0037: 0x0037, # DIGIT SEVEN + 0x0038: 0x0038, # DIGIT EIGHT + 0x0039: 0x0039, # DIGIT NINE + 0x003a: 0x003a, # COLON + 0x003b: 0x003b, # SEMICOLON + 0x003c: 0x003c, # LESS-THAN SIGN + 0x003d: 0x003d, # EQUALS SIGN + 0x003e: 0x003e, # GREATER-THAN SIGN + 0x003f: 0x003f, # QUESTION MARK + 0x0040: 0x0040, # COMMERCIAL AT + 0x0041: 0x0041, # LATIN CAPITAL LETTER A + 0x0042: 0x0042, # LATIN CAPITAL LETTER B + 0x0043: 0x0043, # LATIN CAPITAL LETTER C + 0x0044: 0x0044, # LATIN CAPITAL LETTER D + 0x0045: 0x0045, # LATIN CAPITAL LETTER E + 0x0046: 0x0046, # LATIN CAPITAL LETTER F + 0x0047: 0x0047, # LATIN CAPITAL LETTER G + 0x0048: 0x0048, # LATIN CAPITAL LETTER H + 0x0049: 0x0049, # LATIN CAPITAL LETTER I + 0x004a: 0x004a, # LATIN CAPITAL LETTER J + 0x004b: 0x004b, # LATIN CAPITAL LETTER K + 0x004c: 0x004c, # LATIN CAPITAL LETTER L + 0x004d: 0x004d, # LATIN CAPITAL LETTER M + 0x004e: 0x004e, # LATIN CAPITAL LETTER N + 0x004f: 0x004f, # LATIN CAPITAL LETTER O + 0x0050: 0x0050, # LATIN CAPITAL LETTER P + 0x0051: 0x0051, # LATIN CAPITAL LETTER Q + 0x0052: 0x0052, # LATIN CAPITAL LETTER R + 0x0053: 0x0053, # LATIN CAPITAL LETTER S + 0x0054: 0x0054, # LATIN CAPITAL LETTER T + 0x0055: 0x0055, # LATIN CAPITAL LETTER U + 0x0056: 0x0056, # LATIN CAPITAL LETTER V + 0x0057: 0x0057, # LATIN CAPITAL LETTER W + 0x0058: 0x0058, # LATIN CAPITAL LETTER X + 0x0059: 0x0059, # LATIN CAPITAL LETTER Y + 0x005a: 0x005a, # LATIN CAPITAL LETTER Z + 0x005b: 0x005b, # LEFT SQUARE BRACKET + 0x005c: 0x005c, # REVERSE SOLIDUS + 0x005d: 0x005d, # RIGHT SQUARE BRACKET + 0x005e: 0x005e, # CIRCUMFLEX ACCENT + 0x005f: 0x005f, # LOW LINE + 0x0060: 0x0060, # GRAVE ACCENT + 0x0061: 0x0061, # LATIN SMALL LETTER A + 0x0062: 0x0062, # LATIN SMALL LETTER B + 0x0063: 0x0063, # LATIN SMALL LETTER C + 0x0064: 0x0064, # LATIN SMALL LETTER D + 0x0065: 0x0065, # LATIN SMALL LETTER E + 0x0066: 0x0066, # LATIN SMALL LETTER F + 0x0067: 0x0067, # LATIN SMALL LETTER G + 0x0068: 0x0068, # LATIN SMALL LETTER H + 0x0069: 0x0069, # LATIN SMALL LETTER I + 0x006a: 0x006a, # LATIN SMALL LETTER J + 0x006b: 0x006b, # LATIN SMALL LETTER K + 0x006c: 0x006c, # LATIN SMALL LETTER L + 0x006d: 0x006d, # LATIN SMALL LETTER M + 0x006e: 0x006e, # LATIN SMALL LETTER N + 0x006f: 0x006f, # LATIN SMALL LETTER O + 0x0070: 0x0070, # LATIN SMALL LETTER P + 0x0071: 0x0071, # LATIN SMALL LETTER Q + 0x0072: 0x0072, # LATIN SMALL LETTER R + 0x0073: 0x0073, # LATIN SMALL LETTER S + 0x0074: 0x0074, # LATIN SMALL LETTER T + 0x0075: 0x0075, # LATIN SMALL LETTER U + 0x0076: 0x0076, # LATIN SMALL LETTER V + 0x0077: 0x0077, # LATIN SMALL LETTER W + 0x0078: 0x0078, # LATIN SMALL LETTER X + 0x0079: 0x0079, # LATIN SMALL LETTER Y + 0x007a: 0x007a, # LATIN SMALL LETTER Z + 0x007b: 0x007b, # LEFT CURLY BRACKET + 0x007c: 0x007c, # VERTICAL LINE + 0x007d: 0x007d, # RIGHT CURLY BRACKET + 0x007e: 0x007e, # TILDE + 0x007f: 0x007f, # DELETE + 0x0411: 0x0080, # CYRILLIC CAPITAL LETTER BE + 0x0414: 0x0081, # CYRILLIC CAPITAL LETTER DE + 0x0416: 0x0082, # CYRILLIC CAPITAL LETTER GJE + 0x0417: 0x0083, # CYRILLIC CAPITAL LETTER ZE + 0x0418: 0x0084, # CYRILLIC CAPITAL LETTER I + 0x0419: 0x0085, # CYRILLIC CAPITAL LETTER SHORT I + 0x041b: 0x0086, # CYRILLIC CAPITAL LETTER EL + 0x041f: 0x0087, # CYRILLIC CAPITAL LETTER PE + 0x0423: 0x0088, # CYRILLIC CAPITAL LETTER U + 0x0426: 0x0089, # CYRILLIC CAPITAL LETTER TSE + 0x0427: 0x008a, # CYRILLIC CAPITAL LETTER CHE + 0x0428: 0x008b, # CYRILLIC CAPITAL LETTER SHA + 0x0429: 0x008c, # CYRILLIC CAPITAL LETTER SHCHA + 0x042a: 0x008d, # CYRILLIC CAPITAL LETTER HARD SIGN + 0x042b: 0x008e, # CYRILLIC CAPITAL LETTER YERU + 0x042d: 0x008f, # CYRILLIC CAPITAL LETTER E + 0x03b1: 0x0090, # GREEK SMALL LETTER ALPHA + 0x266a: 0x0091, # EIGHTH NOTE + 0x0413: 0x0092, # CYRILLIC CAPITAL LETTER GHE + 0x03c0: 0x0093, # GREEK SMALL LETTER PI + 0x03a3: 0x0094, # GREEK CAPITAL LETTER SIGMA + 0x03c3: 0x0095, # GREEK SMALL LETTER SIGMA + 0x266c: 0x0096, # BEAMED SIXTEENTH NOTES + 0x03c4: 0x0097, # GREEK SMALL LETTER TAU + 0xf0f3: 0x0098, # BELL ICON (not sure) + 0x0398: 0x0099, # GREEK CAPITAL LETTER THETA + 0x03a9: 0x009a, # GREEK CAPITAL LETTER OMEGA + 0x03b4: 0x009b, # GREEK SMALL LETTER DELTA + 0x221e: 0x009c, # INFINITY + 0x2664: 0x009d, # HEAVY BLACK HEART + 0x03b5: 0x009e, # GREEK SMALL LETTER EPSILON + 0x2229: 0x009f, # INTERSECTION + 0x2016: 0x00a0, # DOUBLE VERTICAL LINE + 0x00a1: 0x00a1, # INVERTED EXCLAMATION MARK + 0x00a2: 0x00a2, # CENT SIGN + 0x00a3: 0x00a3, # POUND SIGN + 0x00a4: 0x00a4, # CURRENCY SIGN + 0x00a5: 0x00a5, # YEN SIGN + 0x00a6: 0x00a6, # BROKEN BAR + 0x00a7: 0x00a7, # SECTION SIGN + 0x0192: 0x00a8, # LATIN SMALL LETTER F WITH HOOK + 0x00a9: 0x00a9, # COPYRIGHT SIGN + 0x00aa: 0x00aa, # FEMININE ORDINAL INDICATOR + 0x00ab: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + 0x042e: 0x00ac, # CYRILLIC CAPITAL LETTER YU + 0x042f: 0x00ad, # CYRILLIC CAPITAL LETTER YA + 0x00ae: 0x00ae, # REGISTERED SIGN + 0x2018: 0x00af, # LEFT SINGLE QUOTATION MARK + 0x00b0: 0x00b0, # DEGREE SIGN + 0x00b1: 0x00b1, # PLUS-MINUS SIGN + 0x00b2: 0x00b2, # SUPERSCRIPT TWO + 0x00b3: 0x00b3, # SUPERSCRIPT THREE + 0x2109: 0x00b4, # DEGREE FAHRENHEIT + 0x00b5: 0x00b5, # MICRO SIGN + 0x00b6: 0x00b6, # PILCROW SIGN + 0x00b7: 0x00b7, # MIDDLE DOT + 0x03c9: 0x00b8, # GREEK SMALL LETTER OMEGA + 0x00b9: 0x00b9, # SUPERSCRIPT ONE + 0x00ba: 0x00ba, # MASCULINE ORDINAL INDICATOR + 0x00bb: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + 0x00bc: 0x00bc, # VULGAR FRACTION ONE QUARTER + 0x00bd: 0x00bd, # VULGAR FRACTION ONE HALF + 0x00be: 0x00be, # VULGAR FRACTION THREE QUARTERS + 0x00bf: 0x00bf, # INVERTED QUESTION MARK + 0x00c0: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE + 0x00c1: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE + 0x00c2: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX + 0x00c3: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE + 0x00c4: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS + 0x00c5: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE + 0x00c6: 0x00c6, # LATIN CAPITAL LETTER AE + 0x00c7: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA + 0x00c8: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE + 0x00c9: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE + 0x00ca: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX + 0x00cb: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS + 0x00cc: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE + 0x00cd: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE + 0x00ce: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX + 0x00cf: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS + 0x00d0: 0x00d0, # LATIN CAPITAL LETTER ETH + 0x00d1: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE + 0x00d2: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE + 0x00d3: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE + 0x00d4: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX + 0x00d5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE + 0x00d6: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS + 0x00d7: 0x00d7, # MULTIPLICATION SIGN + 0x0424: 0x00d8, # CYRILLIC CAPITAL LETTER EF + 0x00d9: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE + 0x00da: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE + 0x00db: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX + 0x00dc: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS + 0x00dd: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE + 0x00de: 0x00de, # LATIN CAPITAL LETTER THORN + 0x00df: 0x00df, # LATIN SMALL LETTER SHARP + 0x00e0: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE + 0x00e1: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE + 0x00e2: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX + 0x00e3: 0x00e3, # LATIN SMALL LETTER A WITH TILDE + 0x00e4: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS + 0x00e5: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE + 0x00e6: 0x00e6, # LATIN SMALL LETTER AE + 0x00e7: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA + 0x00e8: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE + 0x00e9: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE + 0x00ea: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX + 0x00eb: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS + 0x00ec: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE + 0x00ed: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE + 0x00ee: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX + 0x00ef: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS + 0x00f0: 0x00f0, # LATIN SMALL LETTER ETH + 0x00f1: 0x00f1, # LATIN SMALL LETTER N WITH TILDE + 0x00f2: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE + 0x00f3: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE + 0x00f4: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX + 0x00f5: 0x00f5, # LATIN SMALL LETTER O WITH TILDE + 0x00f6: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS + 0x00f7: 0x00f7, # DIVISION SIGN + 0x00f8: 0x00f8, # LATIN SMALL LETTER O WITH STROKE + 0x00f9: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE + 0x00fa: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE + 0x00fb: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX + 0x00fc: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS + 0x00fd: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE + 0x00fe: 0x00fe, # LATIN SMALL LETTER THORN + 0x00ff: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS +# Rest of capital cyrillic letters + 0x0410: 0x0041, + 0x0412: 0x0042, + 0x0415: 0x0045, + 0x0401: 0x00cb, + 0x041a: 0x004b, + 0x041c: 0x004d, + 0x041d: 0x0048, + 0x041e: 0x004f, + 0x0420: 0x0050, + 0x0421: 0x0043, + 0x0422: 0x0054, + 0x0425: 0x0058, + 0x042c: 0x0062, +# Small Cyrillc letters + 0x0430: 0x0041, + 0x0431: 0x0080, + 0x0432: 0x0042, + 0x0433: 0x0092, + 0x0434: 0x0081, + 0x0435: 0x0045, + 0x0451: 0x00cb, + 0x0436: 0x0082, + 0x0437: 0x0083, + 0x0438: 0x0084, + 0x0439: 0x0085, + 0x043a: 0x004b, + 0x043b: 0x0086, + 0x043c: 0x004d, + 0x043d: 0x0048, + 0x043e: 0x004f, + 0x043f: 0x0087, + 0x0440: 0x0050, + 0x0441: 0x0043, + 0x0442: 0x0054, + 0x0443: 0x0088, + 0x0444: 0x00d8, + 0x0445: 0x0058, + 0x0446: 0x0089, + 0x0447: 0x008a, + 0x0448: 0x008b, + 0x0449: 0x008c, + 0x044a: 0x008d, + 0x044b: 0x008e, + 0x044c: 0x0062, + 0x044d: 0x008f, + 0x044e: 0x00ac, + 0x044f: 0x00ad +} + +class Codec(codecs.Codec): + + def encode(self,input,errors='strict'): + return codecs.charmap_encode(input,errors,imon_encoding_map) + + def decode(self,input,errors='strict'): + return codecs.charmap_decode(input,errors,imon_decoding_table) + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input, final=False): + return codecs.charmap_encode(input,self.errors,imon_encoding_map)[0] + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input, final=False): + return codecs.charmap_decode(input,self.errors,imon_decoding_table)[0] + +class StreamWriter(Codec,codecs.StreamWriter): + pass + +class StreamReader(Codec,codecs.StreamReader): + pass + +def searchcp(name): + if name == 'imon': + return codecs.CodecInfo( + name='imon', + encode=Codec().encode, + decode=Codec().decode, + incrementalencoder=IncrementalEncoder, + incrementaldecoder=IncrementalDecoder, + streamreader=StreamReader, + streamwriter=StreamWriter, + ) + else: return None + From 91373ec9675241d499412a7fbf097aa62b9e2a87 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 6 Jan 2013 15:15:16 +0100 Subject: [PATCH 162/337] Un-duplicate code, revert code shuffling and enable charmap encoding when info.regex suggests --- resources/lib/lcdbase.py | 4 ++++ resources/lib/lcdproc.py | 12 +++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index a00bcf0..032e1a2 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -91,6 +91,8 @@ def __init__(self): self.m_extraBars = [None] * (LCD_EXTRABARS_MAX + 1) self.m_bDimmedOnPlayback = False self.m_iDimOnPlayDelay = 0 + self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 + self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! self.m_strScrollSeparator = " " self.m_bProgressbarSurroundings = False self.m_iIconTextOffset = 2 @@ -433,6 +435,8 @@ def Render(self, mode, bForce): self.SetPlayingStateIcon() line = InfoLabel_GetInfoLabel(self.m_lcdMode[mode][inLine]['text']) + if self.m_strInfoLabelEncoding != self.m_strLCDEncoding: + line = line.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") self.SetProgressBar(0, -1) if self.m_bAllowEmptyLines or len(line) > 0: diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 38cd54f..1b6e95e 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -75,8 +75,6 @@ def __init__(self): self.m_strSetLineCmds = "" self.m_cExtraIcons = None self.m_vPythonVersion = sys.version_info - self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 - self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants anything but utf-8. if self.m_vPythonVersion < (2, 7): log(xbmc.LOGWARNING, "Python < 2.7 detected. Upgrade your Python for optimal results.") @@ -238,6 +236,7 @@ def DetermineExtraSupport(self): rematch_imon = "SoundGraph iMON(.*)LCD" rematch_mdm166a = "Targa(.*)mdm166a" rematch_imonvfd = "Soundgraph(.*)VFD" + bSupportNativeCP = False # Never cause script failure/interruption by this! This is totally optional! try: @@ -256,9 +255,6 @@ def DetermineExtraSupport(self): log(xbmc.LOGNOTICE, "SoundGraph iMON LCD detected") self.m_cExtraIcons = LCDproc_extra_imon() self.m_cExtraIcons.Initialize() - if settings_getNativecodepage(): - codecs.register(searchcp) - self.m_strLCDEncoding = 'imon' elif re.match(rematch_mdm166a, reply): log(xbmc.LOGNOTICE, "Futaba/Targa USB mdm166a VFD detected") @@ -267,7 +263,9 @@ def DetermineExtraSupport(self): elif re.match(rematch_imonvfd, reply): log(xbmc.LOGNOTICE, "SoundGraph iMON IR/VFD detected") - if settings_getNativecodepage(): + bSupportNativeCP = True + + if bSupportNativeCP and settings_getNativecodepage(): codecs.register(searchcp) self.m_strLCDEncoding = 'imon' @@ -533,7 +531,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: strLineLong = self.GetBigDigitTime() else: - strLineLong = strLine.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") + strLineLong = strLine strLineLong.strip() From e7f041aaaeca79f074115947fa185063a639afa1 Mon Sep 17 00:00:00 2001 From: Vanek <9175@mail.ru> Date: Tue, 8 Jan 2013 01:04:53 +0400 Subject: [PATCH 163/337] Delete redundant decoding table --- .../resources/lib/lcd_codepages.py | 264 +----------------- 1 file changed, 2 insertions(+), 262 deletions(-) diff --git a/script.xbmc.lcd/resources/lib/lcd_codepages.py b/script.xbmc.lcd/resources/lib/lcd_codepages.py index 7f37bb3..c8baa38 100644 --- a/script.xbmc.lcd/resources/lib/lcd_codepages.py +++ b/script.xbmc.lcd/resources/lib/lcd_codepages.py @@ -22,265 +22,6 @@ import codecs -imon_decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\u25b6' # 0x10 -> BLACK RIGHT-POINTING TRIANGLE - u'\u25c0' # 0x11 -> BLACK LEFT-POINTING TRIANGLE - u'\u201C' # 0x12 -> LEFT DOUBLE QUOTATION MARK - u'\u201D' # 0x13 -> RIGHT DOUBLE QUOTATION MARK - u'\u23eb' # 0x14 -> BLACK UP-POINTING DOUBLE TRIANGLE - u'\u23ec' # 0x15 -> BLACK DOWN-POINTING DOUBLE TRIANGLE - u'\u2b24' # 0x16 -> BLACK LARGE CIRCLE - u'\u21b2' # 0x17 -> DOWNWARDS ARROW WITH TIP LEFTWARDS - u'\u2191' # 0x18 -> UPWARDS ARROW - u'\u2193' # 0x19 -> DOWNWARDS ARROW - u'\u2192' # 0x1A -> RIGHTWARDS ARROW - u'\u2190' # 0x1B -> LEFTWARDS ARROW - u'\u2264' # 0x1C -> LESS-THAN OR EQUAL TO - u'\u2265' # 0x1D -> GREATER-THAN OR EQUAL TO - u'\u25b2' # 0x1E -> BLACK UP-POINTING TRIANGLE - u'\u25bc' # 0x1F -> BLACK DOWN-POINTING TRIANGLE - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u0411' # 0x80 -> CYRILLIC CAPITAL LETTER BE - u'\u0414' # 0x81 -> CYRILLIC CAPITAL LETTER DE - u'\u0417' # 0x82 -> CYRILLIC CAPITAL LETTER GJE - u'\u0453' # 0x83 -> CYRILLIC CAPITAL LETTER ZE - u'\u0418' # 0x84 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0x85 -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041b' # 0x86 -> CYRILLIC CAPITAL LETTER EL - u'\u041f' # 0x87 -> CYRILLIC CAPITAL LETTER PE - u'\u0423' # 0x88 -> CYRILLIC CAPITAL LETTER U - u'\u0426' # 0x89 -> CYRILLIC CAPITAL LETTER TSE - u'\u0427' # 0x8A -> CYRILLIC CAPITAL LETTER CHE - u'\u0428' # 0x8B -> CYRILLIC CAPITAL LETTER SHA - u'\u0429' # 0x8C -> CYRILLIC CAPITAL LETTER SHCHA - u'\u042A' # 0x8D -> CYRILLIC CAPITAL LETTER HARD SIGN - u'\u042B' # 0x8E -> CYRILLIC CAPITAL LETTER YERU - u'\u042d' # 0x8F -> CYRILLIC CAPITAL LETTER E - u'\u03b1' # 0x90 -> GREEK SMALL LETTER ALPHA - u'\u266a' # 0x91 -> EIGHTH NOTE - u'\u0413' # 0x92 -> CYRILLIC CAPITAL LETTER GHE - u'\u03c0' # 0x93 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x94 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x95 -> GREEK SMALL LETTER SIGMA - u'\u266c' # 0x96 -> BEAMED SIXTEENTH NOTES - u'\u03c4' # 0x97 -> GREEK SMALL LETTER TAU - u'\uf0f3' # 0x98 -> BELL ICON (not sure) - u'\u0398' # 0x99 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x9A -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x9B -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x9C -> INFINITY - u'\u2664' # 0x9D -> HEAVY BLACK HEART - u'\u03b5' # 0x9E -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x9F -> INTERSECTION - u'\u2016' # 0xA0 -> DOUBLE VERTICAL LINE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\u0192' # 0xA8 -> LATIN SMALL LETTER F WITH HOOK - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u042e' # 0xAC -> CYRILLIC CAPITAL LETTER YU - u'\u042f' # 0xAD -> CYRILLIC CAPITAL LETTER YA - u'\xae' # 0xAE -> REGISTERED SIGN - u'\u2018' # 0xAF -> LEFT SINGLE QUOTATION MARK - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\u2109' # 0xB4 -> DEGREE FAHRENHEIT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u03c9' # 0xB8 -> GREEK SMALL LETTER OMEGA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u0424' # 0xD8 -> CYRILLIC CAPITAL LETTER EF - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS -) - imon_encoding_map = { 0x0000: 0x0000, # NULL 0x0001: 0x0001, # START OF HEADING @@ -594,15 +335,14 @@ def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,imon_encoding_map) def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,imon_decoding_table) + pass class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input, final=False): return codecs.charmap_encode(input,self.errors,imon_encoding_map)[0] class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,imon_decoding_table)[0] + pass class StreamWriter(Codec,codecs.StreamWriter): pass From 56eaf210b65f89a11610b7832f50158fe92a051a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Feb 2013 12:43:59 +0100 Subject: [PATCH 164/337] Move codepages to correct location --- {script.xbmc.lcd/resources => resources}/lib/lcd_codepages.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {script.xbmc.lcd/resources => resources}/lib/lcd_codepages.py (100%) diff --git a/script.xbmc.lcd/resources/lib/lcd_codepages.py b/resources/lib/lcd_codepages.py similarity index 100% rename from script.xbmc.lcd/resources/lib/lcd_codepages.py rename to resources/lib/lcd_codepages.py From 71120bca165140ef52848eb9524e43786f705f94 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 11 Feb 2013 21:16:47 +0100 Subject: [PATCH 165/337] settings and strings for alternative charset selection --- resources/language/English/strings.xml | 13 +++++++++++-- resources/language/German/strings.xml | 13 +++++++++++-- resources/settings.xml | 3 ++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 45b1509..973c969 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -7,7 +7,8 @@ Scroll mode Navigation display duration (s) Display refresh rate (Hz) - Use native codepages (only for imon-like displays for now) + Use alternate charset + Charset Backlight @@ -22,10 +23,18 @@ Show heartbeat symbol Hide connection error notifications - + Marquee Left/Right + + ISO8859-1 (default) + ISO8859-15 + KOI8-R + CP1251 + ISO8859-5 + HD44780-ROM + Failed to connect to LCDProc! Connected to LCDProc! diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml index 2cd98b6..20db389 100644 --- a/resources/language/German/strings.xml +++ b/resources/language/German/strings.xml @@ -7,7 +7,8 @@ Scroll-Modus Anzeigedauer der Navigationsansicht (s) Display-Aktualisierungsrate (Hz) - Native codepages (für imon) + Verwende alternativen Zeichensatz + Zeichensatz Beleuchtung @@ -22,10 +23,18 @@ Heartbeatsymbol anzeigen Verbindungsfehler-Benachrichtigung verstecken - + Durchlaufend Links/Rechts + + ISO8859-1 (Standard) + ISO8859-15 + KOI8-R + CP1251 + ISO8859-5 + HD44780-ROM + Fehler beim Verbinden zu LCDproc! Verbunden mit LCDproc! diff --git a/resources/settings.xml b/resources/settings.xml index 9f47959..ec3a671 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -5,7 +5,8 @@ - + + From e222f4ddf1156f0bbd2b1ed2b49d738f2bb7a9cc Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 11 Feb 2013 22:11:18 +0100 Subject: [PATCH 166/337] introduce GUI-setting updater, carefully handle charset setting and catch possible errors on hd44780 charset registration and usage --- lcdmain.py | 4 ++ resources/lib/lcdbase.py | 19 +++++++++ resources/lib/lcdproc.py | 7 ---- resources/lib/settings.py | 84 ++++++++++++++++++++++++++------------- 4 files changed, 80 insertions(+), 34 deletions(-) diff --git a/lcdmain.py b/lcdmain.py index fbb19f9..9ed9c07 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -104,6 +104,10 @@ def process_lcd(): while not xbmc.abortRequested: if handleConnectLCD(): settingsChanged = settings_didSettingsChange() + + if settingsChanged: + g_lcdproc.UpdateGUISettings() + mode = getLcdMode() if mode == LCD_MODE.LCD_MODE_SCREENSAVER and settings_getDimOnScreensaver() and not bBacklightDimmed: diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 032e1a2..551bf3c 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -41,8 +41,10 @@ __lcdxml__ = xbmc.translatePath( os.path.join("special://masterprofile","LCD.xml")) __lcddefaultxml__ = xbmc.translatePath( os.path.join(__cwd__, "resources", "LCD.xml.defaults")) +from settings import * from extraicons import * from infolabels import * +from lcd_codepages import * # global functions def log(loglevel, msg): @@ -102,6 +104,7 @@ def __init__(self): self.m_iOldAudioChannelsVar = 0 self.m_bWasStopped = True self.m_bXMLWarningDisplayed = False + self.m_bHaveHD44780Charmap = False # @abstractmethod def _concrete_method(self): @@ -189,6 +192,13 @@ def Initialize(self): strXMLFile = __lcdxml__ self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE + try: + log(xbmc.LOGDEBUG, "Registering HD44780-ROM pseudocodepage") + codecs.register(searchcp) + self.m_bHaveHD44780Charmap = True + except: + log(xbmc.LOGERROR, "Failed to register custom HD44780-ROM pseudocodepage, expect problems with alternative charsets!") + if not self.ManageLCDXML(): strXMLFile = __lcddefaultxml__ @@ -197,6 +207,15 @@ def Initialize(self): return True + def UpdateGUISettings(self): + str_charset = settings_getCharset() + if str_charset != self.m_strLCDEncoding: + if str_charset == "hd44780-hw" and not self.m_bHaveHD44780Charmap: + str_charset = "iso8859-1" + + self.m_strLCDEncoding = str_charset + log(xbmc.LOGDEBUG, "Setting character encoding to %s" % (self.m_strLCDEncoding)) + def LoadSkin(self, xmlFile): self.Reset() bHaveSkin = False diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 1b6e95e..ec4409d 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -44,7 +44,6 @@ from lcdproc_extra_mdm166a import * from infolabels import * -from lcd_codepages import * def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) @@ -236,7 +235,6 @@ def DetermineExtraSupport(self): rematch_imon = "SoundGraph iMON(.*)LCD" rematch_mdm166a = "Targa(.*)mdm166a" rematch_imonvfd = "Soundgraph(.*)VFD" - bSupportNativeCP = False # Never cause script failure/interruption by this! This is totally optional! try: @@ -263,11 +261,6 @@ def DetermineExtraSupport(self): elif re.match(rematch_imonvfd, reply): log(xbmc.LOGNOTICE, "SoundGraph iMON IR/VFD detected") - bSupportNativeCP = True - - if bSupportNativeCP and settings_getNativecodepage(): - codecs.register(searchcp) - self.m_strLCDEncoding = 'imon' except: pass diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 4639611..ce30788 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -39,13 +39,14 @@ global g_heartbeat global g_scrolldelay global g_scrollmode -global g_nativecodepage global g_settingsChanged global g_dimonscreensaver global g_dimonshutdown global g_navtimeout global g_refreshrate global g_hideconnpopups +global g_usealternatecharset +global g_charset #init globals with defaults def settings_initGlobals(): @@ -55,27 +56,29 @@ def settings_initGlobals(): global g_heartbeat global g_scrolldelay global g_scrollmode - global g_nativecodepage global g_settingsChanged global g_dimonscreensaver global g_dimonshutdown global g_navtimeout global g_refreshrate global g_hideconnpopups - - g_hostip = "127.0.0.1" - g_hostport = 13666 - g_timer = time.time() - g_heartbeat = False - g_scrolldelay = 1 - g_scrollmode = "0" - g_nativecodepage = False - g_settigsChanged = True - g_dimonscreensaver = False - g_dimonshutdown = False - g_navtimeout = 3 - g_refreshrate = 1 - g_hideconnpopups = True + global g_usealternatecharset + global g_charset + + g_hostip = "127.0.0.1" + g_hostport = 13666 + g_timer = time.time() + g_heartbeat = False + g_scrolldelay = 1 + g_scrollmode = "0" + g_settigsChanged = True + g_dimonscreensaver = False + g_dimonshutdown = False + g_navtimeout = 3 + g_refreshrate = 1 + g_hideconnpopups = True + g_usealternatecharset = False + g_charset = "iso-8859-1" def settings_getHostIp(): global g_hostip @@ -97,10 +100,6 @@ def settings_getScrollMode(): global g_scrollmode return g_scrollmode -def settings_getNativecodepage(): - global g_nativecodepage - return g_nativecodepage - def settings_getLCDprocScrollMode(): global g_scrollmode if g_scrollmode == "1": @@ -127,6 +126,31 @@ def settings_getHideConnPopups(): global g_hideconnpopups return g_hideconnpopups +def settings_getCharset(): + global g_usealternatecharset + global g_charset + ret = "" + + # if alternatecharset is disabled, return LCDproc's default + if g_usealternatecharset == False: + ret = "iso-8859-1" + else: + # make sure to keep this in sync with settings.xml! + if g_charset == "1": + ret = "iso-8859-15" + elif g_charset == "2": + ret = "koi8-r" + elif g_charset == "3": + ret = "cp1251" + elif g_charset == "4": + ret = "iso-8859-5" + elif g_charset == "5": + ret = "hd44780-hw" + else: + ret = "iso-8859-1" + + return ret + #check for new settings and handle them if anything changed #only checks if the last check is 5 secs old #returns if a reconnect is needed due to settings change @@ -191,7 +215,6 @@ def settings_handleNetworkSettings(): def settings_handleLcdSettings(): global g_scrolldelay global g_scrollmode - global g_nativecodepage global g_heartbeat global g_settingsChanged global g_dimonscreensaver @@ -199,18 +222,21 @@ def settings_handleLcdSettings(): global g_navtimeout global g_refreshrate global g_hideconnpopups + global g_usealternatecharset + global g_charset g_settingsChanged = False scrolldelay = int(float(string.replace(__settings__.getSetting("scrolldelay"), ",", "."))) scrollmode = __settings__.getSetting("scrollmode") - nativecodepage = __settings__.getSetting("nativecodepage") == "true" dimonscreensaver = __settings__.getSetting("dimonscreensaver") == "true" dimonshutdown = __settings__.getSetting("dimonshutdown") == "true" navtimeout = int(float(string.replace(__settings__.getSetting("navtimeout"), ",", "."))) refreshrate = int(float(string.replace(__settings__.getSetting("refreshrate"), ",", "."))) hideconnpopups = __settings__.getSetting("hideconnpopups") == "true" - + usealternatecharset = __settings__.getSetting("usealternatecharset") == "true" + charset = __settings__.getSetting("charset") + if g_scrolldelay != scrolldelay: g_scrolldelay = scrolldelay g_settingsChanged = True @@ -219,10 +245,6 @@ def settings_handleLcdSettings(): g_scrollmode = scrollmode g_settingsChanged = True - if g_nativecodepage != nativecodepage: - g_nativecodepage = nativecodepage - g_settingsChanged = True - if g_dimonscreensaver != dimonscreensaver: g_dimonscreensaver = dimonscreensaver g_settingsChanged = True @@ -247,6 +269,14 @@ def settings_handleLcdSettings(): g_hideconnpopups = hideconnpopups g_settingsChanged = True + if g_usealternatecharset != usealternatecharset: + g_usealternatecharset = usealternatecharset + g_settingsChanged = True + + if g_charset != charset: + g_charset = charset + g_settingsChanged = True + #handles all settings and applies them as needed #returns if a reconnect is needed due to settings changes def settings_setup(): From 18cc8edee33fe22316657165d5b438131ffe550e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 11 Feb 2013 22:27:11 +0100 Subject: [PATCH 167/337] rename things to charset_hd44780, make code style match all other python code --- resources/lib/charset_hd44780.py | 365 +++++++++++++++++++++++++++++++ resources/lib/lcd_codepages.py | 365 ------------------------------- resources/lib/lcdbase.py | 4 +- 3 files changed, 367 insertions(+), 367 deletions(-) create mode 100644 resources/lib/charset_hd44780.py delete mode 100644 resources/lib/lcd_codepages.py diff --git a/resources/lib/charset_hd44780.py b/resources/lib/charset_hd44780.py new file mode 100644 index 0000000..d0a8ab2 --- /dev/null +++ b/resources/lib/charset_hd44780.py @@ -0,0 +1,365 @@ +''' + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +import codecs + +hd44780_encoding_map = { + 0x0000: 0x0000, # NULL + 0x0001: 0x0001, # START OF HEADING + 0x0002: 0x0002, # START OF TEXT + 0x0003: 0x0003, # END OF TEXT + 0x0004: 0x0004, # END OF TRANSMISSION + 0x0005: 0x0005, # ENQUIRY + 0x0006: 0x0006, # ACKNOWLEDGE + 0x0007: 0x0007, # BELL + 0x0008: 0x0008, # BACKSPACE + 0x0009: 0x0009, # HORIZONTAL TABULATION + 0x000a: 0x000a, # LINE FEED + 0x000b: 0x000b, # VERTICAL TABULATION + 0x000c: 0x000c, # FORM FEED + 0x000d: 0x000d, # CARRIAGE RETURN + 0x000e: 0x000e, # SHIFT OUT + 0x000f: 0x000f, # SHIFT IN + 0x25b6: 0x0010, # BLACK RIGHT-POINTING TRIANGLE + 0x25c0: 0x0011, # BLACK LEFT-POINTING TRIANGLE + 0x201c: 0x0012, # LEFT DOUBLE QUOTATION MARK + 0x201d: 0x0013, # RIGHT DOUBLE QUOTATION MARK + 0x23eb: 0x0014, # BLACK UP-POINTING DOUBLE TRIANGLE + 0x23ec: 0x0015, # BLACK DOWN-POINTING DOUBLE TRIANGLE + 0x2b24: 0x0016, # BLACK LARGE CIRCLE + 0x21b2: 0x0017, # DOWNWARDS ARROW WITH TIP LEFTWARDS + 0x2191: 0x0018, # UPWARDS ARROW + 0x2193: 0x0019, # DOWNWARDS ARROW + 0x2192: 0x001a, # RIGHTWARDS ARROW + 0x2190: 0x001b, # LEFTWARDS ARROW + 0x2264: 0x001c, # LESS-THAN OR EQUAL TO + 0x2265: 0x001d, # GREATER-THAN OR EQUAL TO + 0x25b2: 0x001e, # BLACK UP-POINTING TRIANGLE + 0x25bc: 0x001f, # BLACK DOWN-POINTING TRIANGLE + 0x0020: 0x0020, # SPACE + 0x0021: 0x0021, # EXCLAMATION MARK + 0x0022: 0x0022, # QUOTATION MARK + 0x0023: 0x0023, # NUMBER SIGN + 0x0024: 0x0024, # DOLLAR SIGN + 0x0025: 0x0025, # PERCENT SIGN + 0x0026: 0x0026, # AMPERSAND + 0x0027: 0x0027, # APOSTROPHE + 0x0028: 0x0028, # LEFT PARENTHESIS + 0x0029: 0x0029, # RIGHT PARENTHESIS + 0x002a: 0x002a, # ASTERISK + 0x002b: 0x002b, # PLUS SIGN + 0x002c: 0x002c, # COMMA + 0x002d: 0x002d, # HYPHEN-MINUS + 0x002e: 0x002e, # FULL STOP + 0x002f: 0x002f, # SOLIDUS + 0x0030: 0x0030, # DIGIT ZERO + 0x0031: 0x0031, # DIGIT ONE + 0x0032: 0x0032, # DIGIT TWO + 0x0033: 0x0033, # DIGIT THREE + 0x0034: 0x0034, # DIGIT FOUR + 0x0035: 0x0035, # DIGIT FIVE + 0x0036: 0x0036, # DIGIT SIX + 0x0037: 0x0037, # DIGIT SEVEN + 0x0038: 0x0038, # DIGIT EIGHT + 0x0039: 0x0039, # DIGIT NINE + 0x003a: 0x003a, # COLON + 0x003b: 0x003b, # SEMICOLON + 0x003c: 0x003c, # LESS-THAN SIGN + 0x003d: 0x003d, # EQUALS SIGN + 0x003e: 0x003e, # GREATER-THAN SIGN + 0x003f: 0x003f, # QUESTION MARK + 0x0040: 0x0040, # COMMERCIAL AT + 0x0041: 0x0041, # LATIN CAPITAL LETTER A + 0x0042: 0x0042, # LATIN CAPITAL LETTER B + 0x0043: 0x0043, # LATIN CAPITAL LETTER C + 0x0044: 0x0044, # LATIN CAPITAL LETTER D + 0x0045: 0x0045, # LATIN CAPITAL LETTER E + 0x0046: 0x0046, # LATIN CAPITAL LETTER F + 0x0047: 0x0047, # LATIN CAPITAL LETTER G + 0x0048: 0x0048, # LATIN CAPITAL LETTER H + 0x0049: 0x0049, # LATIN CAPITAL LETTER I + 0x004a: 0x004a, # LATIN CAPITAL LETTER J + 0x004b: 0x004b, # LATIN CAPITAL LETTER K + 0x004c: 0x004c, # LATIN CAPITAL LETTER L + 0x004d: 0x004d, # LATIN CAPITAL LETTER M + 0x004e: 0x004e, # LATIN CAPITAL LETTER N + 0x004f: 0x004f, # LATIN CAPITAL LETTER O + 0x0050: 0x0050, # LATIN CAPITAL LETTER P + 0x0051: 0x0051, # LATIN CAPITAL LETTER Q + 0x0052: 0x0052, # LATIN CAPITAL LETTER R + 0x0053: 0x0053, # LATIN CAPITAL LETTER S + 0x0054: 0x0054, # LATIN CAPITAL LETTER T + 0x0055: 0x0055, # LATIN CAPITAL LETTER U + 0x0056: 0x0056, # LATIN CAPITAL LETTER V + 0x0057: 0x0057, # LATIN CAPITAL LETTER W + 0x0058: 0x0058, # LATIN CAPITAL LETTER X + 0x0059: 0x0059, # LATIN CAPITAL LETTER Y + 0x005a: 0x005a, # LATIN CAPITAL LETTER Z + 0x005b: 0x005b, # LEFT SQUARE BRACKET + 0x005c: 0x005c, # REVERSE SOLIDUS + 0x005d: 0x005d, # RIGHT SQUARE BRACKET + 0x005e: 0x005e, # CIRCUMFLEX ACCENT + 0x005f: 0x005f, # LOW LINE + 0x0060: 0x0060, # GRAVE ACCENT + 0x0061: 0x0061, # LATIN SMALL LETTER A + 0x0062: 0x0062, # LATIN SMALL LETTER B + 0x0063: 0x0063, # LATIN SMALL LETTER C + 0x0064: 0x0064, # LATIN SMALL LETTER D + 0x0065: 0x0065, # LATIN SMALL LETTER E + 0x0066: 0x0066, # LATIN SMALL LETTER F + 0x0067: 0x0067, # LATIN SMALL LETTER G + 0x0068: 0x0068, # LATIN SMALL LETTER H + 0x0069: 0x0069, # LATIN SMALL LETTER I + 0x006a: 0x006a, # LATIN SMALL LETTER J + 0x006b: 0x006b, # LATIN SMALL LETTER K + 0x006c: 0x006c, # LATIN SMALL LETTER L + 0x006d: 0x006d, # LATIN SMALL LETTER M + 0x006e: 0x006e, # LATIN SMALL LETTER N + 0x006f: 0x006f, # LATIN SMALL LETTER O + 0x0070: 0x0070, # LATIN SMALL LETTER P + 0x0071: 0x0071, # LATIN SMALL LETTER Q + 0x0072: 0x0072, # LATIN SMALL LETTER R + 0x0073: 0x0073, # LATIN SMALL LETTER S + 0x0074: 0x0074, # LATIN SMALL LETTER T + 0x0075: 0x0075, # LATIN SMALL LETTER U + 0x0076: 0x0076, # LATIN SMALL LETTER V + 0x0077: 0x0077, # LATIN SMALL LETTER W + 0x0078: 0x0078, # LATIN SMALL LETTER X + 0x0079: 0x0079, # LATIN SMALL LETTER Y + 0x007a: 0x007a, # LATIN SMALL LETTER Z + 0x007b: 0x007b, # LEFT CURLY BRACKET + 0x007c: 0x007c, # VERTICAL LINE + 0x007d: 0x007d, # RIGHT CURLY BRACKET + 0x007e: 0x007e, # TILDE + 0x007f: 0x007f, # DELETE + 0x0411: 0x0080, # CYRILLIC CAPITAL LETTER BE + 0x0414: 0x0081, # CYRILLIC CAPITAL LETTER DE + 0x0416: 0x0082, # CYRILLIC CAPITAL LETTER GJE + 0x0417: 0x0083, # CYRILLIC CAPITAL LETTER ZE + 0x0418: 0x0084, # CYRILLIC CAPITAL LETTER I + 0x0419: 0x0085, # CYRILLIC CAPITAL LETTER SHORT I + 0x041b: 0x0086, # CYRILLIC CAPITAL LETTER EL + 0x041f: 0x0087, # CYRILLIC CAPITAL LETTER PE + 0x0423: 0x0088, # CYRILLIC CAPITAL LETTER U + 0x0426: 0x0089, # CYRILLIC CAPITAL LETTER TSE + 0x0427: 0x008a, # CYRILLIC CAPITAL LETTER CHE + 0x0428: 0x008b, # CYRILLIC CAPITAL LETTER SHA + 0x0429: 0x008c, # CYRILLIC CAPITAL LETTER SHCHA + 0x042a: 0x008d, # CYRILLIC CAPITAL LETTER HARD SIGN + 0x042b: 0x008e, # CYRILLIC CAPITAL LETTER YERU + 0x042d: 0x008f, # CYRILLIC CAPITAL LETTER E + 0x03b1: 0x0090, # GREEK SMALL LETTER ALPHA + 0x266a: 0x0091, # EIGHTH NOTE + 0x0413: 0x0092, # CYRILLIC CAPITAL LETTER GHE + 0x03c0: 0x0093, # GREEK SMALL LETTER PI + 0x03a3: 0x0094, # GREEK CAPITAL LETTER SIGMA + 0x03c3: 0x0095, # GREEK SMALL LETTER SIGMA + 0x266c: 0x0096, # BEAMED SIXTEENTH NOTES + 0x03c4: 0x0097, # GREEK SMALL LETTER TAU + 0xf0f3: 0x0098, # BELL ICON (not sure) + 0x0398: 0x0099, # GREEK CAPITAL LETTER THETA + 0x03a9: 0x009a, # GREEK CAPITAL LETTER OMEGA + 0x03b4: 0x009b, # GREEK SMALL LETTER DELTA + 0x221e: 0x009c, # INFINITY + 0x2664: 0x009d, # HEAVY BLACK HEART + 0x03b5: 0x009e, # GREEK SMALL LETTER EPSILON + 0x2229: 0x009f, # INTERSECTION + 0x2016: 0x00a0, # DOUBLE VERTICAL LINE + 0x00a1: 0x00a1, # INVERTED EXCLAMATION MARK + 0x00a2: 0x00a2, # CENT SIGN + 0x00a3: 0x00a3, # POUND SIGN + 0x00a4: 0x00a4, # CURRENCY SIGN + 0x00a5: 0x00a5, # YEN SIGN + 0x00a6: 0x00a6, # BROKEN BAR + 0x00a7: 0x00a7, # SECTION SIGN + 0x0192: 0x00a8, # LATIN SMALL LETTER F WITH HOOK + 0x00a9: 0x00a9, # COPYRIGHT SIGN + 0x00aa: 0x00aa, # FEMININE ORDINAL INDICATOR + 0x00ab: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + 0x042e: 0x00ac, # CYRILLIC CAPITAL LETTER YU + 0x042f: 0x00ad, # CYRILLIC CAPITAL LETTER YA + 0x00ae: 0x00ae, # REGISTERED SIGN + 0x2018: 0x00af, # LEFT SINGLE QUOTATION MARK + 0x00b0: 0x00b0, # DEGREE SIGN + 0x00b1: 0x00b1, # PLUS-MINUS SIGN + 0x00b2: 0x00b2, # SUPERSCRIPT TWO + 0x00b3: 0x00b3, # SUPERSCRIPT THREE + 0x2109: 0x00b4, # DEGREE FAHRENHEIT + 0x00b5: 0x00b5, # MICRO SIGN + 0x00b6: 0x00b6, # PILCROW SIGN + 0x00b7: 0x00b7, # MIDDLE DOT + 0x03c9: 0x00b8, # GREEK SMALL LETTER OMEGA + 0x00b9: 0x00b9, # SUPERSCRIPT ONE + 0x00ba: 0x00ba, # MASCULINE ORDINAL INDICATOR + 0x00bb: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + 0x00bc: 0x00bc, # VULGAR FRACTION ONE QUARTER + 0x00bd: 0x00bd, # VULGAR FRACTION ONE HALF + 0x00be: 0x00be, # VULGAR FRACTION THREE QUARTERS + 0x00bf: 0x00bf, # INVERTED QUESTION MARK + 0x00c0: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE + 0x00c1: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE + 0x00c2: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX + 0x00c3: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE + 0x00c4: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS + 0x00c5: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE + 0x00c6: 0x00c6, # LATIN CAPITAL LETTER AE + 0x00c7: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA + 0x00c8: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE + 0x00c9: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE + 0x00ca: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX + 0x00cb: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS + 0x00cc: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE + 0x00cd: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE + 0x00ce: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX + 0x00cf: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS + 0x00d0: 0x00d0, # LATIN CAPITAL LETTER ETH + 0x00d1: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE + 0x00d2: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE + 0x00d3: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE + 0x00d4: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX + 0x00d5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE + 0x00d6: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS + 0x00d7: 0x00d7, # MULTIPLICATION SIGN + 0x0424: 0x00d8, # CYRILLIC CAPITAL LETTER EF + 0x00d9: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE + 0x00da: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE + 0x00db: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX + 0x00dc: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS + 0x00dd: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE + 0x00de: 0x00de, # LATIN CAPITAL LETTER THORN + 0x00df: 0x00df, # LATIN SMALL LETTER SHARP + 0x00e0: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE + 0x00e1: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE + 0x00e2: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX + 0x00e3: 0x00e3, # LATIN SMALL LETTER A WITH TILDE + 0x00e4: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS + 0x00e5: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE + 0x00e6: 0x00e6, # LATIN SMALL LETTER AE + 0x00e7: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA + 0x00e8: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE + 0x00e9: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE + 0x00ea: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX + 0x00eb: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS + 0x00ec: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE + 0x00ed: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE + 0x00ee: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX + 0x00ef: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS + 0x00f0: 0x00f0, # LATIN SMALL LETTER ETH + 0x00f1: 0x00f1, # LATIN SMALL LETTER N WITH TILDE + 0x00f2: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE + 0x00f3: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE + 0x00f4: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX + 0x00f5: 0x00f5, # LATIN SMALL LETTER O WITH TILDE + 0x00f6: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS + 0x00f7: 0x00f7, # DIVISION SIGN + 0x00f8: 0x00f8, # LATIN SMALL LETTER O WITH STROKE + 0x00f9: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE + 0x00fa: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE + 0x00fb: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX + 0x00fc: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS + 0x00fd: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE + 0x00fe: 0x00fe, # LATIN SMALL LETTER THORN + 0x00ff: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS +# Rest of capital cyrillic letters + 0x0410: 0x0041, + 0x0412: 0x0042, + 0x0415: 0x0045, + 0x0401: 0x00cb, + 0x041a: 0x004b, + 0x041c: 0x004d, + 0x041d: 0x0048, + 0x041e: 0x004f, + 0x0420: 0x0050, + 0x0421: 0x0043, + 0x0422: 0x0054, + 0x0425: 0x0058, + 0x042c: 0x0062, +# Small Cyrillc letters + 0x0430: 0x0041, + 0x0431: 0x0080, + 0x0432: 0x0042, + 0x0433: 0x0092, + 0x0434: 0x0081, + 0x0435: 0x0045, + 0x0451: 0x00cb, + 0x0436: 0x0082, + 0x0437: 0x0083, + 0x0438: 0x0084, + 0x0439: 0x0085, + 0x043a: 0x004b, + 0x043b: 0x0086, + 0x043c: 0x004d, + 0x043d: 0x0048, + 0x043e: 0x004f, + 0x043f: 0x0087, + 0x0440: 0x0050, + 0x0441: 0x0043, + 0x0442: 0x0054, + 0x0443: 0x0088, + 0x0444: 0x00d8, + 0x0445: 0x0058, + 0x0446: 0x0089, + 0x0447: 0x008a, + 0x0448: 0x008b, + 0x0449: 0x008c, + 0x044a: 0x008d, + 0x044b: 0x008e, + 0x044c: 0x0062, + 0x044d: 0x008f, + 0x044e: 0x00ac, + 0x044f: 0x00ad +} + +class Codec(codecs.Codec): + + def encode(self,input,errors='strict'): + return codecs.charmap_encode(input,errors,hd44780_encoding_map) + + def decode(self,input,errors='strict'): + pass + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input, final=False): + return codecs.charmap_encode(input,self.errors,hd44780_encoding_map)[0] + +class IncrementalDecoder(codecs.IncrementalDecoder): + pass + +class StreamWriter(Codec,codecs.StreamWriter): + pass + +class StreamReader(Codec,codecs.StreamReader): + pass + +def charset_hd44780(name): + if name == "hd44780-hw": + return codecs.CodecInfo( + name = "hd44780-hw", + encode = Codec().encode, + decode = Codec().decode, + incrementalencoder = IncrementalEncoder, + incrementaldecoder = IncrementalDecoder, + streamreader = StreamReader, + streamwriter = StreamWriter, + ) + else: + return None diff --git a/resources/lib/lcd_codepages.py b/resources/lib/lcd_codepages.py deleted file mode 100644 index c8baa38..0000000 --- a/resources/lib/lcd_codepages.py +++ /dev/null @@ -1,365 +0,0 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012 Team XBMC - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' - -import codecs - -imon_encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x25b6: 0x0010, # BLACK RIGHT-POINTING TRIANGLE - 0x25c0: 0x0011, # BLACK LEFT-POINTING TRIANGLE - 0x201c: 0x0012, # LEFT DOUBLE QUOTATION MARK - 0x201d: 0x0013, # RIGHT DOUBLE QUOTATION MARK - 0x23eb: 0x0014, # BLACK UP-POINTING DOUBLE TRIANGLE - 0x23ec: 0x0015, # BLACK DOWN-POINTING DOUBLE TRIANGLE - 0x2b24: 0x0016, # BLACK LARGE CIRCLE - 0x21b2: 0x0017, # DOWNWARDS ARROW WITH TIP LEFTWARDS - 0x2191: 0x0018, # UPWARDS ARROW - 0x2193: 0x0019, # DOWNWARDS ARROW - 0x2192: 0x001a, # RIGHTWARDS ARROW - 0x2190: 0x001b, # LEFTWARDS ARROW - 0x2264: 0x001c, # LESS-THAN OR EQUAL TO - 0x2265: 0x001d, # GREATER-THAN OR EQUAL TO - 0x25b2: 0x001e, # BLACK UP-POINTING TRIANGLE - 0x25bc: 0x001f, # BLACK DOWN-POINTING TRIANGLE - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x0411: 0x0080, # CYRILLIC CAPITAL LETTER BE - 0x0414: 0x0081, # CYRILLIC CAPITAL LETTER DE - 0x0416: 0x0082, # CYRILLIC CAPITAL LETTER GJE - 0x0417: 0x0083, # CYRILLIC CAPITAL LETTER ZE - 0x0418: 0x0084, # CYRILLIC CAPITAL LETTER I - 0x0419: 0x0085, # CYRILLIC CAPITAL LETTER SHORT I - 0x041b: 0x0086, # CYRILLIC CAPITAL LETTER EL - 0x041f: 0x0087, # CYRILLIC CAPITAL LETTER PE - 0x0423: 0x0088, # CYRILLIC CAPITAL LETTER U - 0x0426: 0x0089, # CYRILLIC CAPITAL LETTER TSE - 0x0427: 0x008a, # CYRILLIC CAPITAL LETTER CHE - 0x0428: 0x008b, # CYRILLIC CAPITAL LETTER SHA - 0x0429: 0x008c, # CYRILLIC CAPITAL LETTER SHCHA - 0x042a: 0x008d, # CYRILLIC CAPITAL LETTER HARD SIGN - 0x042b: 0x008e, # CYRILLIC CAPITAL LETTER YERU - 0x042d: 0x008f, # CYRILLIC CAPITAL LETTER E - 0x03b1: 0x0090, # GREEK SMALL LETTER ALPHA - 0x266a: 0x0091, # EIGHTH NOTE - 0x0413: 0x0092, # CYRILLIC CAPITAL LETTER GHE - 0x03c0: 0x0093, # GREEK SMALL LETTER PI - 0x03a3: 0x0094, # GREEK CAPITAL LETTER SIGMA - 0x03c3: 0x0095, # GREEK SMALL LETTER SIGMA - 0x266c: 0x0096, # BEAMED SIXTEENTH NOTES - 0x03c4: 0x0097, # GREEK SMALL LETTER TAU - 0xf0f3: 0x0098, # BELL ICON (not sure) - 0x0398: 0x0099, # GREEK CAPITAL LETTER THETA - 0x03a9: 0x009a, # GREEK CAPITAL LETTER OMEGA - 0x03b4: 0x009b, # GREEK SMALL LETTER DELTA - 0x221e: 0x009c, # INFINITY - 0x2664: 0x009d, # HEAVY BLACK HEART - 0x03b5: 0x009e, # GREEK SMALL LETTER EPSILON - 0x2229: 0x009f, # INTERSECTION - 0x2016: 0x00a0, # DOUBLE VERTICAL LINE - 0x00a1: 0x00a1, # INVERTED EXCLAMATION MARK - 0x00a2: 0x00a2, # CENT SIGN - 0x00a3: 0x00a3, # POUND SIGN - 0x00a4: 0x00a4, # CURRENCY SIGN - 0x00a5: 0x00a5, # YEN SIGN - 0x00a6: 0x00a6, # BROKEN BAR - 0x00a7: 0x00a7, # SECTION SIGN - 0x0192: 0x00a8, # LATIN SMALL LETTER F WITH HOOK - 0x00a9: 0x00a9, # COPYRIGHT SIGN - 0x00aa: 0x00aa, # FEMININE ORDINAL INDICATOR - 0x00ab: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x042e: 0x00ac, # CYRILLIC CAPITAL LETTER YU - 0x042f: 0x00ad, # CYRILLIC CAPITAL LETTER YA - 0x00ae: 0x00ae, # REGISTERED SIGN - 0x2018: 0x00af, # LEFT SINGLE QUOTATION MARK - 0x00b0: 0x00b0, # DEGREE SIGN - 0x00b1: 0x00b1, # PLUS-MINUS SIGN - 0x00b2: 0x00b2, # SUPERSCRIPT TWO - 0x00b3: 0x00b3, # SUPERSCRIPT THREE - 0x2109: 0x00b4, # DEGREE FAHRENHEIT - 0x00b5: 0x00b5, # MICRO SIGN - 0x00b6: 0x00b6, # PILCROW SIGN - 0x00b7: 0x00b7, # MIDDLE DOT - 0x03c9: 0x00b8, # GREEK SMALL LETTER OMEGA - 0x00b9: 0x00b9, # SUPERSCRIPT ONE - 0x00ba: 0x00ba, # MASCULINE ORDINAL INDICATOR - 0x00bb: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00bc: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00bd: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00be: 0x00be, # VULGAR FRACTION THREE QUARTERS - 0x00bf: 0x00bf, # INVERTED QUESTION MARK - 0x00c0: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE - 0x00c1: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00c2: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00c3: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE - 0x00c4: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x00c5: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x00c6: 0x00c6, # LATIN CAPITAL LETTER AE - 0x00c7: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00c8: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE - 0x00c9: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00ca: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x00cb: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x00cc: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE - 0x00cd: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00ce: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00cf: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS - 0x00d0: 0x00d0, # LATIN CAPITAL LETTER ETH - 0x00d1: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE - 0x00d2: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE - 0x00d3: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00d4: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00d5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE - 0x00d6: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x00d7: 0x00d7, # MULTIPLICATION SIGN - 0x0424: 0x00d8, # CYRILLIC CAPITAL LETTER EF - 0x00d9: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE - 0x00da: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00db: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX - 0x00dc: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00dd: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE - 0x00de: 0x00de, # LATIN CAPITAL LETTER THORN - 0x00df: 0x00df, # LATIN SMALL LETTER SHARP - 0x00e0: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE - 0x00e1: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x00e2: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00e3: 0x00e3, # LATIN SMALL LETTER A WITH TILDE - 0x00e4: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x00e5: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE - 0x00e6: 0x00e6, # LATIN SMALL LETTER AE - 0x00e7: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x00e8: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE - 0x00e9: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x00ea: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x00eb: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS - 0x00ec: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE - 0x00ed: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x00ee: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x00ef: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS - 0x00f0: 0x00f0, # LATIN SMALL LETTER ETH - 0x00f1: 0x00f1, # LATIN SMALL LETTER N WITH TILDE - 0x00f2: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE - 0x00f3: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00f4: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00f5: 0x00f5, # LATIN SMALL LETTER O WITH TILDE - 0x00f6: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x00f7: 0x00f7, # DIVISION SIGN - 0x00f8: 0x00f8, # LATIN SMALL LETTER O WITH STROKE - 0x00f9: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE - 0x00fa: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00fb: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x00fc: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x00fd: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE - 0x00fe: 0x00fe, # LATIN SMALL LETTER THORN - 0x00ff: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS -# Rest of capital cyrillic letters - 0x0410: 0x0041, - 0x0412: 0x0042, - 0x0415: 0x0045, - 0x0401: 0x00cb, - 0x041a: 0x004b, - 0x041c: 0x004d, - 0x041d: 0x0048, - 0x041e: 0x004f, - 0x0420: 0x0050, - 0x0421: 0x0043, - 0x0422: 0x0054, - 0x0425: 0x0058, - 0x042c: 0x0062, -# Small Cyrillc letters - 0x0430: 0x0041, - 0x0431: 0x0080, - 0x0432: 0x0042, - 0x0433: 0x0092, - 0x0434: 0x0081, - 0x0435: 0x0045, - 0x0451: 0x00cb, - 0x0436: 0x0082, - 0x0437: 0x0083, - 0x0438: 0x0084, - 0x0439: 0x0085, - 0x043a: 0x004b, - 0x043b: 0x0086, - 0x043c: 0x004d, - 0x043d: 0x0048, - 0x043e: 0x004f, - 0x043f: 0x0087, - 0x0440: 0x0050, - 0x0441: 0x0043, - 0x0442: 0x0054, - 0x0443: 0x0088, - 0x0444: 0x00d8, - 0x0445: 0x0058, - 0x0446: 0x0089, - 0x0447: 0x008a, - 0x0448: 0x008b, - 0x0449: 0x008c, - 0x044a: 0x008d, - 0x044b: 0x008e, - 0x044c: 0x0062, - 0x044d: 0x008f, - 0x044e: 0x00ac, - 0x044f: 0x00ad -} - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,imon_encoding_map) - - def decode(self,input,errors='strict'): - pass - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,imon_encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - pass - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -def searchcp(name): - if name == 'imon': - return codecs.CodecInfo( - name='imon', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - else: return None - diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 551bf3c..2687457 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -44,7 +44,7 @@ from settings import * from extraicons import * from infolabels import * -from lcd_codepages import * +from charset_hd44780 import * # global functions def log(loglevel, msg): @@ -194,7 +194,7 @@ def Initialize(self): try: log(xbmc.LOGDEBUG, "Registering HD44780-ROM pseudocodepage") - codecs.register(searchcp) + codecs.register(charset_hd44780) self.m_bHaveHD44780Charmap = True except: log(xbmc.LOGERROR, "Failed to register custom HD44780-ROM pseudocodepage, expect problems with alternative charsets!") From 4a155da093024248e04861b536b5ba0e3841f328 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 18 Feb 2013 21:32:07 +0100 Subject: [PATCH 168/337] update credits for original implementation of imon/mdm166a stuff --- resources/lib/lcdproc_extra_imon.py | 2 +- resources/lib/lcdproc_extra_mdm166a.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index 49618a3..8397186 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -4,7 +4,7 @@ Support for extra symbols on SoundGraph iMON LCD displays Copyright (C) 2012 Daniel 'herrnst' Scheller - Original C implementation (C) 2010 theonlychriss@vdr-portal + Original C implementation (C) 2010 Christian Leuschen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py index 25285d4..ba296c6 100644 --- a/resources/lib/lcdproc_extra_mdm166a.py +++ b/resources/lib/lcdproc_extra_mdm166a.py @@ -4,7 +4,7 @@ Support for extra symbols on Futaba/Targa USB mdm166a VFD displays Copyright (C) 2012 Daniel 'herrnst' Scheller - Original C implementation (C) 2010 theonlychriss@vdr-portal + Original C implementation (C) 2010 Christian Leuschen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From b99a55aebef6b7a35f22a32dadd6cba15bd2e4a1 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 23 Feb 2013 12:27:23 +0100 Subject: [PATCH 169/337] changelog update --- changelog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.txt b/changelog.txt index a3e9b15..6bfd43c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,7 @@ 1.3.0 / 2.3.0 +- Alternate charmap selection and HD44780/iMON ROM charset support +1.2.1 / 2.2.1 +- Bugfixes / Credits 1.2.0 / 2.2.0 - Maintain versions for Eden (1.x.x) and Frodo+ (2.x.x) - Support for extra stuff (icons, bars) on supporting displays From 4bcd19c00254b0ac1265ff30b1545eb762c91e0e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 23 Feb 2013 13:19:09 +0100 Subject: [PATCH 170/337] fix variable initialisation (typo) --- resources/lib/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/settings.py b/resources/lib/settings.py index ce30788..e2954ee 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -68,10 +68,10 @@ def settings_initGlobals(): g_hostip = "127.0.0.1" g_hostport = 13666 g_timer = time.time() - g_heartbeat = False + g_heartbeat = False g_scrolldelay = 1 g_scrollmode = "0" - g_settigsChanged = True + g_settingsChanged = True g_dimonscreensaver = False g_dimonshutdown = False g_navtimeout = 3 From 1ab1b7167d789430f32673d5596d80e475e5eebe Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 23 Feb 2013 15:28:46 +0100 Subject: [PATCH 171/337] register hd44780 encoder only if not previously done --- resources/lib/lcdbase.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 2687457..d8d2694 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -193,9 +193,10 @@ def Initialize(self): self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE try: - log(xbmc.LOGDEBUG, "Registering HD44780-ROM pseudocodepage") - codecs.register(charset_hd44780) - self.m_bHaveHD44780Charmap = True + if not self.m_bHaveHD44780Charmap: + log(xbmc.LOGDEBUG, "Registering HD44780-ROM pseudocodepage") + codecs.register(charset_hd44780) + self.m_bHaveHD44780Charmap = True except: log(xbmc.LOGERROR, "Failed to register custom HD44780-ROM pseudocodepage, expect problems with alternative charsets!") From 34f701d1c73f42bc23c6ef49de5dbdcd3599662e Mon Sep 17 00:00:00 2001 From: theonlychriss Date: Mon, 14 Jan 2013 16:49:34 +0100 Subject: [PATCH 172/337] Cleanup of/ease backlight control --- lcdmain.py | 17 --------- resources/language/English/strings.xml | 6 ++- resources/language/German/strings.xml | 6 ++- resources/lib/lcdbase.py | 51 +++++++++++--------------- resources/lib/settings.py | 27 +++++++++++++- resources/settings.xml | 2 + 6 files changed, 57 insertions(+), 52 deletions(-) diff --git a/lcdmain.py b/lcdmain.py index 9ed9c07..a5743d5 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -99,7 +99,6 @@ def getLcdMode(): return ret def process_lcd(): - bBacklightDimmed = False while not xbmc.abortRequested: if handleConnectLCD(): @@ -110,24 +109,8 @@ def process_lcd(): mode = getLcdMode() - if mode == LCD_MODE.LCD_MODE_SCREENSAVER and settings_getDimOnScreensaver() and not bBacklightDimmed: - g_lcdproc.SetBackLight(0) - bBacklightDimmed = True - g_lcdproc.Render(mode, settingsChanged) - # turn the backlight on when leaving screensaver and it was dimmed - if mode != LCD_MODE.LCD_MODE_SCREENSAVER and bBacklightDimmed: - g_lcdproc.SetBackLight(1) - bBacklightDimmed = False - - if mode == LCD_MODE.LCD_MODE_MUSIC or mode == LCD_MODE.LCD_MODE_PVRRADIO: - g_lcdproc.DisableOnPlayback(False, True) - elif mode == LCD_MODE.LCD_MODE_VIDEO or mode == LCD_MODE.LCD_MODE_PVRTV: - g_lcdproc.DisableOnPlayback(True, False) - else: - g_lcdproc.DisableOnPlayback(False, False) - time.sleep(1.0 / float(settings_getRefreshRate())) # refresh after configured rate g_lcdproc.Shutdown(settings_getDimOnShutdown()) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 973c969..ecce05c 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -12,8 +12,10 @@ Backlight - Dim backlight on screensaver - Dim backlight on shutdown + Dim on screensaver + Dim on shutdown + Dim on video playback + Dim on music playback Connection diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml index 20db389..101a3fc 100644 --- a/resources/language/German/strings.xml +++ b/resources/language/German/strings.xml @@ -12,8 +12,10 @@ Beleuchtung - Hintergrundbeleuchtung ausschalten, wenn Bildschirmschoner aktiv - Hintergrundbeleuchtung beim Herunterfahren ausschalten + Ausschalten, wenn Bildschirmschoner aktiv + Beim Herunterfahren ausschalten + Ausschalten, wenn ein Video abgespielt wird + Ausschalten, wenn Musik abgespielt wird Verbindung diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index d8d2694..eaa0713 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -50,12 +50,6 @@ def log(loglevel, msg): xbmc.log("### [%s] - %s" % (__scriptname__,msg,),level=loglevel ) -# enumerations -class DISABLE_ON_PLAY: - DISABLE_ON_PLAY_NONE = 0 - DISABLE_ON_PLAY_VIDEO = 1 - DISABLE_ON_PLAY_MUSIC = 2 - class LCD_MODE: LCD_MODE_GENERAL = 0 LCD_MODE_MUSIC = 1 @@ -87,11 +81,10 @@ class LCD_LINEALIGN: class LcdBase(): def __init__(self): - self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE self.m_timeDisableOnPlayTimer = time.time() self.m_lcdMode = [None] * LCD_MODE.LCD_MODE_MAX self.m_extraBars = [None] * (LCD_EXTRABARS_MAX + 1) - self.m_bDimmedOnPlayback = False + self.m_bCurrentlyDimmed = False self.m_iDimOnPlayDelay = 0 self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! @@ -190,7 +183,6 @@ def ManageLCDXML(self): def Initialize(self): strXMLFile = __lcdxml__ - self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE try: if not self.m_bHaveHD44780Charmap: @@ -237,15 +229,6 @@ def LoadSkin(self, xmlFile): if element.tag == "lcd": # load our settings - # disable on play - disableOnPlay = element.find("disableonplay") - if disableOnPlay != None: - self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE - if str(disableOnPlay.text).find("video") >= 0: - self.m_disableOnPlay += DISABLE_ON_PLAY.DISABLE_ON_PLAY_VIDEO - if str(disableOnPlay.text).find("music") >= 0: - self.m_disableOnPlay += DISABLE_ON_PLAY.DISABLE_ON_PLAY_MUSIC - # disable on play delay self.m_iDimOnPlayDelay = 0 @@ -423,7 +406,6 @@ def LoadMode(self, node, mode): self.m_lcdMode[mode].append(linedescriptor) def Reset(self): - self.m_disableOnPlay = DISABLE_ON_PLAY.DISABLE_ON_PLAY_NONE for i in range(0,LCD_MODE.LCD_MODE_MAX): self.m_lcdMode[i] = [] #clear list @@ -476,25 +458,34 @@ def Render(self, mode, bForce): self.m_strSetLineCmds += self.m_cExtraIcons.GetOutputCommands() self.FlushLines() + + self.SetBacklight(mode) - def DisableOnPlayback(self, playingVideo, playingAudio): - # check if any dimming is requested and matching config - dodim = (playingVideo and (self.m_disableOnPlay & DISABLE_ON_PLAY.DISABLE_ON_PLAY_VIDEO)) or (playingAudio and (self.m_disableOnPlay & DISABLE_ON_PLAY.DISABLE_ON_PLAY_MUSIC)) + def IsDimmingOnMusicAllowed(self, mode): + return (mode == LCD_MODE.LCD_MODE_MUSIC or mode == LCD_MODE.LCD_MODE_PVRRADIO) and settings_getDimOnMusicPlayback() - # if dimrequest matches, check if pause is active (don't dim then) - if dodim: - dodim = dodim and not InfoLabel_IsPlayerPaused() + def IsDimmingOnVideoAllowed(self, mode): + return (mode == LCD_MODE.LCD_MODE_VIDEO or mode == LCD_MODE.LCD_MODE_PVRTV) and settings_getDimOnVideoPlayback() + + def SetBacklight(self, mode): + # dimming display in case screensaver is active or something is being played back (and not paused!) + if mode == LCD_MODE.LCD_MODE_SCREENSAVER and settings_getDimOnScreensaver(): + doDim = True + elif not InfoLabel_IsPlayerPaused() and (self.IsDimmingOnVideoAllowed(mode) or self.IsDimmingOnMusicAllowed(mode)): + doDim = True + else: + doDim = False - if dodim: - if not self.m_bDimmedOnPlayback: + if doDim: + if not self.m_bCurrentlyDimmed: if (self.m_timeDisableOnPlayTimer + self.m_iDimOnPlayDelay) < time.time(): self.SetBackLight(0) - self.m_bDimmedOnPlayback = True + self.m_bCurrentlyDimmed = True else: self.m_timeDisableOnPlayTimer = time.time() - if self.m_bDimmedOnPlayback: + if self.m_bCurrentlyDimmed: self.SetBackLight(1) - self.m_bDimmedOnPlayback = False + self.m_bCurrentlyDimmed = False def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): # make sure output scaling indicators are off when not playing and/or not playing video diff --git a/resources/lib/settings.py b/resources/lib/settings.py index e2954ee..eb0b0ba 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -42,6 +42,8 @@ global g_settingsChanged global g_dimonscreensaver global g_dimonshutdown +global g_dimonvideoplayback +global g_dimonmusicplayback global g_navtimeout global g_refreshrate global g_hideconnpopups @@ -59,6 +61,8 @@ def settings_initGlobals(): global g_settingsChanged global g_dimonscreensaver global g_dimonshutdown + global g_dimonvideoplayback + global g_dimonmusicplayback global g_navtimeout global g_refreshrate global g_hideconnpopups @@ -74,6 +78,8 @@ def settings_initGlobals(): g_settingsChanged = True g_dimonscreensaver = False g_dimonshutdown = False + g_dimonvideoplayback = False + g_dimonmusicplayback = False g_navtimeout = 3 g_refreshrate = 1 g_hideconnpopups = True @@ -114,6 +120,14 @@ def settings_getDimOnShutdown(): global g_dimonshutdown return g_dimonshutdown +def settings_getDimOnVideoPlayback(): + global g_dimonvideoplayback + return g_dimonvideoplayback + +def settings_getDimOnMusicPlayback(): + global g_dimonmusicplayback + return g_dimonmusicplayback + def settings_getNavTimeout(): global g_navtimeout return g_navtimeout @@ -219,6 +233,8 @@ def settings_handleLcdSettings(): global g_settingsChanged global g_dimonscreensaver global g_dimonshutdown + global g_dimonvideoplayback + global g_dimonmusicplayback global g_navtimeout global g_refreshrate global g_hideconnpopups @@ -231,6 +247,8 @@ def settings_handleLcdSettings(): scrollmode = __settings__.getSetting("scrollmode") dimonscreensaver = __settings__.getSetting("dimonscreensaver") == "true" dimonshutdown = __settings__.getSetting("dimonshutdown") == "true" + dimonvideoplayback = __settings__.getSetting("dimonvideoplayback") == "true" + dimonmusicplayback = __settings__.getSetting("dimonmusicplayback") == "true" navtimeout = int(float(string.replace(__settings__.getSetting("navtimeout"), ",", "."))) refreshrate = int(float(string.replace(__settings__.getSetting("refreshrate"), ",", "."))) hideconnpopups = __settings__.getSetting("hideconnpopups") == "true" @@ -252,6 +270,14 @@ def settings_handleLcdSettings(): if g_dimonshutdown != dimonshutdown: g_dimonshutdown = dimonshutdown g_settingsChanged = True + + if g_dimonvideoplayback != dimonvideoplayback: + g_dimonvideoplayback = dimonvideoplayback + g_settingsChanged = True + + if g_dimonmusicplayback != dimonmusicplayback: + g_dimonmusicplayback = dimonmusicplayback + g_settingsChanged = True if g_navtimeout != navtimeout: g_navtimeout = navtimeout @@ -285,4 +311,3 @@ def settings_setup(): settings_handleLcdSettings() return reconnect - diff --git a/resources/settings.xml b/resources/settings.xml index ec3a671..a3e1ac3 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -11,6 +11,8 @@ + + From 69e0939fbeea51b7fc97486c6f412c1aecc607ef Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 23 Feb 2013 14:39:32 +0100 Subject: [PATCH 173/337] put screensaver check into separate function aswell, initialise doDim (makes else-branch unneccesary) --- resources/lib/lcdbase.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index eaa0713..40b7569 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -467,14 +467,17 @@ def IsDimmingOnMusicAllowed(self, mode): def IsDimmingOnVideoAllowed(self, mode): return (mode == LCD_MODE.LCD_MODE_VIDEO or mode == LCD_MODE.LCD_MODE_PVRTV) and settings_getDimOnVideoPlayback() + def IsDimmingOnScreensaverAllowed(self, mode): + return (mode == LCD_MODE.LCD_MODE_SCREENSAVER) and settings_getDimOnScreensaver() + def SetBacklight(self, mode): # dimming display in case screensaver is active or something is being played back (and not paused!) - if mode == LCD_MODE.LCD_MODE_SCREENSAVER and settings_getDimOnScreensaver(): + doDim = False + + if self.IsDimmingOnScreensaverAllowed(mode): doDim = True elif not InfoLabel_IsPlayerPaused() and (self.IsDimmingOnVideoAllowed(mode) or self.IsDimmingOnMusicAllowed(mode)): doDim = True - else: - doDim = False if doDim: if not self.m_bCurrentlyDimmed: From 1e4d25d64d03aad210f8f405371f7c098b041959 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 23 Feb 2013 14:47:06 +0100 Subject: [PATCH 174/337] change ambiguous naming, rename dimming-check methods --- resources/lib/lcdbase.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 40b7569..5ef1514 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -459,24 +459,24 @@ def Render(self, mode, bForce): self.FlushLines() - self.SetBacklight(mode) + self.HandleBacklight(mode) - def IsDimmingOnMusicAllowed(self, mode): + def DoDimOnMusic(self, mode): return (mode == LCD_MODE.LCD_MODE_MUSIC or mode == LCD_MODE.LCD_MODE_PVRRADIO) and settings_getDimOnMusicPlayback() - def IsDimmingOnVideoAllowed(self, mode): + def DoDimOnVideo(self, mode): return (mode == LCD_MODE.LCD_MODE_VIDEO or mode == LCD_MODE.LCD_MODE_PVRTV) and settings_getDimOnVideoPlayback() - def IsDimmingOnScreensaverAllowed(self, mode): + def DoDimOnScreensaver(self, mode): return (mode == LCD_MODE.LCD_MODE_SCREENSAVER) and settings_getDimOnScreensaver() - def SetBacklight(self, mode): + def HandleBacklight(self, mode): # dimming display in case screensaver is active or something is being played back (and not paused!) doDim = False - if self.IsDimmingOnScreensaverAllowed(mode): + if self.DoDimOnScreensaver(mode): doDim = True - elif not InfoLabel_IsPlayerPaused() and (self.IsDimmingOnVideoAllowed(mode) or self.IsDimmingOnMusicAllowed(mode)): + elif not InfoLabel_IsPlayerPaused() and (self.DoDimOnVideo(mode) or self.DoDimOnMusic(mode)): doDim = True if doDim: From 64cc12b9cae105e251579d4a4dc96344a8612ab2 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 23 Feb 2013 15:38:01 +0100 Subject: [PATCH 175/337] reset dim state so backlight gets dimmed upon reload/reconnect again --- resources/lib/lcdbase.py | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 5ef1514..eee49b1 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -198,6 +198,7 @@ def Initialize(self): if not self.LoadSkin(strXMLFile): return False + self.m_bCurrentlyDimmed = False return True def UpdateGUISettings(self): From a5c45c5522b31310995bda4e3bcc57588a75cfa7 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 23 Feb 2013 15:48:18 +0100 Subject: [PATCH 176/337] set backlight state before drawing content (fixes empty display on undim on some hardware like imonlcd) --- resources/lib/lcdbase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index eee49b1..53e565c 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -426,6 +426,8 @@ def Render(self, mode, bForce): outLine = 0 inLine = 0 + self.HandleBacklight(mode) + while (outLine < int(self.GetRows()) and inLine < len(self.m_lcdMode[mode])): #parse the progressbar infolabel by ourselfs! if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS: @@ -459,8 +461,6 @@ def Render(self, mode, bForce): self.m_strSetLineCmds += self.m_cExtraIcons.GetOutputCommands() self.FlushLines() - - self.HandleBacklight(mode) def DoDimOnMusic(self, mode): return (mode == LCD_MODE.LCD_MODE_MUSIC or mode == LCD_MODE.LCD_MODE_PVRRADIO) and settings_getDimOnMusicPlayback() From 348667a5457ede6640c564da730565e8b2015193 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 24 Feb 2013 19:41:00 +0100 Subject: [PATCH 177/337] changelog --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 6bfd43c..e140d9f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,6 @@ 1.3.0 / 2.3.0 - Alternate charmap selection and HD44780/iMON ROM charset support +- Refactored backlight dimming handling and configuration via GUI settings 1.2.1 / 2.2.1 - Bugfixes / Credits 1.2.0 / 2.2.0 From 33cb3c325145b5371c52e26940475be0e2d095fc Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 24 Feb 2013 19:51:17 +0100 Subject: [PATCH 178/337] mode variable not needed anymore, directly pass return of getLcdMode() --- lcdmain.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lcdmain.py b/lcdmain.py index a5743d5..041eba3 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -107,9 +107,7 @@ def process_lcd(): if settingsChanged: g_lcdproc.UpdateGUISettings() - mode = getLcdMode() - - g_lcdproc.Render(mode, settingsChanged) + g_lcdproc.Render(getLcdMode(), settingsChanged) time.sleep(1.0 / float(settings_getRefreshRate())) # refresh after configured rate From baa9b59c0948dad30363b6295ab4ea8afe46fd76 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 25 Feb 2013 20:59:51 +0100 Subject: [PATCH 179/337] get dimonshutdown directly in Shutdown() --- lcdmain.py | 2 +- resources/lib/lcdbase.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lcdmain.py b/lcdmain.py index 041eba3..2b180ee 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -111,7 +111,7 @@ def process_lcd(): time.sleep(1.0 / float(settings_getRefreshRate())) # refresh after configured rate - g_lcdproc.Shutdown(settings_getDimOnShutdown()) + g_lcdproc.Shutdown() def handleConnectLCD(): ret = True diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 53e565c..2aec391 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -410,10 +410,10 @@ def Reset(self): for i in range(0,LCD_MODE.LCD_MODE_MAX): self.m_lcdMode[i] = [] #clear list - def Shutdown(self, bDimOnShutdown): + def Shutdown(self): log(xbmc.LOGNOTICE, "Shutting down") - if bDimOnShutdown: + if settings_getDimOnShutdown(): self.SetBackLight(0) if self.m_cExtraIcons is not None: From 8719114d78a2e6199e9ebadb8cd0485ba3e22cc0 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 25 Feb 2013 21:17:33 +0100 Subject: [PATCH 180/337] make 'disableonplaydelay' a GUI setting as well --- resources/language/English/strings.xml | 1 + resources/language/German/strings.xml | 1 + resources/lib/lcdbase.py | 17 ++--------------- resources/lib/settings.py | 13 +++++++++++++ resources/settings.xml | 1 + 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index ecce05c..f8bf7db 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -16,6 +16,7 @@ Dim on shutdown Dim on video playback Dim on music playback + Dim delay (s) Connection diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml index 101a3fc..01f60f5 100644 --- a/resources/language/German/strings.xml +++ b/resources/language/German/strings.xml @@ -16,6 +16,7 @@ Beim Herunterfahren ausschalten Ausschalten, wenn ein Video abgespielt wird Ausschalten, wenn Musik abgespielt wird + Verzögerung (s) Verbindung diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 2aec391..7b60cdf 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -210,6 +210,8 @@ def UpdateGUISettings(self): self.m_strLCDEncoding = str_charset log(xbmc.LOGDEBUG, "Setting character encoding to %s" % (self.m_strLCDEncoding)) + self.m_iDimOnPlayDelay = settings_getDimDelay() + def LoadSkin(self, xmlFile): self.Reset() bHaveSkin = False @@ -230,21 +232,6 @@ def LoadSkin(self, xmlFile): if element.tag == "lcd": # load our settings - # disable on play delay - self.m_iDimOnPlayDelay = 0 - - disableonplaydelay = element.find("disableonplaydelay") - if disableonplaydelay != None and disableonplaydelay.text != None: - try: - intdelay = int(disableonplaydelay.text) - except ValueError, TypeError: - log(xbmc.LOGERROR, "Value for disableonplaydelay must be integer (got: %s)" % (disableonplaydelay.text)) - else: - if intdelay < 0: - log(xbmc.LOGERROR, "Value %d for disableonplaydelay smaller than zero, ignoring" % (intdelay)) - else: - self.m_iDimOnPlayDelay = intdelay - # apply scrollseparator scrollSeparator = element.find("scrollseparator") if scrollSeparator != None: diff --git a/resources/lib/settings.py b/resources/lib/settings.py index eb0b0ba..c6909bd 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -44,6 +44,7 @@ global g_dimonshutdown global g_dimonvideoplayback global g_dimonmusicplayback +global g_dimdelay global g_navtimeout global g_refreshrate global g_hideconnpopups @@ -63,6 +64,7 @@ def settings_initGlobals(): global g_dimonshutdown global g_dimonvideoplayback global g_dimonmusicplayback + global g_dimdelay global g_navtimeout global g_refreshrate global g_hideconnpopups @@ -80,6 +82,7 @@ def settings_initGlobals(): g_dimonshutdown = False g_dimonvideoplayback = False g_dimonmusicplayback = False + g_dimdelay = 0 g_navtimeout = 3 g_refreshrate = 1 g_hideconnpopups = True @@ -128,6 +131,10 @@ def settings_getDimOnMusicPlayback(): global g_dimonmusicplayback return g_dimonmusicplayback +def settings_getDimDelay(): + global g_dimdelay + return g_dimdelay + def settings_getNavTimeout(): global g_navtimeout return g_navtimeout @@ -235,6 +242,7 @@ def settings_handleLcdSettings(): global g_dimonshutdown global g_dimonvideoplayback global g_dimonmusicplayback + global g_dimdelay global g_navtimeout global g_refreshrate global g_hideconnpopups @@ -249,6 +257,7 @@ def settings_handleLcdSettings(): dimonshutdown = __settings__.getSetting("dimonshutdown") == "true" dimonvideoplayback = __settings__.getSetting("dimonvideoplayback") == "true" dimonmusicplayback = __settings__.getSetting("dimonmusicplayback") == "true" + dimdelay = int(float(string.replace(__settings__.getSetting("dimdelay"), ",", "."))) navtimeout = int(float(string.replace(__settings__.getSetting("navtimeout"), ",", "."))) refreshrate = int(float(string.replace(__settings__.getSetting("refreshrate"), ",", "."))) hideconnpopups = __settings__.getSetting("hideconnpopups") == "true" @@ -278,6 +287,10 @@ def settings_handleLcdSettings(): if g_dimonmusicplayback != dimonmusicplayback: g_dimonmusicplayback = dimonmusicplayback g_settingsChanged = True + + if g_dimdelay != dimdelay: + g_dimdelay = dimdelay + g_settingsChanged = True if g_navtimeout != navtimeout: g_navtimeout = navtimeout diff --git a/resources/settings.xml b/resources/settings.xml index a3e1ac3..a519403 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -13,6 +13,7 @@ + From 9b9fde3167bd080280d7d863aeccda9d19f05b6c Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 25 Feb 2013 21:50:41 +0100 Subject: [PATCH 181/337] beautify dim settings/strings a bit --- resources/language/English/strings.xml | 9 +++++---- resources/language/German/strings.xml | 9 +++++---- resources/settings.xml | 10 ++++++---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index f8bf7db..804868b 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -12,11 +12,12 @@ Backlight - Dim on screensaver + on screensaver Dim on shutdown - Dim on video playback - Dim on music playback - Dim delay (s) + on video/LiveTV playback + on music/radio playback + Delay (s) + Dim/turn off... Connection diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml index 01f60f5..18e311a 100644 --- a/resources/language/German/strings.xml +++ b/resources/language/German/strings.xml @@ -12,11 +12,12 @@ Beleuchtung - Ausschalten, wenn Bildschirmschoner aktiv - Beim Herunterfahren ausschalten - Ausschalten, wenn ein Video abgespielt wird - Ausschalten, wenn Musik abgespielt wird + wenn Bildschirmschoner aktiv + Beim Herunterfahren abdunkeln/abschalten + während Video/LiveTV-Wiedergabe + während Musik/Radio-Wiedergabe Verzögerung (s) + Abdunkeln/Abschalten... Verbindung diff --git a/resources/settings.xml b/resources/settings.xml index a519403..5a80ddd 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -9,11 +9,13 @@ - + + + + + + - - - From 11b8b86c3c232bb155952c72f1d2f6ca2fd47e53 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 25 Feb 2013 22:55:31 +0100 Subject: [PATCH 182/337] force UpdateGUISettings() on Initialize() to properly init vars on re/late-connect --- resources/lib/lcdbase.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 7b60cdf..a669ea8 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -198,6 +198,9 @@ def Initialize(self): if not self.LoadSkin(strXMLFile): return False + # force-update GUI settings + self.UpdateGUISettings() + self.m_bCurrentlyDimmed = False return True From 08f41c37a29f300b5afa8eee11ce6edd4b5c6d00 Mon Sep 17 00:00:00 2001 From: petrovse Date: Wed, 13 Feb 2013 15:25:46 +0300 Subject: [PATCH 183/337] Display WEBCASTING icon --- resources/lib/extraicons.py | 1 + resources/lib/infolabels.py | 14 ++++++++++++++ resources/lib/lcdbase.py | 7 ++++++- resources/lib/lcdproc_extra_imon.py | 4 ++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/resources/lib/extraicons.py b/resources/lib/extraicons.py index 1de8164..21d63f4 100644 --- a/resources/lib/extraicons.py +++ b/resources/lib/extraicons.py @@ -39,6 +39,7 @@ def enum(*sequential, **named): 'LCD_EXTRAICON_WEATHER', 'LCD_EXTRAICON_TV', 'LCD_EXTRAICON_PHOTO', + 'LCD_EXTRAICON_WEBCASTING', 'LCD_EXTRAICON_MUTE', 'LCD_EXTRAICON_REPEAT', 'LCD_EXTRAICON_SHUFFLE', diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 150862c..7514624 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -58,6 +58,12 @@ class WINDOW_IDS: WINDOW_DIALOG_VOLUME_BAR = 10104 WINDOW_DIALOG_KAI_TOAST = 10107 +g_StreamPrefixes = [ \ + "http", "https", "tcp", "udp", "rtp", \ + "sdp", "mms", "mmst", "mmsh", "rtsp", \ + "rtmp", "rtmpt", "rtmpe", "rtmpte", "rtmps" \ +] + global g_InfoLabel_oldMenu global g_InfoLabel_oldSubMenu global g_InfoLabel_navTimer @@ -123,6 +129,14 @@ def InfoLabel_IsPlayingAny(): InfoLabel_IsPlayerForwarding() | InfoLabel_IsPlayerRewinding()) +def InfoLabel_IsInternetStream(): + fname = xbmc.getInfoLabel("Player.Filenameandpath") + for prefix in g_StreamPrefixes: + if fname.find(prefix + "://") == 0: + return True + + return False + def InfoLabel_IsPassthroughAudio(): return xbmc.getCondVisibility("Player.Passthrough") diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index a669ea8..057f995 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -500,6 +500,8 @@ def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): if InfoLabel_PlayingLiveTV(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TV, True) + elif InfoLabel_IsInternetStream(): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_WEBCASTING, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MOVIE, True) @@ -514,7 +516,10 @@ def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUTFIT, True) elif isaudio: - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUSIC, True) + if InfoLabel_IsInternetStream(): + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_WEBCASTING, True) + else: + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUSIC, True) else: # not playing diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index 8397186..7a54ab3 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -200,6 +200,10 @@ def SetIconState(self, icon, state): self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_TOPROW self._SetIconStateDo(IMON_ICONS.ICON_TOP_MUSIC, state) + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_WEBCASTING: + self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_TOPROW + self._SetIconStateDo(IMON_ICONS.ICON_TOP_WEBCASTING, state) + elif icon == LCD_EXTRAICONS.LCD_EXTRAICON_WEATHER: self.m_iOutputValueIcons &= IMON_ICONS.ICON_CLEAR_TOPROW self._SetIconStateDo(IMON_ICONS.ICON_TOP_NEWSWEATHER, state) From 675d447af857b7ebe36d326beee57cde6924b8a7 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 28 Feb 2013 22:25:11 +0100 Subject: [PATCH 184/337] add caching around URI evaluation in InfoLabels_IsInternetStream() to save cycles on lower-end platforms --- resources/lib/infolabels.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 7514624..0770792 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -67,15 +67,21 @@ class WINDOW_IDS: global g_InfoLabel_oldMenu global g_InfoLabel_oldSubMenu global g_InfoLabel_navTimer +global g_InfoLabel_oldFilenameandpath +global g_InfoLabel_CachedFilenameIsStream def InfoLabel_Initialize(): global g_InfoLabel_oldMenu global g_InfoLabel_oldSubMenu global g_InfoLabel_navTimer + global g_InfoLabel_oldFilenameandpath + global g_InfoLabel_CachedFilenameIsStream g_InfoLabel_oldMenu = "" g_InfoLabel_oldSubMenu = "" g_InfoLabel_navTimer = time.time() + g_InfoLabel_oldFilenameandpath = "" + g_InfoLabel_CachedFilenameIsStream = False def InfoLabel_timeToSecs(timeAr): arLen = len(timeAr) @@ -130,12 +136,19 @@ def InfoLabel_IsPlayingAny(): InfoLabel_IsPlayerRewinding()) def InfoLabel_IsInternetStream(): - fname = xbmc.getInfoLabel("Player.Filenameandpath") - for prefix in g_StreamPrefixes: - if fname.find(prefix + "://") == 0: - return True + global g_InfoLabel_oldFilenameandpath + global g_InfoLabel_CachedFilenameIsStream - return False + fname = xbmc.getInfoLabel("Player.Filenameandpath") + if fname != g_InfoLabel_oldFilenameandpath: + g_InfoLabel_oldFilenameandpath = fname + g_InfoLabel_CachedFilenameIsStream = False + print "evaluating if " + fname + " 'IsInternetStream'..." + for prefix in g_StreamPrefixes: + if fname.find(prefix + "://") == 0: + g_InfoLabel_CachedFilenameIsStream = True + + return g_InfoLabel_CachedFilenameIsStream def InfoLabel_IsPassthroughAudio(): return xbmc.getCondVisibility("Player.Passthrough") From fa6f8faae5b4780b9fd9e4292fe4d2444c2bb830 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 25 Feb 2013 22:51:20 +0100 Subject: [PATCH 185/337] get rid of self.tn.get_socket() --- resources/lib/lcdproc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index ec4409d..cdd1d95 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -327,7 +327,7 @@ def Connect(self): return True def CloseSocket(self): - if self.tn.get_socket() != None: + if self.tnsocket: # no pyexceptions, please, we're disconnecting anyway try: # do gracefully disconnect (send directly as we won't get any response on this) @@ -343,7 +343,7 @@ def CloseSocket(self): self.tn = telnetlib.Telnet() def IsConnected(self): - if self.tn.get_socket() == None: + if not self.tnsocket: return False # Ping only every SocketIdleTimeout seconds @@ -357,7 +357,7 @@ def IsConnected(self): return True def SetBackLight(self, iLight): - if self.tn.get_socket() == None: + if not self.tnsocket: return log(xbmc.LOGDEBUG, "Switch Backlight to: " + str(iLight)) @@ -381,7 +381,7 @@ def Stop(self): self.m_bStop = True def Suspend(self): - if self.m_bStop or self.tn.get_socket() == None: + if self.m_bStop or not self.tnsocket: return # Build command to suspend screen @@ -393,7 +393,7 @@ def Suspend(self): self.CloseSocket() def Resume(self): - if self.m_bStop or self.tn.get_socket() == None: + if self.m_bStop or not self.tnsocket: return # Build command to resume screen @@ -497,7 +497,7 @@ def ClearLine(self, iLine): self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"\"\n" % (iLine, iLine, self.m_iColumns, iLine) def SetLine(self, iLine, strLine, dictDescriptor, bForce): - if self.m_bStop or self.tn.get_socket() == None: + if self.m_bStop or not self.tnsocket: return if iLine < 0 or iLine >= int(self.m_iRows): From 828c82032fc4bb491395b355319156edcc595d9f Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 28 Feb 2013 22:49:25 +0100 Subject: [PATCH 186/337] housekeeping --- resources/lib/infolabels.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 0770792..7df3ae8 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -140,10 +140,11 @@ def InfoLabel_IsInternetStream(): global g_InfoLabel_CachedFilenameIsStream fname = xbmc.getInfoLabel("Player.Filenameandpath") + if fname != g_InfoLabel_oldFilenameandpath: g_InfoLabel_oldFilenameandpath = fname g_InfoLabel_CachedFilenameIsStream = False - print "evaluating if " + fname + " 'IsInternetStream'..." + for prefix in g_StreamPrefixes: if fname.find(prefix + "://") == 0: g_InfoLabel_CachedFilenameIsStream = True From 65185e24176ddea892da964ad0a9e542c4f286d0 Mon Sep 17 00:00:00 2001 From: Tigrolefff Date: Sat, 2 Mar 2013 13:52:10 +0400 Subject: [PATCH 187/337] Use XBMC system time instead python's local time --- resources/lib/infolabels.py | 6 ++++++ resources/lib/lcdproc.py | 30 +++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 150862c..3d52f4a 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -96,6 +96,12 @@ def InfoLabel_PlayingLiveTV(): def InfoLabel_PlayingLiveRadio(): return xbmc.getCondVisibility("PVR.IsPlayingRadio") +def InfoLabel_GetSystemTime(format): + cmd = "System.Time" + if len(format): + cmd += "(" + format + ")" + return xbmc.getInfoLabel(cmd) + def InfoLabel_GetPlayerTime(): return xbmc.getInfoLabel("Player.Time") diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index ec4409d..e819c04 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -305,10 +305,14 @@ def Connect(self): self.DetermineExtraSupport() # Set up BigNum values based on display geometry - if self.m_iColumns < 16: - self.m_iBigDigits = 5 + if self.m_iColumns < 13: + self.m_iBigDigits = 0 # No clock + elif self.m_iColumns < 16: # Hack: should be 17, but use 16 for imonlcd + self.m_iBigDigits = 5 # HH:MM elif self.m_iColumns < 20: - self.m_iBigDigits = 7 + self.m_iBigDigits = 7 # H:MM:SS on play, HH:MM on clock + else: + self.m_iBigDigits = 8 # HH:MM:SS except: log(xbmc.LOGERROR,"Connect: Caught exception, aborting.") @@ -411,10 +415,16 @@ def GetBigDigitTime(self): ret = InfoLabel_GetPlayerTime() if ret == "": # no usable timestring, e.g. not playing anything - if self.m_iBigDigits < 8: # return only h:m when display too small - ret = time.strftime("%X")[:5] # %X = locale-based currenttime + ret = InfoLabel_GetSystemTime("hh:mm:ss") + ret = ret.split(" ")[0] # Hack: remove AM/PM + ret = "0" + ret + + if self.m_iBigDigits >= 8: # return h:m:s + ret = ret[-8:] + elif self.m_iBigDigits >= 5: # return h:m when display too small + ret = ret[-8:-3] else: - ret = time.strftime("%X")[:8] + ret = "" return ret @@ -438,8 +448,10 @@ def SetBigDigits(self, strTimeString, bForceUpdate): if strTimeString[i] == ":": self.m_strSetLineCmds += "widget_set xbmc lineBigDigit%i %i 10\n" % (iDigitCount, iOffset) - else: + elif strTimeString[i].isdigit(): self.m_strSetLineCmds += "widget_set xbmc lineBigDigit%i %i %s\n" % (iDigitCount, iOffset, strTimeString[i]) + else: + self.m_strSetLineCmds += "widget_set xbmc lineBigDigit" + str(iDigitCount) + " 0 0\n" if strTimeString[i] == ":": iOffset += 1 @@ -448,10 +460,10 @@ def SetBigDigits(self, strTimeString, bForceUpdate): iDigitCount += 1 - for j in range(i + 2, int(self.m_iBigDigits + 1)): + while iDigitCount <= self.m_iBigDigits: if self.m_strDigits[iDigitCount] != "" or bForceUpdate: self.m_strDigits[iDigitCount] = "" - self.m_strSetLineCmds += "widget_set xbmc lineBigDigit" + str(j) + " 0 0\n" + self.m_strSetLineCmds += "widget_set xbmc lineBigDigit" + str(iDigitCount) + " 0 0\n" iDigitCount += 1 From df142de2237d5d95a72ed031454f096596345de4 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Mar 2013 18:15:54 +0100 Subject: [PATCH 188/337] make time retrieval a bit more compact, refactor abit to not need finishing else --- resources/lib/lcdproc.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 85e7722..e9d7cdf 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -415,16 +415,15 @@ def GetBigDigitTime(self): ret = InfoLabel_GetPlayerTime() if ret == "": # no usable timestring, e.g. not playing anything - ret = InfoLabel_GetSystemTime("hh:mm:ss") - ret = ret.split(" ")[0] # Hack: remove AM/PM - ret = "0" + ret + # apply some split magic for 12h format here, as "hh:mm:ss" + # makes up for format guessing inside XBMC - fix for post-frodo at + # https://github.com/xbmc/xbmc/pull/2321 + strSysTime = "0" + InfoLabel_GetSystemTime("hh:mm:ss").split(" ")[0] if self.m_iBigDigits >= 8: # return h:m:s - ret = ret[-8:] + ret = strSysTime[-8:] elif self.m_iBigDigits >= 5: # return h:m when display too small - ret = ret[-8:-3] - else: - ret = "" + ret = strSysTime[-8:-3] return ret From eec656058ee80d916b1562fcf390d08c53e9ecd1 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 4 Mar 2013 19:36:59 +0100 Subject: [PATCH 189/337] allow 'on' and 'true' as case-insensitive LCD.xml option bools --- resources/lib/lcdbase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 057f995..d0f3fea 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -247,7 +247,7 @@ def LoadSkin(self, xmlFile): progressbarSurroundings = element.find("progressbarsurroundings") if progressbarSurroundings != None: - if str(progressbarSurroundings.text) == "on": + if str(progressbarSurroundings.text).lower() in ["on", "true"]: self.m_bProgressbarSurroundings = True # icontext offset setting @@ -272,7 +272,7 @@ def LoadSkin(self, xmlFile): allowemptylines = element.find("allowemptylines") if allowemptylines != None: - if str(allowemptylines.text) == "on": + if str(allowemptylines.text).lower() in ["on", "true"]: self.m_bAllowEmptyLines = True # extra progress bars From 6f5f08cfcbac6bad13a9fd5bb866d5750c576ea5 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 4 Mar 2013 19:47:43 +0100 Subject: [PATCH 190/337] new option 'disableplayindicatoronpause' disables playing indicator (PLAY icon, spinning disc et al) when playback is paused --- resources/lib/lcdbase.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index d0f3fea..429fc36 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -98,6 +98,7 @@ def __init__(self): self.m_bWasStopped = True self.m_bXMLWarningDisplayed = False self.m_bHaveHD44780Charmap = False + self.m_bDisablePlayIndicatorOnPause = False # @abstractmethod def _concrete_method(self): @@ -275,6 +276,14 @@ def LoadSkin(self, xmlFile): if str(allowemptylines.text).lower() in ["on", "true"]: self.m_bAllowEmptyLines = True + # check for disableplayindicatoronpause setting + self.m_bDisablePlayIndicatorOnPause = False + + disableplayindicatoronpause = element.find("disableplayindicatoronpause") + if disableplayindicatoronpause != None: + if str(disableplayindicatoronpause.text).lower() in ["on", "true"]: + self.m_bDisablePlayIndicatorOnPause = True + # extra progress bars for i in range(1, LCD_EXTRABARS_MAX + 1): extrabar = None @@ -734,7 +743,8 @@ def SetExtraInformation(self): bIsVideo = InfoLabel_PlayingVideo() bIsAudio = InfoLabel_PlayingAudio() - self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING, bPlaying) + self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING, + bPlaying and not (bPaused and self.m_bDisablePlayIndicatorOnPause)) self.SetExtraInfoPlaying(bPlaying, bIsVideo, bIsAudio) self.SetExtraInfoCodecs(bPlaying, bIsVideo, bIsAudio) From d50ec47a2e71a8601bace49fc5c64df245882fe1 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 4 Mar 2013 20:29:52 +0100 Subject: [PATCH 191/337] extrabar-value 'volumehidden' only shows volume extra bar when volume change is active --- resources/lib/lcdbase.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 429fc36..387aab2 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -99,6 +99,7 @@ def __init__(self): self.m_bXMLWarningDisplayed = False self.m_bHaveHD44780Charmap = False self.m_bDisablePlayIndicatorOnPause = False + self.m_bVolumeChangeActive = False # @abstractmethod def _concrete_method(self): @@ -289,7 +290,7 @@ def LoadSkin(self, xmlFile): extrabar = None extrabar = element.find("extrabar%i" % (i)) if extrabar != None: - if str(extrabar.text).strip() in ["progress", "volume", "menu"]: + if str(extrabar.text).strip() in ["progress", "volume", "volumehidden", "menu"]: self.m_extraBars[i] = str(extrabar.text).strip() else: self.m_extraBars[i] = "" @@ -711,8 +712,10 @@ def SetExtraInfoGeneric(self, ispaused): if InfoLabel_WindowIsActive(WINDOW_IDS.WINDOW_DIALOG_VOLUME_BAR): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VOLUME, True) + self.m_bVolumeChangeActive = True else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VOLUME, False) + self.m_bVolumeChangeActive = False if InfoLabel_WindowIsActive(WINDOW_IDS.WINDOW_DIALOG_KAI_TOAST): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ALARM, True) @@ -728,6 +731,11 @@ def SetExtraInfoBars(self, isplaying): self.m_cExtraIcons.SetBar(i, 0) elif self.m_extraBars[i] == "volume": self.m_cExtraIcons.SetBar(i, InfoLabel_GetVolumePercent()) + elif self.m_extraBars[i] == "volumehidden": + if self.m_bVolumeChangeActive: + self.m_cExtraIcons.SetBar(i, InfoLabel_GetVolumePercent()) + else: + self.m_cExtraIcons.SetBar(i, 0) elif self.m_extraBars[i] == "menu": if isplaying: self.m_cExtraIcons.SetBar(i, 0) From 7234eeb9ad2ed76a92d5c8dee1b5c4c91278bccb Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 10 Mar 2013 19:20:16 +0100 Subject: [PATCH 192/337] changelog --- changelog.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index e140d9f..32ecd0c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,8 +1,12 @@ 1.3.0 / 2.3.0 - Alternate charmap selection and HD44780/iMON ROM charset support - Refactored backlight dimming handling and configuration via GUI settings +- Cleaned up and improved TCP/Telnet socket handling +- Indicate internet stream on extraicon-supported displays +- Use XBMC's time for daytime display on BigDigit-mode and thus properly display 12/24h clocks +- Additional "finetuning"-options for extraicon/bar-support 1.2.1 / 2.2.1 -- Bugfixes / Credits +- Bugfixes, Credits, slightly more convenient configuration option bools 1.2.0 / 2.2.0 - Maintain versions for Eden (1.x.x) and Frodo+ (2.x.x) - Support for extra stuff (icons, bars) on supporting displays From dbeb77913a200ba7a0ce20cabfaa1048b5f0fa56 Mon Sep 17 00:00:00 2001 From: petrovse Date: Wed, 13 Mar 2013 18:12:48 +0300 Subject: [PATCH 193/337] Alignment on the center of the big clock --- resources/lib/lcdbase.py | 6 ++++++ resources/lib/lcdproc.py | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 387aab2..6e18089 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -84,6 +84,7 @@ def __init__(self): self.m_timeDisableOnPlayTimer = time.time() self.m_lcdMode = [None] * LCD_MODE.LCD_MODE_MAX self.m_extraBars = [None] * (LCD_EXTRABARS_MAX + 1) + self.m_bCenterBigDigits = False self.m_bCurrentlyDimmed = False self.m_iDimOnPlayDelay = 0 self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 @@ -277,6 +278,11 @@ def LoadSkin(self, xmlFile): if str(allowemptylines.text).lower() in ["on", "true"]: self.m_bAllowEmptyLines = True + centerbigdigits = element.find("centerbigdigits") + if centerbigdigits != None: + if str(centerbigdigits.text).lower() in ["on", "true"]: + self.m_bCenterBigDigits = True + # check for disableplayindicatoronpause setting self.m_bDisablePlayIndicatorOnPause = False diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index e9d7cdf..298ffbd 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -71,6 +71,7 @@ def __init__(self): self.m_iProgressBarLine = -1 self.m_strIconName = "BLOCK_FILLED" self.m_iBigDigits = int(8) # 12:45:78 / colons count as digit + self.m_iOffset = 1 self.m_strSetLineCmds = "" self.m_cExtraIcons = None self.m_vPythonVersion = sys.version_info @@ -438,8 +439,18 @@ def SetBigDigits(self, strTimeString, bForceUpdate): iStringLength = int(len(strTimeString)) + if self.m_bCenterBigDigits: + iColons = strTimeString.count(":") + iWidth = 3 * (iStringLength - iColons) + iColons + iOffset = 1 + max(self.m_iColumns - iWidth, 0) / 2 + if iStringLength > self.m_iBigDigits: iStringOffset = len(strTimeString) - self.m_iBigDigits + iOffset = 1; + + if self.m_iOffset != iOffset: + self.ClearBigDigits() + self.m_iOffset = iOffset for i in range(int(iStringOffset), int(iStringLength)): if self.m_strDigits[iDigitCount] != strTimeString[i] or bForceUpdate: From a4b4a71ef0ff550ac8a0947a683abcd9bded0a48 Mon Sep 17 00:00:00 2001 From: petrovse Date: Sun, 24 Mar 2013 12:56:35 +0300 Subject: [PATCH 194/337] Use sendall instead send --- resources/lib/lcdproc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 298ffbd..cb57440 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -94,7 +94,7 @@ def SendCommand(self, strCmd, bCheckRet): try: # Send to server via raw socket to prevent telnetlib tampering with # certain chars (especially 0xFF -> telnet IAC) - self.tnsocket.send(sendcmd) + self.tnsocket.sendall(sendcmd) except: # Something bad happened, abort log(xbmc.LOGERROR, "SendCommand: Telnet exception - send") From 2872979ed9e352599ab40407780ba2f7c942989a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 27 Mar 2013 21:15:56 +0100 Subject: [PATCH 195/337] tidy up var initialisation a bit for readability --- resources/lib/lcdbase.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 6e18089..743dbe9 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -81,26 +81,29 @@ class LCD_LINEALIGN: class LcdBase(): def __init__(self): - self.m_timeDisableOnPlayTimer = time.time() + # configuration vars (from LCD.xml) self.m_lcdMode = [None] * LCD_MODE.LCD_MODE_MAX self.m_extraBars = [None] * (LCD_EXTRABARS_MAX + 1) + self.m_bAllowEmptyLines = False self.m_bCenterBigDigits = False - self.m_bCurrentlyDimmed = False - self.m_iDimOnPlayDelay = 0 - self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 - self.m_strLCDEncoding = "iso-8859-1" # LCDproc wants iso-8859-1! - self.m_strScrollSeparator = " " + self.m_bDisablePlayIndicatorOnPause = False self.m_bProgressbarSurroundings = False + self.m_iDimOnPlayDelay = 0 self.m_iIconTextOffset = 2 - self.m_bAllowEmptyLines = False - self.m_strOldVideoCodec = "" - self.m_strOldAudioCodec = "" - self.m_iOldAudioChannelsVar = 0 - self.m_bWasStopped = True - self.m_bXMLWarningDisplayed = False + self.m_strLCDEncoding = "iso-8859-1" # LCDproc default is iso-8859-1! + self.m_strScrollSeparator = " " + + # runtime vars/state tracking + self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 + self.m_timeDisableOnPlayTimer = time.time() + self.m_bCurrentlyDimmed = False self.m_bHaveHD44780Charmap = False - self.m_bDisablePlayIndicatorOnPause = False self.m_bVolumeChangeActive = False + self.m_bWasStopped = True + self.m_bXMLWarningDisplayed = False + self.m_iOldAudioChannelsVar = 0 + self.m_strOldAudioCodec = "" + self.m_strOldVideoCodec = "" # @abstractmethod def _concrete_method(self): From 454be7050d8bc56fe5e3ae1ca3a5339cc35403e9 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 27 Mar 2013 21:30:43 +0100 Subject: [PATCH 196/337] unduplicate code --- resources/lib/lcdproc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index cb57440..14bcf6c 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -253,16 +253,17 @@ def DetermineExtraSupport(self): if re.match(rematch_imon, reply): log(xbmc.LOGNOTICE, "SoundGraph iMON LCD detected") self.m_cExtraIcons = LCDproc_extra_imon() - self.m_cExtraIcons.Initialize() elif re.match(rematch_mdm166a, reply): log(xbmc.LOGNOTICE, "Futaba/Targa USB mdm166a VFD detected") self.m_cExtraIcons = LCDproc_extra_mdm166a() - self.m_cExtraIcons.Initialize() elif re.match(rematch_imonvfd, reply): log(xbmc.LOGNOTICE, "SoundGraph iMON IR/VFD detected") + if self.m_cExtraIcons is not None: + self.m_cExtraIcons.Initialize() + except: pass From 77c0ae63594f5fd2bd57c1a662416968470e9422 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 27 Mar 2013 21:39:26 +0100 Subject: [PATCH 197/337] housekeeping --- resources/lib/lcdbase.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 743dbe9..925ccee 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -281,6 +281,9 @@ def LoadSkin(self, xmlFile): if str(allowemptylines.text).lower() in ["on", "true"]: self.m_bAllowEmptyLines = True + # check for centerbigdigits setting + self.m_bCenterBigDigits = False + centerbigdigits = element.find("centerbigdigits") if centerbigdigits != None: if str(centerbigdigits.text).lower() in ["on", "true"]: From 9b9d1e67cd974fcc6e227f5b86053513fcf320c4 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 27 Mar 2013 22:31:50 +0100 Subject: [PATCH 198/337] infolabels: interface function for getCondVidibility(), move getters more to the top, consistently make use of getters --- resources/lib/infolabels.py | 57 +++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 76b6bda..0a5625b 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -83,6 +83,15 @@ def InfoLabel_Initialize(): g_InfoLabel_oldFilenameandpath = "" g_InfoLabel_CachedFilenameIsStream = False +def InfoLabel_GetInfoLabel(strLabel): + return xbmc.getInfoLabel(strLabel) + +def InfoLabel_GetBool(strBool): + return xbmc.getCondVisibility(strBool) + +def InfoLabel_GetActiveWindowID(): + return int(xbmcgui.getCurrentWindowId()) + def InfoLabel_timeToSecs(timeAr): arLen = len(timeAr) if arLen == 1: @@ -94,46 +103,43 @@ def InfoLabel_timeToSecs(timeAr): return currentSecs def InfoLabel_WindowIsActive(WindowID): - return xbmc.getCondVisibility("Window.IsActive(" + str(WindowID) + ")") + return InfoLabel_GetBool("Window.IsActive(" + str(WindowID) + ")") def InfoLabel_PlayingVideo(): - return xbmc.getCondVisibility("Player.HasVideo") + return InfoLabel_GetBool("Player.HasVideo") def InfoLabel_PlayingAudio(): - return xbmc.getCondVisibility("Player.HasAudio") + return InfoLabel_GetBool("Player.HasAudio") def InfoLabel_PlayingLiveTV(): - return xbmc.getCondVisibility("PVR.IsPlayingTV") + return InfoLabel_GetBool("PVR.IsPlayingTV") def InfoLabel_PlayingLiveRadio(): - return xbmc.getCondVisibility("PVR.IsPlayingRadio") + return InfoLabel_GetBool("PVR.IsPlayingRadio") def InfoLabel_GetSystemTime(format): cmd = "System.Time" if len(format): cmd += "(" + format + ")" - return xbmc.getInfoLabel(cmd) + return InfoLabel_GetInfoLabel(cmd) def InfoLabel_GetPlayerTime(): - return xbmc.getInfoLabel("Player.Time") + return InfoLabel_GetInfoLabel("Player.Time") def InfoLabel_GetPlayerDuration(): - return xbmc.getInfoLabel("Player.Duration") - -def InfoLabel_GetActiveWindowID(): - return int(xbmcgui.getCurrentWindowId()) + return InfoLabel_GetInfoLabel("Player.Duration") def InfoLabel_IsPlayerPlaying(): - return xbmc.getCondVisibility("Player.Playing") + return InfoLabel_GetBool("Player.Playing") def InfoLabel_IsPlayerPaused(): - return xbmc.getCondVisibility("Player.Paused") + return InfoLabel_GetBool("Player.Paused") def InfoLabel_IsPlayerForwarding(): - return xbmc.getCondVisibility("Player.Forwarding") + return InfoLabel_GetBool("Player.Forwarding") def InfoLabel_IsPlayerRewinding(): - return xbmc.getCondVisibility("Player.Rewinding") + return InfoLabel_GetBool("Player.Rewinding") def InfoLabel_IsPlayingAny(): return (InfoLabel_IsPlayerPlaying() | @@ -145,7 +151,7 @@ def InfoLabel_IsInternetStream(): global g_InfoLabel_oldFilenameandpath global g_InfoLabel_CachedFilenameIsStream - fname = xbmc.getInfoLabel("Player.Filenameandpath") + fname = InfoLabel_GetInfoLabel("Player.Filenameandpath") if fname != g_InfoLabel_oldFilenameandpath: g_InfoLabel_oldFilenameandpath = fname @@ -158,34 +164,31 @@ def InfoLabel_IsInternetStream(): return g_InfoLabel_CachedFilenameIsStream def InfoLabel_IsPassthroughAudio(): - return xbmc.getCondVisibility("Player.Passthrough") + return InfoLabel_GetBool("Player.Passthrough") def InfoLabel_IsPVRRecording(): - return xbmc.getCondVisibility("PVR.IsRecording") + return InfoLabel_GetBool("PVR.IsRecording") def InfoLabel_IsPlaylistRandom(): - return xbmc.getCondVisibility("Playlist.IsRandom") + return InfoLabel_GetBool("Playlist.IsRandom") def InfoLabel_IsPlaylistRepeatAll(): - return xbmc.getCondVisibility("Playlist.IsRepeat") + return InfoLabel_GetBool("Playlist.IsRepeat") def InfoLabel_IsPlaylistRepeatOne(): - return xbmc.getCondVisibility("Playlist.IsRepeatOne") + return InfoLabel_GetBool("Playlist.IsRepeatOne") def InfoLabel_IsPlaylistRepeatAny(): return (InfoLabel_IsPlaylistRepeatAll() | InfoLabel_IsPlaylistRepeatOne()) def InfoLabel_IsDiscInDrive(): - return xbmc.getCondVisibility("System.HasMediaDVD") + return InfoLabel_GetBool("System.HasMediaDVD") def InfoLabel_IsScreenSaverActive(): - return xbmc.getCondVisibility("System.ScreenSaverActive") - -def InfoLabel_GetInfoLabel(strLabel): - return xbmc.getInfoLabel(strLabel) + return InfoLabel_GetBool("System.ScreenSaverActive") def InfoLabel_GetVolumePercent(): - volumedb = float(string.replace(string.replace(xbmc.getInfoLabel("Player.Volume"), ",", "."), " dB", "")) + volumedb = float(string.replace(string.replace(InfoLabel_GetInfoLabel("Player.Volume"), ",", "."), " dB", "")) return (100 * (60.0 + volumedb) / 60) def InfoLabel_GetPlayerTimeSecs(): From c1402f110ef6530a677a816ccc4e9944d2a422f4 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 7 Apr 2013 22:47:10 +0200 Subject: [PATCH 199/337] provide "alwayson" option for extrabars --- resources/lib/lcdbase.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 925ccee..92bf5d7 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -302,7 +302,7 @@ def LoadSkin(self, xmlFile): extrabar = None extrabar = element.find("extrabar%i" % (i)) if extrabar != None: - if str(extrabar.text).strip() in ["progress", "volume", "volumehidden", "menu"]: + if str(extrabar.text).strip() in ["progress", "volume", "volumehidden", "menu", "alwayson"]: self.m_extraBars[i] = str(extrabar.text).strip() else: self.m_extraBars[i] = "" @@ -753,6 +753,8 @@ def SetExtraInfoBars(self, isplaying): self.m_cExtraIcons.SetBar(i, 0) else: self.m_cExtraIcons.SetBar(i, 100) + elif self.m_extraBars[i] == "alwayson": + self.m_cExtraIcons.SetBar(i, 100) else: self.m_cExtraIcons.SetBar(i, 0) From e87a718cb5e98f5f849a030276b111590d5d7601 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 22 Apr 2013 22:24:26 +0200 Subject: [PATCH 200/337] cleanup reconnect conditional and improve code readability --- lcdmain.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lcdmain.py b/lcdmain.py index 2b180ee..6b813cc 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -121,12 +121,10 @@ def handleConnectLCD(): #check for new settings if settings_checkForNewSettings() or not g_lcdproc.IsConnected(): #networksettings changed? g_failedConnectionNotified = False #reset notification flag - else: - return True - ret = g_lcdproc.Initialize() - if not settings_getHideConnPopups(): - HandleConnectionNotification(ret) + ret = g_lcdproc.Initialize() + if not settings_getHideConnPopups(): + HandleConnectionNotification(ret) return ret From 2bf7891a9572909057daa5f8d7eb370255b5d223 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 21 Apr 2013 21:43:06 +0200 Subject: [PATCH 201/337] add support for differing A00 and A02 charset variants for HD44780 ROM/custom encoder, map some polish (latin-enhanced A) chars --- changelog.txt | 2 +- resources/language/English/strings.xml | 3 +- resources/language/German/strings.xml | 3 +- resources/lib/charset_hd44780.py | 356 ++------------------- resources/lib/charset_map_hd44780_a00.py | 301 ++++++++++++++++++ resources/lib/charset_map_hd44780_a02.py | 387 +++++++++++++++++++++++ resources/lib/lcdbase.py | 4 +- resources/lib/settings.py | 4 +- resources/settings.xml | 2 +- 9 files changed, 733 insertions(+), 329 deletions(-) create mode 100644 resources/lib/charset_map_hd44780_a00.py create mode 100644 resources/lib/charset_map_hd44780_a02.py diff --git a/changelog.txt b/changelog.txt index 32ecd0c..2a10ed9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,5 @@ 1.3.0 / 2.3.0 -- Alternate charmap selection and HD44780/iMON ROM charset support +- Alternate charmap selection, support for HD44780/iMON ROM (A00 and A02 variants) charsets - Refactored backlight dimming handling and configuration via GUI settings - Cleaned up and improved TCP/Telnet socket handling - Indicate internet stream on extraicon-supported displays diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 804868b..3574933 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -37,7 +37,8 @@ KOI8-R CP1251 ISO8859-5 - HD44780-ROM + HD44780-ROM A00 + HD44780-ROM A02 Failed to connect to LCDProc! diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml index 18e311a..d5c8bed 100644 --- a/resources/language/German/strings.xml +++ b/resources/language/German/strings.xml @@ -37,7 +37,8 @@ KOI8-R CP1251 ISO8859-5 - HD44780-ROM + HD44780-ROM A00 + HD44780-ROM A02 Fehler beim Verbinden zu LCDproc! diff --git a/resources/lib/charset_hd44780.py b/resources/lib/charset_hd44780.py index d0a8ab2..869d2d5 100644 --- a/resources/lib/charset_hd44780.py +++ b/resources/lib/charset_hd44780.py @@ -21,345 +21,57 @@ ''' import codecs +from charset_map_hd44780_a00 import * +from charset_map_hd44780_a02 import * -hd44780_encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x25b6: 0x0010, # BLACK RIGHT-POINTING TRIANGLE - 0x25c0: 0x0011, # BLACK LEFT-POINTING TRIANGLE - 0x201c: 0x0012, # LEFT DOUBLE QUOTATION MARK - 0x201d: 0x0013, # RIGHT DOUBLE QUOTATION MARK - 0x23eb: 0x0014, # BLACK UP-POINTING DOUBLE TRIANGLE - 0x23ec: 0x0015, # BLACK DOWN-POINTING DOUBLE TRIANGLE - 0x2b24: 0x0016, # BLACK LARGE CIRCLE - 0x21b2: 0x0017, # DOWNWARDS ARROW WITH TIP LEFTWARDS - 0x2191: 0x0018, # UPWARDS ARROW - 0x2193: 0x0019, # DOWNWARDS ARROW - 0x2192: 0x001a, # RIGHTWARDS ARROW - 0x2190: 0x001b, # LEFTWARDS ARROW - 0x2264: 0x001c, # LESS-THAN OR EQUAL TO - 0x2265: 0x001d, # GREATER-THAN OR EQUAL TO - 0x25b2: 0x001e, # BLACK UP-POINTING TRIANGLE - 0x25bc: 0x001f, # BLACK DOWN-POINTING TRIANGLE - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x0411: 0x0080, # CYRILLIC CAPITAL LETTER BE - 0x0414: 0x0081, # CYRILLIC CAPITAL LETTER DE - 0x0416: 0x0082, # CYRILLIC CAPITAL LETTER GJE - 0x0417: 0x0083, # CYRILLIC CAPITAL LETTER ZE - 0x0418: 0x0084, # CYRILLIC CAPITAL LETTER I - 0x0419: 0x0085, # CYRILLIC CAPITAL LETTER SHORT I - 0x041b: 0x0086, # CYRILLIC CAPITAL LETTER EL - 0x041f: 0x0087, # CYRILLIC CAPITAL LETTER PE - 0x0423: 0x0088, # CYRILLIC CAPITAL LETTER U - 0x0426: 0x0089, # CYRILLIC CAPITAL LETTER TSE - 0x0427: 0x008a, # CYRILLIC CAPITAL LETTER CHE - 0x0428: 0x008b, # CYRILLIC CAPITAL LETTER SHA - 0x0429: 0x008c, # CYRILLIC CAPITAL LETTER SHCHA - 0x042a: 0x008d, # CYRILLIC CAPITAL LETTER HARD SIGN - 0x042b: 0x008e, # CYRILLIC CAPITAL LETTER YERU - 0x042d: 0x008f, # CYRILLIC CAPITAL LETTER E - 0x03b1: 0x0090, # GREEK SMALL LETTER ALPHA - 0x266a: 0x0091, # EIGHTH NOTE - 0x0413: 0x0092, # CYRILLIC CAPITAL LETTER GHE - 0x03c0: 0x0093, # GREEK SMALL LETTER PI - 0x03a3: 0x0094, # GREEK CAPITAL LETTER SIGMA - 0x03c3: 0x0095, # GREEK SMALL LETTER SIGMA - 0x266c: 0x0096, # BEAMED SIXTEENTH NOTES - 0x03c4: 0x0097, # GREEK SMALL LETTER TAU - 0xf0f3: 0x0098, # BELL ICON (not sure) - 0x0398: 0x0099, # GREEK CAPITAL LETTER THETA - 0x03a9: 0x009a, # GREEK CAPITAL LETTER OMEGA - 0x03b4: 0x009b, # GREEK SMALL LETTER DELTA - 0x221e: 0x009c, # INFINITY - 0x2664: 0x009d, # HEAVY BLACK HEART - 0x03b5: 0x009e, # GREEK SMALL LETTER EPSILON - 0x2229: 0x009f, # INTERSECTION - 0x2016: 0x00a0, # DOUBLE VERTICAL LINE - 0x00a1: 0x00a1, # INVERTED EXCLAMATION MARK - 0x00a2: 0x00a2, # CENT SIGN - 0x00a3: 0x00a3, # POUND SIGN - 0x00a4: 0x00a4, # CURRENCY SIGN - 0x00a5: 0x00a5, # YEN SIGN - 0x00a6: 0x00a6, # BROKEN BAR - 0x00a7: 0x00a7, # SECTION SIGN - 0x0192: 0x00a8, # LATIN SMALL LETTER F WITH HOOK - 0x00a9: 0x00a9, # COPYRIGHT SIGN - 0x00aa: 0x00aa, # FEMININE ORDINAL INDICATOR - 0x00ab: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x042e: 0x00ac, # CYRILLIC CAPITAL LETTER YU - 0x042f: 0x00ad, # CYRILLIC CAPITAL LETTER YA - 0x00ae: 0x00ae, # REGISTERED SIGN - 0x2018: 0x00af, # LEFT SINGLE QUOTATION MARK - 0x00b0: 0x00b0, # DEGREE SIGN - 0x00b1: 0x00b1, # PLUS-MINUS SIGN - 0x00b2: 0x00b2, # SUPERSCRIPT TWO - 0x00b3: 0x00b3, # SUPERSCRIPT THREE - 0x2109: 0x00b4, # DEGREE FAHRENHEIT - 0x00b5: 0x00b5, # MICRO SIGN - 0x00b6: 0x00b6, # PILCROW SIGN - 0x00b7: 0x00b7, # MIDDLE DOT - 0x03c9: 0x00b8, # GREEK SMALL LETTER OMEGA - 0x00b9: 0x00b9, # SUPERSCRIPT ONE - 0x00ba: 0x00ba, # MASCULINE ORDINAL INDICATOR - 0x00bb: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00bc: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00bd: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00be: 0x00be, # VULGAR FRACTION THREE QUARTERS - 0x00bf: 0x00bf, # INVERTED QUESTION MARK - 0x00c0: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE - 0x00c1: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00c2: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00c3: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE - 0x00c4: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x00c5: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x00c6: 0x00c6, # LATIN CAPITAL LETTER AE - 0x00c7: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00c8: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE - 0x00c9: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00ca: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x00cb: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x00cc: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE - 0x00cd: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00ce: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00cf: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS - 0x00d0: 0x00d0, # LATIN CAPITAL LETTER ETH - 0x00d1: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE - 0x00d2: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE - 0x00d3: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00d4: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00d5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE - 0x00d6: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x00d7: 0x00d7, # MULTIPLICATION SIGN - 0x0424: 0x00d8, # CYRILLIC CAPITAL LETTER EF - 0x00d9: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE - 0x00da: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00db: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX - 0x00dc: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00dd: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE - 0x00de: 0x00de, # LATIN CAPITAL LETTER THORN - 0x00df: 0x00df, # LATIN SMALL LETTER SHARP - 0x00e0: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE - 0x00e1: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x00e2: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00e3: 0x00e3, # LATIN SMALL LETTER A WITH TILDE - 0x00e4: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x00e5: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE - 0x00e6: 0x00e6, # LATIN SMALL LETTER AE - 0x00e7: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x00e8: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE - 0x00e9: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x00ea: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x00eb: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS - 0x00ec: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE - 0x00ed: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x00ee: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x00ef: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS - 0x00f0: 0x00f0, # LATIN SMALL LETTER ETH - 0x00f1: 0x00f1, # LATIN SMALL LETTER N WITH TILDE - 0x00f2: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE - 0x00f3: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00f4: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00f5: 0x00f5, # LATIN SMALL LETTER O WITH TILDE - 0x00f6: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x00f7: 0x00f7, # DIVISION SIGN - 0x00f8: 0x00f8, # LATIN SMALL LETTER O WITH STROKE - 0x00f9: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE - 0x00fa: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00fb: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x00fc: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x00fd: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE - 0x00fe: 0x00fe, # LATIN SMALL LETTER THORN - 0x00ff: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS -# Rest of capital cyrillic letters - 0x0410: 0x0041, - 0x0412: 0x0042, - 0x0415: 0x0045, - 0x0401: 0x00cb, - 0x041a: 0x004b, - 0x041c: 0x004d, - 0x041d: 0x0048, - 0x041e: 0x004f, - 0x0420: 0x0050, - 0x0421: 0x0043, - 0x0422: 0x0054, - 0x0425: 0x0058, - 0x042c: 0x0062, -# Small Cyrillc letters - 0x0430: 0x0041, - 0x0431: 0x0080, - 0x0432: 0x0042, - 0x0433: 0x0092, - 0x0434: 0x0081, - 0x0435: 0x0045, - 0x0451: 0x00cb, - 0x0436: 0x0082, - 0x0437: 0x0083, - 0x0438: 0x0084, - 0x0439: 0x0085, - 0x043a: 0x004b, - 0x043b: 0x0086, - 0x043c: 0x004d, - 0x043d: 0x0048, - 0x043e: 0x004f, - 0x043f: 0x0087, - 0x0440: 0x0050, - 0x0441: 0x0043, - 0x0442: 0x0054, - 0x0443: 0x0088, - 0x0444: 0x00d8, - 0x0445: 0x0058, - 0x0446: 0x0089, - 0x0447: 0x008a, - 0x0448: 0x008b, - 0x0449: 0x008c, - 0x044a: 0x008d, - 0x044b: 0x008e, - 0x044c: 0x0062, - 0x044d: 0x008f, - 0x044e: 0x00ac, - 0x044f: 0x00ad -} +class HD44780_Codec(codecs.Codec): -class Codec(codecs.Codec): + def encode_a00(self,input,errors='strict'): + return codecs.charmap_encode(input,errors,encmap_hd44780_a00) - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,hd44780_encoding_map) + def encode_a02(self,input,errors='strict'): + return codecs.charmap_encode(input,errors,encmap_hd44780_a02) def decode(self,input,errors='strict'): pass -class IncrementalEncoder(codecs.IncrementalEncoder): +class HD44780_IncrementalEncoder_a00(codecs.IncrementalEncoder): def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,hd44780_encoding_map)[0] + return codecs.charmap_encode(input,self.errors,encmap_hd44780_a00)[0] -class IncrementalDecoder(codecs.IncrementalDecoder): +class HD44780_IncrementalEncoder_a02(codecs.IncrementalEncoder): + def encode(self, input, final=False): + return codecs.charmap_encode(input,self.errors,encmap_hd44780_a02)[0] + +class HD44780_IncrementalDecoder(codecs.IncrementalDecoder): pass -class StreamWriter(Codec,codecs.StreamWriter): +class HD44780_StreamWriter(HD44780_Codec,codecs.StreamWriter): pass -class StreamReader(Codec,codecs.StreamReader): +class HD44780_StreamReader(HD44780_Codec,codecs.StreamReader): pass def charset_hd44780(name): - if name == "hd44780-hw": + if name == "hd44780-a00": + return codecs.CodecInfo( + name = "hd44780-a00", + encode = HD44780_Codec().encode_a00, + decode = HD44780_Codec().decode, + incrementalencoder = HD44780_IncrementalEncoder_a00, + incrementaldecoder = HD44780_IncrementalDecoder, + streamreader = HD44780_StreamReader, + streamwriter = HD44780_StreamWriter, + ) + elif name == "hd44780-a02": return codecs.CodecInfo( - name = "hd44780-hw", - encode = Codec().encode, - decode = Codec().decode, - incrementalencoder = IncrementalEncoder, - incrementaldecoder = IncrementalDecoder, - streamreader = StreamReader, - streamwriter = StreamWriter, + name = "hd44780-a02", + encode = HD44780_Codec().encode_a02, + decode = HD44780_Codec().decode, + incrementalencoder = HD44780_IncrementalEncoder_a02, + incrementaldecoder = HD44780_IncrementalDecoder, + streamreader = HD44780_StreamReader, + streamwriter = HD44780_StreamWriter, ) else: return None diff --git a/resources/lib/charset_map_hd44780_a00.py b/resources/lib/charset_map_hd44780_a00.py new file mode 100644 index 0000000..9a8bb97 --- /dev/null +++ b/resources/lib/charset_map_hd44780_a00.py @@ -0,0 +1,301 @@ +''' + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +encmap_hd44780_a00 = { + 0x0000: 0x0000, # NULL + # 0x0001: 0x0001, # START OF HEADING + # 0x0002: 0x0002, # START OF TEXT + # 0x0003: 0x0003, # END OF TEXT + # 0x0004: 0x0004, # END OF TRANSMISSION + # 0x0005: 0x0005, # ENQUIRY + # 0x0006: 0x0006, # ACKNOWLEDGE + # 0x0007: 0x0007, # BELL + # 0x0008: 0x0008, # BACKSPACE + # 0x0009: 0x0009, # HORIZONTAL TABULATION + # 0x000a: 0x000a, # LINE FEED + # 0x000b: 0x000b, # VERTICAL TABULATION + # 0x000c: 0x000c, # FORM FEED + # 0x000d: 0x000d, # CARRIAGE RETURN + # 0x000e: 0x000e, # SHIFT OUT + # 0x000f: 0x000f, # SHIFT IN + # 0x0010: 0x0010, # DATA LINK ESCAPE + # 0x0011: 0x0011, # DEVICE CONTROL ONE + # 0x0012: 0x0012, # DEVICE CONTROL TWO + # 0x0013: 0x0013, # DEVICE CONTROL THREE + # 0x0014: 0x0014, # DEVICE CONTROL FOUR + # 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE + # 0x0016: 0x0016, # SYNCHRONOUS IDLE + # 0x0017: 0x0017, # END OF TRANSMISSION BLOCK + # 0x0018: 0x0018, # CANCEL + # 0x0019: 0x0019, # END OF MEDIUM + # 0x001a: 0x001a, # SUBSTITUTE + # 0x001b: 0x001b, # ESCAPE + # 0x001c: 0x001c, # INFORMATION SEPARATOR FOUR + # 0x001d: 0x001d, # INFORMATION SEPARATOR THREE + # 0x001e: 0x001e, # INFORMATION SEPARATOR TWO + # 0x001f: 0x001f, # INFORMATION SEPARATOR ONE + 0x0020: 0x0020, # SPACE + 0x0021: 0x0021, # EXCLAMATION MARK + 0x0022: 0x0022, # QUOTATION MARK + 0x0023: 0x0023, # NUMBER SIGN + 0x0024: 0x0024, # DOLLAR SIGN + 0x0025: 0x0025, # PERCENT SIGN + 0x0026: 0x0026, # AMPERSAND + 0x0027: 0x0027, # APOSTROPHE + 0x0028: 0x0028, # LEFT PARENTHESIS + 0x0029: 0x0029, # RIGHT PARENTHESIS + 0x002a: 0x002a, # ASTERISK + 0x002b: 0x002b, # PLUS SIGN + 0x002c: 0x002c, # COMMA + 0x002d: 0x002d, # HYPHEN-MINUS + 0x002e: 0x002e, # FULL STOP + 0x002f: 0x002f, # SOLIDUS + 0x0030: 0x0030, # DIGIT ZERO + 0x0031: 0x0031, # DIGIT ONE + 0x0032: 0x0032, # DIGIT TWO + 0x0033: 0x0033, # DIGIT THREE + 0x0034: 0x0034, # DIGIT FOUR + 0x0035: 0x0035, # DIGIT FIVE + 0x0036: 0x0036, # DIGIT SIX + 0x0037: 0x0037, # DIGIT SEVEN + 0x0038: 0x0038, # DIGIT EIGHT + 0x0039: 0x0039, # DIGIT NINE + 0x003a: 0x003a, # COLON + 0x003b: 0x003b, # SEMICOLON + 0x003c: 0x003c, # LESS-THAN SIGN + 0x003d: 0x003d, # EQUALS SIGN + 0x003e: 0x003e, # GREATER-THAN SIGN + 0x003f: 0x003f, # QUESTION MARK + 0x0040: 0x0040, # COMMERCIAL AT + 0x0041: 0x0041, # LATIN CAPITAL LETTER A + 0x0042: 0x0042, # LATIN CAPITAL LETTER B + 0x0043: 0x0043, # LATIN CAPITAL LETTER C + 0x0044: 0x0044, # LATIN CAPITAL LETTER D + 0x0045: 0x0045, # LATIN CAPITAL LETTER E + 0x0046: 0x0046, # LATIN CAPITAL LETTER F + 0x0047: 0x0047, # LATIN CAPITAL LETTER G + 0x0048: 0x0048, # LATIN CAPITAL LETTER H + 0x0049: 0x0049, # LATIN CAPITAL LETTER I + 0x004a: 0x004a, # LATIN CAPITAL LETTER J + 0x004b: 0x004b, # LATIN CAPITAL LETTER K + 0x004c: 0x004c, # LATIN CAPITAL LETTER L + 0x004d: 0x004d, # LATIN CAPITAL LETTER M + 0x004e: 0x004e, # LATIN CAPITAL LETTER N + 0x004f: 0x004f, # LATIN CAPITAL LETTER O + 0x0050: 0x0050, # LATIN CAPITAL LETTER P + 0x0051: 0x0051, # LATIN CAPITAL LETTER Q + 0x0052: 0x0052, # LATIN CAPITAL LETTER R + 0x0053: 0x0053, # LATIN CAPITAL LETTER S + 0x0054: 0x0054, # LATIN CAPITAL LETTER T + 0x0055: 0x0055, # LATIN CAPITAL LETTER U + 0x0056: 0x0056, # LATIN CAPITAL LETTER V + 0x0057: 0x0057, # LATIN CAPITAL LETTER W + 0x0058: 0x0058, # LATIN CAPITAL LETTER X + 0x0059: 0x0059, # LATIN CAPITAL LETTER Y + 0x005a: 0x005a, # LATIN CAPITAL LETTER Z + 0x005b: 0x005b, # LEFT SQUARE BRACKET + 0x005c: 0x00a4, # REVERSE SOLIDUS + 0x005d: 0x005d, # RIGHT SQUARE BRACKET + 0x005e: 0x005e, # CIRCUMFLEX ACCENT + 0x005f: 0x005f, # LOW LINE + 0x0060: 0x0060, # GRAVE ACCENT + 0x0061: 0x0061, # LATIN SMALL LETTER A + 0x0062: 0x0062, # LATIN SMALL LETTER B + 0x0063: 0x0063, # LATIN SMALL LETTER C + 0x0064: 0x0064, # LATIN SMALL LETTER D + 0x0065: 0x0065, # LATIN SMALL LETTER E + 0x0066: 0x0066, # LATIN SMALL LETTER F + 0x0067: 0x0067, # LATIN SMALL LETTER G + 0x0068: 0x0068, # LATIN SMALL LETTER H + 0x0069: 0x0069, # LATIN SMALL LETTER I + 0x006a: 0x006a, # LATIN SMALL LETTER J + 0x006b: 0x006b, # LATIN SMALL LETTER K + 0x006c: 0x006c, # LATIN SMALL LETTER L + 0x006d: 0x006d, # LATIN SMALL LETTER M + 0x006e: 0x006e, # LATIN SMALL LETTER N + 0x006f: 0x006f, # LATIN SMALL LETTER O + 0x0070: 0x0070, # LATIN SMALL LETTER P + 0x0071: 0x0071, # LATIN SMALL LETTER Q + 0x0072: 0x0072, # LATIN SMALL LETTER R + 0x0073: 0x0073, # LATIN SMALL LETTER S + 0x0074: 0x0074, # LATIN SMALL LETTER T + 0x0075: 0x0075, # LATIN SMALL LETTER U + 0x0076: 0x0076, # LATIN SMALL LETTER V + 0x0077: 0x0077, # LATIN SMALL LETTER W + 0x0078: 0x0078, # LATIN SMALL LETTER X + 0x0079: 0x0079, # LATIN SMALL LETTER Y + 0x007a: 0x007a, # LATIN SMALL LETTER Z + 0x007b: 0x007b, # LEFT CURLY BRACKET + 0x007c: 0x007c, # VERTICAL LINE + 0x007d: 0x007d, # RIGHT CURLY BRACKET + 0x007e: 0x00b0, # TILDE + 0x007f: 0x0020, # DELETE + 0x0080: 0x0020, + 0x0081: 0x0020, + 0x0082: 0x002c, + 0x0083: 0x0020, + 0x0084: 0x0022, + 0x0085: 0x0020, + 0x0086: 0x0020, + 0x0087: 0x0020, + 0x0088: 0x005e, + 0x0089: 0x0020, + 0x008a: 0x0053, + 0x008b: 0x003c, + 0x008c: 0x0020, + 0x008d: 0x0020, + 0x008e: 0x005a, + 0x008f: 0x0020, + 0x0090: 0x0020, + 0x0091: 0x0027, + 0x0092: 0x0027, + 0x0093: 0x0022, + 0x0094: 0x0022, + 0x0095: 0x00a5, + 0x0096: 0x00b0, + 0x0097: 0x00b0, + 0x0098: 0x00b0, + 0x0099: 0x0020, + 0x009a: 0x0073, + 0x009b: 0x003e, + 0x009c: 0x0020, + 0x009d: 0x0020, + 0x009e: 0x007a, + 0x009f: 0x0059, + 0x00a0: 0x00ff, # NO-BREAK SPACE + 0x00a1: 0x0021, # INVERTED EXCLAMATION MARK + 0x00a2: 0x0020, # CENT SIGN + 0x00a3: 0x0020, # POUND SIGN + 0x00a4: 0x0020, # CURRENCY SIGN + 0x00a5: 0x005c, # YEN SIGN + 0x00a6: 0x007c, # BROKEN BAR + 0x00a7: 0x0020, # SECTION SIGN + 0x00a8: 0x0022, # DIAERESIS + 0x00a9: 0x0020, # COPYRIGHT SIGN + 0x00aa: 0x0020, # FEMININE ORDINAL INDICATOR + 0x00ab: 0x00ff, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + 0x00ac: 0x000e, # NOT SIGN -- FIXME? + 0x00ad: 0x000a, # SOFT HYPHEN -- FIXME? + 0x00ae: 0x0009, # REGISTERED SIGN -- FIXME? + 0x00af: 0x0008, # MACRON -- FIXME? + 0x00b0: 0x00df, # DEGREE SIGN + 0x00b1: 0x0020, # PLUS-MINUS SIGN + 0x00b2: 0x0020, # SUPERSCRIPT TWO + 0x00b3: 0x0020, # SUPERSCRIPT THREE + 0x00b4: 0x0027, # ACUTE ACCENT + 0x00b5: 0x00e4, # MICRO SIGN + 0x00b6: 0x0020, # PILCROW SIGN + 0x00b7: 0x00a5, # MIDDLE DOT + 0x00b8: 0x0020, # CEDILLA + 0x00b9: 0x0020, # SUPERSCRIPT ONE + 0x00ba: 0x00df, # MASCULINE ORDINAL INDICATOR + 0x00bb: 0x003e, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + 0x00bc: 0x0020, # VULGAR FRACTION ONE QUARTER + 0x00bd: 0x0020, # VULGAR FRACTION ONE HALF + 0x00be: 0x0020, # VULGAR FRACTION THREE QUARTERS + 0x00bf: 0x003f, # INVERTED QUESTION MARK + 0x00c0: 0x0041, # LATIN CAPITAL LETTER A WITH GRAVE + 0x00c1: 0x0041, # LATIN CAPITAL LETTER A WITH ACUTE + 0x00c2: 0x0041, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX + 0x00c3: 0x0041, # LATIN CAPITAL LETTER A WITH TILDE + 0x00c4: 0x0041, # LATIN CAPITAL LETTER A WITH DIAERESIS + 0x00c5: 0x0041, # LATIN CAPITAL LETTER A WITH RING ABOVE + 0x00c6: 0x0020, # LATIN CAPITAL LETTER AE + 0x00c7: 0x0043, # LATIN CAPITAL LETTER C WITH CEDILLA + 0x00c8: 0x0045, # LATIN CAPITAL LETTER E WITH GRAVE + 0x00c9: 0x0045, # LATIN CAPITAL LETTER E WITH ACUTE + 0x00ca: 0x0045, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX + 0x00cb: 0x0045, # LATIN CAPITAL LETTER E WITH DIAERESIS + 0x00cc: 0x0049, # LATIN CAPITAL LETTER I WITH GRAVE + 0x00cd: 0x0049, # LATIN CAPITAL LETTER I WITH ACUTE + 0x00ce: 0x0049, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX + 0x00cf: 0x0049, # LATIN CAPITAL LETTER I WITH DIAERESIS + 0x00d0: 0x0044, # LATIN CAPITAL LETTER ETH + 0x00d1: 0x004e, # LATIN CAPITAL LETTER N WITH TILDE + 0x00d2: 0x004f, # LATIN CAPITAL LETTER O WITH GRAVE + 0x00d3: 0x004f, # LATIN CAPITAL LETTER O WITH ACUTE + 0x00d4: 0x004f, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX + 0x00d5: 0x004f, # LATIN CAPITAL LETTER O WITH TILDE + 0x00d6: 0x004f, # LATIN CAPITAL LETTER O WITH DIAERESIS + 0x00d7: 0x0078, # MULTIPLICATION SIGN + 0x00d8: 0x0030, # LATIN CAPITAL LETTER O WITH STROKE + 0x00d9: 0x0055, # LATIN CAPITAL LETTER U WITH GRAVE + 0x00da: 0x0055, # LATIN CAPITAL LETTER U WITH ACUTE + 0x00db: 0x0055, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX + 0x00dc: 0x0055, # LATIN CAPITAL LETTER U WITH DIAERESIS + 0x00dd: 0x0059, # LATIN CAPITAL LETTER Y WITH ACUTE + 0x00de: 0x0020, # LATIN CAPITAL LETTER THORN + 0x00df: 0x00e2, # LATIN SMALL LETTER SHARP + 0x00e0: 0x0061, # LATIN SMALL LETTER A WITH GRAVE + 0x00e1: 0x0061, # LATIN SMALL LETTER A WITH ACUTE + 0x00e2: 0x0061, # LATIN SMALL LETTER A WITH CIRCUMFLEX + 0x00e3: 0x0061, # LATIN SMALL LETTER A WITH TILDE + 0x00e4: 0x00e1, # LATIN SMALL LETTER A WITH DIAERESIS + 0x00e5: 0x0061, # LATIN SMALL LETTER A WITH RING ABOVE + 0x00e6: 0x0020, # LATIN SMALL LETTER AE + 0x00e7: 0x0063, # LATIN SMALL LETTER C WITH CEDILLA + 0x00e8: 0x0065, # LATIN SMALL LETTER E WITH GRAVE + 0x00e9: 0x0065, # LATIN SMALL LETTER E WITH ACUTE + 0x00ea: 0x0065, # LATIN SMALL LETTER E WITH CIRCUMFLEX + 0x00eb: 0x0065, # LATIN SMALL LETTER E WITH DIAERESIS + 0x00ec: 0x0069, # LATIN SMALL LETTER I WITH GRAVE + 0x00ed: 0x0069, # LATIN SMALL LETTER I WITH ACUTE + 0x00ee: 0x0069, # LATIN SMALL LETTER I WITH CIRCUMFLEX + 0x00ef: 0x0069, # LATIN SMALL LETTER I WITH DIAERESIS + 0x00f0: 0x006f, # LATIN SMALL LETTER ETH + 0x00f1: 0x006e, # LATIN SMALL LETTER N WITH TILDE + 0x00f2: 0x006f, # LATIN SMALL LETTER O WITH GRAVE + 0x00f3: 0x006f, # LATIN SMALL LETTER O WITH ACUTE + 0x00f4: 0x006f, # LATIN SMALL LETTER O WITH CIRCUMFLEX + 0x00f5: 0x006f, # LATIN SMALL LETTER O WITH TILDE + 0x00f6: 0x006f, # LATIN SMALL LETTER O WITH DIAERESIS + 0x00f7: 0x00fd, # DIVISION SIGN + 0x00f8: 0x006f, # LATIN SMALL LETTER O WITH STROKE + 0x00f9: 0x0075, # LATIN SMALL LETTER U WITH GRAVE + 0x00fa: 0x0075, # LATIN SMALL LETTER U WITH ACUTE + 0x00fb: 0x0075, # LATIN SMALL LETTER U WITH CIRCUMFLEX + 0x00fc: 0x0075, # LATIN SMALL LETTER U WITH DIAERESIS + 0x00fd: 0x0079, # LATIN SMALL LETTER Y WITH ACUTE + 0x00fe: 0x0020, # LATIN SMALL LETTER THORN + 0x00ff: 0x0079, # LATIN SMALL LETTER Y WITH DIAERESIS +# Polish letters mapping replacements + 0x0104: 0x0041, # LATIN CAPITAL LETTER A WITH OGONEK + 0x0105: 0x0061, # LATIN SMALL LETTER A WITH OGONEK + 0x0106: 0x0043, # LATIN CAPITAL LETTER C WITH ACUTE + 0x0118: 0x0045, # LATIN CAPITAL LETTER E WITH OGONEK + 0x0119: 0x0065, # LATIN SMALL LETTER E WITH OGONEK + 0x0141: 0x004c, # LATIN CAPITAL LETTER L WITH STROKE + 0x0142: 0x006c, # LATIN SMALL LETTER L WITH STROKE + 0x0143: 0x004e, # LATIN CAPITAL LETTER N WITH ACUTE + 0x0144: 0x006e, # LATIN SMALL LETTER N WITH ACUTE + 0x015a: 0x0053, # LATIN CAPITAL LETTER S WITH ACUTE + 0x015b: 0x0073, # LATIN SMALL LETTER S WITH ACUTE + 0x0179: 0x005a, # LATIN CAPITAL LETTER Z WITH ACUTE + 0x017a: 0x007a, # LATIN SMALL LETTER Z WITH ACUTE + 0x017b: 0x005a, # LATIN CAPITAL LETTER Z WITH DOT ABOVE + 0x017c: 0x007a, # LATIN SMALL LETTER Z WITH DOT ABOVE + 0x0230: 0x004f, # LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON +# Greek letters, technical symbols and misc + 0x2190: 0x007f, # LEFTWARDS ARROW + 0x2192: 0x007e, # RIGHTWARDS ARROW + +} diff --git a/resources/lib/charset_map_hd44780_a02.py b/resources/lib/charset_map_hd44780_a02.py new file mode 100644 index 0000000..5b3210d --- /dev/null +++ b/resources/lib/charset_map_hd44780_a02.py @@ -0,0 +1,387 @@ +''' + XBMC LCDproc addon + Copyright (C) 2012 Team XBMC + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +import codecs + +encmap_hd44780_a02 = { + 0x0000: 0x0000, # NULL + # 0x0001: 0x0001, # START OF HEADING + # 0x0002: 0x0002, # START OF TEXT + # 0x0003: 0x0003, # END OF TEXT + # 0x0004: 0x0004, # END OF TRANSMISSION + # 0x0005: 0x0005, # ENQUIRY + # 0x0006: 0x0006, # ACKNOWLEDGE + # 0x0007: 0x0007, # BELL + # 0x0008: 0x0008, # BACKSPACE + # 0x0009: 0x0009, # HORIZONTAL TABULATION + # 0x000a: 0x000a, # LINE FEED + # 0x000b: 0x000b, # VERTICAL TABULATION + # 0x000c: 0x000c, # FORM FEED + # 0x000d: 0x000d, # CARRIAGE RETURN + # 0x000e: 0x000e, # SHIFT OUT + # 0x000f: 0x000f, # SHIFT IN + # 0x0010: 0x0010, # DATA LINK ESCAPE + # 0x0011: 0x0011, # DEVICE CONTROL ONE + # 0x0012: 0x0012, # DEVICE CONTROL TWO + # 0x0013: 0x0013, # DEVICE CONTROL THREE + # 0x0014: 0x0014, # DEVICE CONTROL FOUR + # 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE + # 0x0016: 0x0016, # SYNCHRONOUS IDLE + # 0x0017: 0x0017, # END OF TRANSMISSION BLOCK + # 0x0018: 0x0018, # CANCEL + # 0x0019: 0x0019, # END OF MEDIUM + # 0x001a: 0x001a, # SUBSTITUTE + # 0x001b: 0x001b, # ESCAPE + # 0x001c: 0x001c, # INFORMATION SEPARATOR FOUR + # 0x001d: 0x001d, # INFORMATION SEPARATOR THREE + # 0x001e: 0x001e, # INFORMATION SEPARATOR TWO + # 0x001f: 0x001f, # INFORMATION SEPARATOR ONE + 0x0020: 0x0020, # SPACE + 0x0021: 0x0021, # EXCLAMATION MARK + 0x0022: 0x0022, # QUOTATION MARK + 0x0023: 0x0023, # NUMBER SIGN + 0x0024: 0x0024, # DOLLAR SIGN + 0x0025: 0x0025, # PERCENT SIGN + 0x0026: 0x0026, # AMPERSAND + 0x0027: 0x0027, # APOSTROPHE + 0x0028: 0x0028, # LEFT PARENTHESIS + 0x0029: 0x0029, # RIGHT PARENTHESIS + 0x002a: 0x002a, # ASTERISK + 0x002b: 0x002b, # PLUS SIGN + 0x002c: 0x002c, # COMMA + 0x002d: 0x002d, # HYPHEN-MINUS + 0x002e: 0x002e, # FULL STOP + 0x002f: 0x002f, # SOLIDUS + 0x0030: 0x0030, # DIGIT ZERO + 0x0031: 0x0031, # DIGIT ONE + 0x0032: 0x0032, # DIGIT TWO + 0x0033: 0x0033, # DIGIT THREE + 0x0034: 0x0034, # DIGIT FOUR + 0x0035: 0x0035, # DIGIT FIVE + 0x0036: 0x0036, # DIGIT SIX + 0x0037: 0x0037, # DIGIT SEVEN + 0x0038: 0x0038, # DIGIT EIGHT + 0x0039: 0x0039, # DIGIT NINE + 0x003a: 0x003a, # COLON + 0x003b: 0x003b, # SEMICOLON + 0x003c: 0x003c, # LESS-THAN SIGN + 0x003d: 0x003d, # EQUALS SIGN + 0x003e: 0x003e, # GREATER-THAN SIGN + 0x003f: 0x003f, # QUESTION MARK + 0x0040: 0x0040, # COMMERCIAL AT + 0x0041: 0x0041, # LATIN CAPITAL LETTER A + 0x0042: 0x0042, # LATIN CAPITAL LETTER B + 0x0043: 0x0043, # LATIN CAPITAL LETTER C + 0x0044: 0x0044, # LATIN CAPITAL LETTER D + 0x0045: 0x0045, # LATIN CAPITAL LETTER E + 0x0046: 0x0046, # LATIN CAPITAL LETTER F + 0x0047: 0x0047, # LATIN CAPITAL LETTER G + 0x0048: 0x0048, # LATIN CAPITAL LETTER H + 0x0049: 0x0049, # LATIN CAPITAL LETTER I + 0x004a: 0x004a, # LATIN CAPITAL LETTER J + 0x004b: 0x004b, # LATIN CAPITAL LETTER K + 0x004c: 0x004c, # LATIN CAPITAL LETTER L + 0x004d: 0x004d, # LATIN CAPITAL LETTER M + 0x004e: 0x004e, # LATIN CAPITAL LETTER N + 0x004f: 0x004f, # LATIN CAPITAL LETTER O + 0x0050: 0x0050, # LATIN CAPITAL LETTER P + 0x0051: 0x0051, # LATIN CAPITAL LETTER Q + 0x0052: 0x0052, # LATIN CAPITAL LETTER R + 0x0053: 0x0053, # LATIN CAPITAL LETTER S + 0x0054: 0x0054, # LATIN CAPITAL LETTER T + 0x0055: 0x0055, # LATIN CAPITAL LETTER U + 0x0056: 0x0056, # LATIN CAPITAL LETTER V + 0x0057: 0x0057, # LATIN CAPITAL LETTER W + 0x0058: 0x0058, # LATIN CAPITAL LETTER X + 0x0059: 0x0059, # LATIN CAPITAL LETTER Y + 0x005a: 0x005a, # LATIN CAPITAL LETTER Z + 0x005b: 0x005b, # LEFT SQUARE BRACKET + 0x005c: 0x005c, # REVERSE SOLIDUS + 0x005d: 0x005d, # RIGHT SQUARE BRACKET + 0x005e: 0x005e, # CIRCUMFLEX ACCENT + 0x005f: 0x005f, # LOW LINE + 0x0060: 0x0060, # GRAVE ACCENT + 0x0061: 0x0061, # LATIN SMALL LETTER A + 0x0062: 0x0062, # LATIN SMALL LETTER B + 0x0063: 0x0063, # LATIN SMALL LETTER C + 0x0064: 0x0064, # LATIN SMALL LETTER D + 0x0065: 0x0065, # LATIN SMALL LETTER E + 0x0066: 0x0066, # LATIN SMALL LETTER F + 0x0067: 0x0067, # LATIN SMALL LETTER G + 0x0068: 0x0068, # LATIN SMALL LETTER H + 0x0069: 0x0069, # LATIN SMALL LETTER I + 0x006a: 0x006a, # LATIN SMALL LETTER J + 0x006b: 0x006b, # LATIN SMALL LETTER K + 0x006c: 0x006c, # LATIN SMALL LETTER L + 0x006d: 0x006d, # LATIN SMALL LETTER M + 0x006e: 0x006e, # LATIN SMALL LETTER N + 0x006f: 0x006f, # LATIN SMALL LETTER O + 0x0070: 0x0070, # LATIN SMALL LETTER P + 0x0071: 0x0071, # LATIN SMALL LETTER Q + 0x0072: 0x0072, # LATIN SMALL LETTER R + 0x0073: 0x0073, # LATIN SMALL LETTER S + 0x0074: 0x0074, # LATIN SMALL LETTER T + 0x0075: 0x0075, # LATIN SMALL LETTER U + 0x0076: 0x0076, # LATIN SMALL LETTER V + 0x0077: 0x0077, # LATIN SMALL LETTER W + 0x0078: 0x0078, # LATIN SMALL LETTER X + 0x0079: 0x0079, # LATIN SMALL LETTER Y + 0x007a: 0x007a, # LATIN SMALL LETTER Z + 0x007b: 0x007b, # LEFT CURLY BRACKET + 0x007c: 0x007c, # VERTICAL LINE + 0x007d: 0x007d, # RIGHT CURLY BRACKET + 0x007e: 0x007e, # TILDE + 0x007f: 0x0020, # DELETE + # 0x0080: + # 0x0081: + # 0x0082: + # 0x0083: + # 0x0084: + # 0x0085: + # 0x0086: + # 0x0087: + # 0x0088: + # 0x0089: + # 0x008a: + # 0x008b: + # 0x008c: + # 0x008d: + # 0x008e: + # 0x008f: + # 0x0090: + # 0x0091: + # 0x0092: + # 0x0093: + # 0x0094: + # 0x0095: + # 0x0096: + # 0x0097: + # 0x0098: + # 0x0099: + # 0x009a: + # 0x009b: + # 0x009c: + # 0x009d: + # 0x009e: + # 0x009f: + 0x00a0: 0x0020, # NO-BREAK SPACE + 0x00a1: 0x00a1, # INVERTED EXCLAMATION MARK + 0x00a2: 0x00a2, # CENT SIGN + 0x00a3: 0x00a3, # POUND SIGN + 0x00a4: 0x00a4, # CURRENCY SIGN + 0x00a5: 0x00a5, # YEN SIGN + 0x00a6: 0x00a6, # BROKEN BAR + 0x00a7: 0x00a7, # SECTION SIGN + # 0x00a8: # DIAERESIS + 0x00a9: 0x00a9, # COPYRIGHT SIGN + 0x00aa: 0x00aa, # FEMININE ORDINAL INDICATOR + 0x00ab: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + # 0x00ac: # NOT SIGN + # 0x00ad: # SOFT HYPHEN + 0x00ae: 0x00ae, # REGISTERED SIGN + # 0x00af: # MACRON + 0x00b0: 0x00b0, # DEGREE SIGN + 0x00b1: 0x00b1, # PLUS-MINUS SIGN + 0x00b2: 0x00b2, # SUPERSCRIPT TWO + 0x00b3: 0x00b3, # SUPERSCRIPT THREE + # 0x00b4: # ACUTE ACCENT + 0x00b5: 0x00b5, # MICRO SIGN + 0x00b6: 0x00b6, # PILCROW SIGN + 0x00b7: 0x00b7, # MIDDLE DOT + # 0x00b8: # CEDILLA + 0x00b9: 0x00b9, # SUPERSCRIPT ONE + 0x00ba: 0x00ba, # MASCULINE ORDINAL INDICATOR + 0x00bb: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + 0x00bc: 0x00bc, # VULGAR FRACTION ONE QUARTER + 0x00bd: 0x00bd, # VULGAR FRACTION ONE HALF + 0x00be: 0x00be, # VULGAR FRACTION THREE QUARTERS + 0x00bf: 0x00bf, # INVERTED QUESTION MARK + 0x00c0: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE + 0x00c1: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE + 0x00c2: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX + 0x00c3: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE + 0x00c4: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS + 0x00c5: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE + 0x00c6: 0x00c6, # LATIN CAPITAL LETTER AE + 0x00c7: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA + 0x00c8: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE + 0x00c9: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE + 0x00ca: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX + 0x00cb: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS + 0x00cc: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE + 0x00cd: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE + 0x00ce: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX + 0x00cf: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS + 0x00d0: 0x00d0, # LATIN CAPITAL LETTER ETH + 0x00d1: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE + 0x00d2: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE + 0x00d3: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE + 0x00d4: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX + 0x00d5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE + 0x00d6: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS + 0x00d7: 0x00d7, # MULTIPLICATION SIGN + # 0x00d8: # LATIN CAPITAL LETTER O WITH STROKE + 0x00d9: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE + 0x00da: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE + 0x00db: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX + 0x00dc: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS + 0x00dd: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE + 0x00de: 0x00de, # LATIN CAPITAL LETTER THORN + 0x00df: 0x00df, # LATIN SMALL LETTER SHARP + 0x00e0: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE + 0x00e1: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE + 0x00e2: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX + 0x00e3: 0x00e3, # LATIN SMALL LETTER A WITH TILDE + 0x00e4: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS + 0x00e5: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE + 0x00e6: 0x00e6, # LATIN SMALL LETTER AE + 0x00e7: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA + 0x00e8: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE + 0x00e9: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE + 0x00ea: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX + 0x00eb: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS + 0x00ec: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE + 0x00ed: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE + 0x00ee: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX + 0x00ef: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS + 0x00f0: 0x00f0, # LATIN SMALL LETTER ETH + 0x00f1: 0x00f1, # LATIN SMALL LETTER N WITH TILDE + 0x00f2: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE + 0x00f3: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE + 0x00f4: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX + 0x00f5: 0x00f5, # LATIN SMALL LETTER O WITH TILDE + 0x00f6: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS + 0x00f7: 0x00f7, # DIVISION SIGN + 0x00f8: 0x00f8, # LATIN SMALL LETTER O WITH STROKE + 0x00f9: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE + 0x00fa: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE + 0x00fb: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX + 0x00fc: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS + 0x00fd: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE + 0x00fe: 0x00fe, # LATIN SMALL LETTER THORN + 0x00ff: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS +# Capital cyrillic letters + 0x0401: 0x00cb, # CYRILLIC CAPITAL LETTER IO + 0x0410: 0x0041, # CYRILLIC CAPITAL LETTER A + 0x0411: 0x0080, # CYRILLIC CAPITAL LETTER BE + 0x0412: 0x0042, # CYRILLIC CAPITAL LETTER VE + 0x0413: 0x0092, # CYRILLIC CAPITAL LETTER GHE + 0x0414: 0x0081, # CYRILLIC CAPITAL LETTER DE + 0x0415: 0x0045, # CYRILLIC CAPITAL LETTER IE + 0x0416: 0x0082, # CYRILLIC CAPITAL LETTER GJE + 0x0417: 0x0083, # CYRILLIC CAPITAL LETTER ZE + 0x0418: 0x0084, # CYRILLIC CAPITAL LETTER I + 0x0419: 0x0085, # CYRILLIC CAPITAL LETTER SHORT I + 0x041a: 0x004b, # CYRILLIC CAPITAL LETTER KA + 0x041b: 0x0086, # CYRILLIC CAPITAL LETTER EL + 0x041c: 0x004d, # CYRILLIC CAPITAL LETTER EM + 0x041d: 0x0048, # CYRILLIC CAPITAL LETTER EN + 0x041e: 0x004f, # CYRILLIC CAPITAL LETTER O + 0x041f: 0x0087, # CYRILLIC CAPITAL LETTER PE + 0x0420: 0x0050, # CYRILLIC CAPITAL LETTER ER + 0x0421: 0x0043, # CYRILLIC CAPITAL LETTER ES + 0x0422: 0x0054, # CYRILLIC CAPITAL LETTER TE + 0x0423: 0x0088, # CYRILLIC CAPITAL LETTER U + 0x0424: 0x00d8, # CYRILLIC CAPITAL LETTER EF + 0x0425: 0x0058, # CYRILLIC CAPITAL LETTER HA + 0x0426: 0x0089, # CYRILLIC CAPITAL LETTER TSE + 0x0427: 0x008a, # CYRILLIC CAPITAL LETTER CHE + 0x0428: 0x008b, # CYRILLIC CAPITAL LETTER SHA + 0x0429: 0x008c, # CYRILLIC CAPITAL LETTER SHCHA + 0x042a: 0x008d, # CYRILLIC CAPITAL LETTER HARD SIGN + 0x042b: 0x008e, # CYRILLIC CAPITAL LETTER YERU + 0x042c: 0x0062, # CYRILLIC CAPITAL LETTER SOFT SIGN + 0x042d: 0x008f, # CYRILLIC CAPITAL LETTER E + 0x042e: 0x00ac, # CYRILLIC CAPITAL LETTER YU + 0x042f: 0x00ad, # CYRILLIC CAPITAL LETTER YA +# Small Cyrillc letters + 0x0430: 0x0041, # CYRILLIC SMALL LETTER A + 0x0431: 0x0080, # CYRILLIC SMALL LETTER BE + 0x0432: 0x0042, # CYRILLIC SMALL LETTER VE + 0x0433: 0x0092, # CYRILLIC SMALL LETTER GHE + 0x0434: 0x0081, # CYRILLIC SMALL LETTER DE + 0x0435: 0x0045, # CYRILLIC SMALL LETTER IE + 0x0436: 0x0082, # CYRILLIC SMALL LETTER ZHE + 0x0437: 0x0083, # CYRILLIC SMALL LETTER ZE + 0x0438: 0x0084, # CYRILLIC SMALL LETTER I + 0x0439: 0x0085, # CYRILLIC SMALL LETTER SHORT I + 0x043a: 0x004b, # CYRILLIC SMALL LETTER KA + 0x043b: 0x0086, # CYRILLIC SMALL LETTER EL + 0x043c: 0x004d, # CYRILLIC SMALL LETTER EM + 0x043d: 0x0048, # CYRILLIC SMALL LETTER EN + 0x043e: 0x004f, # CYRILLIC SMALL LETTER O + 0x043f: 0x0087, # CYRILLIC SMALL LETTER PE + 0x0440: 0x0050, # CYRILLIC SMALL LETTER ER + 0x0441: 0x0043, # CYRILLIC SMALL LETTER ES + 0x0442: 0x0054, # CYRILLIC SMALL LETTER TE + 0x0443: 0x0088, # CYRILLIC SMALL LETTER U + 0x0444: 0x00d8, # CYRILLIC SMALL LETTER EF + 0x0445: 0x0058, # CYRILLIC SMALL LETTER HA + 0x0446: 0x0089, # CYRILLIC SMALL LETTER TSE + 0x0447: 0x008a, # CYRILLIC SMALL LETTER CHE + 0x0448: 0x008b, # CYRILLIC SMALL LETTER SHA + 0x0449: 0x008c, # CYRILLIC SMALL LETTER SHCHA + 0x044a: 0x008d, # CYRILLIC SMALL LETTER HARD SIGN + 0x044b: 0x008e, # CYRILLIC SMALL LETTER YERU + 0x044c: 0x0062, # CYRILLIC SMALL LETTER SOFT SIGN + 0x044d: 0x008f, # CYRILLIC SMALL LETTER E + 0x044e: 0x00ac, # CYRILLIC SMALL LETTER YU + 0x044f: 0x00ad, # CYRILLIC SMALL LETTER YA + 0x0451: 0x00cb, # CYRILLIC SMALL LETTER IO +# Greek letters, technical symbols and misc + 0x0192: 0x00a8, # LATIN SMALL LETTER F WITH HOOK + 0x0398: 0x0099, # GREEK CAPITAL LETTER THETA + 0x03a3: 0x0094, # GREEK CAPITAL LETTER SIGMA + 0x03a9: 0x009a, # GREEK CAPITAL LETTER OMEGA + 0x03b1: 0x0090, # GREEK SMALL LETTER ALPHA + 0x03b4: 0x009b, # GREEK SMALL LETTER DELTA + 0x03b5: 0x009e, # GREEK SMALL LETTER EPSILON + 0x03c0: 0x0093, # GREEK SMALL LETTER PI + 0x03c3: 0x0095, # GREEK SMALL LETTER SIGMA + 0x03c4: 0x0097, # GREEK SMALL LETTER TAU + 0x03c9: 0x00b8, # GREEK SMALL LETTER OMEGA + 0x2016: 0x00a0, # DOUBLE VERTICAL LINE + 0x2018: 0x00af, # LEFT SINGLE QUOTATION MARK + 0x201c: 0x0012, # LEFT DOUBLE QUOTATION MARK + 0x201d: 0x0013, # RIGHT DOUBLE QUOTATION MARK + 0x2109: 0x00b4, # DEGREE FAHRENHEIT + 0x2190: 0x001b, # LEFTWARDS ARROW + 0x2191: 0x0018, # UPWARDS ARROW + 0x2192: 0x001a, # RIGHTWARDS ARROW + 0x2193: 0x0019, # DOWNWARDS ARROW + 0x21b2: 0x0017, # DOWNWARDS ARROW WITH TIP LEFTWARDS + 0x221e: 0x009c, # INFINITY + 0x2229: 0x009f, # INTERSECTION + 0x2264: 0x001c, # LESS-THAN OR EQUAL TO + 0x2265: 0x001d, # GREATER-THAN OR EQUAL TO + 0x23eb: 0x0014, # BLACK UP-POINTING DOUBLE TRIANGLE + 0x23ec: 0x0015, # BLACK DOWN-POINTING DOUBLE TRIANGLE + 0x25b2: 0x001e, # BLACK UP-POINTING TRIANGLE + 0x25b6: 0x0010, # BLACK RIGHT-POINTING TRIANGLE + 0x25bc: 0x001f, # BLACK DOWN-POINTING TRIANGLE + 0x25c0: 0x0011, # BLACK LEFT-POINTING TRIANGLE + 0x2664: 0x009d, # HEAVY BLACK HEART + 0x266a: 0x0091, # EIGHTH NOTE + 0x266c: 0x0096, # BEAMED SIXTEENTH NOTES + 0x2b24: 0x0016, # BLACK LARGE CIRCLE + 0xf0f3: 0x0098 # BELL ICON (not sure) +} diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 92bf5d7..b006022 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -192,7 +192,7 @@ def Initialize(self): try: if not self.m_bHaveHD44780Charmap: - log(xbmc.LOGDEBUG, "Registering HD44780-ROM pseudocodepage") + log(xbmc.LOGDEBUG, "Registering HD44780-ROM pseudocodepages") codecs.register(charset_hd44780) self.m_bHaveHD44780Charmap = True except: @@ -213,7 +213,7 @@ def Initialize(self): def UpdateGUISettings(self): str_charset = settings_getCharset() if str_charset != self.m_strLCDEncoding: - if str_charset == "hd44780-hw" and not self.m_bHaveHD44780Charmap: + if (str_charset == "hd44780-a00" or str_charset == "hd44780-a02") and not self.m_bHaveHD44780Charmap: str_charset = "iso8859-1" self.m_strLCDEncoding = str_charset diff --git a/resources/lib/settings.py b/resources/lib/settings.py index c6909bd..4dff7a4 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -166,7 +166,9 @@ def settings_getCharset(): elif g_charset == "4": ret = "iso-8859-5" elif g_charset == "5": - ret = "hd44780-hw" + ret = "hd44780-a00" + elif g_charset == "6": + ret = "hd44780-a02" else: ret = "iso-8859-1" diff --git a/resources/settings.xml b/resources/settings.xml index 5a80ddd..8091d07 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -6,7 +6,7 @@ - + From 88a7e8c24df6693a089e9caf7d05610d53a6d4c0 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 22 Apr 2013 22:06:37 +0200 Subject: [PATCH 202/337] introduce GUI setting to fully disable extra element support (e.g. icons and bars on imonlcd's), closes https://github.com/herrnst/script.xbmc.lcdproc/issues/11 --- resources/language/English/strings.xml | 1 + resources/language/German/strings.xml | 1 + resources/lib/lcdproc.py | 16 ++++++++++++++-- resources/lib/settings.py | 24 ++++++++++++++++++++---- resources/settings.xml | 9 ++++++--- 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 3574933..832a683 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -9,6 +9,7 @@ Display refresh rate (Hz) Use alternate charset Charset + Support for extra display elements (e.g. icons) Backlight diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml index d5c8bed..205fc86 100644 --- a/resources/language/German/strings.xml +++ b/resources/language/German/strings.xml @@ -9,6 +9,7 @@ Display-Aktualisierungsrate (Hz) Verwende alternativen Zeichensatz Zeichensatz + Zusatzdisplayelemente (z.B. Icons) unterstützen Beleuchtung diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 14bcf6c..6cd971a 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -236,6 +236,8 @@ def DetermineExtraSupport(self): rematch_imon = "SoundGraph iMON(.*)LCD" rematch_mdm166a = "Targa(.*)mdm166a" rematch_imonvfd = "Soundgraph(.*)VFD" + + bUseExtraIcons = settings_getUseExtraElements() # Never cause script failure/interruption by this! This is totally optional! try: @@ -252,11 +254,13 @@ def DetermineExtraSupport(self): if re.match(rematch_imon, reply): log(xbmc.LOGNOTICE, "SoundGraph iMON LCD detected") - self.m_cExtraIcons = LCDproc_extra_imon() + if bUseExtraIcons: + self.m_cExtraIcons = LCDproc_extra_imon() elif re.match(rematch_mdm166a, reply): log(xbmc.LOGNOTICE, "Futaba/Targa USB mdm166a VFD detected") - self.m_cExtraIcons = LCDproc_extra_mdm166a() + if bUseExtraIcons: + self.m_cExtraIcons = LCDproc_extra_mdm166a() elif re.match(rematch_imonvfd, reply): log(xbmc.LOGNOTICE, "SoundGraph iMON IR/VFD detected") @@ -336,6 +340,10 @@ def CloseSocket(self): if self.tnsocket: # no pyexceptions, please, we're disconnecting anyway try: + # if we served extra elements, (try to) reset them + if self.m_cExtraIcons is not None: + self.SendCommand(self.m_cExtraIcons.GetClearAllCmd(), False) + # do gracefully disconnect (send directly as we won't get any response on this) self.tn.write("bye\n") # and close socket afterwards @@ -344,6 +352,10 @@ def CloseSocket(self): # exception caught on this, so what? :) pass + # delete/cleanup extra support instance + del self.m_cExtraIcons + self.m_cExtraIcons = None + self.tnsocket = None del self.tn self.tn = telnetlib.Telnet() diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 4dff7a4..c7a69e1 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -50,6 +50,7 @@ global g_hideconnpopups global g_usealternatecharset global g_charset +global g_useextraelements #init globals with defaults def settings_initGlobals(): @@ -70,6 +71,7 @@ def settings_initGlobals(): global g_hideconnpopups global g_usealternatecharset global g_charset + global g_useextraelements g_hostip = "127.0.0.1" g_hostport = 13666 @@ -88,6 +90,7 @@ def settings_initGlobals(): g_hideconnpopups = True g_usealternatecharset = False g_charset = "iso-8859-1" + g_useextraelements = True def settings_getHostIp(): global g_hostip @@ -101,6 +104,10 @@ def settings_getHeartBeat(): global g_heartbeat return g_heartbeat +def settings_getUseExtraElements(): + global g_useextraelements + return g_useextraelements + def settings_getScrollDelay(): global g_scrolldelay return g_scrolldelay @@ -194,18 +201,21 @@ def settings_didSettingsChange(): g_settingsChanged = False return settingsChanged -#handle all settings in the general tab according to network access -#returns true if reconnect is needed due to network changes -def settings_handleNetworkSettings(): +# handle all settings that might require a reinit and/or reconnect +# (e.g. network config changes) +# returns true if reconnect is needed due to network changes +def settings_handleCriticalSettings(): global g_hostip global g_hostport global g_heartbeat + global g_useextraelements reconnect = False hostip = __settings__.getSetting("hostip") hostport = int(__settings__.getSetting("hostport")) heartbeat = __settings__.getSetting("heartbeat") == "true" + useextraelements = __settings__.getSetting("useextraelements") == "true" #server settings #we need to reconnect if networkaccess bool changes @@ -233,6 +243,12 @@ def settings_handleNetworkSettings(): g_heartbeat = heartbeat reconnect = True + # extra element support needs a reinit+reconnect so the extraelement + # support object resets + if g_useextraelements != useextraelements: + g_useextraelements = useextraelements + reconnect = True + return reconnect def settings_handleLcdSettings(): @@ -322,7 +338,7 @@ def settings_handleLcdSettings(): #returns if a reconnect is needed due to settings changes def settings_setup(): reconnect = False - reconnect = settings_handleNetworkSettings() + reconnect = settings_handleCriticalSettings() settings_handleLcdSettings() return reconnect diff --git a/resources/settings.xml b/resources/settings.xml index 8091d07..2b006e8 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -5,8 +5,11 @@ + + + @@ -14,16 +17,16 @@ - + - + - + From eb8a6bb2ae1d48ca6cd4553d3fe7f845d6d6e537 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 25 Apr 2013 22:59:08 +0200 Subject: [PATCH 203/337] remove redundant extraicon clearing from ShutDown() and have functionality in CloseSocket() --- resources/lib/lcdbase.py | 4 ---- resources/lib/lcdproc.py | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index b006022..eaa2b4f 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -428,10 +428,6 @@ def Shutdown(self): if settings_getDimOnShutdown(): self.SetBackLight(0) - if self.m_cExtraIcons is not None: - if not self.SendCommand(self.m_cExtraIcons.GetClearAllCmd(), True): - log(xbmc.LOGERROR, "Shutdown(): Cannot clear extra icons") - self.CloseSocket() def Render(self, mode, bForce): diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 6cd971a..d9f2869 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -342,7 +342,8 @@ def CloseSocket(self): try: # if we served extra elements, (try to) reset them if self.m_cExtraIcons is not None: - self.SendCommand(self.m_cExtraIcons.GetClearAllCmd(), False) + if not self.SendCommand(self.m_cExtraIcons.GetClearAllCmd(), True): + log(xbmc.LOGERROR, "CloseSocket(): Cannot clear extra icons") # do gracefully disconnect (send directly as we won't get any response on this) self.tn.write("bye\n") From 44ad0836469e96cc68a0d40b20aea548b54da65b Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 25 Apr 2013 23:00:58 +0200 Subject: [PATCH 204/337] changelog --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 2a10ed9..3abc45e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ - Indicate internet stream on extraicon-supported displays - Use XBMC's time for daytime display on BigDigit-mode and thus properly display 12/24h clocks - Additional "finetuning"-options for extraicon/bar-support +- Option to entirely disable extra stuff support 1.2.1 / 2.2.1 - Bugfixes, Credits, slightly more convenient configuration option bools 1.2.0 / 2.2.0 From 059ecaa511c090dd01ed948cf59af3b6a2f01d4c Mon Sep 17 00:00:00 2001 From: Waven Date: Thu, 23 May 2013 17:42:14 +0200 Subject: [PATCH 205/337] added tvshow mode --- lcdmain.py | 3 +++ resources/LCD.xml.defaults | 9 ++++++++- resources/lib/infolabels.py | 6 ++++++ resources/lib/lcdbase.py | 18 +++++++++++------- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/lcdmain.py b/lcdmain.py index 6b813cc..3bdb45c 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -79,6 +79,7 @@ def getLcdMode(): navActive = InfoLabel_IsNavigationActive() screenSaver = InfoLabel_IsScreenSaverActive() playingVideo = InfoLabel_PlayingVideo() + playingTVShow = InfoLabel_PlayingTVShow() playingMusic = InfoLabel_PlayingAudio() playingPVRTV = InfoLabel_PlayingLiveTV() playingPVRRadio = InfoLabel_PlayingLiveRadio() @@ -91,6 +92,8 @@ def getLcdMode(): ret = LCD_MODE.LCD_MODE_PVRTV elif playingPVRRadio: ret = LCD_MODE.LCD_MODE_PVRRADIO + elif playingTVShow: + ret = LCD_MODE.LCD_MODE_TVSHOW elif playingVideo: ret = LCD_MODE.LCD_MODE_VIDEO elif playingMusic: diff --git a/resources/LCD.xml.defaults b/resources/LCD.xml.defaults index 7d50cc5..e65bf5a 100644 --- a/resources/LCD.xml.defaults +++ b/resources/LCD.xml.defaults @@ -20,7 +20,14 @@ $INFO[LCD.ProgressBar] Freemem: $INFO[System.FreeMemory] - + + $INFO[LCD.PlayIcon] $INFO[Player.Time]/$INFO[Player.Duration] + $INFO[VideoPlayer.TVShowTitle] + $INFO[VideoPlayer.Title] + $INFO[LCD.ProgressBar] + Freemem: $INFO[System.FreeMemory] + + XBMC running... $INFO[System.Time] $INFO[System.Date] Freemem: $INFO[System.FreeMemory] diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 0a5625b..3c89396 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -108,6 +108,12 @@ def InfoLabel_WindowIsActive(WindowID): def InfoLabel_PlayingVideo(): return InfoLabel_GetBool("Player.HasVideo") +def InfoLabel_PlayingTVShow(): + if InfoLabel_PlayingVideo() and len(InfoLabel_GetInfoLabel("VideoPlayer.TVShowTitle")): + return True + else: + return False + def InfoLabel_PlayingAudio(): return InfoLabel_GetBool("Player.HasAudio") diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index eaa2b4f..20d9c99 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -54,12 +54,13 @@ class LCD_MODE: LCD_MODE_GENERAL = 0 LCD_MODE_MUSIC = 1 LCD_MODE_VIDEO = 2 - LCD_MODE_NAVIGATION = 3 - LCD_MODE_SCREENSAVER = 4 - LCD_MODE_XBE_LAUNCH = 5 - LCD_MODE_PVRTV = 6 - LCD_MODE_PVRRADIO = 7 - LCD_MODE_MAX = 8 + LCD_MODE_TVSHOW = 3 + LCD_MODE_NAVIGATION = 4 + LCD_MODE_SCREENSAVER = 5 + LCD_MODE_XBE_LAUNCH = 6 + LCD_MODE_PVRTV = 7 + LCD_MODE_PVRRADIO = 8 + LCD_MODE_MAX = 9 class LCD_LINETYPE: LCD_LINETYPE_TEXT = "text" @@ -314,6 +315,9 @@ def LoadSkin(self, xmlFile): tmpMode = element.find("video") self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_VIDEO) + tmpMode = element.find("tvshow") + self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_TVSHOW) + tmpMode = element.find("general") self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_GENERAL) @@ -474,7 +478,7 @@ def DoDimOnMusic(self, mode): return (mode == LCD_MODE.LCD_MODE_MUSIC or mode == LCD_MODE.LCD_MODE_PVRRADIO) and settings_getDimOnMusicPlayback() def DoDimOnVideo(self, mode): - return (mode == LCD_MODE.LCD_MODE_VIDEO or mode == LCD_MODE.LCD_MODE_PVRTV) and settings_getDimOnVideoPlayback() + return (mode == LCD_MODE.LCD_MODE_VIDEO or LCD_MODE.LCD_MODE_TVSHOW or mode == LCD_MODE.LCD_MODE_PVRTV) and settings_getDimOnVideoPlayback() def DoDimOnScreensaver(self, mode): return (mode == LCD_MODE.LCD_MODE_SCREENSAVER) and settings_getDimOnScreensaver() From 5ee4a2f4505633270f4efad9cb7763d2e837a095 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 28 May 2013 21:51:22 +0200 Subject: [PATCH 206/337] changelog, indent --- changelog.txt | 1 + resources/LCD.xml.defaults | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 3abc45e..1f5a192 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,6 @@ 1.3.0 / 2.3.0 - Alternate charmap selection, support for HD44780/iMON ROM (A00 and A02 variants) charsets +- New "tvshow" mode, active when playing media from the TV-shows database - Refactored backlight dimming handling and configuration via GUI settings - Cleaned up and improved TCP/Telnet socket handling - Indicate internet stream on extraicon-supported displays diff --git a/resources/LCD.xml.defaults b/resources/LCD.xml.defaults index e65bf5a..b565702 100644 --- a/resources/LCD.xml.defaults +++ b/resources/LCD.xml.defaults @@ -20,14 +20,14 @@ $INFO[LCD.ProgressBar] Freemem: $INFO[System.FreeMemory] - + $INFO[LCD.PlayIcon] $INFO[Player.Time]/$INFO[Player.Duration] $INFO[VideoPlayer.TVShowTitle] $INFO[VideoPlayer.Title] $INFO[LCD.ProgressBar] Freemem: $INFO[System.FreeMemory] - + XBMC running... $INFO[System.Time] $INFO[System.Date] Freemem: $INFO[System.FreeMemory] From 5a035b8e9cb2bce1320c1d3defd19c39f5391ef9 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 5 Jun 2013 22:31:35 +0200 Subject: [PATCH 207/337] treat LCD.xml as override for LCD.xml.defaults so additions (e.g. new modes) don't lead to empty screens --- changelog.txt | 1 + resources/lib/lcdbase.py | 36 ++++++++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/changelog.txt b/changelog.txt index 1f5a192..5f18aa1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,6 +7,7 @@ - Use XBMC's time for daytime display on BigDigit-mode and thus properly display 12/24h clocks - Additional "finetuning"-options for extraicon/bar-support - Option to entirely disable extra stuff support +- Always load defaults so LCD.xml in the masterprofile acts as user override, makes additions like new modes or wrong spelling in XML tags not result in empty displays 1.2.1 / 2.2.1 - Bugfixes, Credits, slightly more convenient configuration option bools 1.2.0 / 2.2.0 diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 20d9c99..0bfec9f 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -189,7 +189,8 @@ def ManageLCDXML(self): return ret def Initialize(self): - strXMLFile = __lcdxml__ + bGotDefaultSkin = False + bSkinHandled = False try: if not self.m_bHaveHD44780Charmap: @@ -199,10 +200,15 @@ def Initialize(self): except: log(xbmc.LOGERROR, "Failed to register custom HD44780-ROM pseudocodepage, expect problems with alternative charsets!") - if not self.ManageLCDXML(): - strXMLFile = __lcddefaultxml__ + # make sure we got reasonable defaults for users who didn't adapt to newest additions + bGotDefaultSkin = self.LoadSkin(__lcddefaultxml__, True) - if not self.LoadSkin(strXMLFile): + # check for user-LCD.xml, optionally create it + bSkinHandled = self.ManageLCDXML() + + # try to load user setup + if not self.LoadSkin(__lcdxml__, False) and not bGotDefaultSkin: + log(xbmc.LOGERROR, "No usable mode configuration/skin could be loaded, check your addon installation!") return False # force-update GUI settings @@ -222,10 +228,14 @@ def UpdateGUISettings(self): self.m_iDimOnPlayDelay = settings_getDimDelay() - def LoadSkin(self, xmlFile): - self.Reset() + def LoadSkin(self, xmlFile, doReset): + if doReset == True: + self.Reset() + bHaveSkin = False + log(xbmc.LOGNOTICE, "Loading settings from %s" % (xmlFile)) + try: doc = xmltree.parse(xmlFile) except: @@ -346,14 +356,24 @@ def LoadSkin(self, xmlFile): def LoadMode(self, node, mode): if node == None: log(xbmc.LOGWARNING, "Empty Mode %d, check LCD.xml" % (mode)) - self.m_lcdMode[mode].append(g_dictEmptyLineDescriptor) + + # if mode is empty, initialise with blank line + if len(self.m_lcdMode[mode]) <= 0: + self.m_lcdMode[mode].append(g_dictEmptyLineDescriptor) + return if len(node.findall("line")) <= 0: log(xbmc.LOGWARNING, "Mode %d defined without lines, check LCD.xml" % (mode)) - self.m_lcdMode[mode].append(g_dictEmptyLineDescriptor) + + if len(self.m_lcdMode[mode]) <= 0: + self.m_lcdMode[mode].append(g_dictEmptyLineDescriptor) + return + # node has something interesting, so clear mode (probably overriding defaults) + self.m_lcdMode[mode] = [] + # regex to determine any of $INFO[LCD.Time(Wide)21-44] timeregex = r'' + re.escape('$INFO[LCD.') + 'Time((Wide)?\d?\d?)' + re.escape(']') From 4eb95158e5fdb2a149fd134a959ca614fbc44e64 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 18 Jun 2013 20:32:34 +0200 Subject: [PATCH 208/337] LoadMode: clear mode at the beginning so users can force empty modes by overriding them in LCD.xml --- resources/lib/lcdbase.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 0bfec9f..5427ffe 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -354,8 +354,11 @@ def LoadSkin(self, xmlFile, doReset): return bHaveSkin def LoadMode(self, node, mode): + # clear mode (probably overriding defaults), assume the user knows what he wants if an empty node is given + self.m_lcdMode[mode] = [] + if node == None: - log(xbmc.LOGWARNING, "Empty Mode %d, check LCD.xml" % (mode)) + log(xbmc.LOGWARNING, "Empty Mode %d, consider checking LCD.xml" % (mode)) # if mode is empty, initialise with blank line if len(self.m_lcdMode[mode]) <= 0: @@ -364,16 +367,13 @@ def LoadMode(self, node, mode): return if len(node.findall("line")) <= 0: - log(xbmc.LOGWARNING, "Mode %d defined without lines, check LCD.xml" % (mode)) + log(xbmc.LOGWARNING, "Mode %d defined without lines, consider checking LCD.xml" % (mode)) if len(self.m_lcdMode[mode]) <= 0: self.m_lcdMode[mode].append(g_dictEmptyLineDescriptor) return - # node has something interesting, so clear mode (probably overriding defaults) - self.m_lcdMode[mode] = [] - # regex to determine any of $INFO[LCD.Time(Wide)21-44] timeregex = r'' + re.escape('$INFO[LCD.') + 'Time((Wide)?\d?\d?)' + re.escape(']') From 17f1a0e71a40fe5d64faae91506e4b5512ce7887 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 20 Jun 2013 19:30:12 +0200 Subject: [PATCH 209/337] InfoLabels: initialise return value in timeToSecs to fix a python exception if an invalid/unexpected h:m:s array is passed This was discovered when using the tuxbox functionality - when playing a stream, for some unknown reason the Player.Duration label doesn't return a h:m:s value anymore, but rather a string like "Length: 90 Minutes (11:45 - 13:15)", which initially gets split by the colons into four parts, which in turn isn't handled by the timeToSecs function (such a time representation would probably be invalid, anyway). This resulted in currentSecs being returned uninitialised, causing an exception. --- resources/lib/infolabels.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 3c89396..7f25d21 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -93,6 +93,9 @@ def InfoLabel_GetActiveWindowID(): return int(xbmcgui.getCurrentWindowId()) def InfoLabel_timeToSecs(timeAr): + # initialise return + currentSecs = 0 + arLen = len(timeAr) if arLen == 1: currentSecs = int(timeAr[0]) @@ -100,6 +103,7 @@ def InfoLabel_timeToSecs(timeAr): currentSecs = int(timeAr[0]) * 60 + int(timeAr[1]) elif arLen == 3: currentSecs = int(timeAr[0]) * 60 * 60 + int(timeAr[1]) * 60 + int(timeAr[2]) + return currentSecs def InfoLabel_WindowIsActive(WindowID): From b90ec3a833d56f3e55d60b6459c5ee68a9923bac Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 20 Jun 2013 21:08:25 +0200 Subject: [PATCH 210/337] fixed format usage for GetSystemTime() to ease transition to XBMC 13+ --- resources/lib/infolabels.py | 11 ++++++----- resources/lib/lcdproc.py | 9 +++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 7f25d21..0423fd2 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -127,11 +127,12 @@ def InfoLabel_PlayingLiveTV(): def InfoLabel_PlayingLiveRadio(): return InfoLabel_GetBool("PVR.IsPlayingRadio") -def InfoLabel_GetSystemTime(format): - cmd = "System.Time" - if len(format): - cmd += "(" + format + ")" - return InfoLabel_GetInfoLabel(cmd) +def InfoLabel_GetSystemTime(): + # apply some split magic for 12h format here, as "hh:mm:ss" + # makes up for format guessing inside XBMC - fix for post-frodo at + # https://github.com/xbmc/xbmc/pull/2321 + ret = "0" + InfoLabel_GetInfoLabel("System.Time(hh:mm:ss)").split(" ")[0] + return ret[-8:] def InfoLabel_GetPlayerTime(): return InfoLabel_GetInfoLabel("Player.Time") diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index d9f2869..06fc1f8 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -430,15 +430,12 @@ def GetBigDigitTime(self): ret = InfoLabel_GetPlayerTime() if ret == "": # no usable timestring, e.g. not playing anything - # apply some split magic for 12h format here, as "hh:mm:ss" - # makes up for format guessing inside XBMC - fix for post-frodo at - # https://github.com/xbmc/xbmc/pull/2321 - strSysTime = "0" + InfoLabel_GetSystemTime("hh:mm:ss").split(" ")[0] + strSysTime = InfoLabel_GetSystemTime() if self.m_iBigDigits >= 8: # return h:m:s - ret = strSysTime[-8:] + ret = strSysTime elif self.m_iBigDigits >= 5: # return h:m when display too small - ret = strSysTime[-8:-3] + ret = strSysTime[:5] return ret From 5ce88d21ad7a994c2bb867f79e0be85eb4cd9193 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 20 Jun 2013 21:26:08 +0200 Subject: [PATCH 211/337] correctly set num of bigdigits based on display geometry and allow overrides, make bigdigit display prefer (h:)mm:ss on play but keep hh:mm if geometry doesn't allow more --- resources/lib/lcdproc.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 06fc1f8..e18d364 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -257,6 +257,10 @@ def DetermineExtraSupport(self): if bUseExtraIcons: self.m_cExtraIcons = LCDproc_extra_imon() + # override bigdigits counter, the imonlcd driver handles bigdigits + # different: digits count for two columns instead of three + self.m_iBigDigits = 7 + elif re.match(rematch_mdm166a, reply): log(xbmc.LOGNOTICE, "Futaba/Targa USB mdm166a VFD detected") if bUseExtraIcons: @@ -308,18 +312,20 @@ def Connect(self): # tell users what's going on log(xbmc.LOGNOTICE, "Connected to LCDd at %s:%s, Protocol version %s - Geometry %sx%s characters (%sx%s pixels, %sx%s pixels per character)" % (str(ip), str(port), float(lcdinfo.group(1)), str(self.m_iColumns), str(self.m_iRows), str(self.m_iColumns * self.m_iCellWidth), str(self.m_iRows * self.m_iCellHeight), str(self.m_iCellWidth), str(self.m_iCellHeight))) - self.DetermineExtraSupport() - # Set up BigNum values based on display geometry if self.m_iColumns < 13: self.m_iBigDigits = 0 # No clock - elif self.m_iColumns < 16: # Hack: should be 17, but use 16 for imonlcd + elif self.m_iColumns < 17: self.m_iBigDigits = 5 # HH:MM elif self.m_iColumns < 20: self.m_iBigDigits = 7 # H:MM:SS on play, HH:MM on clock else: self.m_iBigDigits = 8 # HH:MM:SS + # Check LCDproc if we can enable any extras or override values + # (might override e.g. m_iBigDigits!) + self.DetermineExtraSupport() + except: log(xbmc.LOGERROR,"Connect: Caught exception, aborting.") return False @@ -427,7 +433,7 @@ def GetColumns(self): return int(self.m_iColumns) def GetBigDigitTime(self): - ret = InfoLabel_GetPlayerTime() + ret = InfoLabel_GetPlayerTime()[-self.m_iBigDigits:] if ret == "": # no usable timestring, e.g. not playing anything strSysTime = InfoLabel_GetSystemTime() From df472d4efea4ef061453f19b6738d3d3813a1463 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 20 Jun 2013 21:07:24 +0200 Subject: [PATCH 212/337] changelog --- changelog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 5f18aa1..172a1e2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,10 +4,11 @@ - Refactored backlight dimming handling and configuration via GUI settings - Cleaned up and improved TCP/Telnet socket handling - Indicate internet stream on extraicon-supported displays -- Use XBMC's time for daytime display on BigDigit-mode and thus properly display 12/24h clocks +- Use XBMC's time for daytime display on BigDigit-mode and thus properly display 12/24h clocks, improve bigdigit handling - Additional "finetuning"-options for extraicon/bar-support - Option to entirely disable extra stuff support - Always load defaults so LCD.xml in the masterprofile acts as user override, makes additions like new modes or wrong spelling in XML tags not result in empty displays +- Bugfixes and friends, of course 1.2.1 / 2.2.1 - Bugfixes, Credits, slightly more convenient configuration option bools 1.2.0 / 2.2.0 From 8e1e96dd361a43065886197e4b8b802430873125 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 4 Jul 2013 22:35:13 +0200 Subject: [PATCH 213/337] catch exceptions on decode.encode in Render() while playing with shoutcast streams a (seemlingly) extremely rare occasion was caught where invalid(?) utf-8 slipped into a parsed label, causing a crash/exception. --- resources/lib/lcdbase.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 5427ffe..db60af9 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -471,9 +471,14 @@ def Render(self, mode, bForce): if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_ICONTEXT: self.SetPlayingStateIcon() - line = InfoLabel_GetInfoLabel(self.m_lcdMode[mode][inLine]['text']) + srcline = InfoLabel_GetInfoLabel(self.m_lcdMode[mode][inLine]['text']) if self.m_strInfoLabelEncoding != self.m_strLCDEncoding: - line = line.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") + try: + line = srcline.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") + except: + log(xbmc.LOGDEBUG, "Caught exception on charset conversion: " + srcline) + line = "---" + self.SetProgressBar(0, -1) if self.m_bAllowEmptyLines or len(line) > 0: From 238896fbc5d7c3aaffc34cc8aff4ff4458df576a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 5 Sep 2013 20:47:49 +0200 Subject: [PATCH 214/337] extraicons: recognize eac3 (dolby digital plus) as ACODEC_AC3 --- resources/lib/lcdbase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index db60af9..d6c0a53 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -653,8 +653,8 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): if strAudioCodec in ["mpga", "mp2"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_MPEG, True) - # any ac3/dolby digital - elif strAudioCodec in ["ac3", "truehd"]: + # any ac3/dolby digital/dd+/truehd + elif strAudioCodec in ["ac3", "eac3", "truehd"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_AC3, True) # any dts including hires variants From 86ceb2ca1dca7a6051fdf5e07692de99ca06b49d Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 9 Sep 2013 20:11:44 +0200 Subject: [PATCH 215/337] bigdigits: don't do full reset in ClearBigDigits() from SetBigDigits(), fixes "overdraw" of digits over text lines on init when things switch too fast --- resources/lib/lcdproc.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index e18d364..50db90b 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -466,7 +466,8 @@ def SetBigDigits(self, strTimeString, bForceUpdate): iOffset = 1; if self.m_iOffset != iOffset: - self.ClearBigDigits() + # on offset change, reset numbers (only) to force redraw + self.ClearBigDigits(False) self.m_iOffset = iOffset for i in range(int(iStringOffset), int(iStringLength)): @@ -518,17 +519,19 @@ def SetPlayingStateIcon(self): def GetRows(self): return int(self.m_iRows) - def ClearBigDigits(self): + def ClearBigDigits(self, fullredraw = True): for i in range(1,int(self.m_iBigDigits + 1)): # Clear Digit - self.m_strSetLineCmds += "widget_set xbmc lineBigDigit" + str(i) + " 0 0\n" + if fullredraw: + self.m_strSetLineCmds += "widget_set xbmc lineBigDigit" + str(i) + " 0 0\n" self.m_strDigits[i] = "" - # make sure all widget get redrawn by resetting their type - for i in range(0, int(self.GetRows())): - self.m_strLineType[i] = "" - self.m_strLineText[i] = "" - self.m_strLineIcon[i] = "" + # on full redraw, make sure all widget get redrawn by resetting their type + if fullredraw: + for i in range(0, int(self.GetRows())): + self.m_strLineType[i] = "" + self.m_strLineText[i] = "" + self.m_strLineIcon[i] = "" def ClearLine(self, iLine): self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (iLine) From 4f9bb03a743dfe9a02cd7b54cee8db59382b8743 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 9 Sep 2013 20:16:14 +0200 Subject: [PATCH 216/337] changelog --- changelog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.txt b/changelog.txt index 172a1e2..f30cb6d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +1.3.1 / 2.3.1 +- Recognize E-AC3 (Dolby Digital plus) as AC3 in extra stuff support (affect imonlcd support) +- Fix BigDigits overdrawing text on addon start when things change too fast 1.3.0 / 2.3.0 - Alternate charmap selection, support for HD44780/iMON ROM (A00 and A02 variants) charsets - New "tvshow" mode, active when playing media from the TV-shows database From 8c7885021fb5ab606d301a74b9dfdb61c62aea8e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 12 Sep 2013 22:29:23 +0200 Subject: [PATCH 217/337] update LCD.xml.defaults with all "advanced" options and their defaults and short descriptions --- resources/LCD.xml.defaults | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/resources/LCD.xml.defaults b/resources/LCD.xml.defaults index b565702..361407d 100644 --- a/resources/LCD.xml.defaults +++ b/resources/LCD.xml.defaults @@ -1,6 +1,24 @@ - - video + + + + + + + + + + + + + + + + + + + + $INFO[System.CurrentWindow] $INFO[System.CurrentControl] From 4822b3086644a12cfbbae7a1548bd36b7a38af55 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 15 Sep 2013 11:33:11 +0200 Subject: [PATCH 218/337] bump version for release --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 97e588e..4dee8a7 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From 88aaec22af203e32579fe1c2269fdcc640145b80 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 14 Oct 2013 19:32:00 +0200 Subject: [PATCH 219/337] fix DoDimOnVideo(), missed variable comparison resulting in always-true --- resources/lib/lcdbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index d6c0a53..9249693 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -503,7 +503,7 @@ def DoDimOnMusic(self, mode): return (mode == LCD_MODE.LCD_MODE_MUSIC or mode == LCD_MODE.LCD_MODE_PVRRADIO) and settings_getDimOnMusicPlayback() def DoDimOnVideo(self, mode): - return (mode == LCD_MODE.LCD_MODE_VIDEO or LCD_MODE.LCD_MODE_TVSHOW or mode == LCD_MODE.LCD_MODE_PVRTV) and settings_getDimOnVideoPlayback() + return (mode == LCD_MODE.LCD_MODE_VIDEO or mode == LCD_MODE.LCD_MODE_TVSHOW or mode == LCD_MODE.LCD_MODE_PVRTV) and settings_getDimOnVideoPlayback() def DoDimOnScreensaver(self, mode): return (mode == LCD_MODE.LCD_MODE_SCREENSAVER) and settings_getDimOnScreensaver() From 5e2c93b649ddb50cf620cd76880bb3fd9172271c Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 14 Oct 2013 19:37:40 +0200 Subject: [PATCH 220/337] version bump, changelog --- addon.xml | 2 +- changelog.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 4dee8a7..a53cfc1 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index f30cb6d..a8deb93 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,5 @@ +1.3.2 / 2.3.2 +- Fix "dim display on video playback" functionality 1.3.1 / 2.3.1 - Recognize E-AC3 (Dolby Digital plus) as AC3 in extra stuff support (affect imonlcd support) - Fix BigDigits overdrawing text on addon start when things change too fast From 789970100624ec6e5d5a35c123992b1b37ede92f Mon Sep 17 00:00:00 2001 From: pavian Date: Sat, 1 Feb 2014 21:42:23 +0100 Subject: [PATCH 221/337] added cz/sk characters with caron --- resources/lib/charset_map_hd44780_a02.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/resources/lib/charset_map_hd44780_a02.py b/resources/lib/charset_map_hd44780_a02.py index 5b3210d..cbf2c29 100644 --- a/resources/lib/charset_map_hd44780_a02.py +++ b/resources/lib/charset_map_hd44780_a02.py @@ -223,16 +223,20 @@ 0x00c5: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE 0x00c6: 0x00c6, # LATIN CAPITAL LETTER AE 0x00c7: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA + 0x010c: 0x0043, # LATIN CAPITAL LETTER C WITH CARON + 0x010e: 0x0044, # LATIN CAPITAL LETTER D WITH CARON 0x00c8: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE 0x00c9: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE 0x00ca: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX 0x00cb: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS + 0x011a: 0x0045, # LATIN CAPITAL LETTER E WITH CARON 0x00cc: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE 0x00cd: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE 0x00ce: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX 0x00cf: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS 0x00d0: 0x00d0, # LATIN CAPITAL LETTER ETH 0x00d1: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE + 0x0147: 0x004e, # LATIN CAPITAL LETTER N WITH CARON 0x00d2: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE 0x00d3: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE 0x00d4: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX @@ -240,11 +244,16 @@ 0x00d6: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS 0x00d7: 0x00d7, # MULTIPLICATION SIGN # 0x00d8: # LATIN CAPITAL LETTER O WITH STROKE + 0x0158: 0x0052, # LATIN CAPITAL LETTER R WITH CARON + 0x0160: 0x0053, # LATIN CAPITAL LETTER S WITH CARON + 0x0164: 0x0054, # LATIN CAPITAL LETTER T WITH CARON 0x00d9: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE 0x00da: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE 0x00db: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX 0x00dc: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS 0x00dd: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE + 0x016e: 0x0055, # LATIN CAPITAL LETTER U WITH RING ABOVE + 0x017d: 0x005a, # LATIN CAPITAL LETTER Z WITH CARON 0x00de: 0x00de, # LATIN CAPITAL LETTER THORN 0x00df: 0x00df, # LATIN SMALL LETTER SHARP 0x00e0: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE @@ -255,16 +264,20 @@ 0x00e5: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE 0x00e6: 0x00e6, # LATIN SMALL LETTER AE 0x00e7: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA + 0x010d: 0x0063, # LATIN SMALL LETTER C WITH CARON + 0x010f: 0x0064, # LATIN SMALL LETTER D WITH CARON 0x00e8: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE 0x00e9: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE 0x00ea: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX 0x00eb: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS + 0x011b: 0x0065, # LATIN SMALL LETTER E WITH CARON 0x00ec: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE 0x00ed: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE 0x00ee: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX 0x00ef: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS 0x00f0: 0x00f0, # LATIN SMALL LETTER ETH 0x00f1: 0x00f1, # LATIN SMALL LETTER N WITH TILDE + 0x0148: 0x006e, # LATIN SMALL LETTER N WITH CARON 0x00f2: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE 0x00f3: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE 0x00f4: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX @@ -272,13 +285,18 @@ 0x00f6: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS 0x00f7: 0x00f7, # DIVISION SIGN 0x00f8: 0x00f8, # LATIN SMALL LETTER O WITH STROKE + 0x0159: 0x0072, # LATIN SMALL LETTER R WITH CARON + 0x0161: 0x0073, # LATIN SMALL LETTER S WITH CARON + 0x0165: 0x0074, # LATIN SMALL LETTER T WITH CARON 0x00f9: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE 0x00fa: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE 0x00fb: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX 0x00fc: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS + 0x016f: 0x0075, # LATIN SMALL LETTER U WITH RING ABOVE 0x00fd: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE 0x00fe: 0x00fe, # LATIN SMALL LETTER THORN 0x00ff: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS + 0x017e: 0x007a, # LATIN SMALL LETTER Z WITH CARON # Capital cyrillic letters 0x0401: 0x00cb, # CYRILLIC CAPITAL LETTER IO 0x0410: 0x0041, # CYRILLIC CAPITAL LETTER A From 484db0c54cd6817b8b0b3a54a27ab1066db21f93 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 2 Feb 2014 17:59:39 +0100 Subject: [PATCH 222/337] Bump addon version, start X.3.3 changelog --- addon.xml | 2 +- changelog.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index a53cfc1..51f2284 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index a8deb93..5a30d48 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,5 @@ +1.3.3 / 2.3.3 +- A02 char map enhanced to map czech characters 1.3.2 / 2.3.2 - Fix "dim display on video playback" functionality 1.3.1 / 2.3.1 From 3d3806a06216112ae582f69cf41a0e98252a9f89 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 2 Feb 2014 18:31:35 +0100 Subject: [PATCH 223/337] Bump version to 2.4.x, start some gotham-only enhancements/changes --- addon.xml | 5 ++--- changelog.txt | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addon.xml b/addon.xml index 51f2284..8f6e96b 100644 --- a/addon.xml +++ b/addon.xml @@ -1,8 +1,7 @@ - + - - + diff --git a/changelog.txt b/changelog.txt index 5a30d48..a1790c9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,6 @@ -1.3.3 / 2.3.3 +2.4.0 (Gotham) +- Gotham +1.3.3 / 2.3.3 (Eden / Frodo) - A02 char map enhanced to map czech characters 1.3.2 / 2.3.2 - Fix "dim display on video playback" functionality From 29608a88a2487ffb9a33f2e4d65c703e188c8d6a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 2 Feb 2014 18:51:35 +0100 Subject: [PATCH 224/337] cleanup usage of xbmcgui, readd to addon.xml imports as infolabels.py:InfoLabel_GetActiveWindowID() requires xbmcgui --- addon.xml | 1 + lcdmain.py | 1 - resources/lib/lcdbase.py | 1 - resources/lib/lcdproc.py | 1 - 4 files changed, 1 insertion(+), 3 deletions(-) diff --git a/addon.xml b/addon.xml index 8f6e96b..dd46f1d 100644 --- a/addon.xml +++ b/addon.xml @@ -3,6 +3,7 @@ + diff --git a/lcdmain.py b/lcdmain.py index 3bdb45c..182a259 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -23,7 +23,6 @@ import xbmc import xbmcaddon -import xbmcgui import time import os diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 9249693..d1ac467 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -23,7 +23,6 @@ import platform import xbmc -import xbmcgui import sys import os import shutil diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 50db90b..0ceb6fa 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -23,7 +23,6 @@ import platform import xbmc -import xbmcgui import sys import os import re From 76c41f8431a54b8bd0370b9a763e4fd33c230f6e Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Sun, 23 Feb 2014 13:12:32 +0100 Subject: [PATCH 225/337] Fixed German u and o umlauts (small letters) in hd44780 a00 charset map. --- resources/lib/charset_map_hd44780_a00.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/charset_map_hd44780_a00.py b/resources/lib/charset_map_hd44780_a00.py index 9a8bb97..a0d060e 100644 --- a/resources/lib/charset_map_hd44780_a00.py +++ b/resources/lib/charset_map_hd44780_a00.py @@ -267,13 +267,13 @@ 0x00f3: 0x006f, # LATIN SMALL LETTER O WITH ACUTE 0x00f4: 0x006f, # LATIN SMALL LETTER O WITH CIRCUMFLEX 0x00f5: 0x006f, # LATIN SMALL LETTER O WITH TILDE - 0x00f6: 0x006f, # LATIN SMALL LETTER O WITH DIAERESIS + 0x00f6: 0x00ef, # LATIN SMALL LETTER O WITH DIAERESIS 0x00f7: 0x00fd, # DIVISION SIGN 0x00f8: 0x006f, # LATIN SMALL LETTER O WITH STROKE 0x00f9: 0x0075, # LATIN SMALL LETTER U WITH GRAVE 0x00fa: 0x0075, # LATIN SMALL LETTER U WITH ACUTE 0x00fb: 0x0075, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x00fc: 0x0075, # LATIN SMALL LETTER U WITH DIAERESIS + 0x00fc: 0x00f5, # LATIN SMALL LETTER U WITH DIAERESIS 0x00fd: 0x0079, # LATIN SMALL LETTER Y WITH ACUTE 0x00fe: 0x0020, # LATIN SMALL LETTER THORN 0x00ff: 0x0079, # LATIN SMALL LETTER Y WITH DIAERESIS From ab6cd2217daf830600f19ff059ab6d7e5b04c546 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 26 Feb 2014 20:57:49 +0100 Subject: [PATCH 226/337] Gotham version will be 2.5.0 --- addon.xml | 2 +- changelog.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addon.xml b/addon.xml index dd46f1d..04e9231 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index a1790c9..6f80875 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,4 @@ -2.4.0 (Gotham) +2.5.0 (Gotham) - Gotham 1.3.3 / 2.3.3 (Eden / Frodo) - A02 char map enhanced to map czech characters From 9ad38d96bb6f2b4110f9e946a7f78cdca1e9e2a1 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 26 Feb 2014 21:19:28 +0100 Subject: [PATCH 227/337] line should have content also when configured encodings match --- resources/lib/lcdbase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index d1ac467..ff93aac 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -477,6 +477,8 @@ def Render(self, mode, bForce): except: log(xbmc.LOGDEBUG, "Caught exception on charset conversion: " + srcline) line = "---" + else: + line = srcline self.SetProgressBar(0, -1) From 417d8c5581f488df5cd42f4bbffa1093af9afa30 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 26 Feb 2014 21:17:29 +0100 Subject: [PATCH 228/337] strip off BBcode tags from parsed infolabel in line renderer --- resources/lib/lcdbase.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index ff93aac..af7d15e 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -453,6 +453,23 @@ def Shutdown(self): self.CloseSocket() + def StripBBCode(self, strtext): + tmpline = strtext + loopcount = 5 + + # do regex multiple times to catch nested tags + while True: + loopcount = loopcount - 1 + mangledline = re.sub("\[(?P\w+)([^\[]+)*\](?P.*?)\[/(?P=tagname)\]", "\g", tmpline) + + # when the result didn't change, all tags should be gone (but also stop if maxnum iterations are reached) + if tmpline == mangledline or loopcount < 1: + break + tmpline = mangledline + + # return last replace mangling + return tmpline + def Render(self, mode, bForce): outLine = 0 inLine = 0 @@ -471,6 +488,10 @@ def Render(self, mode, bForce): self.SetPlayingStateIcon() srcline = InfoLabel_GetInfoLabel(self.m_lcdMode[mode][inLine]['text']) + + if len(srcline) > 0: + srcline = self.StripBBCode(srcline) + if self.m_strInfoLabelEncoding != self.m_strLCDEncoding: try: line = srcline.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") From a9c42bcca896a8f8b5fba47498e21d9ff972d8e1 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 17 Feb 2014 22:47:58 +0100 Subject: [PATCH 229/337] pass current mode to GetBigDigitTime() and use as indicator wether to force retrieval of system time when screensaving and player is paused --- resources/lib/lcdbase.py | 6 +++--- resources/lib/lcdproc.py | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index af7d15e..bf698d5 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -142,7 +142,7 @@ def ClearLine(self, iLine): pass # @abstractmethod - def SetLine(self, iLine, strLine, dictDescriptor, bForce): + def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): pass # @abstractmethod @@ -504,7 +504,7 @@ def Render(self, mode, bForce): self.SetProgressBar(0, -1) if self.m_bAllowEmptyLines or len(line) > 0: - self.SetLine(outLine, line, self.m_lcdMode[mode][inLine], bForce) + self.SetLine(mode, outLine, line, self.m_lcdMode[mode][inLine], bForce) outLine += 1 inLine += 1 @@ -512,7 +512,7 @@ def Render(self, mode, bForce): # fill remainder with empty space if not bigscreen if self.m_lcdMode[mode][0]['type'] != LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: while outLine < int(self.GetRows()): - self.SetLine(outLine, "", g_dictEmptyLineDescriptor, bForce) + self.SetLine(mode, outLine, "", g_dictEmptyLineDescriptor, bForce) outLine += 1 if self.m_cExtraIcons is not None: diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 0ceb6fa..eb54ee3 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -431,8 +431,10 @@ def Resume(self): def GetColumns(self): return int(self.m_iColumns) - def GetBigDigitTime(self): - ret = InfoLabel_GetPlayerTime()[-self.m_iBigDigits:] + def GetBigDigitTime(self, mode): + ret = "" + if not (InfoLabel_IsPlayerPaused() and mode == LCD_MODE.LCD_MODE_SCREENSAVER): + ret = InfoLabel_GetPlayerTime()[-self.m_iBigDigits:] if ret == "": # no usable timestring, e.g. not playing anything strSysTime = InfoLabel_GetSystemTime() @@ -537,7 +539,7 @@ def ClearLine(self, iLine): self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (iLine) self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"\"\n" % (iLine, iLine, self.m_iColumns, iLine) - def SetLine(self, iLine, strLine, dictDescriptor, bForce): + def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): if self.m_bStop or not self.tnsocket: return @@ -563,7 +565,7 @@ def SetLine(self, iLine, strLine, dictDescriptor, bForce): self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text']) if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: - strLineLong = self.GetBigDigitTime() + strLineLong = self.GetBigDigitTime(mode) else: strLineLong = strLine From 5cd189eb279929fa87f0fa43c81247d6003154e2 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 3 Mar 2014 21:50:10 +0100 Subject: [PATCH 230/337] changelog --- changelog.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 6f80875..27e39fe 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ 2.5.0 (Gotham) -- Gotham +- Initial version for XBMC Gotham with updated dependencies +- BBcode tags are stripped before sending content to the display (reported to happen on e.g. OpenELEC) +- Change in behaviour: BigDigit tag will show the system time instead of current playtime if playing media is paused and the screensaver kicks in +- Missing german umlauts added to the HD44780-A00 character translation map 1.3.3 / 2.3.3 (Eden / Frodo) - A02 char map enhanced to map czech characters 1.3.2 / 2.3.2 From ff50c4744d93be6cd4a99a9dbcea1e3ecb17cb0a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 4 Mar 2014 00:47:38 +0100 Subject: [PATCH 231/337] improve/fix cpu-hogging regex, tidy up code --- resources/lib/lcdbase.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index bf698d5..83b2793 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -105,6 +105,9 @@ def __init__(self): self.m_strOldAudioCodec = "" self.m_strOldVideoCodec = "" + # regex compile cache + self.m_reBBCode = None + # @abstractmethod def _concrete_method(self): pass @@ -454,21 +457,27 @@ def Shutdown(self): self.CloseSocket() def StripBBCode(self, strtext): - tmpline = strtext + # precompile and remember regex to make sure re's caching won't cause accidential recompilation + if not self.m_reBBCode: + self.m_reBBCode = re.compile("\[(?P[0-9a-zA-Z_\-]+?)[0-9a-zA-Z_\- ]*?\](?P.*?)\[\/(?P=tagname)\]") + + # loop to catch nested tags loopcount = 5 + + # start with passed string + mangledline = strtext # do regex multiple times to catch nested tags while True: loopcount = loopcount - 1 - mangledline = re.sub("\[(?P\w+)([^\[]+)*\](?P.*?)\[/(?P=tagname)\]", "\g", tmpline) + mangledline, replacements = re.subn(self.m_reBBCode, "\g", mangledline) # when the result didn't change, all tags should be gone (but also stop if maxnum iterations are reached) - if tmpline == mangledline or loopcount < 1: + if replacements == 0 or loopcount < 1: break - tmpline = mangledline # return last replace mangling - return tmpline + return mangledline def Render(self, mode, bForce): outLine = 0 From efa735ba7f9d9e6c0ffa2517d457eab33e67a396 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 5 Mar 2014 21:12:34 +0100 Subject: [PATCH 232/337] catch errors related to bbcode regex caching/execution --- resources/lib/lcdbase.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 83b2793..e684eb5 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -457,9 +457,14 @@ def Shutdown(self): self.CloseSocket() def StripBBCode(self, strtext): + regexbbcode = "\[(?P[0-9a-zA-Z_\-]+?)[0-9a-zA-Z_\- ]*?\](?P.*?)\[\/(?P=tagname)\]" # precompile and remember regex to make sure re's caching won't cause accidential recompilation if not self.m_reBBCode: - self.m_reBBCode = re.compile("\[(?P[0-9a-zA-Z_\-]+?)[0-9a-zA-Z_\- ]*?\](?P.*?)\[\/(?P=tagname)\]") + self.m_reBBCode = re.compile(regexbbcode) + # catch+report failure + if not self.m_reBBCode: + log(xbmc.LOGWARNING, "Precompilation of BBCode strip regex failed") + self.m_reBBCode = regexbbcode # loop to catch nested tags loopcount = 5 @@ -470,7 +475,10 @@ def StripBBCode(self, strtext): # do regex multiple times to catch nested tags while True: loopcount = loopcount - 1 - mangledline, replacements = re.subn(self.m_reBBCode, "\g", mangledline) + try: + mangledline, replacements = re.subn(self.m_reBBCode, "\g", mangledline) + except: + return mangledline # when the result didn't change, all tags should be gone (but also stop if maxnum iterations are reached) if replacements == 0 or loopcount < 1: From e5408ac1b00dc4b2f6c51e804fbeffa9d6022cf5 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 9 Mar 2014 11:44:35 +0100 Subject: [PATCH 233/337] insert resources/lib at index 0 of sys.path to fix unwanted priorisation of site-packages and friends when scriptnames overlap (fixes name conflict with the lcdproc pyegg) --- lcdmain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lcdmain.py b/lcdmain.py index 182a259..08c7f4b 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -32,7 +32,7 @@ __scriptname__ = "XBMC LCDproc" BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'lib' ) ) -sys.path.append (BASE_RESOURCE_PATH) +sys.path.insert(0, BASE_RESOURCE_PATH) from settings import * from lcdproc import * From 865f134028f3c6a52084566ebb8701b5427ac346 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 21 May 2014 21:33:22 +0200 Subject: [PATCH 234/337] changelog --- changelog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.txt b/changelog.txt index 27e39fe..a8309e6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,5 @@ +2.5.1 +- Fix name conflict with the LCDproc PyEgg 2.5.0 (Gotham) - Initial version for XBMC Gotham with updated dependencies - BBcode tags are stripped before sending content to the display (reported to happen on e.g. OpenELEC) From 70f68e238280aea7b5364dd21449d213946c69e2 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 21 May 2014 21:44:49 +0200 Subject: [PATCH 235/337] split setup command loop to initialise all hbars before icons, fixes display of bars below icons on RasbPi --- changelog.txt | 1 + resources/lib/lcdproc.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index a8309e6..2724f36 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,6 @@ 2.5.1 - Fix name conflict with the LCDproc PyEgg +- Split setup command list loop to initialise hbars before icons, fixes progress bars not being shown if placed after any icons on RasbPi 2.5.0 (Gotham) - Initial version for XBMC Gotham with updated dependencies - BBcode tags are stripped before sending content to the display (reported to happen on e.g. OpenELEC) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index eb54ee3..55fa51e 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -161,7 +161,7 @@ def SetupScreen(self): # Initialize command list var strInitCommandList = "" - # Setup widgets + # Setup widgets (scrollers and hbars first) for i in range(1,int(self.m_iRows)+1): # Text widgets strInitCommandList += "widget_add xbmc lineScroller" + str(i) + " scroller\n" @@ -172,14 +172,17 @@ def SetupScreen(self): # Reset bars to zero strInitCommandList += "widget_set xbmc lineProgress" + str(i) + " 0 0 0\n" + self.m_strLineText[i-1] = "" + self.m_strLineType[i-1] = "" + + # Setup icons last + for i in range(1,int(self.m_iRows)+1): # Icons strInitCommandList += "widget_add xbmc lineIcon" + str(i) + " icon\n" # Default icon strInitCommandList += "widget_set xbmc lineIcon" + str(i) + " 0 0 BLOCK_FILLED\n" - self.m_strLineText[i-1] = "" - self.m_strLineType[i-1] = "" self.m_strLineIcon[i-1] = "" for i in range(1,int(self.m_iBigDigits + 1)): From 647dbf286c72bfbd61f81023e52118f1ce74a3f3 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 7 Jul 2014 20:51:58 +0200 Subject: [PATCH 236/337] don't use str() function in LcdBase::LoadMode() and encode to UTF8, should fix charset encoding exceptions when using UTF8 in LCD.xml --- changelog.txt | 1 + resources/lib/lcdbase.py | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/changelog.txt b/changelog.txt index 2724f36..61eeba8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,7 @@ 2.5.1 - Fix name conflict with the LCDproc PyEgg - Split setup command list loop to initialise hbars before icons, fixes progress bars not being shown if placed after any icons on RasbPi +- Fix charset encoding exceptions on LCD.xml load if it contains UTF8 chars 2.5.0 (Gotham) - Initial version for XBMC Gotham with updated dependencies - BBcode tags are stripped before sending content to the display (reported to happen on e.g. OpenELEC) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index e684eb5..b64bf28 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -389,7 +389,7 @@ def LoadMode(self, node, mode): if line.text == None: linetext = "" else: - linetext = str(line.text).strip() + linetext = line.text.strip().encode("utf-8", "ignore") # make sure linetext has something so re.match won't fail if linetext != "": @@ -405,7 +405,7 @@ def LoadMode(self, node, mode): return # progressbar line if InfoLabel exists - if str(linetext).lower().find("$info[lcd.progressbar]") >= 0: + if linetext.lower().find("$info[lcd.progressbar]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_PROGRESS linedescriptor['endx'] = int(self.m_iCellWidth) * int(self.m_iColumns) @@ -415,32 +415,32 @@ def LoadMode(self, node, mode): linedescriptor['endx'] = int(self.m_iCellWidth) * (int(self.GetColumns()) - 2) # textline with icon in front - elif str(linetext).lower().find("$info[lcd.playicon]") >= 0: + elif linetext.lower().find("$info[lcd.playicon]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_ICONTEXT linedescriptor['startx'] = int(1 + self.m_iIconTextOffset) # icon widgets take 2 chars, so shift text offset (default: 2) # support Python < 2.7 (e.g. Debian Squeeze) if self.m_vPythonVersion < (2, 7): - linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', str(linetext))).strip() + linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', linetext).strip() else: - linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', str(linetext), flags=re.IGNORECASE)).strip() + linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', linetext, flags=re.IGNORECASE).strip() # standard (scrolling) text line else: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_TEXT - linedescriptor['text'] = str(linetext) + linedescriptor['text'] = linetext # check for alignment pseudo-labels - if str(linetext).lower().find("$info[lcd.aligncenter]") >= 0: + if linetext.lower().find("$info[lcd.aligncenter]") >= 0: linedescriptor['align'] = LCD_LINEALIGN.LCD_LINEALIGN_CENTER - if str(linetext).lower().find("$info[lcd.alignright]") >= 0: + if linetext.lower().find("$info[lcd.alignright]") >= 0: linedescriptor['align'] = LCD_LINEALIGN.LCD_LINEALIGN_RIGHT if self.m_vPythonVersion < (2, 7): - linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.AlignCenter]") + '\s?', ' ', linedescriptor['text'])).strip() - linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.AlignRight]") + '\s?', ' ', linedescriptor['text'])).strip() + linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignCenter]") + '\s?', ' ', linedescriptor['text']).strip() + linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignRight]") + '\s?', ' ', linedescriptor['text']).strip() else: - linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.AlignCenter]") + '\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE)).strip() - linedescriptor['text'] = str(re.sub(r'\s?' + re.escape("$INFO[LCD.AlignRight]") + '\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE)).strip() + linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignCenter]") + '\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE).strip() + linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignRight]") + '\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE).strip() self.m_lcdMode[mode].append(linedescriptor) From b90a79013a310c646461c9a9a4e41b4f22cff0f5 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 18 Aug 2014 22:17:54 +0200 Subject: [PATCH 237/337] version bump to 2.5.1 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 04e9231..984ff64 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From 879c98df5425bab17fefe88aa0f83862093c3e8a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 18 Aug 2014 22:30:28 +0200 Subject: [PATCH 238/337] use m_strInfoLabelEncoding for linetext assignment instead of hardcoded value --- resources/lib/lcdbase.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index b64bf28..dcfdbe8 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -389,7 +389,8 @@ def LoadMode(self, node, mode): if line.text == None: linetext = "" else: - linetext = line.text.strip().encode("utf-8", "ignore") + # prepare text line for XBMC's expected encoding + linetext = line.text.strip().encode(self.m_strInfoLabelEncoding, "ignore") # make sure linetext has something so re.match won't fail if linetext != "": From 0c739fdfd4a730b37d234472d3ff593acd7f0adb Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Fri, 12 Sep 2014 19:44:57 +0200 Subject: [PATCH 239/337] version bump, bump depends for helix --- addon.xml | 6 +++--- changelog.txt | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addon.xml b/addon.xml index 984ff64..36a83c2 100644 --- a/addon.xml +++ b/addon.xml @@ -1,9 +1,9 @@ - + - + - + diff --git a/changelog.txt b/changelog.txt index 61eeba8..5d4b8aa 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,5 @@ +2.6.0 +- Initial version for Kodi Helix 2.5.1 - Fix name conflict with the LCDproc PyEgg - Split setup command list loop to initialise hbars before icons, fixes progress bars not being shown if placed after any icons on RasbPi From 602c899de00e6196a7338e102bd1986f4115ed6d Mon Sep 17 00:00:00 2001 From: DK-Git Date: Sat, 20 Sep 2014 15:39:29 +0200 Subject: [PATCH 240/337] Update charset_map_hd44780_a00.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit small letter "ć" --- resources/lib/charset_map_hd44780_a00.py | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lib/charset_map_hd44780_a00.py b/resources/lib/charset_map_hd44780_a00.py index a0d060e..0be4fcf 100644 --- a/resources/lib/charset_map_hd44780_a00.py +++ b/resources/lib/charset_map_hd44780_a00.py @@ -281,6 +281,7 @@ 0x0104: 0x0041, # LATIN CAPITAL LETTER A WITH OGONEK 0x0105: 0x0061, # LATIN SMALL LETTER A WITH OGONEK 0x0106: 0x0043, # LATIN CAPITAL LETTER C WITH ACUTE + 0x0107: 0x0063, # LATIN SMALL LETTER C WITH ACUTE 0x0118: 0x0045, # LATIN CAPITAL LETTER E WITH OGONEK 0x0119: 0x0065, # LATIN SMALL LETTER E WITH OGONEK 0x0141: 0x004c, # LATIN CAPITAL LETTER L WITH STROKE From a790757e8c298b19e1957c3eb53b28ad13fe7797 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 18 Sep 2014 21:15:05 +0200 Subject: [PATCH 241/337] use player.muted infobool to determine mute state --- resources/lib/infolabels.py | 3 +++ resources/lib/lcdbase.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 0423fd2..953dacd 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -198,6 +198,9 @@ def InfoLabel_IsDiscInDrive(): def InfoLabel_IsScreenSaverActive(): return InfoLabel_GetBool("System.ScreenSaverActive") +def InfoLabel_IsMuted(): + return InfoLabel_GetBool("Player.Muted") + def InfoLabel_GetVolumePercent(): volumedb = float(string.replace(string.replace(InfoLabel_GetInfoLabel("Player.Volume"), ",", "."), " dB", "")) return (100 * (60.0 + volumedb) / 60) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index dcfdbe8..e4ab839 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -752,7 +752,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_bWasStopped = True def SetExtraInfoGeneric(self, ispaused): - if InfoLabel_GetVolumePercent() == 0.0: + if InfoLabel_IsMuted(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUTE, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUTE, False) From a603fedd70961a2e2a406577337d18fade279d31 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 21 Sep 2014 15:25:10 +0200 Subject: [PATCH 242/337] changelog --- changelog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.txt b/changelog.txt index 5d4b8aa..67c14b2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,7 @@ 2.6.0 - Initial version for Kodi Helix +- Fix retrieval of application mute state +- Small addition to the HD44780-A00 charmap for polish chars 2.5.1 - Fix name conflict with the LCDproc PyEgg - Split setup command list loop to initialise hbars before icons, fixes progress bars not being shown if placed after any icons on RasbPi From 8a61128df2b03f6d1bcf761db6a334b0b020a79c Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Fri, 7 Nov 2014 22:49:17 +0100 Subject: [PATCH 243/337] drop unneeded dependency on xbmc.gui --- addon.xml | 1 - changelog.txt | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 36a83c2..0b7f94e 100644 --- a/addon.xml +++ b/addon.xml @@ -3,7 +3,6 @@ - diff --git a/changelog.txt b/changelog.txt index 67c14b2..cd0ec7a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ - Initial version for Kodi Helix - Fix retrieval of application mute state - Small addition to the HD44780-A00 charmap for polish chars +- Dropped unneeded dependency on xbmc.gui 2.5.1 - Fix name conflict with the LCDproc PyEgg - Split setup command list loop to initialise hbars before icons, fixes progress bars not being shown if placed after any icons on RasbPi From f6dc66438117e91904f80bae449c25ec27805c7c Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Fri, 7 Nov 2014 23:03:43 +0100 Subject: [PATCH 244/337] changelog: tag 2.6.0 as "Helix" --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index cd0ec7a..8cb33e0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,4 @@ -2.6.0 +2.6.0 (Helix) - Initial version for Kodi Helix - Fix retrieval of application mute state - Small addition to the HD44780-A00 charmap for polish chars From f1b1ed3e7057484d2f756da9e7e336869aceef7f Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 30 Jan 2017 19:51:06 +0100 Subject: [PATCH 245/337] change startup priority to "startup" so the addon gets active earlier --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 0b7f94e..a5b540d 100644 --- a/addon.xml +++ b/addon.xml @@ -4,7 +4,7 @@ - + XBMC LCDproc From 406ebd1133ceac08500e1b6d7caf1b99734a302c Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 May 2018 17:26:08 +0200 Subject: [PATCH 246/337] fix BigDigit (TimeWide mode) SystemTime retrieval seems that from Krypton to Leia, Player.Paused doesn't return True anymore if nothing is played, thus causing Player.Time to be fetched even when nothing is played, causing TimeWide in ie. general modes to display 00:00. Fix this by taking Player.Playing into the equation wether to fetch the player time or the system.time. --- resources/lib/lcdproc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 55fa51e..95ef38f 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -436,8 +436,10 @@ def GetColumns(self): def GetBigDigitTime(self, mode): ret = "" - if not (InfoLabel_IsPlayerPaused() and mode == LCD_MODE.LCD_MODE_SCREENSAVER): - ret = InfoLabel_GetPlayerTime()[-self.m_iBigDigits:] + + if InfoLabel_IsPlayerPlaying(): + if not (mode == LCD_MODE.LCD_MODE_SCREENSAVER and InfoLabel_IsPlayerPaused()): + ret = InfoLabel_GetPlayerTime()[-self.m_iBigDigits:] if ret == "": # no usable timestring, e.g. not playing anything strSysTime = InfoLabel_GetSystemTime() From dcb673eb86a764c367aaae84e471e0a405447a42 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 May 2018 18:02:02 +0200 Subject: [PATCH 247/337] check Player.HasMedia instead of Player.Playing for any player activity Player.Playing seems to cause false positives especially on application start, causing the imon spinner to be active and bigdigit systemtime evaluation to fail. --- resources/lib/infolabels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 953dacd..1f1cf91 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -141,7 +141,7 @@ def InfoLabel_GetPlayerDuration(): return InfoLabel_GetInfoLabel("Player.Duration") def InfoLabel_IsPlayerPlaying(): - return InfoLabel_GetBool("Player.Playing") + return InfoLabel_GetBool("Player.HasMedia") def InfoLabel_IsPlayerPaused(): return InfoLabel_GetBool("Player.Paused") From c0e4512fadb3444a01a9bdb2c7194453f531a658 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 May 2018 18:08:59 +0200 Subject: [PATCH 248/337] use IsPlayerPlaying instead of IsPlayingAny in LcdBase.SetExtraInformation() IsPlayerPlaying() serves the same purpose as IsPlayingAny() after the former now queries Player.HasMedia, but with less overhead. As IsPlayingAny() isn't used anywhere else, get rid of it. --- resources/lib/infolabels.py | 6 ------ resources/lib/lcdbase.py | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 1f1cf91..d7211a9 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -152,12 +152,6 @@ def InfoLabel_IsPlayerForwarding(): def InfoLabel_IsPlayerRewinding(): return InfoLabel_GetBool("Player.Rewinding") -def InfoLabel_IsPlayingAny(): - return (InfoLabel_IsPlayerPlaying() | - InfoLabel_IsPlayerPaused() | - InfoLabel_IsPlayerForwarding() | - InfoLabel_IsPlayerRewinding()) - def InfoLabel_IsInternetStream(): global g_InfoLabel_oldFilenameandpath global g_InfoLabel_CachedFilenameIsStream diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index e4ab839..9cd08d1 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -825,7 +825,7 @@ def SetExtraInfoBars(self, isplaying): def SetExtraInformation(self): bPaused = InfoLabel_IsPlayerPaused() - bPlaying = InfoLabel_IsPlayingAny() + bPlaying = InfoLabel_IsPlayerPlaying() bIsVideo = InfoLabel_PlayingVideo() bIsAudio = InfoLabel_PlayingAudio() From b4f03132db480a30914d0191ea5431974ab49061 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 May 2018 18:15:36 +0200 Subject: [PATCH 249/337] check for playing and paused in HandleBacklight() As Player.Paused isn't True anymore when nothing is playing, also check IsPlaying() to evaluate this correctly. --- resources/lib/lcdbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 9cd08d1..bc85df0 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -554,7 +554,7 @@ def HandleBacklight(self, mode): if self.DoDimOnScreensaver(mode): doDim = True - elif not InfoLabel_IsPlayerPaused() and (self.DoDimOnVideo(mode) or self.DoDimOnMusic(mode)): + elif not (InfoLabel_IsPlayerPlaying() and InfoLabel_IsPlayerPaused()) and (self.DoDimOnVideo(mode) or self.DoDimOnMusic(mode)): doDim = True if doDim: From e45d116ac5b8a2334cb2856d148d1be5159827c7 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 May 2018 18:47:06 +0200 Subject: [PATCH 250/337] get PVR Epg progress labels to determine player progress percent When playing back LiveTV or LiveRadio through PVR, the elapsed time and duration are now available in specific PVR labels, Player.Time and Player.Duration don't hold that information anymore. Query these PVR labels when playing PVR Live content. --- resources/lib/infolabels.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index d7211a9..8a29a83 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -135,9 +135,15 @@ def InfoLabel_GetSystemTime(): return ret[-8:] def InfoLabel_GetPlayerTime(): + if InfoLabel_PlayingLiveTV() or InfoLabel_PlayingLiveRadio(): + return InfoLabel_GetInfoLabel("PVR.EpgEventElapsedTime") + return InfoLabel_GetInfoLabel("Player.Time") def InfoLabel_GetPlayerDuration(): + if InfoLabel_PlayingLiveTV() or InfoLabel_PlayingLiveRadio(): + return InfoLabel_GetInfoLabel("PVR.EpgEventDuration") + return InfoLabel_GetInfoLabel("Player.Duration") def InfoLabel_IsPlayerPlaying(): From 3070b3c74400a8c9bd4dd5db241c3207d51af1a2 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 May 2018 18:57:53 +0200 Subject: [PATCH 251/337] get Player.IsInternetStream in InfoBool_IsInternetStream() Instead of determining if the currently playing item is played from any online resource (online stream) in a complicated way, rather ask Kodi via Player.IsInternetStream about that (Kodi probably even knows about that better anyway). Also, clean up the now unused globals accordingly. --- resources/lib/infolabels.py | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 8a29a83..27654a6 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -57,31 +57,19 @@ class WINDOW_IDS: WINDOW_PICTURES = 10002 WINDOW_DIALOG_VOLUME_BAR = 10104 WINDOW_DIALOG_KAI_TOAST = 10107 - -g_StreamPrefixes = [ \ - "http", "https", "tcp", "udp", "rtp", \ - "sdp", "mms", "mmst", "mmsh", "rtsp", \ - "rtmp", "rtmpt", "rtmpe", "rtmpte", "rtmps" \ -] global g_InfoLabel_oldMenu global g_InfoLabel_oldSubMenu global g_InfoLabel_navTimer -global g_InfoLabel_oldFilenameandpath -global g_InfoLabel_CachedFilenameIsStream def InfoLabel_Initialize(): global g_InfoLabel_oldMenu global g_InfoLabel_oldSubMenu global g_InfoLabel_navTimer - global g_InfoLabel_oldFilenameandpath - global g_InfoLabel_CachedFilenameIsStream g_InfoLabel_oldMenu = "" g_InfoLabel_oldSubMenu = "" g_InfoLabel_navTimer = time.time() - g_InfoLabel_oldFilenameandpath = "" - g_InfoLabel_CachedFilenameIsStream = False def InfoLabel_GetInfoLabel(strLabel): return xbmc.getInfoLabel(strLabel) @@ -159,20 +147,7 @@ def InfoLabel_IsPlayerRewinding(): return InfoLabel_GetBool("Player.Rewinding") def InfoLabel_IsInternetStream(): - global g_InfoLabel_oldFilenameandpath - global g_InfoLabel_CachedFilenameIsStream - - fname = InfoLabel_GetInfoLabel("Player.Filenameandpath") - - if fname != g_InfoLabel_oldFilenameandpath: - g_InfoLabel_oldFilenameandpath = fname - g_InfoLabel_CachedFilenameIsStream = False - - for prefix in g_StreamPrefixes: - if fname.find(prefix + "://") == 0: - g_InfoLabel_CachedFilenameIsStream = True - - return g_InfoLabel_CachedFilenameIsStream + return InfoLabel_GetBool("Player.IsInternetStream") def InfoLabel_IsPassthroughAudio(): return InfoLabel_GetBool("Player.Passthrough") From f65f18eba170f9df35b3bb02ef4df27a62a0fdcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Skalski?= Date: Sat, 30 Dec 2017 23:56:55 +0100 Subject: [PATCH 252/337] Added Polish translation --- resources/language/Polish/strings.xml | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 resources/language/Polish/strings.xml diff --git a/resources/language/Polish/strings.xml b/resources/language/Polish/strings.xml new file mode 100644 index 0000000..91be8dd --- /dev/null +++ b/resources/language/Polish/strings.xml @@ -0,0 +1,49 @@ + + + + + Zachowanie + Opóźnienie dla przewijania tekstu + Tryb przewijania + Czas wyświetlania informacji nawigacyjnych (s) + Częstotliwość odświeżania (Hz) + Użyj alternatywnego zestawu znaków + Zestaw znaków + Wsparcie dla dodatkowych elementów wyświetlających (np. ikon) + + + Podświetlenie + podczas działania wygaszacza ekrany + Przyciemnij przed wyłączeniem + podczas odtwarzania filmów wideo/TV + podczas odtwarzania muzyki/radia + Opóźnienie (s) + Przyciemnij/wyłącz: + + + Połączenie + Podłącz do zdalnego serwera LCDProc + Adres IP serwera LCDd + Port serwera LCDd + Włącz tętno (heartbeat) + Nie pokazuj powiadomień o błędach połączenia + + + Marquee + Lewo/Prawo + + + ISO8859-1 (default) + ISO8859-15 + KOI8-R + CP1251 + ISO8859-5 + HD44780-ROM A00 + HD44780-ROM A02 + + + Błąd połączenia z serwerem LCDProc! + Połączony z serwerem LCDProc! + Uwaga! Błędy w konfiguracji w pliku LCD.xml lub plik LCD.xml nie znaleziony! + + From 329efa1372633d2248df4acf6e45c2e4a042ef07 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 May 2018 19:29:56 +0200 Subject: [PATCH 253/337] versionate as 3.0.0 --- addon.xml | 6 +++--- changelog.txt | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addon.xml b/addon.xml index a5b540d..dad79f1 100644 --- a/addon.xml +++ b/addon.xml @@ -1,8 +1,8 @@ - + - - + + diff --git a/changelog.txt b/changelog.txt index 8cb33e0..bad99d9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +3.0.0 (Leia) +- Compatibility with Kodi 18 Leia +- Polish translation by mskalski (thanks!) +- Fixes, cleanups and optimizations all over the place 2.6.0 (Helix) - Initial version for Kodi Helix - Fix retrieval of application mute state From 2171d24928b1aa5858830624f0d6c9a0315c6b1a Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 May 2018 19:30:22 +0200 Subject: [PATCH 254/337] add *.pyo to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0d20b64..52e4e61 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.pyc +*.pyo From 8c8b8a94327d596a40e9d7311264a03caf648d10 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 May 2018 19:44:31 +0200 Subject: [PATCH 255/337] cosmetics: get rid of stray whitespace all over the place --- lcdmain.py | 16 ++++---- resources/LCD.xml.defaults | 4 +- resources/lib/charset_hd44780.py | 8 ++-- resources/lib/charset_map_hd44780_a00.py | 9 ++--- resources/lib/charset_map_hd44780_a02.py | 8 ++-- resources/lib/extraicons.py | 10 ++--- resources/lib/infolabels.py | 14 +++---- resources/lib/lcdbase.py | 48 ++++++++++++------------ resources/lib/lcdproc.py | 40 ++++++++++---------- resources/lib/lcdproc_extra_base.py | 10 ++--- resources/lib/lcdproc_extra_imon.py | 16 ++++---- resources/lib/lcdproc_extra_mdm166a.py | 14 +++---- resources/lib/settings.py | 32 ++++++++-------- 13 files changed, 114 insertions(+), 115 deletions(-) diff --git a/lcdmain.py b/lcdmain.py index 08c7f4b..413e9f3 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -2,21 +2,21 @@ XBMC LCDproc addon Copyright (C) 2012 Team XBMC Copyright (C) 2012 Daniel 'herrnst' Scheller - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' @@ -45,9 +45,9 @@ def initGlobals(): global g_failedConnectionNotified global g_initialConnectAttempt - global g_lcdproc + global g_lcdproc - g_failedConnectionNotified = False + g_failedConnectionNotified = False g_initialConnectAttempt = True settings_initGlobals() g_lcdproc = LCDProc() @@ -72,7 +72,7 @@ def HandleConnectionNotification(bConnectSuccess): g_failedConnectionNotified = True # returns mode identifier based on currently playing media/active navigation -def getLcdMode(): +def getLcdMode(): ret = LCD_MODE.LCD_MODE_GENERAL navActive = InfoLabel_IsNavigationActive() @@ -97,7 +97,7 @@ def getLcdMode(): ret = LCD_MODE.LCD_MODE_VIDEO elif playingMusic: ret = LCD_MODE.LCD_MODE_MUSIC - + return ret def process_lcd(): diff --git a/resources/LCD.xml.defaults b/resources/LCD.xml.defaults index 361407d..c1d9423 100644 --- a/resources/LCD.xml.defaults +++ b/resources/LCD.xml.defaults @@ -16,7 +16,7 @@ - + @@ -44,7 +44,7 @@ $INFO[VideoPlayer.Title] $INFO[LCD.ProgressBar] Freemem: $INFO[System.FreeMemory] - + XBMC running... $INFO[System.Time] $INFO[System.Date] diff --git a/resources/lib/charset_hd44780.py b/resources/lib/charset_hd44780.py index 869d2d5..cc7f34d 100644 --- a/resources/lib/charset_hd44780.py +++ b/resources/lib/charset_hd44780.py @@ -1,21 +1,21 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' diff --git a/resources/lib/charset_map_hd44780_a00.py b/resources/lib/charset_map_hd44780_a00.py index 0be4fcf..5aa4ebd 100644 --- a/resources/lib/charset_map_hd44780_a00.py +++ b/resources/lib/charset_map_hd44780_a00.py @@ -1,21 +1,21 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' @@ -298,5 +298,4 @@ # Greek letters, technical symbols and misc 0x2190: 0x007f, # LEFTWARDS ARROW 0x2192: 0x007e, # RIGHTWARDS ARROW - } diff --git a/resources/lib/charset_map_hd44780_a02.py b/resources/lib/charset_map_hd44780_a02.py index cbf2c29..e237bdb 100644 --- a/resources/lib/charset_map_hd44780_a02.py +++ b/resources/lib/charset_map_hd44780_a02.py @@ -1,21 +1,21 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' diff --git a/resources/lib/extraicons.py b/resources/lib/extraicons.py index 21d63f4..ca5252a 100644 --- a/resources/lib/extraicons.py +++ b/resources/lib/extraicons.py @@ -1,24 +1,24 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - + Extra icon defines/enums Copyright (C) 2012 Daniel 'herrnst' Scheller - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 27654a6..e2ff191 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -1,24 +1,24 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - + InfoLabel handling Copyright (C) 2012 Daniel 'herrnst' Scheller - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' @@ -101,7 +101,7 @@ def InfoLabel_PlayingVideo(): return InfoLabel_GetBool("Player.HasVideo") def InfoLabel_PlayingTVShow(): - if InfoLabel_PlayingVideo() and len(InfoLabel_GetInfoLabel("VideoPlayer.TVShowTitle")): + if InfoLabel_PlayingVideo() and len(InfoLabel_GetInfoLabel("VideoPlayer.TVShowTitle")): return True else: return False @@ -219,7 +219,7 @@ def InfoLabel_IsNavigationActive(): if menu != g_InfoLabel_oldMenu or subMenu != g_InfoLabel_oldSubMenu or (g_InfoLabel_navTimer + navtimeout) > time.time(): ret = True if menu != g_InfoLabel_oldMenu or subMenu != g_InfoLabel_oldSubMenu: - g_InfoLabel_navTimer = time.time() + g_InfoLabel_navTimer = time.time() g_InfoLabel_oldMenu = menu g_InfoLabel_oldSubMenu = subMenu diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index bc85df0..a8dca33 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -2,21 +2,21 @@ XBMC LCDproc addon Copyright (C) 2012 Team XBMC Copyright (C) 2012 Daniel 'herrnst' Scheller - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' @@ -47,7 +47,7 @@ # global functions def log(loglevel, msg): - xbmc.log("### [%s] - %s" % (__scriptname__,msg,),level=loglevel ) + xbmc.log("### [%s] - %s" % (__scriptname__,msg,),level=loglevel) class LCD_MODE: LCD_MODE_GENERAL = 0 @@ -72,7 +72,7 @@ class LCD_LINEALIGN: LCD_LINEALIGN_CENTER = 1 LCD_LINEALIGN_RIGHT = 2 -g_dictEmptyLineDescriptor = {} +g_dictEmptyLineDescriptor = {} g_dictEmptyLineDescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_TEXT g_dictEmptyLineDescriptor['startx'] = int(0) g_dictEmptyLineDescriptor['text'] = str("") @@ -124,11 +124,11 @@ def Stop(self): def Suspend(self): pass -# @abstractmethod +# @abstractmethod def Resume(self): pass -# @abstractmethod +# @abstractmethod def SetBackLight(self, iLight): pass @@ -136,27 +136,27 @@ def SetBackLight(self, iLight): def SetContrast(self, iContrast): pass -# @abstractmethod +# @abstractmethod def SetBigDigits(self, strTimeString, bForceUpdate): pass -# @abstractmethod +# @abstractmethod def ClearLine(self, iLine): pass -# @abstractmethod +# @abstractmethod def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): pass -# @abstractmethod +# @abstractmethod def ClearDisplay(self): pass -# @abstractmethod +# @abstractmethod def FlushLines(self): pass - -# @abstractmethod + +# @abstractmethod def GetColumns(self): pass @@ -252,7 +252,7 @@ def LoadSkin(self, xmlFile, doReset): for element in doc.getiterator(): #PARSE LCD infos if element.tag == "lcd": - # load our settings + # load our settings # apply scrollseparator scrollSeparator = element.find("scrollseparator") @@ -335,7 +335,7 @@ def LoadSkin(self, xmlFile, doReset): tmpMode = element.find("navigation") self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_NAVIGATION) - + tmpMode = element.find("screensaver") self.LoadMode(tmpMode, LCD_MODE.LCD_MODE_SCREENSAVER) @@ -358,7 +358,7 @@ def LoadSkin(self, xmlFile, doReset): def LoadMode(self, node, mode): # clear mode (probably overriding defaults), assume the user knows what he wants if an empty node is given self.m_lcdMode[mode] = [] - + if node == None: log(xbmc.LOGWARNING, "Empty Mode %d, consider checking LCD.xml" % (mode)) @@ -391,7 +391,7 @@ def LoadMode(self, node, mode): else: # prepare text line for XBMC's expected encoding linetext = line.text.strip().encode(self.m_strInfoLabelEncoding, "ignore") - + # make sure linetext has something so re.match won't fail if linetext != "": timematch = re.match(timeregex, linetext, flags=re.IGNORECASE) @@ -469,7 +469,7 @@ def StripBBCode(self, strtext): # loop to catch nested tags loopcount = 5 - + # start with passed string mangledline = strtext @@ -556,7 +556,7 @@ def HandleBacklight(self, mode): doDim = True elif not (InfoLabel_IsPlayerPlaying() and InfoLabel_IsPlayerPaused()) and (self.DoDimOnVideo(mode) or self.DoDimOnMusic(mode)): doDim = True - + if doDim: if not self.m_bCurrentlyDimmed: if (self.m_timeDisableOnPlayTimer + self.m_iDimOnPlayDelay) < time.time(): @@ -637,7 +637,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, False) - + if isvideo: strVideoCodec = str(InfoLabel_GetInfoLabel("VideoPlayer.VideoCodec")).lower() strAudioCodec = str(InfoLabel_GetInfoLabel("VideoPlayer.AudioCodec")).lower() @@ -688,7 +688,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): if self.m_strOldAudioCodec != strAudioCodec: # work only when audio codec changed self.m_strOldAudioCodec = strAudioCodec - + # any mpeg audio if strAudioCodec in ["mpga", "mp2"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_MPEG, True) @@ -709,7 +709,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): elif strAudioCodec in ["ogg", "vorbis"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_OGG, True) - # any wma + # any wma elif strAudioCodec in ["wma", "wmav2"]: if isvideo: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_VWMA, True) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 95ef38f..e695f42 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -2,21 +2,21 @@ XBMC LCDproc addon Copyright (C) 2012 Team XBMC Copyright (C) 2012 Daniel 'herrnst' Scheller - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' @@ -45,8 +45,8 @@ from infolabels import * def log(loglevel, msg): - xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) - + xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) + MAX_ROWS = 20 MAX_BIGDIGITS = 20 INIT_RETRY_INTERVAL = 2 @@ -101,14 +101,14 @@ def SendCommand(self, strCmd, bCheckRet): # Update last socketaction timestamp self.m_timeLastSockAction = time.time() - + # Repeat for number of found commands for i in range(1, (countcmds + 1)): # Read in (multiple) responses while True: try: # Read server reply - reply = self.tn.read_until("\n",3) + reply = self.tn.read_until("\n",3) except: # (Re)read failed, abort log(xbmc.LOGERROR, "SendCommand: Telnet exception - reread") @@ -124,9 +124,9 @@ def SendCommand(self, strCmd, bCheckRet): elif reply[:9] == 'menuevent': continue - # Response seems interesting, so stop here + # Response seems interesting, so stop here break - + if not bCheckRet: continue # no return checking desired, so be fine @@ -135,7 +135,7 @@ def SendCommand(self, strCmd, bCheckRet): if reply == 'success\n': continue - + ret = False # Leave information something undesired happened @@ -238,7 +238,7 @@ def DetermineExtraSupport(self): rematch_imon = "SoundGraph iMON(.*)LCD" rematch_mdm166a = "Targa(.*)mdm166a" rematch_imonvfd = "Soundgraph(.*)VFD" - + bUseExtraIcons = settings_getUseExtraElements() # Never cause script failure/interruption by this! This is totally optional! @@ -284,7 +284,7 @@ def Connect(self): ip = settings_getHostIp() port = settings_getHostPort() log(xbmc.LOGDEBUG,"Open " + str(ip) + ":" + str(port)) - + self.tn.open(ip, port) # Start a new session self.tn.write("hello\n") @@ -292,7 +292,7 @@ def Connect(self): # Receive LCDproc data to determine row and column information reply = self.tn.read_until("\n",3) log(xbmc.LOGDEBUG,"Reply: " + reply) - + # parse reply by regex lcdinfo = re.match("^connect .+ protocol ([0-9\.]+) lcd wid (\d+) hgt (\d+) cellwid (\d+) cellhgt (\d+)$", reply) @@ -340,7 +340,7 @@ def Connect(self): if not self.SetupScreen(): log(xbmc.LOGERROR, "Screen setup failed!") - return False + return False return True @@ -479,7 +479,7 @@ def SetBigDigits(self, strTimeString, bForceUpdate): for i in range(int(iStringOffset), int(iStringLength)): if self.m_strDigits[iDigitCount] != strTimeString[i] or bForceUpdate: self.m_strDigits[iDigitCount] = strTimeString[i] - + if strTimeString[i] == ":": self.m_strSetLineCmds += "widget_set xbmc lineBigDigit%i %i 10\n" % (iDigitCount, iOffset) elif strTimeString[i].isdigit(): @@ -498,7 +498,7 @@ def SetBigDigits(self, strTimeString, bForceUpdate): if self.m_strDigits[iDigitCount] != "" or bForceUpdate: self.m_strDigits[iDigitCount] = "" self.m_strSetLineCmds += "widget_set xbmc lineBigDigit" + str(iDigitCount) + " 0 0\n" - + iDigitCount += 1 def SetProgressBar(self, percent, pxWidth): @@ -575,7 +575,7 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): strLineLong = strLine strLineLong.strip() - + iMaxLineLen = dictDescriptor['endx'] - (int(dictDescriptor['startx']) - 1) iScrollSpeed = settings_getScrollDelay() strScrollMode = settings_getLCDprocScrollMode() @@ -583,7 +583,7 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): if len(strLineLong) > iMaxLineLen: # if the string doesn't fit the display... if iScrollSpeed != 0: # add separator when scrolling enabled if strScrollMode == "m": # and scrollmode is marquee - strLineLong += self.m_strScrollSeparator + strLineLong += self.m_strScrollSeparator else: # or cut off strLineLong = strLineLong[:iMaxLineLen] iScrollSpeed = 1 @@ -615,7 +615,7 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_ICONTEXT: if self.m_strLineIcon[iLine] != self.m_strIconName or bExtraForce: self.m_strLineIcon[iLine] = self.m_strIconName - + self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 1 %i %s\n" % (ln, ln, self.m_strIconName) def ClearDisplay(self): diff --git a/resources/lib/lcdproc_extra_base.py b/resources/lib/lcdproc_extra_base.py index 423b6fc..815e245 100644 --- a/resources/lib/lcdproc_extra_base.py +++ b/resources/lib/lcdproc_extra_base.py @@ -1,24 +1,24 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - + Stub class for extra symbol support e.g. on SoundGraph iMON or mdm166a LCDs/VFDs Copyright (C) 2012 Daniel 'herrnst' Scheller - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index 7a54ab3..841e345 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -1,25 +1,25 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - + Support for extra symbols on SoundGraph iMON LCD displays Copyright (C) 2012 Daniel 'herrnst' Scheller Original C implementation (C) 2010 Christian Leuschen - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' @@ -41,8 +41,8 @@ IMON_OUTPUT_INTERVAL = 0.2 # seconds def log(loglevel, msg): - xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) - + xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) + # extra icon bitmasks class IMON_ICONS: ICON_SPINDISC = 0x01 << 0 @@ -175,7 +175,7 @@ def SetOutputBars(self): def GetOutputCommands(self): ret = "" - + if self._DoOutputCommand(): ret += self.SetOutputIcons() diff --git a/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py index ba296c6..1199ea9 100644 --- a/resources/lib/lcdproc_extra_mdm166a.py +++ b/resources/lib/lcdproc_extra_mdm166a.py @@ -1,25 +1,25 @@ ''' XBMC LCDproc addon Copyright (C) 2012 Team XBMC - + Support for extra symbols on Futaba/Targa USB mdm166a VFD displays Copyright (C) 2012 Daniel 'herrnst' Scheller Original C implementation (C) 2010 Christian Leuschen - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' @@ -38,8 +38,8 @@ from lcdproc_extra_base import * def log(loglevel, msg): - xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) - + xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) + # extra icon bitmasks class MDM166A_ICONS: ICON_PLAY = 0x01 << 0 diff --git a/resources/lib/settings.py b/resources/lib/settings.py index c7a69e1..9fb1229 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -2,21 +2,21 @@ XBMC LCDproc addon Copyright (C) 2012 Team XBMC Copyright (C) 2012 Daniel 'herrnst' Scheller - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - + You should have received a copy of the GNU General Public License along with this program. If not, see . ''' @@ -55,7 +55,7 @@ #init globals with defaults def settings_initGlobals(): global g_hostip - global g_hostport + global g_hostport global g_timer global g_heartbeat global g_scrolldelay @@ -75,7 +75,7 @@ def settings_initGlobals(): g_hostip = "127.0.0.1" g_hostport = 13666 - g_timer = time.time() + g_timer = time.time() g_heartbeat = False g_scrolldelay = 1 g_scrollmode = "0" @@ -98,7 +98,7 @@ def settings_getHostIp(): def settings_getHostPort(): global g_hostport - return g_hostport + return g_hostport def settings_getHeartBeat(): global g_heartbeat @@ -180,7 +180,7 @@ def settings_getCharset(): ret = "iso-8859-1" return ret - + #check for new settings and handle them if anything changed #only checks if the last check is 5 secs old #returns if a reconnect is needed due to settings change @@ -194,13 +194,13 @@ def settings_checkForNewSettings(): reconnect = settings_setup() g_timer = time.time() return reconnect - + def settings_didSettingsChange(): global g_settingsChanged settingsChanged = g_settingsChanged g_settingsChanged = False return settingsChanged - + # handle all settings that might require a reinit and/or reconnect # (e.g. network config changes) # returns true if reconnect is needed due to network changes @@ -297,11 +297,11 @@ def settings_handleLcdSettings(): if g_dimonshutdown != dimonshutdown: g_dimonshutdown = dimonshutdown g_settingsChanged = True - + if g_dimonvideoplayback != dimonvideoplayback: g_dimonvideoplayback = dimonvideoplayback g_settingsChanged = True - + if g_dimonmusicplayback != dimonmusicplayback: g_dimonmusicplayback = dimonmusicplayback g_settingsChanged = True @@ -309,10 +309,10 @@ def settings_handleLcdSettings(): if g_dimdelay != dimdelay: g_dimdelay = dimdelay g_settingsChanged = True - + if g_navtimeout != navtimeout: g_navtimeout = navtimeout - g_settingsChanged = True + g_settingsChanged = True if g_refreshrate != refreshrate: g_refreshrate = refreshrate @@ -320,7 +320,7 @@ def settings_handleLcdSettings(): if refreshrate < 1: g_refreshrate = 1 - g_settingsChanged = True + g_settingsChanged = True if g_hideconnpopups != hideconnpopups: g_hideconnpopups = hideconnpopups @@ -336,7 +336,7 @@ def settings_handleLcdSettings(): #handles all settings and applies them as needed #returns if a reconnect is needed due to settings changes -def settings_setup(): +def settings_setup(): reconnect = False reconnect = settings_handleCriticalSettings() settings_handleLcdSettings() From d0b33d9082bd8297044769762a4c219d52a51600 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 31 May 2018 19:49:16 +0200 Subject: [PATCH 256/337] update copyright year in all files --- README.md | 2 +- lcdmain.py | 4 ++-- resources/lib/charset_hd44780.py | 2 +- resources/lib/charset_map_hd44780_a00.py | 2 +- resources/lib/charset_map_hd44780_a02.py | 2 +- resources/lib/extraicons.py | 4 ++-- resources/lib/infolabels.py | 4 ++-- resources/lib/lcdbase.py | 4 ++-- resources/lib/lcdproc.py | 4 ++-- resources/lib/lcdproc_extra_base.py | 4 ++-- resources/lib/lcdproc_extra_imon.py | 4 ++-- resources/lib/lcdproc_extra_mdm166a.py | 4 ++-- resources/lib/settings.py | 4 ++-- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index f9dfe38..07be854 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ XBMC LCDproc Python addon ========================== -Copyright (C) 2012 Team XBMC, Daniel 'herrnst' Scheller +Copyright (C) 2012-2018 Team XBMC, Daniel 'herrnst' Scheller Based on initial work (C) 2012 Memphiz/Team XBMC LCDproc support for XBMC implemented in Python, direct drop-in replacement for diff --git a/lcdmain.py b/lcdmain.py index 413e9f3..f53a090 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -1,7 +1,7 @@ ''' XBMC LCDproc addon - Copyright (C) 2012 Team XBMC - Copyright (C) 2012 Daniel 'herrnst' Scheller + Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/charset_hd44780.py b/resources/lib/charset_hd44780.py index cc7f34d..501bac1 100644 --- a/resources/lib/charset_hd44780.py +++ b/resources/lib/charset_hd44780.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012 Team XBMC + Copyright (C) 2012-2018 Team XBMC This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/charset_map_hd44780_a00.py b/resources/lib/charset_map_hd44780_a00.py index 5aa4ebd..b0c873a 100644 --- a/resources/lib/charset_map_hd44780_a00.py +++ b/resources/lib/charset_map_hd44780_a00.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012 Team XBMC + Copyright (C) 2012-2018 Team XBMC This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/charset_map_hd44780_a02.py b/resources/lib/charset_map_hd44780_a02.py index e237bdb..e066036 100644 --- a/resources/lib/charset_map_hd44780_a02.py +++ b/resources/lib/charset_map_hd44780_a02.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012 Team XBMC + Copyright (C) 2012-2018 Team XBMC This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/extraicons.py b/resources/lib/extraicons.py index ca5252a..68ee699 100644 --- a/resources/lib/extraicons.py +++ b/resources/lib/extraicons.py @@ -1,9 +1,9 @@ ''' XBMC LCDproc addon - Copyright (C) 2012 Team XBMC + Copyright (C) 2012-2018 Team XBMC Extra icon defines/enums - Copyright (C) 2012 Daniel 'herrnst' Scheller + Copyright (C) 2012-2018 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index e2ff191..0b2b3dc 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -1,9 +1,9 @@ ''' XBMC LCDproc addon - Copyright (C) 2012 Team XBMC + Copyright (C) 2012-2018 Team XBMC InfoLabel handling - Copyright (C) 2012 Daniel 'herrnst' Scheller + Copyright (C) 2012-2018 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index a8dca33..b68804d 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -1,7 +1,7 @@ ''' XBMC LCDproc addon - Copyright (C) 2012 Team XBMC - Copyright (C) 2012 Daniel 'herrnst' Scheller + Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index e695f42..13db48f 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -1,7 +1,7 @@ ''' XBMC LCDproc addon - Copyright (C) 2012 Team XBMC - Copyright (C) 2012 Daniel 'herrnst' Scheller + Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/lcdproc_extra_base.py b/resources/lib/lcdproc_extra_base.py index 815e245..ca5ff8d 100644 --- a/resources/lib/lcdproc_extra_base.py +++ b/resources/lib/lcdproc_extra_base.py @@ -1,9 +1,9 @@ ''' XBMC LCDproc addon - Copyright (C) 2012 Team XBMC + Copyright (C) 2012-2018 Team XBMC Stub class for extra symbol support e.g. on SoundGraph iMON or mdm166a LCDs/VFDs - Copyright (C) 2012 Daniel 'herrnst' Scheller + Copyright (C) 2012-2018 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index 841e345..9dfcf4f 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -1,9 +1,9 @@ ''' XBMC LCDproc addon - Copyright (C) 2012 Team XBMC + Copyright (C) 2012-2018 Team XBMC Support for extra symbols on SoundGraph iMON LCD displays - Copyright (C) 2012 Daniel 'herrnst' Scheller + Copyright (C) 2012-2018 Daniel 'herrnst' Scheller Original C implementation (C) 2010 Christian Leuschen This program is free software; you can redistribute it and/or modify diff --git a/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py index 1199ea9..8907f60 100644 --- a/resources/lib/lcdproc_extra_mdm166a.py +++ b/resources/lib/lcdproc_extra_mdm166a.py @@ -1,9 +1,9 @@ ''' XBMC LCDproc addon - Copyright (C) 2012 Team XBMC + Copyright (C) 2012-2018 Team XBMC Support for extra symbols on Futaba/Targa USB mdm166a VFD displays - Copyright (C) 2012 Daniel 'herrnst' Scheller + Copyright (C) 2012-2018 Daniel 'herrnst' Scheller Original C implementation (C) 2010 Christian Leuschen This program is free software; you can redistribute it and/or modify diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 9fb1229..afb419a 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -1,7 +1,7 @@ ''' XBMC LCDproc addon - Copyright (C) 2012 Team XBMC - Copyright (C) 2012 Daniel 'herrnst' Scheller + Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From 6173e8c39cd90e179de6a2780c7eb7b0fd6ba895 Mon Sep 17 00:00:00 2001 From: fengalin Date: Fri, 11 Aug 2017 14:57:51 +0200 Subject: [PATCH 257/337] French translation --- addon.xml | 2 ++ resources/language/French/strings.xml | 49 +++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 resources/language/French/strings.xml diff --git a/addon.xml b/addon.xml index dad79f1..526ebe2 100644 --- a/addon.xml +++ b/addon.xml @@ -10,8 +10,10 @@ XBMC LCDproc Displays configurable information e.g. about playing media or XBMC status on any LC/VF-display driven by LCDproc, and acts as direct drop-in replacement to the LCD/VFD-feature previously available in XBMC's core. Supports additional display elements (icons, bars) on SoundGraph iMON LCD and Targa/Futaba mdm166a VFD hardware. Requires a properly configured and running LCDd either locally or somewhere on the network. Zeigt konfigurierbare Informationen z.B. über aktuelle Wiedergabe oder XBMC Stati auf beliebigen von LCDproc angesteuerten LC/VF-Displays, ersetzt die zuvor im XBMC-Kern enthaltene LCD/VFD-Funktion. Unterstützt zusätzliche Elemente (Icons, Balken) von SoundGraph iMON LCD und Targa/Futaba mdm166a VFD Hardware. Benötigt einen konfigurierten, laufenden LCDd auf dem lokalen System oder im Netzwerk. + Affiche des informations définies par configuration telles que le média en cours de lecture, l'état de XBMC... et ce sur tout type d'afficheur LC/VF géré par LCDProc. Remplace la fonctionnalité LCD/VFD précédemment disponible par défaut dans XBMC. Gère des éléments supplémentaires (icônes, barres) sur les écrans SoundGraph iMON LCD et Targa/Futaba mdm166a VFD. Nécessite un serveur LCDd correctement configuré et disponible localement ou sur le réseau. Works with LCDproc only. Other LCD services like LCD4Linux or iMON Manager on Win32 are not supported. No liability taken for damaged hardware and/or software caused by this addon. Funktioniert ausschliesslich mit LCDproc. Andere LCD-Dienste wie LCD4Linux, iMON Manager unter Win32 u.a. sind nicht unterstützt. Keine Haftung für durch dieses Addon beschädigte Hard-/Software. + Fonctionne uniquement avec LCDProc. Les services tels que LCD4Linux ou iMON Manager sur Win32 ne sont pas gérés. Nous déclinons toute responsabilité en cas de dégats survenus suite à l'utilisation de cette extension. GNU GENERAL PUBLIC LICENSE. Version 2, June 1991 all diff --git a/resources/language/French/strings.xml b/resources/language/French/strings.xml new file mode 100644 index 0000000..0d58856 --- /dev/null +++ b/resources/language/French/strings.xml @@ -0,0 +1,49 @@ + + + + + Comportement + Délai avant défilement du texte + Mode de défilement + Rémanence de l'écran de navigation (s) + Taux de rafraichissement (Hz) + Utiliser un jeu de caractères alternatif + Jeu de caractères + Gestion des éléments d'affichage supplémentaires (ex. icones) + + + Rétro-éclairage + en mode économie d'écran + Diminuer lors de l'arrêt + lors de la lecture de vidéo ou en mode TV + lors de la lecture de musique ou en mode radio + Délai (s) + Diminuer/éteindre... + + + Connexion + Utiliser un démon LCDProc distant + Adresse IP de LCDd + Port de LCDd + Afficher le symbole de pulsation + Cacher les notifications d'erreurs de connexion + + + En boucle + Gauche/Droite + + + ISO8859-1 (valeur d'origine) + ISO8859-15 + KOI8-R + CP1251 + ISO8859-5 + HD44780-ROM A00 + HD44780-ROM A02 + + + Échec lors de la connection à LCDProc ! + Connecté à LCDProc! + Attention ! Erreurs dans LCD.xml ou impossible de trouver LCD.xml ! + + From 4a158b92b49dac9df742a4dad18d6124265a43f2 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Fri, 1 Jun 2018 12:58:39 +0200 Subject: [PATCH 258/337] changelog: add note for the french translation --- changelog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index bad99d9..4462b0c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,8 @@ 3.0.0 (Leia) - Compatibility with Kodi 18 Leia - Polish translation by mskalski (thanks!) -- Fixes, cleanups and optimizations all over the place +- French translation by fengalin (thanks!) +- Fixes, cleanups, cosmetics and optimizations all over the place 2.6.0 (Helix) - Initial version for Kodi Helix - Fix retrieval of application mute state From b724247ae0897618e97449725e517701c507f3b5 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Fri, 1 Jun 2018 19:31:58 +0200 Subject: [PATCH 259/337] fix Time/Duration InfoLabels in the PVR screens in LCD.xml.defaults After the code in infolabels.py was changed to use the different labels for time/duration inquiry, also fix this in the LCD.xml defaults. And while we're touching the defaults file, change the duration labels in the PVR blocks to display the "/" only if a duration is present. --- resources/LCD.xml.defaults | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/LCD.xml.defaults b/resources/LCD.xml.defaults index c1d9423..c5b99c4 100644 --- a/resources/LCD.xml.defaults +++ b/resources/LCD.xml.defaults @@ -65,13 +65,13 @@ $INFO[VideoPlayer.ChannelName] $INFO[VideoPlayer.Title] - $INFO[LCD.PlayIcon] $INFO[Player.Time]/$INFO[Player.Duration] + $INFO[LCD.PlayIcon] $INFO[PVR.EpgEventElapsedTime]$INFO[PVR.EpgEventDuration,/,] $INFO[LCD.ProgressBar] $INFO[MusicPlayer.ChannelName] $INFO[MusicPlayer.Title] - $INFO[LCD.PlayIcon] $INFO[Player.Time]/$INFO[Player.Duration] + $INFO[LCD.PlayIcon] $INFO[PVR.EpgEventElapsedTime]$INFO[PVR.EpgEventDuration,/,] $INFO[LCD.ProgressBar] From 19aea124a3b5c103098031838a2162dcc55ce023 Mon Sep 17 00:00:00 2001 From: Truong Ta Date: Sat, 12 Sep 2015 11:10:18 +0700 Subject: [PATCH 260/337] Add progressbar with time [d.scheller@gmx.net: mangled whitespace errors] --- resources/LCD.xml.defaults | 3 +++ resources/lib/lcdbase.py | 28 +++++++++++++++++++++++----- resources/lib/lcdproc.py | 9 +++++++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/resources/LCD.xml.defaults b/resources/LCD.xml.defaults index c5b99c4..749e601 100644 --- a/resources/LCD.xml.defaults +++ b/resources/LCD.xml.defaults @@ -7,6 +7,9 @@ + + + diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index b68804d..2982a1c 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -62,10 +62,11 @@ class LCD_MODE: LCD_MODE_MAX = 9 class LCD_LINETYPE: - LCD_LINETYPE_TEXT = "text" - LCD_LINETYPE_PROGRESS = "progressbar" - LCD_LINETYPE_ICONTEXT = "icontext" - LCD_LINETYPE_BIGSCREEN = "bigscreen" + LCD_LINETYPE_TEXT = "text" + LCD_LINETYPE_PROGRESS = "progressbar" + LCD_LINETYPE_PROGRESSTIME = "progresstime" + LCD_LINETYPE_ICONTEXT = "icontext" + LCD_LINETYPE_BIGSCREEN = "bigscreen" class LCD_LINEALIGN: LCD_LINEALIGN_LEFT = 0 @@ -269,6 +270,13 @@ def LoadSkin(self, xmlFile, doReset): if str(progressbarSurroundings.text).lower() in ["on", "true"]: self.m_bProgressbarSurroundings = True + # apply progressbarblank + self.m_bProgressbarBlank = " " + + progressbarBlank = element.find("progressbarblank") + if progressbarBlank != None: + self.m_bProgressbarBlank = str(progressbarBlank.text)[0] + # icontext offset setting self.m_iIconTextOffset = 2 @@ -408,13 +416,19 @@ def LoadMode(self, node, mode): # progressbar line if InfoLabel exists if linetext.lower().find("$info[lcd.progressbar]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_PROGRESS + linedescriptor['text'] = self.m_bProgressbarBlank * int(self.m_iColumns) linedescriptor['endx'] = int(self.m_iCellWidth) * int(self.m_iColumns) if self.m_bProgressbarSurroundings == True: linedescriptor['startx'] = int(2) - linedescriptor['text'] = "[" + " " * (self.m_iColumns - 2) + "]" + linedescriptor['text'] = "[" + self.m_bProgressbarBlank * (self.m_iColumns - 2) + "]" linedescriptor['endx'] = int(self.m_iCellWidth) * (int(self.GetColumns()) - 2) + # progresstime line if InfoLabel exists + elif linetext.lower().find("$info[lcd.progresstime]") >= 0: + linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_PROGRESSTIME + linedescriptor['endx'] = int(self.m_iCellWidth) * int(self.m_iColumns) + # textline with icon in front elif linetext.lower().find("$info[lcd.playicon]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_ICONTEXT @@ -501,6 +515,10 @@ def Render(self, mode, bForce): percent = InfoLabel_GetProgressPercent() pixelsWidth = self.SetProgressBar(percent, self.m_lcdMode[mode][inLine]['endx']) line = "p" + str(pixelsWidth) + elif self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESSTIME: + percent = InfoLabel_GetProgressPercent() + pixelsWidth = self.SetProgressBar(percent, self.m_lcdMode[mode][inLine]['endx']) + line = "p" + str(pixelsWidth) else: if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_ICONTEXT: self.SetPlayingStateIcon() diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 13db48f..aa737a2 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -569,8 +569,13 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS and dictDescriptor['text'] != "": self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text']) + if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESSTIME and dictDescriptor['text'] != "": + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text']) + if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: strLineLong = self.GetBigDigitTime(mode) + elif dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESSTIME: + strLineLong = InfoLabel_GetPlayerTime() + self.m_bProgressbarBlank * (self.m_iColumns - len(InfoLabel_GetPlayerTime()) - len(InfoLabel_GetPlayerDuration())) + InfoLabel_GetPlayerDuration() else: strLineLong = strLine @@ -598,6 +603,10 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): # progressbar line elif dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS: self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, iStartX, ln, self.m_iProgressBarWidth) + # progressbar line with time + elif dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESSTIME: + self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, iStartX + len(InfoLabel_GetPlayerTime()), ln, self.m_iProgressBarWidth - int((len(InfoLabel_GetPlayerDuration()) + len(InfoLabel_GetPlayerTime())) * self.m_iProgressBarWidth / self.m_iColumns)) + self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i %s %i \"%s\"\n" % (ln, iStartX, ln, self.m_iColumns, ln, strScrollMode, iScrollSpeed, re.escape(strLineLong)) # everything else (text, icontext) else: if len(strLineLong) < iMaxLineLen and dictDescriptor['align'] != LCD_LINEALIGN.LCD_LINEALIGN_LEFT: From 1bdbd9920ee6a11f452cd6d3e0032ca83586c4c0 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Fri, 1 Jun 2018 19:49:29 +0200 Subject: [PATCH 261/337] changelog: add note for the new progressbar+time linetype --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 4462b0c..481eedd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ - Compatibility with Kodi 18 Leia - Polish translation by mskalski (thanks!) - French translation by fengalin (thanks!) +- New progressbar+time linetype by Truong Ta (thanks!) - Fixes, cleanups, cosmetics and optimizations all over the place 2.6.0 (Helix) - Initial version for Kodi Helix From 5dc5a3ccd15c1ac576eb4b1216479d8aa6787642 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Fri, 1 Jun 2018 20:52:34 +0200 Subject: [PATCH 262/337] optimizations for progresstime linetype handling The ProgressTime linetype changes unnecessarily duplicated code in a few places and repeatedly fetched information (playertime, duration) from Kodi instead of reading these things once to store in a local variable and reuse those vars where needed. Fix this, this also makes things a bit more readable. --- resources/lib/lcdbase.py | 6 +----- resources/lib/lcdproc.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 2982a1c..95ef3ae 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -510,15 +510,11 @@ def Render(self, mode, bForce): while (outLine < int(self.GetRows()) and inLine < len(self.m_lcdMode[mode])): #parse the progressbar infolabel by ourselfs! - if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS: + if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS or self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESSTIME: # get playtime and duration and convert into seconds percent = InfoLabel_GetProgressPercent() pixelsWidth = self.SetProgressBar(percent, self.m_lcdMode[mode][inLine]['endx']) line = "p" + str(pixelsWidth) - elif self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESSTIME: - percent = InfoLabel_GetProgressPercent() - pixelsWidth = self.SetProgressBar(percent, self.m_lcdMode[mode][inLine]['endx']) - line = "p" + str(pixelsWidth) else: if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_ICONTEXT: self.SetPlayingStateIcon() diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index aa737a2..19ce63d 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -551,8 +551,11 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): if iLine < 0 or iLine >= int(self.m_iRows): return + plTime = InfoLabel_GetPlayerTime() + plDuration = InfoLabel_GetPlayerDuration() ln = iLine + 1 bExtraForce = False + drawLineText = False if self.m_strLineType[iLine] != dictDescriptor['type']: if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: @@ -575,7 +578,7 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: strLineLong = self.GetBigDigitTime(mode) elif dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESSTIME: - strLineLong = InfoLabel_GetPlayerTime() + self.m_bProgressbarBlank * (self.m_iColumns - len(InfoLabel_GetPlayerTime()) - len(InfoLabel_GetPlayerDuration())) + InfoLabel_GetPlayerDuration() + strLineLong = plTime + self.m_bProgressbarBlank * (self.m_iColumns - len(plTime) - len(plDuration)) + plDuration else: strLineLong = strLine @@ -605,10 +608,13 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, iStartX, ln, self.m_iProgressBarWidth) # progressbar line with time elif dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESSTIME: - self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, iStartX + len(InfoLabel_GetPlayerTime()), ln, self.m_iProgressBarWidth - int((len(InfoLabel_GetPlayerDuration()) + len(InfoLabel_GetPlayerTime())) * self.m_iProgressBarWidth / self.m_iColumns)) - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i %s %i \"%s\"\n" % (ln, iStartX, ln, self.m_iColumns, ln, strScrollMode, iScrollSpeed, re.escape(strLineLong)) + drawLineText = True + pLenFract = float(self.m_iColumns - int(len(plDuration) + len(plTime))) / self.m_iColumns + pTimeLen = int(self.m_iProgressBarWidth * pLenFract) + self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, iStartX + len(plTime), ln, pTimeLen) # everything else (text, icontext) else: + drawLineText = True if len(strLineLong) < iMaxLineLen and dictDescriptor['align'] != LCD_LINEALIGN.LCD_LINEALIGN_LEFT: iSpaces = iMaxLineLen - len(strLineLong) if dictDescriptor['align'] == LCD_LINEALIGN.LCD_LINEALIGN_RIGHT: @@ -616,6 +622,7 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): elif dictDescriptor['align'] == LCD_LINEALIGN.LCD_LINEALIGN_CENTER: iStartX += int(iSpaces / 2) + if drawLineText: self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i %s %i \"%s\"\n" % (ln, iStartX, ln, self.m_iColumns, ln, strScrollMode, iScrollSpeed, re.escape(strLineLong)) # cache contents From db9cad386b9c3e6e5389305e9a15f8e42a1101b6 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Jun 2018 16:16:26 +0200 Subject: [PATCH 263/337] convert language files to strings.po format Initial conversion done with the help of XBMC-XML2PO v0.96 by Team XBMC, additional fixes applied manually. --- changelog.txt | 1 + resources/language/English/strings.xml | 49 ----- resources/language/French/strings.xml | 49 ----- resources/language/German/strings.xml | 49 ----- resources/language/Polish/strings.xml | 49 ----- .../resource.language.de_de/strings.po | 167 ++++++++++++++++++ .../resource.language.en_gb/strings.po | 167 ++++++++++++++++++ .../resource.language.fr_fr/strings.po | 167 ++++++++++++++++++ .../resource.language.pl_pl/strings.po | 167 ++++++++++++++++++ 9 files changed, 669 insertions(+), 196 deletions(-) delete mode 100644 resources/language/English/strings.xml delete mode 100644 resources/language/French/strings.xml delete mode 100644 resources/language/German/strings.xml delete mode 100644 resources/language/Polish/strings.xml create mode 100644 resources/language/resource.language.de_de/strings.po create mode 100644 resources/language/resource.language.en_gb/strings.po create mode 100644 resources/language/resource.language.fr_fr/strings.po create mode 100644 resources/language/resource.language.pl_pl/strings.po diff --git a/changelog.txt b/changelog.txt index 481eedd..2f448f3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ - Compatibility with Kodi 18 Leia - Polish translation by mskalski (thanks!) - French translation by fengalin (thanks!) +- Strings finally migrated to strings.po format - New progressbar+time linetype by Truong Ta (thanks!) - Fixes, cleanups, cosmetics and optimizations all over the place 2.6.0 (Helix) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml deleted file mode 100644 index 832a683..0000000 --- a/resources/language/English/strings.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - Behaviour - Delay for scrolling text - Scroll mode - Navigation display duration (s) - Display refresh rate (Hz) - Use alternate charset - Charset - Support for extra display elements (e.g. icons) - - - Backlight - on screensaver - Dim on shutdown - on video/LiveTV playback - on music/radio playback - Delay (s) - Dim/turn off... - - - Connection - Use remote LCDProc - LCDd IP - LCDd port - Show heartbeat symbol - Hide connection error notifications - - - Marquee - Left/Right - - - ISO8859-1 (default) - ISO8859-15 - KOI8-R - CP1251 - ISO8859-5 - HD44780-ROM A00 - HD44780-ROM A02 - - - Failed to connect to LCDProc! - Connected to LCDProc! - Warning! Errors in LCD.xml or LCD.xml not found! - - diff --git a/resources/language/French/strings.xml b/resources/language/French/strings.xml deleted file mode 100644 index 0d58856..0000000 --- a/resources/language/French/strings.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - Comportement - Délai avant défilement du texte - Mode de défilement - Rémanence de l'écran de navigation (s) - Taux de rafraichissement (Hz) - Utiliser un jeu de caractères alternatif - Jeu de caractères - Gestion des éléments d'affichage supplémentaires (ex. icones) - - - Rétro-éclairage - en mode économie d'écran - Diminuer lors de l'arrêt - lors de la lecture de vidéo ou en mode TV - lors de la lecture de musique ou en mode radio - Délai (s) - Diminuer/éteindre... - - - Connexion - Utiliser un démon LCDProc distant - Adresse IP de LCDd - Port de LCDd - Afficher le symbole de pulsation - Cacher les notifications d'erreurs de connexion - - - En boucle - Gauche/Droite - - - ISO8859-1 (valeur d'origine) - ISO8859-15 - KOI8-R - CP1251 - ISO8859-5 - HD44780-ROM A00 - HD44780-ROM A02 - - - Échec lors de la connection à LCDProc ! - Connecté à LCDProc! - Attention ! Erreurs dans LCD.xml ou impossible de trouver LCD.xml ! - - diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml deleted file mode 100644 index 205fc86..0000000 --- a/resources/language/German/strings.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - Verhalten - Geschwindigkeit für gescrollten Text - Scroll-Modus - Anzeigedauer der Navigationsansicht (s) - Display-Aktualisierungsrate (Hz) - Verwende alternativen Zeichensatz - Zeichensatz - Zusatzdisplayelemente (z.B. Icons) unterstützen - - - Beleuchtung - wenn Bildschirmschoner aktiv - Beim Herunterfahren abdunkeln/abschalten - während Video/LiveTV-Wiedergabe - während Musik/Radio-Wiedergabe - Verzögerung (s) - Abdunkeln/Abschalten... - - - Verbindung - Entfernten LCDproc-Server benutzen - LCDd IP - LCDd Port - Heartbeatsymbol anzeigen - Verbindungsfehler-Benachrichtigung verstecken - - - Durchlaufend - Links/Rechts - - - ISO8859-1 (Standard) - ISO8859-15 - KOI8-R - CP1251 - ISO8859-5 - HD44780-ROM A00 - HD44780-ROM A02 - - - Fehler beim Verbinden zu LCDproc! - Verbunden mit LCDproc! - Warnung! Fehlerhafte LCD.xml oder LCD.xml nicht gefunden! - - diff --git a/resources/language/Polish/strings.xml b/resources/language/Polish/strings.xml deleted file mode 100644 index 91be8dd..0000000 --- a/resources/language/Polish/strings.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - Zachowanie - Opóźnienie dla przewijania tekstu - Tryb przewijania - Czas wyświetlania informacji nawigacyjnych (s) - Częstotliwość odświeżania (Hz) - Użyj alternatywnego zestawu znaków - Zestaw znaków - Wsparcie dla dodatkowych elementów wyświetlających (np. ikon) - - - Podświetlenie - podczas działania wygaszacza ekrany - Przyciemnij przed wyłączeniem - podczas odtwarzania filmów wideo/TV - podczas odtwarzania muzyki/radia - Opóźnienie (s) - Przyciemnij/wyłącz: - - - Połączenie - Podłącz do zdalnego serwera LCDProc - Adres IP serwera LCDd - Port serwera LCDd - Włącz tętno (heartbeat) - Nie pokazuj powiadomień o błędach połączenia - - - Marquee - Lewo/Prawo - - - ISO8859-1 (default) - ISO8859-15 - KOI8-R - CP1251 - ISO8859-5 - HD44780-ROM A00 - HD44780-ROM A02 - - - Błąd połączenia z serwerem LCDProc! - Połączony z serwerem LCDProc! - Uwaga! Błędy w konfiguracji w pliku LCD.xml lub plik LCD.xml nie znaleziony! - - diff --git a/resources/language/resource.language.de_de/strings.po b/resources/language/resource.language.de_de/strings.po new file mode 100644 index 0000000..dfb8006 --- /dev/null +++ b/resources/language/resource.language.de_de/strings.po @@ -0,0 +1,167 @@ +# Kodi Media Center language file +# Addon Name: XBMC LCDproc +# Addon id: script.xbmc.lcdproc +# Addon Provider: Team Kodi: Memphiz, Daniel 'herrnst' Scheller +msgid "" +msgstr "" +"Project-Id-Version: script.xbmc.lcdproc\n" +"Report-Msgid-Bugs-To: https://github.com/herrnst/script.xbmc.lcdproc\n" +"POT-Creation-Date: 2018-06-02 15:55+0200\n" +"PO-Revision-Date: 2018-06-02 15:55+0200\n" +"Last-Translator: Daniel Scheller \n" +"Language-Team: German\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +# Settings +# Behaviour + +msgctxt "#32100" +msgid "Behaviour" +msgstr "Verhalten" + +msgctxt "#32101" +msgid "Delay for scrolling text" +msgstr "Geschwindigkeit für gescrollten Text" + +msgctxt "#32102" +msgid "Scroll mode" +msgstr "Scroll-Modus" + +msgctxt "#32103" +msgid "Navigation display duration (s)" +msgstr "Anzeigedauer der Navigationsansicht (s)" + +msgctxt "#32104" +msgid "Display refresh rate (Hz)" +msgstr "Display-Aktualisierungsrate (Hz)" + +msgctxt "#32105" +msgid "Use alternate charset" +msgstr "Verwende alternativen Zeichensatz" + +msgctxt "#32106" +msgid "Charset" +msgstr "Zeichensatz" + +msgctxt "#32107" +msgid "Support for extra display elements (e.g. icons)" +msgstr "Zusatzdisplayelemente (z.B. Icons) unterstützen" + +# empty strings from id 32108 to 32199 +# Backlight + +msgctxt "#32200" +msgid "Backlight" +msgstr "Beleuchtung" + +msgctxt "#32201" +msgid "on screensaver" +msgstr "wenn Bildschirmschoner aktiv" + +msgctxt "#32202" +msgid "Dim on shutdown" +msgstr "Beim Herunterfahren abdunkeln/abschalten" + +msgctxt "#32203" +msgid "on video/LiveTV playback" +msgstr "während Video/LiveTV-Wiedergabe" + +msgctxt "#32204" +msgid "on music/radio playback" +msgstr "während Musik/Radio-Wiedergabe" + +msgctxt "#32205" +msgid "Delay (s)" +msgstr "Verzögerung (s)" + +msgctxt "#32206" +msgid "Dim/turn off..." +msgstr "Abdunkeln/Abschalten..." + +# empty strings from id 32207 to 32299 +# Connection + +msgctxt "#32300" +msgid "Connection" +msgstr "Verbindung" + +msgctxt "#32301" +msgid "Use remote LCDProc" +msgstr "Entfernten LCDproc-Server benutzen" + +msgctxt "#32302" +msgid "LCDd IP" +msgstr "LCDd IP" + +msgctxt "#32303" +msgid "LCDd port" +msgstr "LCDd Port" + +msgctxt "#32304" +msgid "Show heartbeat symbol" +msgstr "Heartbeatsymbol anzeigen" + +msgctxt "#32305" +msgid "Hide connection error notifications" +msgstr "Verbindungsfehler-Benachrichtigung verstecken" + +# empty strings from id 32306 to 32400 +# Enum values: Scroll mode + +msgctxt "#32401" +msgid "Marquee" +msgstr "Durchlaufend" + +msgctxt "#32402" +msgid "Left/Right" +msgstr "Links/Rechts" + +# empty strings from id 32403 to 32410 +# Enum values: Charsets + +msgctxt "#32411" +msgid "ISO8859-1 (default)" +msgstr "ISO8859-1 (Standard)" + +msgctxt "#32412" +msgid "ISO8859-15" +msgstr "ISO8859-15" + +msgctxt "#32413" +msgid "KOI8-R" +msgstr "KOI8-R" + +msgctxt "#32414" +msgid "CP1251" +msgstr "CP1251" + +msgctxt "#32415" +msgid "ISO8859-5" +msgstr "ISO8859-5" + +msgctxt "#32416" +msgid "HD44780-ROM A00" +msgstr "HD44780-ROM A00" + +msgctxt "#32417" +msgid "HD44780-ROM A02" +msgstr "HD44780-ROM A02" + +# empty strings from id 32418 to 32499 +# Notifications + +msgctxt "#32500" +msgid "Failed to connect to LCDProc!" +msgstr "Fehler beim Verbinden zu LCDproc!" + +msgctxt "#32501" +msgid "Connected to LCDProc!" +msgstr "Verbunden mit LCDproc!" + +msgctxt "#32502" +msgid "Warning! Errors in LCD.xml or LCD.xml not found!" +msgstr "Warnung! Fehlerhafte LCD.xml oder LCD.xml nicht gefunden!" diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po new file mode 100644 index 0000000..4a19d57 --- /dev/null +++ b/resources/language/resource.language.en_gb/strings.po @@ -0,0 +1,167 @@ +# Kodi Media Center language file +# Addon Name: XBMC LCDproc +# Addon id: script.xbmc.lcdproc +# Addon Provider: Team Kodi: Memphiz, Daniel 'herrnst' Scheller +msgid "" +msgstr "" +"Project-Id-Version: script.xbmc.lcdproc\n" +"Report-Msgid-Bugs-To: https://github.com/herrnst/script.xbmc.lcdproc\n" +"POT-Creation-Date: 2018-06-02 15:55+0200\n" +"PO-Revision-Date: 2018-06-02 15:55+0200\n" +"Last-Translator: Daniel Scheller \n" +"Language-Team: English\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: en\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +# Settings +# Behaviour + +msgctxt "#32100" +msgid "Behaviour" +msgstr "" + +msgctxt "#32101" +msgid "Delay for scrolling text" +msgstr "" + +msgctxt "#32102" +msgid "Scroll mode" +msgstr "" + +msgctxt "#32103" +msgid "Navigation display duration (s)" +msgstr "" + +msgctxt "#32104" +msgid "Display refresh rate (Hz)" +msgstr "" + +msgctxt "#32105" +msgid "Use alternate charset" +msgstr "" + +msgctxt "#32106" +msgid "Charset" +msgstr "" + +msgctxt "#32107" +msgid "Support for extra display elements (e.g. icons)" +msgstr "" + +# empty strings from id 32108 to 32199 +# Backlight + +msgctxt "#32200" +msgid "Backlight" +msgstr "" + +msgctxt "#32201" +msgid "on screensaver" +msgstr "" + +msgctxt "#32202" +msgid "Dim on shutdown" +msgstr "" + +msgctxt "#32203" +msgid "on video/LiveTV playback" +msgstr "" + +msgctxt "#32204" +msgid "on music/radio playback" +msgstr "" + +msgctxt "#32205" +msgid "Delay (s)" +msgstr "" + +msgctxt "#32206" +msgid "Dim/turn off..." +msgstr "" + +# empty strings from id 32207 to 32299 +# Connection + +msgctxt "#32300" +msgid "Connection" +msgstr "" + +msgctxt "#32301" +msgid "Use remote LCDProc" +msgstr "" + +msgctxt "#32302" +msgid "LCDd IP" +msgstr "" + +msgctxt "#32303" +msgid "LCDd port" +msgstr "" + +msgctxt "#32304" +msgid "Show heartbeat symbol" +msgstr "" + +msgctxt "#32305" +msgid "Hide connection error notifications" +msgstr "" + +# empty strings from id 32306 to 32400 +# Enum values: Scroll mode + +msgctxt "#32401" +msgid "Marquee" +msgstr "" + +msgctxt "#32402" +msgid "Left/Right" +msgstr "" + +# empty strings from id 32403 to 32410 +# Enum values: Charsets + +msgctxt "#32411" +msgid "ISO8859-1 (default)" +msgstr "" + +msgctxt "#32412" +msgid "ISO8859-15" +msgstr "" + +msgctxt "#32413" +msgid "KOI8-R" +msgstr "" + +msgctxt "#32414" +msgid "CP1251" +msgstr "" + +msgctxt "#32415" +msgid "ISO8859-5" +msgstr "" + +msgctxt "#32416" +msgid "HD44780-ROM A00" +msgstr "" + +msgctxt "#32417" +msgid "HD44780-ROM A02" +msgstr "" + +# empty strings from id 32418 to 32499 +# Notifications + +msgctxt "#32500" +msgid "Failed to connect to LCDProc!" +msgstr "" + +msgctxt "#32501" +msgid "Connected to LCDProc!" +msgstr "" + +msgctxt "#32502" +msgid "Warning! Errors in LCD.xml or LCD.xml not found!" +msgstr "" diff --git a/resources/language/resource.language.fr_fr/strings.po b/resources/language/resource.language.fr_fr/strings.po new file mode 100644 index 0000000..f8b18c1 --- /dev/null +++ b/resources/language/resource.language.fr_fr/strings.po @@ -0,0 +1,167 @@ +# Kodi Media Center language file +# Addon Name: XBMC LCDproc +# Addon id: script.xbmc.lcdproc +# Addon Provider: Team Kodi: Memphiz, Daniel 'herrnst' Scheller +msgid "" +msgstr "" +"Project-Id-Version: script.xbmc.lcdproc\n" +"Report-Msgid-Bugs-To: https://github.com/herrnst/script.xbmc.lcdproc\n" +"POT-Creation-Date: 2018-06-02 15:55+0200\n" +"PO-Revision-Date: 2018-06-02 15:55+0200\n" +"Last-Translator: François Laignel \n" +"Language-Team: Français\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" + +# Settings +# Behaviour + +msgctxt "#32100" +msgid "Behaviour" +msgstr "Comportement" + +msgctxt "#32101" +msgid "Delay for scrolling text" +msgstr "Délai avant défilement du texte" + +msgctxt "#32102" +msgid "Scroll mode" +msgstr "Mode de défilement" + +msgctxt "#32103" +msgid "Navigation display duration (s)" +msgstr "Rémanence de l'écran de navigation (s)" + +msgctxt "#32104" +msgid "Display refresh rate (Hz)" +msgstr "Taux de rafraichissement (Hz)" + +msgctxt "#32105" +msgid "Use alternate charset" +msgstr "Utiliser un jeu de caractères alternatif" + +msgctxt "#32106" +msgid "Charset" +msgstr "Jeu de caractères" + +msgctxt "#32107" +msgid "Support for extra display elements (e.g. icons)" +msgstr "Gestion des éléments d'affichage supplémentaires (ex. icones)" + +# empty strings from id 32108 to 32199 +# Backlight + +msgctxt "#32200" +msgid "Backlight" +msgstr "Rétro-éclairage" + +msgctxt "#32201" +msgid "on screensaver" +msgstr "en mode économie d'écran" + +msgctxt "#32202" +msgid "Dim on shutdown" +msgstr "Diminuer lors de l'arrêt" + +msgctxt "#32203" +msgid "on video/LiveTV playback" +msgstr "lors de la lecture de vidéo ou en mode TV" + +msgctxt "#32204" +msgid "on music/radio playback" +msgstr "lors de la lecture de musique ou en mode radio" + +msgctxt "#32205" +msgid "Delay (s)" +msgstr "Délai (s)" + +msgctxt "#32206" +msgid "Dim/turn off..." +msgstr "Diminuer/éteindre..." + +# empty strings from id 32207 to 32299 +# Connection + +msgctxt "#32300" +msgid "Connection" +msgstr "Connexion" + +msgctxt "#32301" +msgid "Use remote LCDProc" +msgstr "Utiliser un démon LCDProc distant" + +msgctxt "#32302" +msgid "LCDd IP" +msgstr "Adresse IP de LCDd" + +msgctxt "#32303" +msgid "LCDd port" +msgstr "Port de LCDd" + +msgctxt "#32304" +msgid "Show heartbeat symbol" +msgstr "Afficher le symbole de pulsation" + +msgctxt "#32305" +msgid "Hide connection error notifications" +msgstr "Cacher les notifications d'erreurs de connexion" + +# empty strings from id 32306 to 32400 +# Enum values: Scroll mode + +msgctxt "#32401" +msgid "Marquee" +msgstr "En boucle" + +msgctxt "#32402" +msgid "Left/Right" +msgstr "Gauche/Droite" + +# empty strings from id 32403 to 32410 +# Enum values: Charsets + +msgctxt "#32411" +msgid "ISO8859-1 (default)" +msgstr "ISO8859-1 (valeur d'origine)" + +msgctxt "#32412" +msgid "ISO8859-15" +msgstr "ISO8859-15" + +msgctxt "#32413" +msgid "KOI8-R" +msgstr "KOI8-R" + +msgctxt "#32414" +msgid "CP1251" +msgstr "CP1251" + +msgctxt "#32415" +msgid "ISO8859-5" +msgstr "ISO8859-5" + +msgctxt "#32416" +msgid "HD44780-ROM A00" +msgstr "HD44780-ROM A00" + +msgctxt "#32417" +msgid "HD44780-ROM A02" +msgstr "HD44780-ROM A02" + +# empty strings from id 32418 to 32499 +# Notifications + +msgctxt "#32500" +msgid "Failed to connect to LCDProc!" +msgstr "Échec lors de la connection à LCDProc !" + +msgctxt "#32501" +msgid "Connected to LCDProc!" +msgstr "Connecté à LCDProc!" + +msgctxt "#32502" +msgid "Warning! Errors in LCD.xml or LCD.xml not found!" +msgstr "Attention ! Erreurs dans LCD.xml ou impossible de trouver LCD.xml !" diff --git a/resources/language/resource.language.pl_pl/strings.po b/resources/language/resource.language.pl_pl/strings.po new file mode 100644 index 0000000..eee0225 --- /dev/null +++ b/resources/language/resource.language.pl_pl/strings.po @@ -0,0 +1,167 @@ +# Kodi Media Center language file +# Addon Name: XBMC LCDproc +# Addon id: script.xbmc.lcdproc +# Addon Provider: Team Kodi: Memphiz, Daniel 'herrnst' Scheller +msgid "" +msgstr "" +"Project-Id-Version: script.xbmc.lcdproc\n" +"Report-Msgid-Bugs-To: https://github.com/herrnst/script.xbmc.lcdproc\n" +"POT-Creation-Date: 2018-06-02 15:55+0200\n" +"PO-Revision-Date: 2018-06-02 15:55+0200\n" +"Last-Translator: Michał Skalski \n" +"Language-Team: Polish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: pl\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" + +# Settings +# Behaviour + +msgctxt "#32100" +msgid "Behaviour" +msgstr "Zachowanie" + +msgctxt "#32101" +msgid "Delay for scrolling text" +msgstr "Opóźnienie dla przewijania tekstu" + +msgctxt "#32102" +msgid "Scroll mode" +msgstr "Tryb przewijania" + +msgctxt "#32103" +msgid "Navigation display duration (s)" +msgstr "Czas wyświetlania informacji nawigacyjnych (s)" + +msgctxt "#32104" +msgid "Display refresh rate (Hz)" +msgstr "Częstotliwość odświeżania (Hz)" + +msgctxt "#32105" +msgid "Use alternate charset" +msgstr "Użyj alternatywnego zestawu znaków" + +msgctxt "#32106" +msgid "Charset" +msgstr "Zestaw znaków" + +msgctxt "#32107" +msgid "Support for extra display elements (e.g. icons)" +msgstr "Wsparcie dla dodatkowych elementów wyświetlających (np. ikon)" + +# empty strings from id 32108 to 32199 +# Backlight + +msgctxt "#32200" +msgid "Backlight" +msgstr "Podświetlenie" + +msgctxt "#32201" +msgid "on screensaver" +msgstr "podczas działania wygaszacza ekrany" + +msgctxt "#32202" +msgid "Dim on shutdown" +msgstr "Przyciemnij przed wyłączeniem" + +msgctxt "#32203" +msgid "on video/LiveTV playback" +msgstr "podczas odtwarzania filmów wideo/TV" + +msgctxt "#32204" +msgid "on music/radio playback" +msgstr "podczas odtwarzania muzyki/radia" + +msgctxt "#32205" +msgid "Delay (s)" +msgstr "Opóźnienie (s)" + +msgctxt "#32206" +msgid "Dim/turn off..." +msgstr "Przyciemnij/wyłącz:" + +# empty strings from id 32207 to 32299 +# Connection + +msgctxt "#32300" +msgid "Connection" +msgstr "Połączenie" + +msgctxt "#32301" +msgid "Use remote LCDProc" +msgstr "Podłącz do zdalnego serwera LCDProc" + +msgctxt "#32302" +msgid "LCDd IP" +msgstr "Adres IP serwera LCDd" + +msgctxt "#32303" +msgid "LCDd port" +msgstr "Port serwera LCDd" + +msgctxt "#32304" +msgid "Show heartbeat symbol" +msgstr "Włącz tętno (heartbeat)" + +msgctxt "#32305" +msgid "Hide connection error notifications" +msgstr "Nie pokazuj powiadomień o błędach połączenia" + +# empty strings from id 32306 to 32400 +# Enum values: Scroll mode + +msgctxt "#32401" +msgid "Marquee" +msgstr "Marquee" + +msgctxt "#32402" +msgid "Left/Right" +msgstr "Lewo/Prawo" + +# empty strings from id 32403 to 32410 +# Enum values: Charsets + +msgctxt "#32411" +msgid "ISO8859-1 (default)" +msgstr "ISO8859-1 (default)" + +msgctxt "#32412" +msgid "ISO8859-15" +msgstr "ISO8859-15" + +msgctxt "#32413" +msgid "KOI8-R" +msgstr "KOI8-R" + +msgctxt "#32414" +msgid "CP1251" +msgstr "CP1251" + +msgctxt "#32415" +msgid "ISO8859-5" +msgstr "ISO8859-5" + +msgctxt "#32416" +msgid "HD44780-ROM A00" +msgstr "HD44780-ROM A00" + +msgctxt "#32417" +msgid "HD44780-ROM A02" +msgstr "HD44780-ROM A02" + +# empty strings from id 32418 to 32499 +# Notifications + +msgctxt "#32500" +msgid "Failed to connect to LCDProc!" +msgstr "Błąd połączenia z serwerem LCDProc!" + +msgctxt "#32501" +msgid "Connected to LCDProc!" +msgstr "Połączony z serwerem LCDProc!" + +msgctxt "#32502" +msgid "Warning! Errors in LCD.xml or LCD.xml not found!" +msgstr "Uwaga! Błędy w konfiguracji w pliku LCD.xml lub plik LCD.xml nie znaleziony!" From b128729f156d1630ea192c61f31c9294e730c6ed Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Jun 2018 16:35:28 +0200 Subject: [PATCH 264/337] addon.xml: add more addon details and fix language codes --- addon.xml | 16 ++++++++++++---- icon.png => resources/icon.png | Bin 2 files changed, 12 insertions(+), 4 deletions(-) rename icon.png => resources/icon.png (100%) diff --git a/addon.xml b/addon.xml index 526ebe2..f201c55 100644 --- a/addon.xml +++ b/addon.xml @@ -9,12 +9,20 @@ XBMC LCDproc Displays configurable information e.g. about playing media or XBMC status on any LC/VF-display driven by LCDproc, and acts as direct drop-in replacement to the LCD/VFD-feature previously available in XBMC's core. Supports additional display elements (icons, bars) on SoundGraph iMON LCD and Targa/Futaba mdm166a VFD hardware. Requires a properly configured and running LCDd either locally or somewhere on the network. - Zeigt konfigurierbare Informationen z.B. über aktuelle Wiedergabe oder XBMC Stati auf beliebigen von LCDproc angesteuerten LC/VF-Displays, ersetzt die zuvor im XBMC-Kern enthaltene LCD/VFD-Funktion. Unterstützt zusätzliche Elemente (Icons, Balken) von SoundGraph iMON LCD und Targa/Futaba mdm166a VFD Hardware. Benötigt einen konfigurierten, laufenden LCDd auf dem lokalen System oder im Netzwerk. - Affiche des informations définies par configuration telles que le média en cours de lecture, l'état de XBMC... et ce sur tout type d'afficheur LC/VF géré par LCDProc. Remplace la fonctionnalité LCD/VFD précédemment disponible par défaut dans XBMC. Gère des éléments supplémentaires (icônes, barres) sur les écrans SoundGraph iMON LCD et Targa/Futaba mdm166a VFD. Nécessite un serveur LCDd correctement configuré et disponible localement ou sur le réseau. + Zeigt konfigurierbare Informationen z.B. über aktuelle Wiedergabe oder XBMC Stati auf beliebigen von LCDproc angesteuerten LC/VF-Displays, ersetzt die zuvor im XBMC-Kern enthaltene LCD/VFD-Funktion. Unterstützt zusätzliche Elemente (Icons, Balken) von SoundGraph iMON LCD und Targa/Futaba mdm166a VFD Hardware. Benötigt einen konfigurierten, laufenden LCDd auf dem lokalen System oder im Netzwerk. + Affiche des informations définies par configuration telles que le média en cours de lecture, l'état de XBMC... et ce sur tout type d'afficheur LC/VF géré par LCDProc. Remplace la fonctionnalité LCD/VFD précédemment disponible par défaut dans XBMC. Gère des éléments supplémentaires (icônes, barres) sur les écrans SoundGraph iMON LCD et Targa/Futaba mdm166a VFD. Nécessite un serveur LCDd correctement configuré et disponible localement ou sur le réseau. Works with LCDproc only. Other LCD services like LCD4Linux or iMON Manager on Win32 are not supported. No liability taken for damaged hardware and/or software caused by this addon. - Funktioniert ausschliesslich mit LCDproc. Andere LCD-Dienste wie LCD4Linux, iMON Manager unter Win32 u.a. sind nicht unterstützt. Keine Haftung für durch dieses Addon beschädigte Hard-/Software. - Fonctionne uniquement avec LCDProc. Les services tels que LCD4Linux ou iMON Manager sur Win32 ne sont pas gérés. Nous déclinons toute responsabilité en cas de dégats survenus suite à l'utilisation de cette extension. + Funktioniert ausschliesslich mit LCDproc. Andere LCD-Dienste wie LCD4Linux, iMON Manager unter Win32 u.a. sind nicht unterstützt. Keine Haftung für durch dieses Addon beschädigte Hard-/Software. + Fonctionne uniquement avec LCDProc. Les services tels que LCD4Linux ou iMON Manager sur Win32 ne sont pas gérés. Nous déclinons toute responsabilité en cas de dégats survenus suite à l'utilisation de cette extension. GNU GENERAL PUBLIC LICENSE. Version 2, June 1991 all + https://github.com/lcdproc/lcdproc + https://forum.kodi.tv/showthread.php?tid=143912 + https://github.com/herrnst/script.xbmc.lcdproc + nst at kodi dot tv + + resources/icon.png + + TBD on release diff --git a/icon.png b/resources/icon.png similarity index 100% rename from icon.png rename to resources/icon.png From 29813b2ffdcbf64030f6e30445ecc89b0adfb123 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Jun 2018 16:36:29 +0200 Subject: [PATCH 265/337] addon.xml: drop obsolete startup option from extension point From https://kodi.wiki/view/Service_add-ons: Prior to Kodi 18 Leia there was an additional option start="startup" that would start the service add-on before the first profile login, but that functionality and usefulness were limited so this option was removed. --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index f201c55..f6096ff 100644 --- a/addon.xml +++ b/addon.xml @@ -4,7 +4,7 @@ - + XBMC LCDproc From d07c88e5887d69acb3f660342ea95aa96f254428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Sun, 3 Jun 2018 18:40:08 +0200 Subject: [PATCH 266/337] fr translations: fixes --- .../resource.language.fr_fr/strings.po | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/resources/language/resource.language.fr_fr/strings.po b/resources/language/resource.language.fr_fr/strings.po index f8b18c1..a5cb2f5 100644 --- a/resources/language/resource.language.fr_fr/strings.po +++ b/resources/language/resource.language.fr_fr/strings.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: script.xbmc.lcdproc\n" "Report-Msgid-Bugs-To: https://github.com/herrnst/script.xbmc.lcdproc\n" "POT-Creation-Date: 2018-06-02 15:55+0200\n" -"PO-Revision-Date: 2018-06-02 15:55+0200\n" +"PO-Revision-Date: 2018-06-03 18:37+0200\n" "Last-Translator: François Laignel \n" "Language-Team: Français\n" "MIME-Version: 1.0\n" @@ -18,7 +18,6 @@ msgstr "" # Settings # Behaviour - msgctxt "#32100" msgid "Behaviour" msgstr "Comportement" @@ -49,11 +48,10 @@ msgstr "Jeu de caractères" msgctxt "#32107" msgid "Support for extra display elements (e.g. icons)" -msgstr "Gestion des éléments d'affichage supplémentaires (ex. icones)" +msgstr "Gestion des éléments d'affichage supplémentaires (ex. icônes)" # empty strings from id 32108 to 32199 # Backlight - msgctxt "#32200" msgid "Backlight" msgstr "Rétro-éclairage" @@ -80,11 +78,10 @@ msgstr "Délai (s)" msgctxt "#32206" msgid "Dim/turn off..." -msgstr "Diminuer/éteindre..." +msgstr "Diminuer/éteindre…" # empty strings from id 32207 to 32299 # Connection - msgctxt "#32300" msgid "Connection" msgstr "Connexion" @@ -111,7 +108,6 @@ msgstr "Cacher les notifications d'erreurs de connexion" # empty strings from id 32306 to 32400 # Enum values: Scroll mode - msgctxt "#32401" msgid "Marquee" msgstr "En boucle" @@ -122,7 +118,6 @@ msgstr "Gauche/Droite" # empty strings from id 32403 to 32410 # Enum values: Charsets - msgctxt "#32411" msgid "ISO8859-1 (default)" msgstr "ISO8859-1 (valeur d'origine)" @@ -153,15 +148,14 @@ msgstr "HD44780-ROM A02" # empty strings from id 32418 to 32499 # Notifications - msgctxt "#32500" msgid "Failed to connect to LCDProc!" -msgstr "Échec lors de la connection à LCDProc !" +msgstr "Échec lors de la connexion à LCDProc !" msgctxt "#32501" msgid "Connected to LCDProc!" -msgstr "Connecté à LCDProc!" +msgstr "Connecté à LCDProc !" msgctxt "#32502" msgid "Warning! Errors in LCD.xml or LCD.xml not found!" -msgstr "Attention ! Erreurs dans LCD.xml ou impossible de trouver LCD.xml !" +msgstr "Attention ! LCD.xml comporte des erreurs ou est introuvable !" From 352966ea741f3fda64f97df0163d0d24927a9ee3 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 3 Jun 2018 19:18:42 +0200 Subject: [PATCH 267/337] global: change 'XBMC' to 'Kodi' in a few places XBMC was rebranded to Kodi a long time ago. Time to reflect this when citing Team XBMC/Kodi and some other places. --- README.md | 12 ++++++------ addon.xml | 10 +++++----- lcdmain.py | 2 +- resources/LCD.xml.defaults | 2 +- resources/lib/charset_hd44780.py | 2 +- resources/lib/charset_map_hd44780_a00.py | 2 +- resources/lib/charset_map_hd44780_a02.py | 2 +- resources/lib/extraicons.py | 2 +- resources/lib/infolabels.py | 2 +- resources/lib/lcdbase.py | 2 +- resources/lib/lcdproc.py | 2 +- resources/lib/lcdproc_extra_base.py | 2 +- resources/lib/lcdproc_extra_imon.py | 2 +- resources/lib/lcdproc_extra_mdm166a.py | 2 +- resources/lib/settings.py | 2 +- 15 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 07be854..69ae5af 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -XBMC LCDproc Python addon -========================== +Kodi (XBMC) LCDproc Python addon +================================= -Copyright (C) 2012-2018 Team XBMC, Daniel 'herrnst' Scheller -Based on initial work (C) 2012 Memphiz/Team XBMC +Copyright (C) 2012-2018 Team Kodi, Daniel 'herrnst' Scheller +Based on initial work (C) 2012 Memphiz/Team Kodi (formerly Team XBMC) -LCDproc support for XBMC implemented in Python, direct drop-in replacement for -the LCD support in XBMC core. +LCDproc support for Kodi implemented in Python, direct drop-in replacement for +the LCD support that was present in prior versions of XBMC and it's core. See https://github.com/herrnst/script.xbmc.lcdproc/wiki for details and usage information. diff --git a/addon.xml b/addon.xml index f6096ff..893e7e7 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -7,10 +7,10 @@ - XBMC LCDproc - Displays configurable information e.g. about playing media or XBMC status on any LC/VF-display driven by LCDproc, and acts as direct drop-in replacement to the LCD/VFD-feature previously available in XBMC's core. Supports additional display elements (icons, bars) on SoundGraph iMON LCD and Targa/Futaba mdm166a VFD hardware. Requires a properly configured and running LCDd either locally or somewhere on the network. - Zeigt konfigurierbare Informationen z.B. über aktuelle Wiedergabe oder XBMC Stati auf beliebigen von LCDproc angesteuerten LC/VF-Displays, ersetzt die zuvor im XBMC-Kern enthaltene LCD/VFD-Funktion. Unterstützt zusätzliche Elemente (Icons, Balken) von SoundGraph iMON LCD und Targa/Futaba mdm166a VFD Hardware. Benötigt einen konfigurierten, laufenden LCDd auf dem lokalen System oder im Netzwerk. - Affiche des informations définies par configuration telles que le média en cours de lecture, l'état de XBMC... et ce sur tout type d'afficheur LC/VF géré par LCDProc. Remplace la fonctionnalité LCD/VFD précédemment disponible par défaut dans XBMC. Gère des éléments supplémentaires (icônes, barres) sur les écrans SoundGraph iMON LCD et Targa/Futaba mdm166a VFD. Nécessite un serveur LCDd correctement configuré et disponible localement ou sur le réseau. + Kodi/XBMC LCDproc + Displays configurable information e.g. about playing media or Kodi status on any LC/VF-display driven by LCDproc, and acts as direct drop-in replacement to the LCD/VFD-feature previously available in Kodi/XBMC's core. Supports additional display elements (icons, bars) on SoundGraph iMON LCD and Targa/Futaba mdm166a VFD hardware. Requires a properly configured and running LCDd either locally or somewhere on the network. + Zeigt konfigurierbare Informationen z.B. über aktuelle Wiedergabe oder den Kodi Status auf beliebigen von LCDproc angesteuerten LC/VF-Displays, ersetzt die zuvor im Kodi/XBMC-Kern enthaltene LCD/VFD-Funktion. Unterstützt zusätzliche Elemente (Icons, Balken) von SoundGraph iMON LCD und Targa/Futaba mdm166a VFD Hardware. Benötigt einen konfigurierten, laufenden LCDd auf dem lokalen System oder im Netzwerk. + Affiche des informations définies par configuration telles que le média en cours de lecture, l'état de Kodi... et ce sur tout type d'afficheur LC/VF géré par LCDProc. Remplace la fonctionnalité LCD/VFD précédemment disponible par défaut dans Kodi/XBMC. Gère des éléments supplémentaires (icônes, barres) sur les écrans SoundGraph iMON LCD et Targa/Futaba mdm166a VFD. Nécessite un serveur LCDd correctement configuré et disponible localement ou sur le réseau. Works with LCDproc only. Other LCD services like LCD4Linux or iMON Manager on Win32 are not supported. No liability taken for damaged hardware and/or software caused by this addon. Funktioniert ausschliesslich mit LCDproc. Andere LCD-Dienste wie LCD4Linux, iMON Manager unter Win32 u.a. sind nicht unterstützt. Keine Haftung für durch dieses Addon beschädigte Hard-/Software. Fonctionne uniquement avec LCDProc. Les services tels que LCD4Linux ou iMON Manager sur Win32 ne sont pas gérés. Nous déclinons toute responsabilité en cas de dégats survenus suite à l'utilisation de cette extension. diff --git a/lcdmain.py b/lcdmain.py index f53a090..bb91d76 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Team Kodi Copyright (C) 2012-2018 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify diff --git a/resources/LCD.xml.defaults b/resources/LCD.xml.defaults index 749e601..efe6757 100644 --- a/resources/LCD.xml.defaults +++ b/resources/LCD.xml.defaults @@ -49,7 +49,7 @@ Freemem: $INFO[System.FreeMemory] - XBMC running... + Kodi running... $INFO[System.Time] $INFO[System.Date] Freemem: $INFO[System.FreeMemory] $INFO[System.ScreenWidth]x$INFO[System.ScreenHeight] $INFO[System.ScreenMode] diff --git a/resources/lib/charset_hd44780.py b/resources/lib/charset_hd44780.py index 501bac1..b511bcf 100644 --- a/resources/lib/charset_hd44780.py +++ b/resources/lib/charset_hd44780.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Team Kodi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/charset_map_hd44780_a00.py b/resources/lib/charset_map_hd44780_a00.py index b0c873a..e185c78 100644 --- a/resources/lib/charset_map_hd44780_a00.py +++ b/resources/lib/charset_map_hd44780_a00.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Team Kodi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/charset_map_hd44780_a02.py b/resources/lib/charset_map_hd44780_a02.py index e066036..f32874e 100644 --- a/resources/lib/charset_map_hd44780_a02.py +++ b/resources/lib/charset_map_hd44780_a02.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Team Kodi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/lib/extraicons.py b/resources/lib/extraicons.py index 68ee699..8b23f0c 100644 --- a/resources/lib/extraicons.py +++ b/resources/lib/extraicons.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Team Kodi Extra icon defines/enums Copyright (C) 2012-2018 Daniel 'herrnst' Scheller diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 0b2b3dc..52f5f56 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Team Kodi InfoLabel handling Copyright (C) 2012-2018 Daniel 'herrnst' Scheller diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 95ef3ae..3ad193e 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Team Kodi Copyright (C) 2012-2018 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 19ce63d..519eb6a 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Team Kodi Copyright (C) 2012-2018 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify diff --git a/resources/lib/lcdproc_extra_base.py b/resources/lib/lcdproc_extra_base.py index ca5ff8d..afe44d8 100644 --- a/resources/lib/lcdproc_extra_base.py +++ b/resources/lib/lcdproc_extra_base.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Team Kodi Stub class for extra symbol support e.g. on SoundGraph iMON or mdm166a LCDs/VFDs Copyright (C) 2012-2018 Daniel 'herrnst' Scheller diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index 9dfcf4f..4b5c2b9 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Team Kodi Support for extra symbols on SoundGraph iMON LCD displays Copyright (C) 2012-2018 Daniel 'herrnst' Scheller diff --git a/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py index 8907f60..e1fc6f7 100644 --- a/resources/lib/lcdproc_extra_mdm166a.py +++ b/resources/lib/lcdproc_extra_mdm166a.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Team Kodi Support for extra symbols on Futaba/Targa USB mdm166a VFD displays Copyright (C) 2012-2018 Daniel 'herrnst' Scheller diff --git a/resources/lib/settings.py b/resources/lib/settings.py index afb419a..cc8e136 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -1,6 +1,6 @@ ''' XBMC LCDproc addon - Copyright (C) 2012-2018 Team XBMC + Copyright (C) 2012-2018 Team Kodi Copyright (C) 2012-2018 Daniel 'herrnst' Scheller This program is free software; you can redistribute it and/or modify From fdb8446c257024005b518cd6d41159ca2a3c80d7 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 4 Jun 2018 22:26:22 +0200 Subject: [PATCH 268/337] fix location reference to icon.png in lcdmain.py icon.png was moved to resources/ and addon.xml updated accordingly, but lcdmain.py was unfortunately forgotten. Fix this. Fixes: b128729f156d ("addon.xml: add more addon details and fix language codes") --- lcdmain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lcdmain.py b/lcdmain.py index bb91d76..ad6823a 100644 --- a/lcdmain.py +++ b/lcdmain.py @@ -28,7 +28,7 @@ __settings__ = xbmcaddon.Addon(id='script.xbmc.lcdproc') __cwd__ = __settings__.getAddonInfo('path') -__icon__ = os.path.join(__cwd__,"icon.png") +__icon__ = os.path.join(__cwd__, "resources", "icon.png") __scriptname__ = "XBMC LCDproc" BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'lib' ) ) From bfb5cf92b671862ca2225597b11fea7a0d3617a9 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 5 Jun 2018 19:16:32 +0200 Subject: [PATCH 269/337] changelog: put changes of 3.0.0 into addon.xml news-tag --- addon.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 893e7e7..1403b88 100644 --- a/addon.xml +++ b/addon.xml @@ -23,6 +23,13 @@ resources/icon.png - TBD on release + 3.0.0 (Leia) +- Compatibility with Kodi 18 Leia +- Polish translation by mskalski (thanks!) +- French translation by fengalin (thanks!) +- Strings finally migrated to strings.po format +- New progressbar+time linetype by Truong Ta (thanks!) +- Fixes, cleanups, cosmetics and optimizations all over the place + From be2d357bed1f66e7312c6b7464f53f9b6396a538 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 5 Jun 2018 20:47:18 +0200 Subject: [PATCH 270/337] addon.xml: remove unneeded dependency on xbmc.addon --- addon.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/addon.xml b/addon.xml index 1403b88..c0379d5 100644 --- a/addon.xml +++ b/addon.xml @@ -2,7 +2,6 @@ - From ea1068fa0e8484a6f71f903080ba1ef0a8dc56e7 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Jun 2018 13:23:25 +0200 Subject: [PATCH 271/337] rename lcdmain.py to main.py Make it a bit more obvious that this is the main entry point for the lcdproc service. --- addon.xml | 2 +- lcdmain.py => main.py | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename lcdmain.py => main.py (100%) diff --git a/addon.xml b/addon.xml index c0379d5..2a1097d 100644 --- a/addon.xml +++ b/addon.xml @@ -3,7 +3,7 @@ - + Kodi/XBMC LCDproc diff --git a/lcdmain.py b/main.py similarity index 100% rename from lcdmain.py rename to main.py From e86ee8206bacb5514bfd7471a27bcf776252a1ec Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Jun 2018 13:37:29 +0200 Subject: [PATCH 272/337] make sure things are started only from the __main__ scope --- main.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index ad6823a..4eba8b8 100644 --- a/main.py +++ b/main.py @@ -130,15 +130,19 @@ def handleConnectLCD(): return ret -######################################### - -#MAIN - entry point - -# init vars and classes -initGlobals() - -# initialise and load GUI settings -settings_setup() - -# do LCD processing loop (needs to catch xbmc.abortRequested !) -process_lcd() +###### +# main() +def main(): + # init vars and classes + initGlobals() + + # initialise and load GUI settings + settings_setup() + + # do LCD processing loop (needs to catch xbmc.abortRequested !) + process_lcd() + +###### +# script entry point +if __name__ == "__main__": + main() From 4500a34420bcea0a649c567b9be11b3f5b22bd14 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 3 Jun 2018 20:16:47 +0200 Subject: [PATCH 273/337] refactor imports handling and create common module Have __init__.py files for automatic Python package labeling. This allows for loading all imports without having to determine the addon root path and adding things to sys.path, so this is all being refactored. While at it, add a 'common' module that carries all things that are common through all other python files, like some globals and the log function. --- main.py | 23 +++++----- resources/__init__.py | 1 + resources/lib/__init__.py | 1 + resources/lib/common.py | 58 ++++++++++++++++++++++++++ resources/lib/extraicons.py | 5 +-- resources/lib/infolabels.py | 7 +--- resources/lib/lcdbase.py | 16 +++---- resources/lib/lcdproc.py | 11 ++--- resources/lib/lcdproc_extra_base.py | 8 ++-- resources/lib/lcdproc_extra_imon.py | 11 ++--- resources/lib/lcdproc_extra_mdm166a.py | 11 ++--- resources/lib/settings.py | 9 ++-- 12 files changed, 100 insertions(+), 61 deletions(-) create mode 100644 resources/__init__.py create mode 100644 resources/lib/__init__.py create mode 100644 resources/lib/common.py diff --git a/main.py b/main.py index 4eba8b8..35984d2 100644 --- a/main.py +++ b/main.py @@ -21,22 +21,23 @@ along with this program. If not, see . ''' -import xbmc -import xbmcaddon +# base imports import time import os +import sys -__settings__ = xbmcaddon.Addon(id='script.xbmc.lcdproc') -__cwd__ = __settings__.getAddonInfo('path') -__icon__ = os.path.join(__cwd__, "resources", "icon.png") -__scriptname__ = "XBMC LCDproc" +# Kodi imports +import xbmc +import xbmcaddon -BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'lib' ) ) -sys.path.insert(0, BASE_RESOURCE_PATH) +from resources.lib.common import * +from resources.lib.settings import * +from resources.lib.lcdproc import * +from resources.lib.infolabels import * -from settings import * -from lcdproc import * -from infolabels import * +__settings__ = sys.modules["resources.lib.common"].__settings__ +__icon__ = sys.modules["resources.lib.common"].__icon__ +__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ global g_failedConnectionNotified global g_initialConnectAttempt diff --git a/resources/__init__.py b/resources/__init__.py new file mode 100644 index 0000000..facd939 --- /dev/null +++ b/resources/__init__.py @@ -0,0 +1 @@ +# dummy file for Python package directory labeling diff --git a/resources/lib/__init__.py b/resources/lib/__init__.py new file mode 100644 index 0000000..facd939 --- /dev/null +++ b/resources/lib/__init__.py @@ -0,0 +1 @@ +# dummy file for Python package directory labeling diff --git a/resources/lib/common.py b/resources/lib/common.py new file mode 100644 index 0000000..b325edd --- /dev/null +++ b/resources/lib/common.py @@ -0,0 +1,58 @@ +''' + XBMC LCDproc addon + Copyright (C) 2012-2018 Team Kodi + + resources/lib/common.py: Common defines and functionality used throughout + the whole addon + Copyright (C) 2018 Daniel 'herrnst' Scheller + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +import os +import sys + +import xbmc +import xbmcaddon + +KODI_ADDON_ID = "script.xbmc.lcdproc" +KODI_ADDON_NAME = "XBMC LCDproc" + +__settings__ = xbmcaddon.Addon(id=KODI_ADDON_ID) +__cwd__ = __settings__.getAddonInfo('path') +__icon__ = os.path.join(__cwd__, "resources", "icon.png") +__scriptname__ = KODI_ADDON_NAME + +# copy loglevel defines to the global scope +LOGDEBUG = xbmc.LOGDEBUG +LOGERROR = xbmc.LOGERROR +LOGFATAL = xbmc.LOGFATAL +LOGINFO = xbmc.LOGINFO +LOGNONE = xbmc.LOGNONE +LOGNOTICE = xbmc.LOGNOTICE +LOGSEVERE = xbmc.LOGSEVERE +LOGWARNING = xbmc.LOGWARNING + +# log wrapper +def log(loglevel, msg): + xbmc.log("### [%s] - %s" % (__scriptname__, msg), level=loglevel) + +# enum snippet from http://stackoverflow.com/a/1695250 - thanks! +def enum(*sequential, **named): + enums = dict(zip(sequential, range(len(sequential))), **named) + return type('Enum', (), enums) diff --git a/resources/lib/extraicons.py b/resources/lib/extraicons.py index 8b23f0c..2e806c2 100644 --- a/resources/lib/extraicons.py +++ b/resources/lib/extraicons.py @@ -23,10 +23,7 @@ along with this program. If not, see . ''' -# enum snippet from http://stackoverflow.com/a/1695250 - thanks! -def enum(*sequential, **named): - enums = dict(zip(sequential, range(len(sequential))), **named) - return type('Enum', (), enums) +from common import * LCD_EXTRABARS_MAX = 4 diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 52f5f56..d0516d3 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -33,12 +33,7 @@ import xbmcgui # wonder why "from settings import *" does not work... -__settingshandler__ = sys.modules[ "settings" ] - -# enum snippet from http://stackoverflow.com/a/1695250 - thanks! -def enum(*sequential, **named): - enums = dict(zip(sequential, range(len(sequential))), **named) - return type('Enum', (), enums) +__settingshandler__ = sys.modules["resources.lib.settings"] # interesting XBMC GUI Window IDs (no defines seem to exist for this) class WINDOW_IDS: diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 3ad193e..8370ef7 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -33,22 +33,18 @@ from xml.etree import ElementTree as xmltree from array import array -__scriptname__ = sys.modules[ "__main__" ].__scriptname__ -__settings__ = sys.modules[ "__main__" ].__settings__ -__cwd__ = sys.modules[ "__main__" ].__cwd__ -__icon__ = sys.modules[ "__main__" ].__icon__ -__lcdxml__ = xbmc.translatePath( os.path.join("special://masterprofile","LCD.xml")) -__lcddefaultxml__ = xbmc.translatePath( os.path.join(__cwd__, "resources", "LCD.xml.defaults")) +__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__cwd__ = sys.modules["resources.lib.common"].__cwd__ +__icon__ = sys.modules["resources.lib.common"].__icon__ +__lcdxml__ = xbmc.translatePath(os.path.join("special://masterprofile", "LCD.xml")) +__lcddefaultxml__ = xbmc.translatePath(os.path.join(__cwd__, "resources", "LCD.xml.defaults")) from settings import * from extraicons import * from infolabels import * from charset_hd44780 import * -# global functions -def log(loglevel, msg): - xbmc.log("### [%s] - %s" % (__scriptname__,msg,),level=loglevel) - class LCD_MODE: LCD_MODE_GENERAL = 0 LCD_MODE_MUSIC = 1 diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 519eb6a..f4605a9 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -31,10 +31,10 @@ from socket import * -__scriptname__ = sys.modules[ "__main__" ].__scriptname__ -__settings__ = sys.modules[ "__main__" ].__settings__ -__cwd__ = sys.modules[ "__main__" ].__cwd__ -__icon__ = sys.modules[ "__main__" ].__icon__ +__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__cwd__ = sys.modules["resources.lib.common"].__cwd__ +__icon__ = sys.modules["resources.lib.common"].__icon__ from settings import * from lcdbase import * @@ -44,9 +44,6 @@ from infolabels import * -def log(loglevel, msg): - xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) - MAX_ROWS = 20 MAX_BIGDIGITS = 20 INIT_RETRY_INTERVAL = 2 diff --git a/resources/lib/lcdproc_extra_base.py b/resources/lib/lcdproc_extra_base.py index afe44d8..b0f1ccd 100644 --- a/resources/lib/lcdproc_extra_base.py +++ b/resources/lib/lcdproc_extra_base.py @@ -25,10 +25,10 @@ import sys -__scriptname__ = sys.modules[ "__main__" ].__scriptname__ -__settings__ = sys.modules[ "__main__" ].__settings__ -__cwd__ = sys.modules[ "__main__" ].__cwd__ -__icon__ = sys.modules[ "__main__" ].__icon__ +__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__cwd__ = sys.modules["resources.lib.common"].__cwd__ +__icon__ = sys.modules["resources.lib.common"].__icon__ class LCDproc_extra_base(): def __init__(self): diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index 4b5c2b9..49cad86 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -28,10 +28,10 @@ import sys import time -__scriptname__ = sys.modules[ "__main__" ].__scriptname__ -__settings__ = sys.modules[ "__main__" ].__settings__ -__cwd__ = sys.modules[ "__main__" ].__cwd__ -__icon__ = sys.modules[ "__main__" ].__icon__ +__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__cwd__ = sys.modules["resources.lib.common"].__cwd__ +__icon__ = sys.modules["resources.lib.common"].__icon__ from lcdproc import * from lcdbase import LCD_EXTRAICONS @@ -40,9 +40,6 @@ IMON_OUTPUT_INTERVAL = 0.2 # seconds -def log(loglevel, msg): - xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) - # extra icon bitmasks class IMON_ICONS: ICON_SPINDISC = 0x01 << 0 diff --git a/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py index e1fc6f7..1b8f776 100644 --- a/resources/lib/lcdproc_extra_mdm166a.py +++ b/resources/lib/lcdproc_extra_mdm166a.py @@ -27,19 +27,16 @@ import xbmc import sys -__scriptname__ = sys.modules[ "__main__" ].__scriptname__ -__settings__ = sys.modules[ "__main__" ].__settings__ -__cwd__ = sys.modules[ "__main__" ].__cwd__ -__icon__ = sys.modules[ "__main__" ].__icon__ +__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__cwd__ = sys.modules["resources.lib.common"].__cwd__ +__icon__ = sys.modules["resources.lib.common"].__icon__ from lcdproc import * from lcdbase import LCD_EXTRAICONS from extraicons import * from lcdproc_extra_base import * -def log(loglevel, msg): - xbmc.log("### [%s] - %s" % (__scriptname__,msg,), level=loglevel) - # extra icon bitmasks class MDM166A_ICONS: ICON_PLAY = 0x01 << 0 diff --git a/resources/lib/settings.py b/resources/lib/settings.py index cc8e136..ffd63d2 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -26,11 +26,10 @@ import time import xbmc -__scriptname__ = sys.modules[ "__main__" ].__scriptname__ -__settings__ = sys.modules[ "__main__" ].__settings__ -__cwd__ = sys.modules[ "__main__" ].__cwd__ -__icon__ = sys.modules[ "__main__" ].__icon__ -sys.path.append (__cwd__) +__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__cwd__ = sys.modules["resources.lib.common"].__cwd__ +__icon__ = sys.modules["resources.lib.common"].__icon__ #general global g_hostip From 6942733580a046d4446158536eaf104b71b38713 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 4 Jun 2018 22:22:26 +0200 Subject: [PATCH 274/337] remove __scriptname__ and use KODI_ADDON_NAME globally instead Using the new global doesn't require to redefine __scriptname__ everywhere where it's used. --- main.py | 9 ++++----- resources/lib/common.py | 3 +-- resources/lib/lcdbase.py | 4 ++-- resources/lib/lcdproc.py | 1 - resources/lib/lcdproc_extra_base.py | 1 - resources/lib/lcdproc_extra_imon.py | 1 - resources/lib/lcdproc_extra_mdm166a.py | 1 - resources/lib/settings.py | 1 - 8 files changed, 7 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index 35984d2..e07ff24 100644 --- a/main.py +++ b/main.py @@ -35,9 +35,8 @@ from resources.lib.lcdproc import * from resources.lib.infolabels import * -__settings__ = sys.modules["resources.lib.common"].__settings__ -__icon__ = sys.modules["resources.lib.common"].__icon__ -__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__icon__ = sys.modules["resources.lib.common"].__icon__ global g_failedConnectionNotified global g_initialConnectAttempt @@ -65,11 +64,11 @@ def HandleConnectionNotification(bConnectSuccess): g_failedConnectionNotified = True g_initialConnectAttempt = False text = __settings__.getLocalizedString(32500) - xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) + xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 10, __icon__)) else: text = __settings__.getLocalizedString(32501) if not g_initialConnectAttempt: - xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,10,__icon__)) + xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 10, __icon__)) g_failedConnectionNotified = True # returns mode identifier based on currently playing media/active navigation diff --git a/resources/lib/common.py b/resources/lib/common.py index b325edd..ac82833 100644 --- a/resources/lib/common.py +++ b/resources/lib/common.py @@ -36,7 +36,6 @@ __settings__ = xbmcaddon.Addon(id=KODI_ADDON_ID) __cwd__ = __settings__.getAddonInfo('path') __icon__ = os.path.join(__cwd__, "resources", "icon.png") -__scriptname__ = KODI_ADDON_NAME # copy loglevel defines to the global scope LOGDEBUG = xbmc.LOGDEBUG @@ -50,7 +49,7 @@ # log wrapper def log(loglevel, msg): - xbmc.log("### [%s] - %s" % (__scriptname__, msg), level=loglevel) + xbmc.log("### [%s] - %s" % (KODI_ADDON_NAME, msg), level=loglevel) # enum snippet from http://stackoverflow.com/a/1695250 - thanks! def enum(*sequential, **named): diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 8370ef7..aee6270 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -33,10 +33,10 @@ from xml.etree import ElementTree as xmltree from array import array -__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ __settings__ = sys.modules["resources.lib.common"].__settings__ __cwd__ = sys.modules["resources.lib.common"].__cwd__ __icon__ = sys.modules["resources.lib.common"].__icon__ + __lcdxml__ = xbmc.translatePath(os.path.join("special://masterprofile", "LCD.xml")) __lcddefaultxml__ = xbmc.translatePath(os.path.join(__cwd__, "resources", "LCD.xml.defaults")) @@ -241,7 +241,7 @@ def LoadSkin(self, xmlFile, doReset): if not self.m_bXMLWarningDisplayed: self.m_bXMLWarningDisplayed = True text = __settings__.getLocalizedString(32502) - xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (__scriptname__,text,5000,__icon__)) + xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 5000, __icon__)) log(xbmc.LOGERROR, "Parsing of %s failed" % (xmlFile)) return False diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index f4605a9..ccdb753 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -31,7 +31,6 @@ from socket import * -__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ __settings__ = sys.modules["resources.lib.common"].__settings__ __cwd__ = sys.modules["resources.lib.common"].__cwd__ __icon__ = sys.modules["resources.lib.common"].__icon__ diff --git a/resources/lib/lcdproc_extra_base.py b/resources/lib/lcdproc_extra_base.py index b0f1ccd..1d8ec04 100644 --- a/resources/lib/lcdproc_extra_base.py +++ b/resources/lib/lcdproc_extra_base.py @@ -25,7 +25,6 @@ import sys -__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ __settings__ = sys.modules["resources.lib.common"].__settings__ __cwd__ = sys.modules["resources.lib.common"].__cwd__ __icon__ = sys.modules["resources.lib.common"].__icon__ diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index 49cad86..c61847f 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -28,7 +28,6 @@ import sys import time -__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ __settings__ = sys.modules["resources.lib.common"].__settings__ __cwd__ = sys.modules["resources.lib.common"].__cwd__ __icon__ = sys.modules["resources.lib.common"].__icon__ diff --git a/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py index 1b8f776..7f82f81 100644 --- a/resources/lib/lcdproc_extra_mdm166a.py +++ b/resources/lib/lcdproc_extra_mdm166a.py @@ -27,7 +27,6 @@ import xbmc import sys -__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ __settings__ = sys.modules["resources.lib.common"].__settings__ __cwd__ = sys.modules["resources.lib.common"].__cwd__ __icon__ = sys.modules["resources.lib.common"].__icon__ diff --git a/resources/lib/settings.py b/resources/lib/settings.py index ffd63d2..70ad2da 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -26,7 +26,6 @@ import time import xbmc -__scriptname__ = sys.modules["resources.lib.common"].__scriptname__ __settings__ = sys.modules["resources.lib.common"].__settings__ __cwd__ = sys.modules["resources.lib.common"].__cwd__ __icon__ = sys.modules["resources.lib.common"].__icon__ From 046fd5e93da7cee1489762be9acc2b50969e5628 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 4 Jun 2018 22:55:45 +0200 Subject: [PATCH 275/337] remove __icon__ and use the new global KODI_ADDON_ICON instead Saves on another var that needs to be pulled from another module. --- main.py | 5 ++--- resources/lib/common.py | 7 ++++--- resources/lib/lcdbase.py | 7 +++---- resources/lib/lcdproc.py | 5 ++--- resources/lib/lcdproc_extra_base.py | 5 ++--- resources/lib/lcdproc_extra_imon.py | 5 ++--- resources/lib/lcdproc_extra_mdm166a.py | 5 ++--- resources/lib/settings.py | 5 ++--- 8 files changed, 19 insertions(+), 25 deletions(-) diff --git a/main.py b/main.py index e07ff24..d409de2 100644 --- a/main.py +++ b/main.py @@ -36,7 +36,6 @@ from resources.lib.infolabels import * __settings__ = sys.modules["resources.lib.common"].__settings__ -__icon__ = sys.modules["resources.lib.common"].__icon__ global g_failedConnectionNotified global g_initialConnectAttempt @@ -64,11 +63,11 @@ def HandleConnectionNotification(bConnectSuccess): g_failedConnectionNotified = True g_initialConnectAttempt = False text = __settings__.getLocalizedString(32500) - xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 10, __icon__)) + xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 10, KODI_ADDON_ICON)) else: text = __settings__.getLocalizedString(32501) if not g_initialConnectAttempt: - xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 10, __icon__)) + xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 10, KODI_ADDON_ICON)) g_failedConnectionNotified = True # returns mode identifier based on currently playing media/active navigation diff --git a/resources/lib/common.py b/resources/lib/common.py index ac82833..d4dcdf2 100644 --- a/resources/lib/common.py +++ b/resources/lib/common.py @@ -33,9 +33,10 @@ KODI_ADDON_ID = "script.xbmc.lcdproc" KODI_ADDON_NAME = "XBMC LCDproc" -__settings__ = xbmcaddon.Addon(id=KODI_ADDON_ID) -__cwd__ = __settings__.getAddonInfo('path') -__icon__ = os.path.join(__cwd__, "resources", "icon.png") +__settings__ = xbmcaddon.Addon(id=KODI_ADDON_ID) +__cwd__ = __settings__.getAddonInfo('path') + +KODI_ADDON_ICON = os.path.join(__cwd__, "resources", "icon.png") # copy loglevel defines to the global scope LOGDEBUG = xbmc.LOGDEBUG diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index aee6270..ff905b4 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -33,9 +33,8 @@ from xml.etree import ElementTree as xmltree from array import array -__settings__ = sys.modules["resources.lib.common"].__settings__ -__cwd__ = sys.modules["resources.lib.common"].__cwd__ -__icon__ = sys.modules["resources.lib.common"].__icon__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__cwd__ = sys.modules["resources.lib.common"].__cwd__ __lcdxml__ = xbmc.translatePath(os.path.join("special://masterprofile", "LCD.xml")) __lcddefaultxml__ = xbmc.translatePath(os.path.join(__cwd__, "resources", "LCD.xml.defaults")) @@ -241,7 +240,7 @@ def LoadSkin(self, xmlFile, doReset): if not self.m_bXMLWarningDisplayed: self.m_bXMLWarningDisplayed = True text = __settings__.getLocalizedString(32502) - xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 5000, __icon__)) + xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 5000, KODI_ADDON_ICON)) log(xbmc.LOGERROR, "Parsing of %s failed" % (xmlFile)) return False diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index ccdb753..c0fd9ee 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -31,9 +31,8 @@ from socket import * -__settings__ = sys.modules["resources.lib.common"].__settings__ -__cwd__ = sys.modules["resources.lib.common"].__cwd__ -__icon__ = sys.modules["resources.lib.common"].__icon__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__cwd__ = sys.modules["resources.lib.common"].__cwd__ from settings import * from lcdbase import * diff --git a/resources/lib/lcdproc_extra_base.py b/resources/lib/lcdproc_extra_base.py index 1d8ec04..2318435 100644 --- a/resources/lib/lcdproc_extra_base.py +++ b/resources/lib/lcdproc_extra_base.py @@ -25,9 +25,8 @@ import sys -__settings__ = sys.modules["resources.lib.common"].__settings__ -__cwd__ = sys.modules["resources.lib.common"].__cwd__ -__icon__ = sys.modules["resources.lib.common"].__icon__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__cwd__ = sys.modules["resources.lib.common"].__cwd__ class LCDproc_extra_base(): def __init__(self): diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index c61847f..2bb8aeb 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -28,9 +28,8 @@ import sys import time -__settings__ = sys.modules["resources.lib.common"].__settings__ -__cwd__ = sys.modules["resources.lib.common"].__cwd__ -__icon__ = sys.modules["resources.lib.common"].__icon__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__cwd__ = sys.modules["resources.lib.common"].__cwd__ from lcdproc import * from lcdbase import LCD_EXTRAICONS diff --git a/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py index 7f82f81..9625a3e 100644 --- a/resources/lib/lcdproc_extra_mdm166a.py +++ b/resources/lib/lcdproc_extra_mdm166a.py @@ -27,9 +27,8 @@ import xbmc import sys -__settings__ = sys.modules["resources.lib.common"].__settings__ -__cwd__ = sys.modules["resources.lib.common"].__cwd__ -__icon__ = sys.modules["resources.lib.common"].__icon__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__cwd__ = sys.modules["resources.lib.common"].__cwd__ from lcdproc import * from lcdbase import LCD_EXTRAICONS diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 70ad2da..6986103 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -26,9 +26,8 @@ import time import xbmc -__settings__ = sys.modules["resources.lib.common"].__settings__ -__cwd__ = sys.modules["resources.lib.common"].__cwd__ -__icon__ = sys.modules["resources.lib.common"].__icon__ +__settings__ = sys.modules["resources.lib.common"].__settings__ +__cwd__ = sys.modules["resources.lib.common"].__cwd__ #general global g_hostip From b72a1163605a7c8a12ee105c1438bb7d11ef4355 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 4 Jun 2018 22:59:23 +0200 Subject: [PATCH 276/337] clean up use of __settings__ and __cwd__ No need to pull from common everywhere when they're not used at all. --- resources/lib/lcdproc.py | 3 --- resources/lib/lcdproc_extra_base.py | 3 --- resources/lib/lcdproc_extra_imon.py | 3 --- resources/lib/lcdproc_extra_mdm166a.py | 3 --- resources/lib/settings.py | 1 - 5 files changed, 13 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index c0fd9ee..babfdc2 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -31,9 +31,6 @@ from socket import * -__settings__ = sys.modules["resources.lib.common"].__settings__ -__cwd__ = sys.modules["resources.lib.common"].__cwd__ - from settings import * from lcdbase import * diff --git a/resources/lib/lcdproc_extra_base.py b/resources/lib/lcdproc_extra_base.py index 2318435..5f52bb6 100644 --- a/resources/lib/lcdproc_extra_base.py +++ b/resources/lib/lcdproc_extra_base.py @@ -25,9 +25,6 @@ import sys -__settings__ = sys.modules["resources.lib.common"].__settings__ -__cwd__ = sys.modules["resources.lib.common"].__cwd__ - class LCDproc_extra_base(): def __init__(self): pass diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index 2bb8aeb..99b5091 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -28,9 +28,6 @@ import sys import time -__settings__ = sys.modules["resources.lib.common"].__settings__ -__cwd__ = sys.modules["resources.lib.common"].__cwd__ - from lcdproc import * from lcdbase import LCD_EXTRAICONS from extraicons import * diff --git a/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py index 9625a3e..6f80dae 100644 --- a/resources/lib/lcdproc_extra_mdm166a.py +++ b/resources/lib/lcdproc_extra_mdm166a.py @@ -27,9 +27,6 @@ import xbmc import sys -__settings__ = sys.modules["resources.lib.common"].__settings__ -__cwd__ = sys.modules["resources.lib.common"].__cwd__ - from lcdproc import * from lcdbase import LCD_EXTRAICONS from extraicons import * diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 6986103..38cbc02 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -27,7 +27,6 @@ import xbmc __settings__ = sys.modules["resources.lib.common"].__settings__ -__cwd__ = sys.modules["resources.lib.common"].__cwd__ #general global g_hostip From c1e171f0d3d40ebdff0dd8d64eb04e8a15db9c4e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 4 Jun 2018 23:11:01 +0200 Subject: [PATCH 277/337] remove remaining __cwd__ and __settings__ pseudo globals aswell And make them KODI_ADDON_ROOTPATH and KODI_ADDON_SETTINGS accordingly. Be sure that common is imported in all modules where needed now. --- main.py | 6 ++---- resources/lib/common.py | 12 +++++------- resources/lib/lcdbase.py | 12 +++++------- resources/lib/settings.py | 37 +++++++++++++++++++------------------ 4 files changed, 31 insertions(+), 36 deletions(-) diff --git a/main.py b/main.py index d409de2..feff718 100644 --- a/main.py +++ b/main.py @@ -35,8 +35,6 @@ from resources.lib.lcdproc import * from resources.lib.infolabels import * -__settings__ = sys.modules["resources.lib.common"].__settings__ - global g_failedConnectionNotified global g_initialConnectAttempt global g_lcdproc @@ -62,10 +60,10 @@ def HandleConnectionNotification(bConnectSuccess): if not g_failedConnectionNotified: g_failedConnectionNotified = True g_initialConnectAttempt = False - text = __settings__.getLocalizedString(32500) + text = KODI_ADDON_SETTINGS.getLocalizedString(32500) xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 10, KODI_ADDON_ICON)) else: - text = __settings__.getLocalizedString(32501) + text = KODI_ADDON_SETTINGS.getLocalizedString(32501) if not g_initialConnectAttempt: xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 10, KODI_ADDON_ICON)) g_failedConnectionNotified = True diff --git a/resources/lib/common.py b/resources/lib/common.py index d4dcdf2..e24085e 100644 --- a/resources/lib/common.py +++ b/resources/lib/common.py @@ -30,13 +30,11 @@ import xbmc import xbmcaddon -KODI_ADDON_ID = "script.xbmc.lcdproc" -KODI_ADDON_NAME = "XBMC LCDproc" - -__settings__ = xbmcaddon.Addon(id=KODI_ADDON_ID) -__cwd__ = __settings__.getAddonInfo('path') - -KODI_ADDON_ICON = os.path.join(__cwd__, "resources", "icon.png") +KODI_ADDON_ID = "script.xbmc.lcdproc" +KODI_ADDON_NAME = "XBMC LCDproc" +KODI_ADDON_SETTINGS = xbmcaddon.Addon(id=KODI_ADDON_ID) +KODI_ADDON_ROOTPATH = KODI_ADDON_SETTINGS.getAddonInfo("path") +KODI_ADDON_ICON = os.path.join(KODI_ADDON_ROOTPATH, "resources", "icon.png") # copy loglevel defines to the global scope LOGDEBUG = xbmc.LOGDEBUG diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index ff905b4..444a77d 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -33,17 +33,15 @@ from xml.etree import ElementTree as xmltree from array import array -__settings__ = sys.modules["resources.lib.common"].__settings__ -__cwd__ = sys.modules["resources.lib.common"].__cwd__ - -__lcdxml__ = xbmc.translatePath(os.path.join("special://masterprofile", "LCD.xml")) -__lcddefaultxml__ = xbmc.translatePath(os.path.join(__cwd__, "resources", "LCD.xml.defaults")) - +from common import * from settings import * from extraicons import * from infolabels import * from charset_hd44780 import * +__lcdxml__ = xbmc.translatePath(os.path.join("special://masterprofile", "LCD.xml")) +__lcddefaultxml__ = xbmc.translatePath(os.path.join(KODI_ADDON_ROOTPATH, "resources", "LCD.xml.defaults")) + class LCD_MODE: LCD_MODE_GENERAL = 0 LCD_MODE_MUSIC = 1 @@ -239,7 +237,7 @@ def LoadSkin(self, xmlFile, doReset): except: if not self.m_bXMLWarningDisplayed: self.m_bXMLWarningDisplayed = True - text = __settings__.getLocalizedString(32502) + text = KODI_ADDON_SETTINGS.getLocalizedString(32502) xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 5000, KODI_ADDON_ICON)) log(xbmc.LOGERROR, "Parsing of %s failed" % (xmlFile)) diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 38cbc02..b1caf28 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -24,9 +24,10 @@ import string import sys import time + import xbmc -__settings__ = sys.modules["resources.lib.common"].__settings__ +from common import * #general global g_hostip @@ -208,10 +209,10 @@ def settings_handleCriticalSettings(): reconnect = False - hostip = __settings__.getSetting("hostip") - hostport = int(__settings__.getSetting("hostport")) - heartbeat = __settings__.getSetting("heartbeat") == "true" - useextraelements = __settings__.getSetting("useextraelements") == "true" + hostip = KODI_ADDON_SETTINGS.getSetting("hostip") + hostport = int(KODI_ADDON_SETTINGS.getSetting("hostport")) + heartbeat = KODI_ADDON_SETTINGS.getSetting("heartbeat") == "true" + useextraelements = KODI_ADDON_SETTINGS.getSetting("useextraelements") == "true" #server settings #we need to reconnect if networkaccess bool changes @@ -232,7 +233,7 @@ def settings_handleCriticalSettings(): else: print "lcd: invalid hostport value " + str(hostport) + ", resetting to old value " + str(g_hostport) - __settings__.setSetting("hostport", str(g_hostport)) + KODI_ADDON_SETTINGS.setSetting("hostport", str(g_hostport)) if g_heartbeat != heartbeat: print "lcd: toggled heartbeat bool" @@ -265,18 +266,18 @@ def settings_handleLcdSettings(): g_settingsChanged = False - scrolldelay = int(float(string.replace(__settings__.getSetting("scrolldelay"), ",", "."))) - scrollmode = __settings__.getSetting("scrollmode") - dimonscreensaver = __settings__.getSetting("dimonscreensaver") == "true" - dimonshutdown = __settings__.getSetting("dimonshutdown") == "true" - dimonvideoplayback = __settings__.getSetting("dimonvideoplayback") == "true" - dimonmusicplayback = __settings__.getSetting("dimonmusicplayback") == "true" - dimdelay = int(float(string.replace(__settings__.getSetting("dimdelay"), ",", "."))) - navtimeout = int(float(string.replace(__settings__.getSetting("navtimeout"), ",", "."))) - refreshrate = int(float(string.replace(__settings__.getSetting("refreshrate"), ",", "."))) - hideconnpopups = __settings__.getSetting("hideconnpopups") == "true" - usealternatecharset = __settings__.getSetting("usealternatecharset") == "true" - charset = __settings__.getSetting("charset") + scrolldelay = int(float(string.replace(KODI_ADDON_SETTINGS.getSetting("scrolldelay"), ",", "."))) + scrollmode = KODI_ADDON_SETTINGS.getSetting("scrollmode") + dimonscreensaver = KODI_ADDON_SETTINGS.getSetting("dimonscreensaver") == "true" + dimonshutdown = KODI_ADDON_SETTINGS.getSetting("dimonshutdown") == "true" + dimonvideoplayback = KODI_ADDON_SETTINGS.getSetting("dimonvideoplayback") == "true" + dimonmusicplayback = KODI_ADDON_SETTINGS.getSetting("dimonmusicplayback") == "true" + dimdelay = int(float(string.replace(KODI_ADDON_SETTINGS.getSetting("dimdelay"), ",", "."))) + navtimeout = int(float(string.replace(KODI_ADDON_SETTINGS.getSetting("navtimeout"), ",", "."))) + refreshrate = int(float(string.replace(KODI_ADDON_SETTINGS.getSetting("refreshrate"), ",", "."))) + hideconnpopups = KODI_ADDON_SETTINGS.getSetting("hideconnpopups") == "true" + usealternatecharset = KODI_ADDON_SETTINGS.getSetting("usealternatecharset") == "true" + charset = KODI_ADDON_SETTINGS.getSetting("charset") if g_scrolldelay != scrolldelay: g_scrolldelay = scrolldelay From 8ff1b2825af3e33675377f0868f3c637e3966a3d Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 5 Jun 2018 21:21:47 +0200 Subject: [PATCH 278/337] remove the more or less useless enum construct Due do the way the resulting values are used throughout extraicon handling, it can be replaced directly by a simple class, which is a native part of the python language, and is way more easy to read and understand for others. --- resources/lib/common.py | 5 -- resources/lib/extraicons.py | 98 ++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 55 deletions(-) diff --git a/resources/lib/common.py b/resources/lib/common.py index e24085e..3776d22 100644 --- a/resources/lib/common.py +++ b/resources/lib/common.py @@ -49,8 +49,3 @@ # log wrapper def log(loglevel, msg): xbmc.log("### [%s] - %s" % (KODI_ADDON_NAME, msg), level=loglevel) - -# enum snippet from http://stackoverflow.com/a/1695250 - thanks! -def enum(*sequential, **named): - enums = dict(zip(sequential, range(len(sequential))), **named) - return type('Enum', (), enums) diff --git a/resources/lib/extraicons.py b/resources/lib/extraicons.py index 2e806c2..efc78b8 100644 --- a/resources/lib/extraicons.py +++ b/resources/lib/extraicons.py @@ -27,54 +27,52 @@ LCD_EXTRABARS_MAX = 4 -LCD_EXTRAICONS = enum( - 'LCD_EXTRAICON_NONE', - 'LCD_EXTRAICON_PLAYING', - 'LCD_EXTRAICON_PAUSE', - 'LCD_EXTRAICON_MOVIE', - 'LCD_EXTRAICON_MUSIC', - 'LCD_EXTRAICON_WEATHER', - 'LCD_EXTRAICON_TV', - 'LCD_EXTRAICON_PHOTO', - 'LCD_EXTRAICON_WEBCASTING', - 'LCD_EXTRAICON_MUTE', - 'LCD_EXTRAICON_REPEAT', - 'LCD_EXTRAICON_SHUFFLE', - 'LCD_EXTRAICON_ALARM', - 'LCD_EXTRAICON_RECORD', - 'LCD_EXTRAICON_VOLUME', - 'LCD_EXTRAICON_TIME', - 'LCD_EXTRAICON_SPDIF', - 'LCD_EXTRAICON_DISC_IN', - 'LCD_EXTRAICON_SCR1', - 'LCD_EXTRAICON_SCR2', - 'LCD_EXTRAICON_RESOLUTION_SD', - 'LCD_EXTRAICON_RESOLUTION_HD', - 'LCD_EXTRAICON_VCODEC_MPEG', - 'LCD_EXTRAICON_VCODEC_DIVX', - 'LCD_EXTRAICON_VCODEC_XVID', - 'LCD_EXTRAICON_VCODEC_WMV', - 'LCD_EXTRAICON_ACODEC_MPEG', - 'LCD_EXTRAICON_ACODEC_AC3', - 'LCD_EXTRAICON_ACODEC_DTS', - 'LCD_EXTRAICON_ACODEC_VWMA', # e.g. iMON has video-WMA AND audio-WMA... - 'LCD_EXTRAICON_ACODEC_MP3', - 'LCD_EXTRAICON_ACODEC_OGG', - 'LCD_EXTRAICON_ACODEC_AWMA', # see ACODEC_VWMA - 'LCD_EXTRAICON_ACODEC_WAV', - 'LCD_EXTRAICON_OUTSOURCE', - 'LCD_EXTRAICON_OUTFIT', - 'LCD_EXTRAICON_OUT_2_0', - 'LCD_EXTRAICON_OUT_5_1', - 'LCD_EXTRAICON_OUT_7_1', - 'LCD_EXTRAICON_MAX' -) +class LCD_EXTRAICONS: + LCD_EXTRAICON_NONE = 0 + LCD_EXTRAICON_PLAYING = 1 + LCD_EXTRAICON_PAUSE = 2 + LCD_EXTRAICON_MOVIE = 3 + LCD_EXTRAICON_MUSIC = 4 + LCD_EXTRAICON_WEATHER = 5 + LCD_EXTRAICON_TV = 6 + LCD_EXTRAICON_PHOTO = 7 + LCD_EXTRAICON_WEBCASTING = 8 + LCD_EXTRAICON_MUTE = 9 + LCD_EXTRAICON_REPEAT = 10 + LCD_EXTRAICON_SHUFFLE = 11 + LCD_EXTRAICON_ALARM = 12 + LCD_EXTRAICON_RECORD = 13 + LCD_EXTRAICON_VOLUME = 14 + LCD_EXTRAICON_TIME = 15 + LCD_EXTRAICON_SPDIF = 16 + LCD_EXTRAICON_DISC_IN = 17 + LCD_EXTRAICON_SCR1 = 18 + LCD_EXTRAICON_SCR2 = 19 + LCD_EXTRAICON_RESOLUTION_SD = 20 + LCD_EXTRAICON_RESOLUTION_HD = 21 + LCD_EXTRAICON_VCODEC_MPEG = 22 + LCD_EXTRAICON_VCODEC_DIVX = 23 + LCD_EXTRAICON_VCODEC_XVID = 24 + LCD_EXTRAICON_VCODEC_WMV = 25 + LCD_EXTRAICON_ACODEC_MPEG = 26 + LCD_EXTRAICON_ACODEC_AC3 = 27 + LCD_EXTRAICON_ACODEC_DTS = 28 + LCD_EXTRAICON_ACODEC_VWMA = 29 # e.g. iMON has video-WMA AND audio-WMA... + LCD_EXTRAICON_ACODEC_MP3 = 30 + LCD_EXTRAICON_ACODEC_OGG = 31 + LCD_EXTRAICON_ACODEC_AWMA = 32 # see ACODEC_VWMA + LCD_EXTRAICON_ACODEC_WAV = 33 + LCD_EXTRAICON_OUTSOURCE = 34 + LCD_EXTRAICON_OUTFIT = 35 + LCD_EXTRAICON_OUT_2_0 = 36 + LCD_EXTRAICON_OUT_5_1 = 37 + LCD_EXTRAICON_OUT_7_1 = 38 + LCD_EXTRAICON_MAX = 39 -LCD_EXTRAICONCATEGORIES = enum( - 'LCD_ICONCAT_MODES', - 'LCD_ICONCAT_OUTSCALE', - 'LCD_ICONCAT_CODECS', - 'LCD_ICONCAT_VIDEOCODECS', - 'LCD_ICONCAT_AUDIOCODECS', - 'LCD_ICONCAT_AUDIOCHANNELS' -) +class LCD_EXTRAICONCATEGORIES: + LCD_ICONCAT_MODES = 1 + LCD_ICONCAT_OUTSCALE = 2 + LCD_ICONCAT_CODECS = 3 + LCD_ICONCAT_VIDEOCODECS = 4 + LCD_ICONCAT_AUDIOCODECS = 5 + LCD_ICONCAT_AUDIOCHANNELS = 6 From 0f08d657202673ba0503fc4e1ade065ec3ddf7c6 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 5 Jun 2018 21:47:20 +0200 Subject: [PATCH 279/337] remove pre-python2.7 compat code paths Pretty sure no one will use Leia+ on Squeeze or other long-outdated distros which even don't ship with GCC versions able to build the current Kodi codebase. --- resources/lib/lcdbase.py | 14 +++----------- resources/lib/lcdproc.py | 4 ---- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 444a77d..bb48729 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -426,11 +426,7 @@ def LoadMode(self, node, mode): elif linetext.lower().find("$info[lcd.playicon]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_ICONTEXT linedescriptor['startx'] = int(1 + self.m_iIconTextOffset) # icon widgets take 2 chars, so shift text offset (default: 2) - # support Python < 2.7 (e.g. Debian Squeeze) - if self.m_vPythonVersion < (2, 7): - linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', linetext).strip() - else: - linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', linetext, flags=re.IGNORECASE).strip() + linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', linetext, flags=re.IGNORECASE).strip() # standard (scrolling) text line else: @@ -443,12 +439,8 @@ def LoadMode(self, node, mode): if linetext.lower().find("$info[lcd.alignright]") >= 0: linedescriptor['align'] = LCD_LINEALIGN.LCD_LINEALIGN_RIGHT - if self.m_vPythonVersion < (2, 7): - linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignCenter]") + '\s?', ' ', linedescriptor['text']).strip() - linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignRight]") + '\s?', ' ', linedescriptor['text']).strip() - else: - linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignCenter]") + '\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE).strip() - linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignRight]") + '\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE).strip() + linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignCenter]") + '\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE).strip() + linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignRight]") + '\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE).strip() self.m_lcdMode[mode].append(linedescriptor) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index babfdc2..6f94dc1 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -65,10 +65,6 @@ def __init__(self): self.m_iOffset = 1 self.m_strSetLineCmds = "" self.m_cExtraIcons = None - self.m_vPythonVersion = sys.version_info - - if self.m_vPythonVersion < (2, 7): - log(xbmc.LOGWARNING, "Python < 2.7 detected. Upgrade your Python for optimal results.") LcdBase.__init__(self) From ac7e27b42693be04692d2d8c7ff78218692aecb3 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 6 Jun 2018 19:24:40 +0200 Subject: [PATCH 280/337] addon.xml: explicitly specify en_GB in the desciption and disclaimer tags Required since Krypton. --- addon.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addon.xml b/addon.xml index 2a1097d..e9efda6 100644 --- a/addon.xml +++ b/addon.xml @@ -7,10 +7,10 @@ Kodi/XBMC LCDproc - Displays configurable information e.g. about playing media or Kodi status on any LC/VF-display driven by LCDproc, and acts as direct drop-in replacement to the LCD/VFD-feature previously available in Kodi/XBMC's core. Supports additional display elements (icons, bars) on SoundGraph iMON LCD and Targa/Futaba mdm166a VFD hardware. Requires a properly configured and running LCDd either locally or somewhere on the network. + Displays configurable information e.g. about playing media or Kodi status on any LC/VF-display driven by LCDproc, and acts as direct drop-in replacement to the LCD/VFD-feature previously available in Kodi/XBMC's core. Supports additional display elements (icons, bars) on SoundGraph iMON LCD and Targa/Futaba mdm166a VFD hardware. Requires a properly configured and running LCDd either locally or somewhere on the network. Zeigt konfigurierbare Informationen z.B. über aktuelle Wiedergabe oder den Kodi Status auf beliebigen von LCDproc angesteuerten LC/VF-Displays, ersetzt die zuvor im Kodi/XBMC-Kern enthaltene LCD/VFD-Funktion. Unterstützt zusätzliche Elemente (Icons, Balken) von SoundGraph iMON LCD und Targa/Futaba mdm166a VFD Hardware. Benötigt einen konfigurierten, laufenden LCDd auf dem lokalen System oder im Netzwerk. Affiche des informations définies par configuration telles que le média en cours de lecture, l'état de Kodi... et ce sur tout type d'afficheur LC/VF géré par LCDProc. Remplace la fonctionnalité LCD/VFD précédemment disponible par défaut dans Kodi/XBMC. Gère des éléments supplémentaires (icônes, barres) sur les écrans SoundGraph iMON LCD et Targa/Futaba mdm166a VFD. Nécessite un serveur LCDd correctement configuré et disponible localement ou sur le réseau. - Works with LCDproc only. Other LCD services like LCD4Linux or iMON Manager on Win32 are not supported. No liability taken for damaged hardware and/or software caused by this addon. + Works with LCDproc only. Other LCD services like LCD4Linux or iMON Manager on Win32 are not supported. No liability taken for damaged hardware and/or software caused by this addon. Funktioniert ausschliesslich mit LCDproc. Andere LCD-Dienste wie LCD4Linux, iMON Manager unter Win32 u.a. sind nicht unterstützt. Keine Haftung für durch dieses Addon beschädigte Hard-/Software. Fonctionne uniquement avec LCDProc. Les services tels que LCD4Linux ou iMON Manager sur Win32 ne sont pas gérés. Nous déclinons toute responsabilité en cas de dégats survenus suite à l'utilisation de cette extension. GNU GENERAL PUBLIC LICENSE. Version 2, June 1991 From 54b8b453bdf1427d0fcaf33915d0867221dcd736 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 6 Jun 2018 19:39:07 +0200 Subject: [PATCH 281/337] remove unnecessary __settingshandler__ and just import settings instead By now and for whatever reasons, this is working as originally intended "back then", so drop this uglyness aswell. --- resources/lib/infolabels.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index d0516d3..139137f 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -32,8 +32,7 @@ import xbmcaddon import xbmcgui -# wonder why "from settings import *" does not work... -__settingshandler__ = sys.modules["resources.lib.settings"] +from settings import * # interesting XBMC GUI Window IDs (no defines seem to exist for this) class WINDOW_IDS: @@ -207,7 +206,7 @@ def InfoLabel_IsNavigationActive(): ret = False - navtimeout = __settingshandler__.settings_getNavTimeout() + navtimeout = settings_getNavTimeout() menu = InfoLabel_GetInfoLabel("$INFO[System.CurrentWindow]") subMenu = InfoLabel_GetInfoLabel("$INFO[System.CurrentControl]") From dcc7bb2c6b846b9cb35db7c9d88914c6a10a6c50 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 6 Jun 2018 19:48:43 +0200 Subject: [PATCH 282/337] use the LOG* defines from common instead of referring xbmc.LOG* --- resources/lib/lcdbase.py | 34 +++++++++++++-------------- resources/lib/lcdproc.py | 50 ++++++++++++++++++++-------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index bb48729..fd2b8a0 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -171,14 +171,14 @@ def ManageLCDXML(self): if not os.path.isfile(__lcdxml__): if not os.path.isfile(__lcddefaultxml__): - log(xbmc.LOGERROR, "No LCD.xml found and LCD.xml.defaults missing, expect problems!") + log(LOGERROR, "No LCD.xml found and LCD.xml.defaults missing, expect problems!") else: try: shutil.copy2(__lcddefaultxml__, __lcdxml__) - log(xbmc.LOGNOTICE, "Initialised LCD.xml from defaults") + log(LOGNOTICE, "Initialised LCD.xml from defaults") ret = True except: - log(xbmc.LOGERROR, "Failed to copy LCD defaults!") + log(LOGERROR, "Failed to copy LCD defaults!") else: ret = True @@ -190,11 +190,11 @@ def Initialize(self): try: if not self.m_bHaveHD44780Charmap: - log(xbmc.LOGDEBUG, "Registering HD44780-ROM pseudocodepages") + log(LOGDEBUG, "Registering HD44780-ROM pseudocodepages") codecs.register(charset_hd44780) self.m_bHaveHD44780Charmap = True except: - log(xbmc.LOGERROR, "Failed to register custom HD44780-ROM pseudocodepage, expect problems with alternative charsets!") + log(LOGERROR, "Failed to register custom HD44780-ROM pseudocodepage, expect problems with alternative charsets!") # make sure we got reasonable defaults for users who didn't adapt to newest additions bGotDefaultSkin = self.LoadSkin(__lcddefaultxml__, True) @@ -204,7 +204,7 @@ def Initialize(self): # try to load user setup if not self.LoadSkin(__lcdxml__, False) and not bGotDefaultSkin: - log(xbmc.LOGERROR, "No usable mode configuration/skin could be loaded, check your addon installation!") + log(LOGERROR, "No usable mode configuration/skin could be loaded, check your addon installation!") return False # force-update GUI settings @@ -220,7 +220,7 @@ def UpdateGUISettings(self): str_charset = "iso8859-1" self.m_strLCDEncoding = str_charset - log(xbmc.LOGDEBUG, "Setting character encoding to %s" % (self.m_strLCDEncoding)) + log(LOGDEBUG, "Setting character encoding to %s" % (self.m_strLCDEncoding)) self.m_iDimOnPlayDelay = settings_getDimDelay() @@ -230,7 +230,7 @@ def LoadSkin(self, xmlFile, doReset): bHaveSkin = False - log(xbmc.LOGNOTICE, "Loading settings from %s" % (xmlFile)) + log(LOGNOTICE, "Loading settings from %s" % (xmlFile)) try: doc = xmltree.parse(xmlFile) @@ -240,7 +240,7 @@ def LoadSkin(self, xmlFile, doReset): text = KODI_ADDON_SETTINGS.getLocalizedString(32502) xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 5000, KODI_ADDON_ICON)) - log(xbmc.LOGERROR, "Parsing of %s failed" % (xmlFile)) + log(LOGERROR, "Parsing of %s failed" % (xmlFile)) return False for element in doc.getiterator(): @@ -278,13 +278,13 @@ def LoadSkin(self, xmlFile, doReset): try: intoffset = int(icontextoffset.text) except ValueError, TypeError: - log(xbmc.LOGERROR, "Value for icontextoffset must be integer (got: %s)" % (icontextoffset.text)) + log(LOGERROR, "Value for icontextoffset must be integer (got: %s)" % (icontextoffset.text)) else: if intoffset <= 0 or intoffset >= self.GetColumns(): - log(xbmc.LOGERROR, "Value %d for icontextoffset out of range, ignoring" % (intoffset)) + log(LOGERROR, "Value %d for icontextoffset out of range, ignoring" % (intoffset)) else: if intoffset < 2: - log(xbmc.LOGWARNING, "Value %d for icontextoffset smaller than LCDproc's icon width" % (intoffset)) + log(LOGWARNING, "Value %d for icontextoffset smaller than LCDproc's icon width" % (intoffset)) self.m_iIconTextOffset = intoffset # check for allowemptylines setting @@ -361,7 +361,7 @@ def LoadMode(self, node, mode): self.m_lcdMode[mode] = [] if node == None: - log(xbmc.LOGWARNING, "Empty Mode %d, consider checking LCD.xml" % (mode)) + log(LOGWARNING, "Empty Mode %d, consider checking LCD.xml" % (mode)) # if mode is empty, initialise with blank line if len(self.m_lcdMode[mode]) <= 0: @@ -370,7 +370,7 @@ def LoadMode(self, node, mode): return if len(node.findall("line")) <= 0: - log(xbmc.LOGWARNING, "Mode %d defined without lines, consider checking LCD.xml" % (mode)) + log(LOGWARNING, "Mode %d defined without lines, consider checking LCD.xml" % (mode)) if len(self.m_lcdMode[mode]) <= 0: self.m_lcdMode[mode].append(g_dictEmptyLineDescriptor) @@ -449,7 +449,7 @@ def Reset(self): self.m_lcdMode[i] = [] #clear list def Shutdown(self): - log(xbmc.LOGNOTICE, "Shutting down") + log(LOGNOTICE, "Shutting down") if settings_getDimOnShutdown(): self.SetBackLight(0) @@ -463,7 +463,7 @@ def StripBBCode(self, strtext): self.m_reBBCode = re.compile(regexbbcode) # catch+report failure if not self.m_reBBCode: - log(xbmc.LOGWARNING, "Precompilation of BBCode strip regex failed") + log(LOGWARNING, "Precompilation of BBCode strip regex failed") self.m_reBBCode = regexbbcode # loop to catch nested tags @@ -513,7 +513,7 @@ def Render(self, mode, bForce): try: line = srcline.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") except: - log(xbmc.LOGDEBUG, "Caught exception on charset conversion: " + srcline) + log(LOGDEBUG, "Caught exception on charset conversion: " + srcline) line = "---" else: line = srcline diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 6f94dc1..8bcea3b 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -84,7 +84,7 @@ def SendCommand(self, strCmd, bCheckRet): self.tnsocket.sendall(sendcmd) except: # Something bad happened, abort - log(xbmc.LOGERROR, "SendCommand: Telnet exception - send") + log(LOGERROR, "SendCommand: Telnet exception - send") return False # Update last socketaction timestamp @@ -99,7 +99,7 @@ def SendCommand(self, strCmd, bCheckRet): reply = self.tn.read_until("\n",3) except: # (Re)read failed, abort - log(xbmc.LOGERROR, "SendCommand: Telnet exception - reread") + log(LOGERROR, "SendCommand: Telnet exception - reread") return False # Skip these messages @@ -128,7 +128,7 @@ def SendCommand(self, strCmd, bCheckRet): # Leave information something undesired happened if ret is False: - log(xbmc.LOGWARNING, "Reply to '" + strCmd +"' was '" + reply) + log(LOGWARNING, "Reply to '" + strCmd +"' was '" + reply) return ret @@ -206,7 +206,7 @@ def Initialize(self): connected = True else: - log(xbmc.LOGERROR, "Connection successful but LCD.xml has errors, aborting connect") + log(LOGERROR, "Connection successful but LCD.xml has errors, aborting connect") if not connected: # preventively close socket @@ -215,10 +215,10 @@ def Initialize(self): # give up after INIT_RETRY_INTERVAL_MAX (60) seconds if self.m_initRetryInterval > INIT_RETRY_INTERVAL_MAX: self.m_used = False - log(xbmc.LOGERROR,"Connect failed. Giving up. Please fix any connection problems and restart the addon.") + log(LOGERROR,"Connect failed. Giving up. Please fix any connection problems and restart the addon.") else: self.m_initRetryInterval = self.m_initRetryInterval * 2 - log(xbmc.LOGERROR,"Connect failed. Retry in %d seconds." % self.m_initRetryInterval) + log(LOGERROR,"Connect failed. Retry in %d seconds." % self.m_initRetryInterval) return connected @@ -237,13 +237,13 @@ def DetermineExtraSupport(self): # When the LCDd driver doesn't supply a valid string, inform and return if reply == "": - log(xbmc.LOGNOTICE, "Empty driver information reply") + log(LOGNOTICE, "Empty driver information reply") return - log(xbmc.LOGNOTICE, "Driver information reply: " + reply) + log(LOGNOTICE, "Driver information reply: " + reply) if re.match(rematch_imon, reply): - log(xbmc.LOGNOTICE, "SoundGraph iMON LCD detected") + log(LOGNOTICE, "SoundGraph iMON LCD detected") if bUseExtraIcons: self.m_cExtraIcons = LCDproc_extra_imon() @@ -252,12 +252,12 @@ def DetermineExtraSupport(self): self.m_iBigDigits = 7 elif re.match(rematch_mdm166a, reply): - log(xbmc.LOGNOTICE, "Futaba/Targa USB mdm166a VFD detected") + log(LOGNOTICE, "Futaba/Targa USB mdm166a VFD detected") if bUseExtraIcons: self.m_cExtraIcons = LCDproc_extra_mdm166a() elif re.match(rematch_imonvfd, reply): - log(xbmc.LOGNOTICE, "SoundGraph iMON IR/VFD detected") + log(LOGNOTICE, "SoundGraph iMON IR/VFD detected") if self.m_cExtraIcons is not None: self.m_cExtraIcons.Initialize() @@ -271,7 +271,7 @@ def Connect(self): try: ip = settings_getHostIp() port = settings_getHostPort() - log(xbmc.LOGDEBUG,"Open " + str(ip) + ":" + str(port)) + log(LOGDEBUG,"Open " + str(ip) + ":" + str(port)) self.tn.open(ip, port) # Start a new session @@ -279,7 +279,7 @@ def Connect(self): # Receive LCDproc data to determine row and column information reply = self.tn.read_until("\n",3) - log(xbmc.LOGDEBUG,"Reply: " + reply) + log(LOGDEBUG,"Reply: " + reply) # parse reply by regex lcdinfo = re.match("^connect .+ protocol ([0-9\.]+) lcd wid (\d+) hgt (\d+) cellwid (\d+) cellhgt (\d+)$", reply) @@ -290,7 +290,7 @@ def Connect(self): # protocol version must currently be 0.3 if float(lcdinfo.group(1)) != 0.3: - log(xbmc.LOGERROR, "Only LCDproc protocol 0.3 supported (got " + lcdinfo.group(1) +")") + log(LOGERROR, "Only LCDproc protocol 0.3 supported (got " + lcdinfo.group(1) +")") return False # set up class vars @@ -300,7 +300,7 @@ def Connect(self): self.m_iCellHeight = int(lcdinfo.group(5)) # tell users what's going on - log(xbmc.LOGNOTICE, "Connected to LCDd at %s:%s, Protocol version %s - Geometry %sx%s characters (%sx%s pixels, %sx%s pixels per character)" % (str(ip), str(port), float(lcdinfo.group(1)), str(self.m_iColumns), str(self.m_iRows), str(self.m_iColumns * self.m_iCellWidth), str(self.m_iRows * self.m_iCellHeight), str(self.m_iCellWidth), str(self.m_iCellHeight))) + log(LOGNOTICE, "Connected to LCDd at %s:%s, Protocol version %s - Geometry %sx%s characters (%sx%s pixels, %sx%s pixels per character)" % (str(ip), str(port), float(lcdinfo.group(1)), str(self.m_iColumns), str(self.m_iRows), str(self.m_iColumns * self.m_iCellWidth), str(self.m_iRows * self.m_iCellHeight), str(self.m_iCellWidth), str(self.m_iCellHeight))) # Set up BigNum values based on display geometry if self.m_iColumns < 13: @@ -317,17 +317,17 @@ def Connect(self): self.DetermineExtraSupport() except: - log(xbmc.LOGERROR,"Connect: Caught exception, aborting.") + log(LOGERROR,"Connect: Caught exception, aborting.") return False # retrieve raw socket object self.tnsocket = self.tn.get_socket() if self.tnsocket is None: - log(xbmc.LOGERROR, "Retrieval of socket object failed!") + log(LOGERROR, "Retrieval of socket object failed!") return False if not self.SetupScreen(): - log(xbmc.LOGERROR, "Screen setup failed!") + log(LOGERROR, "Screen setup failed!") return False return True @@ -339,7 +339,7 @@ def CloseSocket(self): # if we served extra elements, (try to) reset them if self.m_cExtraIcons is not None: if not self.SendCommand(self.m_cExtraIcons.GetClearAllCmd(), True): - log(xbmc.LOGERROR, "CloseSocket(): Cannot clear extra icons") + log(LOGERROR, "CloseSocket(): Cannot clear extra icons") # do gracefully disconnect (send directly as we won't get any response on this) self.tn.write("bye\n") @@ -366,7 +366,7 @@ def IsConnected(self): return True if not self.SendCommand("noop", True): - log(xbmc.LOGERROR, "noop failed in IsConnected(), aborting!") + log(LOGERROR, "noop failed in IsConnected(), aborting!") return False return True @@ -374,7 +374,7 @@ def IsConnected(self): def SetBackLight(self, iLight): if not self.tnsocket: return - log(xbmc.LOGDEBUG, "Switch Backlight to: " + str(iLight)) + log(LOGDEBUG, "Switch Backlight to: " + str(iLight)) # Build command if iLight == 0: @@ -384,7 +384,7 @@ def SetBackLight(self, iLight): # Send to server if not self.SendCommand(cmd, True): - log(xbmc.LOGERROR, "SetBackLight(): Cannot change backlight state") + log(LOGERROR, "SetBackLight(): Cannot change backlight state") self.CloseSocket() def SetContrast(self, iContrast): @@ -404,7 +404,7 @@ def Suspend(self): # Send to server if not self.SendCommand(cmd, True): - log(xbmc.LOGERROR, "Suspend(): Cannot suspend") + log(LOGERROR, "Suspend(): Cannot suspend") self.CloseSocket() def Resume(self): @@ -416,7 +416,7 @@ def Resume(self): # Send to server if not self.SendCommand(cmd, True): - log(xbmc.LOGERROR, "Resume(): Cannot resume") + log(LOGERROR, "Resume(): Cannot resume") self.CloseSocket() def GetColumns(self): @@ -623,7 +623,7 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 1 %i %s\n" % (ln, ln, self.m_strIconName) def ClearDisplay(self): - log(xbmc.LOGDEBUG, "Clearing display contents") + log(LOGDEBUG, "Clearing display contents") # clear line buffer first self.FlushLines() From 9cb8df5f243d39480df7feff93ba103718a7cb99 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 6 Jun 2018 19:49:53 +0200 Subject: [PATCH 283/337] don't use print directly but rather use log(LOGDEBUG...) It is not only discouraged to do so in a Kodi addon, but also we don't have to deal with print at all when going for Py3 compat. --- resources/lib/settings.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/lib/settings.py b/resources/lib/settings.py index b1caf28..6a744c0 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -219,7 +219,7 @@ def settings_handleCriticalSettings(): #or if network access is enabled and ip or port have changed if g_hostip != hostip or g_hostport != hostport or g_heartbeat != heartbeat: if g_hostip != hostip: - print "lcd: changed hostip to " + str(hostip) + log(LOGDEBUG, "settings: changed hostip to " + str(hostip)) g_hostip = hostip reconnect = True @@ -227,16 +227,16 @@ def settings_handleCriticalSettings(): # make sure valid port number was given if hostport > 0 and hostport < 65536: - print "lcd: changed hostport to " + str(hostport) + log(LOGDEBUG, "settings: changed hostport to " + str(hostport)) g_hostport = hostport reconnect = True else: - print "lcd: invalid hostport value " + str(hostport) + ", resetting to old value " + str(g_hostport) + log(LOGDEBUG, "settings: invalid hostport value " + str(hostport) + ", resetting to old value " + str(g_hostport)) KODI_ADDON_SETTINGS.setSetting("hostport", str(g_hostport)) if g_heartbeat != heartbeat: - print "lcd: toggled heartbeat bool" + log(LOGDEBUG, "settings: toggled heartbeat bool") g_heartbeat = heartbeat reconnect = True From 1ab8ceea22a08065ab78b58d0f9ecba5da300161 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 6 Jun 2018 19:53:54 +0200 Subject: [PATCH 284/337] use xbmc.Monitor().abortRequested() instead of xbmc.abortRequested Deprecated and discouraged as well. Instanciate as g_xbmcMonitor global. --- main.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index feff718..5056fcc 100644 --- a/main.py +++ b/main.py @@ -39,13 +39,19 @@ global g_initialConnectAttempt global g_lcdproc +global g_xbmcMonitor + def initGlobals(): global g_failedConnectionNotified global g_initialConnectAttempt global g_lcdproc + global g_xbmcMonitor g_failedConnectionNotified = False g_initialConnectAttempt = True + + g_xbmcMonitor = xbmc.Monitor() + settings_initGlobals() g_lcdproc = LCDProc() @@ -98,8 +104,9 @@ def getLcdMode(): return ret def process_lcd(): + global g_xbmcMonitor - while not xbmc.abortRequested: + while not g_xbmcMonitor.abortRequested(): if handleConnectLCD(): settingsChanged = settings_didSettingsChange() @@ -113,10 +120,12 @@ def process_lcd(): g_lcdproc.Shutdown() def handleConnectLCD(): + global g_xbmcMonitor + ret = True # make sure not to block things when shutdown is requested - if not xbmc.abortRequested: + if not g_xbmcMonitor.abortRequested(): #check for new settings if settings_checkForNewSettings() or not g_lcdproc.IsConnected(): #networksettings changed? g_failedConnectionNotified = False #reset notification flag @@ -136,7 +145,7 @@ def main(): # initialise and load GUI settings settings_setup() - # do LCD processing loop (needs to catch xbmc.abortRequested !) + # do LCD processing loop (needs to catch xbmc.Monitor().abortRequested() !) process_lcd() ###### From 335bcb6ba510d8ce5c085735379894250a603abb Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 6 Jun 2018 20:01:54 +0200 Subject: [PATCH 285/337] use xbmcgui.Dialog() instead of executebuiltin to display the warning popups --- main.py | 5 +++-- resources/lib/lcdbase.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 5056fcc..2a7d04d 100644 --- a/main.py +++ b/main.py @@ -29,6 +29,7 @@ # Kodi imports import xbmc import xbmcaddon +import xbmcgui from resources.lib.common import * from resources.lib.settings import * @@ -67,11 +68,11 @@ def HandleConnectionNotification(bConnectSuccess): g_failedConnectionNotified = True g_initialConnectAttempt = False text = KODI_ADDON_SETTINGS.getLocalizedString(32500) - xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 10, KODI_ADDON_ICON)) + xbmcgui.Dialog().notification(KODI_ADDON_NAME, text, KODI_ADDON_ICON) else: text = KODI_ADDON_SETTINGS.getLocalizedString(32501) if not g_initialConnectAttempt: - xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 10, KODI_ADDON_ICON)) + xbmcgui.Dialog().notification(KODI_ADDON_NAME, text, KODI_ADDON_ICON) g_failedConnectionNotified = True # returns mode identifier based on currently playing media/active navigation diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index fd2b8a0..9b9457c 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -22,7 +22,6 @@ ''' import platform -import xbmc import sys import os import shutil @@ -33,6 +32,9 @@ from xml.etree import ElementTree as xmltree from array import array +import xbmc +import xbmcgui + from common import * from settings import * from extraicons import * @@ -238,7 +240,7 @@ def LoadSkin(self, xmlFile, doReset): if not self.m_bXMLWarningDisplayed: self.m_bXMLWarningDisplayed = True text = KODI_ADDON_SETTINGS.getLocalizedString(32502) - xbmc.executebuiltin("XBMC.Notification(%s,%s,%s,%s)" % (KODI_ADDON_NAME, text, 5000, KODI_ADDON_ICON)) + xbmcgui.Dialog().notification(KODI_ADDON_NAME, text, KODI_ADDON_ICON) log(LOGERROR, "Parsing of %s failed" % (xmlFile)) return False From 36775bc5a44d98eea320db960a84ce5665219a36 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 6 Jun 2018 20:15:45 +0200 Subject: [PATCH 286/337] syntax: make the ValueError exception catching py2/3 aware --- resources/lib/lcdbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 9b9457c..f575a37 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -279,7 +279,7 @@ def LoadSkin(self, xmlFile, doReset): if icontextoffset != None and icontextoffset.text != None: try: intoffset = int(icontextoffset.text) - except ValueError, TypeError: + except ValueError as TypeError: log(LOGERROR, "Value for icontextoffset must be integer (got: %s)" % (icontextoffset.text)) else: if intoffset <= 0 or intoffset >= self.GetColumns(): From 2430b042487238a905e16564b56c0b907042edc4 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 6 Jun 2018 21:31:16 +0200 Subject: [PATCH 287/337] cleanup imports All files carry quite some imports which simply aren't needed anymore as nothing from them is directly used, so clean this up. --- main.py | 3 --- resources/lib/charset_map_hd44780_a02.py | 2 -- resources/lib/common.py | 1 - resources/lib/extraicons.py | 2 -- resources/lib/infolabels.py | 5 ----- resources/lib/lcdbase.py | 5 +---- resources/lib/lcdproc.py | 6 ++---- resources/lib/lcdproc_extra_base.py | 2 -- resources/lib/lcdproc_extra_imon.py | 4 ---- resources/lib/lcdproc_extra_mdm166a.py | 5 ----- resources/lib/settings.py | 3 --- 11 files changed, 3 insertions(+), 35 deletions(-) diff --git a/main.py b/main.py index 2a7d04d..2612e9c 100644 --- a/main.py +++ b/main.py @@ -23,12 +23,9 @@ # base imports import time -import os -import sys # Kodi imports import xbmc -import xbmcaddon import xbmcgui from resources.lib.common import * diff --git a/resources/lib/charset_map_hd44780_a02.py b/resources/lib/charset_map_hd44780_a02.py index f32874e..92460f4 100644 --- a/resources/lib/charset_map_hd44780_a02.py +++ b/resources/lib/charset_map_hd44780_a02.py @@ -20,8 +20,6 @@ along with this program. If not, see . ''' -import codecs - encmap_hd44780_a02 = { 0x0000: 0x0000, # NULL # 0x0001: 0x0001, # START OF HEADING diff --git a/resources/lib/common.py b/resources/lib/common.py index 3776d22..67c1c7e 100644 --- a/resources/lib/common.py +++ b/resources/lib/common.py @@ -25,7 +25,6 @@ ''' import os -import sys import xbmc import xbmcaddon diff --git a/resources/lib/extraicons.py b/resources/lib/extraicons.py index efc78b8..538efff 100644 --- a/resources/lib/extraicons.py +++ b/resources/lib/extraicons.py @@ -23,8 +23,6 @@ along with this program. If not, see . ''' -from common import * - LCD_EXTRABARS_MAX = 4 class LCD_EXTRAICONS: diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 139137f..4046872 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -23,13 +23,10 @@ along with this program. If not, see . ''' -import os import string -import sys import time import xbmc -import xbmcaddon import xbmcgui from settings import * @@ -202,8 +199,6 @@ def InfoLabel_IsNavigationActive(): global g_InfoLabel_oldSubMenu global g_InfoLabel_navTimer - #from settings import settings_getNavTimeout - ret = False navtimeout = settings_getNavTimeout() diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index f575a37..de806d1 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -21,12 +21,9 @@ along with this program. If not, see . ''' -import platform -import sys import os -import shutil import re -import telnetlib +import shutil import time from xml.etree import ElementTree as xmltree diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 8bcea3b..724a832 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -21,14 +21,12 @@ along with this program. If not, see . ''' -import platform -import xbmc -import sys -import os import re import telnetlib import time +import xbmc + from socket import * from settings import * diff --git a/resources/lib/lcdproc_extra_base.py b/resources/lib/lcdproc_extra_base.py index 5f52bb6..31c6fac 100644 --- a/resources/lib/lcdproc_extra_base.py +++ b/resources/lib/lcdproc_extra_base.py @@ -23,8 +23,6 @@ along with this program. If not, see . ''' -import sys - class LCDproc_extra_base(): def __init__(self): pass diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index 99b5091..33a5f6d 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -24,12 +24,8 @@ along with this program. If not, see . ''' -import xbmc -import sys import time -from lcdproc import * -from lcdbase import LCD_EXTRAICONS from extraicons import * from lcdproc_extra_base import * diff --git a/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py index 6f80dae..f0c98c5 100644 --- a/resources/lib/lcdproc_extra_mdm166a.py +++ b/resources/lib/lcdproc_extra_mdm166a.py @@ -24,11 +24,6 @@ along with this program. If not, see . ''' -import xbmc -import sys - -from lcdproc import * -from lcdbase import LCD_EXTRAICONS from extraicons import * from lcdproc_extra_base import * diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 6a744c0..3e4f0e5 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -22,11 +22,8 @@ ''' import string -import sys import time -import xbmc - from common import * #general From 25a7d57fd3e93e6246685b63a1bf87a0edcc6340 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 9 Jun 2018 20:05:27 +0200 Subject: [PATCH 288/337] python3: use absolute imports This was already recommended in python2.7 and is required since python3. --- resources/lib/charset_hd44780.py | 4 ++-- resources/lib/infolabels.py | 2 +- resources/lib/lcdbase.py | 10 +++++----- resources/lib/lcdproc.py | 10 +++++----- resources/lib/lcdproc_extra_imon.py | 4 ++-- resources/lib/lcdproc_extra_mdm166a.py | 4 ++-- resources/lib/settings.py | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/resources/lib/charset_hd44780.py b/resources/lib/charset_hd44780.py index b511bcf..98c1aea 100644 --- a/resources/lib/charset_hd44780.py +++ b/resources/lib/charset_hd44780.py @@ -21,8 +21,8 @@ ''' import codecs -from charset_map_hd44780_a00 import * -from charset_map_hd44780_a02 import * +from .charset_map_hd44780_a00 import * +from .charset_map_hd44780_a02 import * class HD44780_Codec(codecs.Codec): diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 4046872..03e7521 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -29,7 +29,7 @@ import xbmc import xbmcgui -from settings import * +from .settings import * # interesting XBMC GUI Window IDs (no defines seem to exist for this) class WINDOW_IDS: diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index de806d1..db3b68f 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -32,11 +32,11 @@ import xbmc import xbmcgui -from common import * -from settings import * -from extraicons import * -from infolabels import * -from charset_hd44780 import * +from .common import * +from .settings import * +from .extraicons import * +from .infolabels import * +from .charset_hd44780 import * __lcdxml__ = xbmc.translatePath(os.path.join("special://masterprofile", "LCD.xml")) __lcddefaultxml__ = xbmc.translatePath(os.path.join(KODI_ADDON_ROOTPATH, "resources", "LCD.xml.defaults")) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 724a832..f84fbf4 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -29,13 +29,13 @@ from socket import * -from settings import * -from lcdbase import * +from .settings import * +from .lcdbase import * -from lcdproc_extra_imon import * -from lcdproc_extra_mdm166a import * +from .lcdproc_extra_imon import * +from .lcdproc_extra_mdm166a import * -from infolabels import * +from .infolabels import * MAX_ROWS = 20 MAX_BIGDIGITS = 20 diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index 33a5f6d..0326e30 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -26,8 +26,8 @@ import time -from extraicons import * -from lcdproc_extra_base import * +from .extraicons import * +from .lcdproc_extra_base import * IMON_OUTPUT_INTERVAL = 0.2 # seconds diff --git a/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py index f0c98c5..4edf122 100644 --- a/resources/lib/lcdproc_extra_mdm166a.py +++ b/resources/lib/lcdproc_extra_mdm166a.py @@ -24,8 +24,8 @@ along with this program. If not, see . ''' -from extraicons import * -from lcdproc_extra_base import * +from .extraicons import * +from .lcdproc_extra_base import * # extra icon bitmasks class MDM166A_ICONS: diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 3e4f0e5..a6a3ac6 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -24,7 +24,7 @@ import string import time -from common import * +from .common import * #general global g_hostip From 629689ca7db4ac5627adab5e71d7368e895d3ba7 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 9 Jun 2018 20:07:39 +0200 Subject: [PATCH 289/337] python3: don't use obsolete methods from the string library Using ie. string.replace() was already deprecated in py2.7 and was finally removed from python3. Use the .replace() and .count() methods on strings where needed instead. Since string isn't used anymore at all by now, clean up the imports accordingly. --- resources/lib/infolabels.py | 3 +-- resources/lib/lcdproc.py | 2 +- resources/lib/settings.py | 9 ++++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 03e7521..bc0d057 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -23,7 +23,6 @@ along with this program. If not, see . ''' -import string import time import xbmc @@ -168,7 +167,7 @@ def InfoLabel_IsMuted(): return InfoLabel_GetBool("Player.Muted") def InfoLabel_GetVolumePercent(): - volumedb = float(string.replace(string.replace(InfoLabel_GetInfoLabel("Player.Volume"), ",", "."), " dB", "")) + volumedb = float(InfoLabel_GetInfoLabel("Player.Volume").replace(",", ".").replace(" dB", "")) return (100 * (60.0 + volumedb) / 60) def InfoLabel_GetPlayerTimeSecs(): diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index f84fbf4..736af68 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -67,7 +67,7 @@ def __init__(self): LcdBase.__init__(self) def SendCommand(self, strCmd, bCheckRet): - countcmds = string.count(strCmd, '\n') + countcmds = strCmd.count('\n') sendcmd = strCmd ret = True diff --git a/resources/lib/settings.py b/resources/lib/settings.py index a6a3ac6..04829a4 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -21,7 +21,6 @@ along with this program. If not, see . ''' -import string import time from .common import * @@ -263,15 +262,15 @@ def settings_handleLcdSettings(): g_settingsChanged = False - scrolldelay = int(float(string.replace(KODI_ADDON_SETTINGS.getSetting("scrolldelay"), ",", "."))) + scrolldelay = int(float(KODI_ADDON_SETTINGS.getSetting("scrolldelay").replace(",", "."))) scrollmode = KODI_ADDON_SETTINGS.getSetting("scrollmode") dimonscreensaver = KODI_ADDON_SETTINGS.getSetting("dimonscreensaver") == "true" dimonshutdown = KODI_ADDON_SETTINGS.getSetting("dimonshutdown") == "true" dimonvideoplayback = KODI_ADDON_SETTINGS.getSetting("dimonvideoplayback") == "true" dimonmusicplayback = KODI_ADDON_SETTINGS.getSetting("dimonmusicplayback") == "true" - dimdelay = int(float(string.replace(KODI_ADDON_SETTINGS.getSetting("dimdelay"), ",", "."))) - navtimeout = int(float(string.replace(KODI_ADDON_SETTINGS.getSetting("navtimeout"), ",", "."))) - refreshrate = int(float(string.replace(KODI_ADDON_SETTINGS.getSetting("refreshrate"), ",", "."))) + dimdelay = int(float(KODI_ADDON_SETTINGS.getSetting("dimdelay").replace(",", "."))) + navtimeout = int(float(KODI_ADDON_SETTINGS.getSetting("navtimeout").replace(",", "."))) + refreshrate = int(float(KODI_ADDON_SETTINGS.getSetting("refreshrate").replace(",", "."))) hideconnpopups = KODI_ADDON_SETTINGS.getSetting("hideconnpopups") == "true" usealternatecharset = KODI_ADDON_SETTINGS.getSetting("usealternatecharset") == "true" charset = KODI_ADDON_SETTINGS.getSetting("charset") From d9f1c01b20642bdfd152e59487df16afb965df17 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 10 Jun 2018 11:19:42 +0200 Subject: [PATCH 290/337] python3: fix up byte/unicode string handling Currently, the whole code abuses the allowed mixing of bytestrings and unicode strings, in that strings are converted from one format into the other more or less randomly. This is not only something that should be avoided, but also py3 doesn't allow this anymore. Fix this by handling all strings (starting from the XML config parser) as "normal" unicode strings, and only convert them *once* to the format LCDproc requires, depending on it's config, and handle all LCDd communication commands as byte strings. With that, prefix all string vars that are supposed to hold byte strings only with the letter b to have a clear indicator on being bytestrings when using the vars. Also avoid string concatenation for inserting digits and use format specifiers instead. And, make some strings that are only used for setting up things via LCDd like the icon identifiers bytestrings so no conversion has to be applied to them. While at it, don't explicitly use a str object in LcdProc.DetermineExtraSupport() when parsing the "info" response. --- resources/lib/lcdbase.py | 6 +- resources/lib/lcdproc.py | 128 ++++++++++++------------- resources/lib/lcdproc_extra_imon.py | 14 +-- resources/lib/lcdproc_extra_mdm166a.py | 6 +- 4 files changed, 77 insertions(+), 77 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index db3b68f..30253fd 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -390,7 +390,7 @@ def LoadMode(self, node, mode): linetext = "" else: # prepare text line for XBMC's expected encoding - linetext = line.text.strip().encode(self.m_strInfoLabelEncoding, "ignore") + linetext = line.text.strip() # make sure linetext has something so re.match won't fail if linetext != "": @@ -510,7 +510,7 @@ def Render(self, mode, bForce): if self.m_strInfoLabelEncoding != self.m_strLCDEncoding: try: - line = srcline.decode(self.m_strInfoLabelEncoding).encode(self.m_strLCDEncoding, "replace") + line = srcline except: log(LOGDEBUG, "Caught exception on charset conversion: " + srcline) line = "---" @@ -533,7 +533,7 @@ def Render(self, mode, bForce): if self.m_cExtraIcons is not None: self.SetExtraInformation() - self.m_strSetLineCmds += self.m_cExtraIcons.GetOutputCommands() + self.m_bstrSetLineCmds += self.m_cExtraIcons.GetOutputCommands() self.FlushLines() diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 736af68..4e3b8c4 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -54,27 +54,27 @@ def __init__(self): self.m_timeSocketIdleTimeout = 2 self.m_strLineText = [None]*MAX_ROWS self.m_strLineType = [None]*MAX_ROWS - self.m_strLineIcon = [None]*MAX_ROWS + self.m_bstrLineIcon = [None]*MAX_ROWS self.m_strDigits = [None]*MAX_BIGDIGITS self.m_iProgressBarWidth = 0 self.m_iProgressBarLine = -1 - self.m_strIconName = "BLOCK_FILLED" + self.m_bstrIconName = b"BLOCK_FILLED" self.m_iBigDigits = int(8) # 12:45:78 / colons count as digit self.m_iOffset = 1 - self.m_strSetLineCmds = "" + self.m_bstrSetLineCmds = b"" self.m_cExtraIcons = None LcdBase.__init__(self) def SendCommand(self, strCmd, bCheckRet): - countcmds = strCmd.count('\n') + countcmds = strCmd.count(b'\n') sendcmd = strCmd ret = True # Single command without lf if countcmds < 1: countcmds = 1 - sendcmd += "\n" + sendcmd += b"\n" try: # Send to server via raw socket to prevent telnetlib tampering with @@ -94,20 +94,20 @@ def SendCommand(self, strCmd, bCheckRet): while True: try: # Read server reply - reply = self.tn.read_until("\n",3) + reply = self.tn.read_until(b"\n",3) except: # (Re)read failed, abort log(LOGERROR, "SendCommand: Telnet exception - reread") return False # Skip these messages - if reply[:6] == 'listen': + if reply[:6] == b'listen': continue - elif reply[:6] == 'ignore': + elif reply[:6] == b'ignore': continue - elif reply[:3] == 'key': + elif reply[:3] == b'key': continue - elif reply[:9] == 'menuevent': + elif reply[:9] == b'menuevent': continue # Response seems interesting, so stop here @@ -116,47 +116,47 @@ def SendCommand(self, strCmd, bCheckRet): if not bCheckRet: continue # no return checking desired, so be fine - if strCmd == 'noop' and reply == 'noop complete\n': + if strCmd == b'noop' and reply == b'noop complete\n': continue # noop has special reply - if reply == 'success\n': + if reply == b'success\n': continue ret = False # Leave information something undesired happened if ret is False: - log(LOGWARNING, "Reply to '" + strCmd +"' was '" + reply) + log(LOGWARNING, "Reply to '%s' was '%s'" % (strCmd.decode(self.m_strLCDEncoding), reply.decode(self.m_strLCDEncoding))) return ret def SetupScreen(self): # Add screen first - if not self.SendCommand("screen_add xbmc", True): + if not self.SendCommand(b"screen_add xbmc", True): return False # Set screen priority - if not self.SendCommand("screen_set xbmc -priority info", True): + if not self.SendCommand(b"screen_set xbmc -priority info", True): return False # Turn off heartbeat if desired if not settings_getHeartBeat(): - if not self.SendCommand("screen_set xbmc -heartbeat off", True): + if not self.SendCommand(b"screen_set xbmc -heartbeat off", True): return False # Initialize command list var - strInitCommandList = "" + strInitCommandList = b"" # Setup widgets (scrollers and hbars first) for i in range(1,int(self.m_iRows)+1): # Text widgets - strInitCommandList += "widget_add xbmc lineScroller" + str(i) + " scroller\n" + strInitCommandList += b"widget_add xbmc lineScroller%i scroller\n" % (i) # Progress bars - strInitCommandList += "widget_add xbmc lineProgress" + str(i) + " hbar\n" + strInitCommandList += b"widget_add xbmc lineProgress%i hbar\n" % (i) # Reset bars to zero - strInitCommandList += "widget_set xbmc lineProgress" + str(i) + " 0 0 0\n" + strInitCommandList += b"widget_set xbmc lineProgress%i 0 0 0\n" % (i) self.m_strLineText[i-1] = "" self.m_strLineType[i-1] = "" @@ -164,21 +164,21 @@ def SetupScreen(self): # Setup icons last for i in range(1,int(self.m_iRows)+1): # Icons - strInitCommandList += "widget_add xbmc lineIcon" + str(i) + " icon\n" + strInitCommandList += b"widget_add xbmc lineIcon%i icon\n" % (i) # Default icon - strInitCommandList += "widget_set xbmc lineIcon" + str(i) + " 0 0 BLOCK_FILLED\n" + strInitCommandList += b"widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (i) - self.m_strLineIcon[i-1] = "" + self.m_bstrLineIcon[i-1] = b"" for i in range(1,int(self.m_iBigDigits + 1)): # Big Digit - strInitCommandList += "widget_add xbmc lineBigDigit" + str(i) + " num\n" + strInitCommandList += b"widget_add xbmc lineBigDigit%i num\n" % (i) # Set Digit - strInitCommandList += "widget_set xbmc lineBigDigit" + str(i) + " 0 0\n" + strInitCommandList += b"widget_set xbmc lineBigDigit%i 0 0\n" % (i) - self.m_strDigits[i] = "" + self.m_strDigits[i] = b"" if not self.SendCommand(strInitCommandList, True): return False @@ -230,8 +230,8 @@ def DetermineExtraSupport(self): # Never cause script failure/interruption by this! This is totally optional! try: # Retrieve driver name for additional functionality - self.tn.write("info\n") - reply = str(self.tn.read_until("\n",3)).strip() + self.tn.write(b"info\n") + reply = self.tn.read_until(b"\n",3).strip().decode("ascii") # When the LCDd driver doesn't supply a valid string, inform and return if reply == "": @@ -273,10 +273,10 @@ def Connect(self): self.tn.open(ip, port) # Start a new session - self.tn.write("hello\n") + self.tn.write(b"hello\n") # Receive LCDproc data to determine row and column information - reply = self.tn.read_until("\n",3) + reply = self.tn.read_until(b"\n",3).decode("ascii") log(LOGDEBUG,"Reply: " + reply) # parse reply by regex @@ -340,7 +340,7 @@ def CloseSocket(self): log(LOGERROR, "CloseSocket(): Cannot clear extra icons") # do gracefully disconnect (send directly as we won't get any response on this) - self.tn.write("bye\n") + self.tn.write(b"bye\n") # and close socket afterwards self.tn.close() except: @@ -363,7 +363,7 @@ def IsConnected(self): if (self.m_timeLastSockAction + self.m_timeSocketIdleTimeout) > time.time(): return True - if not self.SendCommand("noop", True): + if not self.SendCommand(b"noop", True): log(LOGERROR, "noop failed in IsConnected(), aborting!") return False @@ -376,9 +376,9 @@ def SetBackLight(self, iLight): # Build command if iLight == 0: - cmd = "screen_set xbmc -backlight off\n" + cmd = b"screen_set xbmc -backlight off\n" elif iLight > 0: - cmd = "screen_set xbmc -backlight on\n" + cmd = b"screen_set xbmc -backlight on\n" # Send to server if not self.SendCommand(cmd, True): @@ -398,7 +398,7 @@ def Suspend(self): return # Build command to suspend screen - cmd = "screen_set xbmc -priority hidden\n" + cmd = b"screen_set xbmc -priority hidden\n" # Send to server if not self.SendCommand(cmd, True): @@ -410,7 +410,7 @@ def Resume(self): return # Build command to resume screen - cmd = "screen_set xbmc -priority info\n" + cmd = b"screen_set xbmc -priority info\n" # Send to server if not self.SendCommand(cmd, True): @@ -467,11 +467,11 @@ def SetBigDigits(self, strTimeString, bForceUpdate): self.m_strDigits[iDigitCount] = strTimeString[i] if strTimeString[i] == ":": - self.m_strSetLineCmds += "widget_set xbmc lineBigDigit%i %i 10\n" % (iDigitCount, iOffset) + self.m_bstrSetLineCmds += b"widget_set xbmc lineBigDigit%i %i 10\n" % (iDigitCount, iOffset) elif strTimeString[i].isdigit(): - self.m_strSetLineCmds += "widget_set xbmc lineBigDigit%i %i %s\n" % (iDigitCount, iOffset, strTimeString[i]) + self.m_bstrSetLineCmds += b"widget_set xbmc lineBigDigit%i %i %s\n" % (iDigitCount, iOffset, strTimeString[i].encode(self.m_strLCDEncoding)) else: - self.m_strSetLineCmds += "widget_set xbmc lineBigDigit" + str(iDigitCount) + " 0 0\n" + self.m_bstrSetLineCmds += b"widget_set xbmc lineBigDigit%i 0 0\n" % (iDigitCount) if strTimeString[i] == ":": iOffset += 1 @@ -483,7 +483,7 @@ def SetBigDigits(self, strTimeString, bForceUpdate): while iDigitCount <= self.m_iBigDigits: if self.m_strDigits[iDigitCount] != "" or bForceUpdate: self.m_strDigits[iDigitCount] = "" - self.m_strSetLineCmds += "widget_set xbmc lineBigDigit" + str(iDigitCount) + " 0 0\n" + self.m_bstrSetLineCmds += b"widget_set xbmc lineBigDigit%i 0 0\n" % (iDigitCount) iDigitCount += 1 @@ -497,16 +497,16 @@ def SetPlayingStateIcon(self): bForwarding = InfoLabel_IsPlayerForwarding() bRewinding = InfoLabel_IsPlayerRewinding() - self.m_strIconName = "STOP" + self.m_bstrIconName = b"STOP" if bForwarding: - self.m_strIconName = "FF" + self.m_bstrIconName = b"FF" elif bRewinding: - self.m_strIconName = "FR" + self.m_bstrIconName = b"FR" elif bPaused: - self.m_strIconName = "PAUSE" + self.m_bstrIconName = b"PAUSE" elif bPlaying: - self.m_strIconName = "PLAY" + self.m_bstrIconName = b"PLAY" def GetRows(self): return int(self.m_iRows) @@ -515,7 +515,7 @@ def ClearBigDigits(self, fullredraw = True): for i in range(1,int(self.m_iBigDigits + 1)): # Clear Digit if fullredraw: - self.m_strSetLineCmds += "widget_set xbmc lineBigDigit" + str(i) + " 0 0\n" + self.m_bstrSetLineCmds += b"widget_set xbmc lineBigDigit%i 0 0\n" % (i) self.m_strDigits[i] = "" # on full redraw, make sure all widget get redrawn by resetting their type @@ -523,12 +523,12 @@ def ClearBigDigits(self, fullredraw = True): for i in range(0, int(self.GetRows())): self.m_strLineType[i] = "" self.m_strLineText[i] = "" - self.m_strLineIcon[i] = "" + self.m_bstrLineIcon[i] = b"" def ClearLine(self, iLine): - self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (iLine) - self.m_strSetLineCmds += "widget_set xbmc lineProgress%i 0 0 0\n" % (iLine) - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"\"\n" % (iLine, iLine, self.m_iColumns, iLine) + self.m_bstrSetLineCmds += b"widget_set xbmc lineIcon%i 0 0 BLOCK_FILLED\n" % (iLine) + self.m_bstrSetLineCmds += b"widget_set xbmc lineProgress%i 0 0 0\n" % (iLine) + self.m_bstrSetLineCmds += b"widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"\"\n" % (iLine, iLine, self.m_iColumns, iLine) def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): if self.m_bStop or not self.tnsocket: @@ -556,10 +556,10 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): bExtraForce = True if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS and dictDescriptor['text'] != "": - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text']) + self.m_bstrSetLineCmds += b"widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text'].encode(self.m_strLCDEncoding)) if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESSTIME and dictDescriptor['text'] != "": - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text']) + self.m_bstrSetLineCmds += b"widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"%s\"\n" % (ln, ln, self.m_iColumns, ln, dictDescriptor['text'].encode(self.m_strLCDEncoding)) if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_BIGSCREEN: strLineLong = self.GetBigDigitTime(mode) @@ -572,11 +572,11 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): iMaxLineLen = dictDescriptor['endx'] - (int(dictDescriptor['startx']) - 1) iScrollSpeed = settings_getScrollDelay() - strScrollMode = settings_getLCDprocScrollMode() + bstrScrollMode = settings_getLCDprocScrollMode().encode(self.m_strLCDEncoding) if len(strLineLong) > iMaxLineLen: # if the string doesn't fit the display... - if iScrollSpeed != 0: # add separator when scrolling enabled - if strScrollMode == "m": # and scrollmode is marquee + if iScrollSpeed != 0: # add separator when scrolling enabled + if bstrScrollMode == b"m": # and scrollmode is marquee strLineLong += self.m_strScrollSeparator else: # or cut off strLineLong = strLineLong[:iMaxLineLen] @@ -591,13 +591,13 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): self.SetBigDigits(strLineLong, bExtraForce) # progressbar line elif dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS: - self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, iStartX, ln, self.m_iProgressBarWidth) + self.m_bstrSetLineCmds += b"widget_set xbmc lineProgress%i %i %i %i\n" % (ln, iStartX, ln, self.m_iProgressBarWidth) # progressbar line with time elif dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESSTIME: drawLineText = True pLenFract = float(self.m_iColumns - int(len(plDuration) + len(plTime))) / self.m_iColumns pTimeLen = int(self.m_iProgressBarWidth * pLenFract) - self.m_strSetLineCmds += "widget_set xbmc lineProgress%i %i %i %i\n" % (ln, iStartX + len(plTime), ln, pTimeLen) + self.m_bstrSetLineCmds += b"widget_set xbmc lineProgress%i %i %i %i\n" % (ln, iStartX + len(plTime), ln, pTimeLen) # everything else (text, icontext) else: drawLineText = True @@ -609,16 +609,16 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): iStartX += int(iSpaces / 2) if drawLineText: - self.m_strSetLineCmds += "widget_set xbmc lineScroller%i %i %i %i %i %s %i \"%s\"\n" % (ln, iStartX, ln, self.m_iColumns, ln, strScrollMode, iScrollSpeed, re.escape(strLineLong)) + self.m_bstrSetLineCmds += b"widget_set xbmc lineScroller%i %i %i %i %i %s %i \"%s\"\n" % (ln, iStartX, ln, self.m_iColumns, ln, bstrScrollMode, iScrollSpeed, re.escape(strLineLong.encode(self.m_strLCDEncoding, errors="replace"))) # cache contents self.m_strLineText[iLine] = strLineLong if dictDescriptor['type'] == LCD_LINETYPE.LCD_LINETYPE_ICONTEXT: - if self.m_strLineIcon[iLine] != self.m_strIconName or bExtraForce: - self.m_strLineIcon[iLine] = self.m_strIconName + if self.m_bstrLineIcon[iLine] != self.m_bstrIconName or bExtraForce: + self.m_bstrLineIcon[iLine] = self.m_bstrIconName - self.m_strSetLineCmds += "widget_set xbmc lineIcon%i 1 %i %s\n" % (ln, ln, self.m_strIconName) + self.m_bstrSetLineCmds += b"widget_set xbmc lineIcon%i 1 %i %s\n" % (ln, ln, self.m_bstrIconName) def ClearDisplay(self): log(LOGDEBUG, "Clearing display contents") @@ -637,8 +637,8 @@ def ClearDisplay(self): self.FlushLines() def FlushLines(self): - if len(self.m_strSetLineCmds) > 0: + if len(self.m_bstrSetLineCmds) > 0: # Send complete command package - self.SendCommand(self.m_strSetLineCmds, False) + self.SendCommand(self.m_bstrSetLineCmds, False) - self.m_strSetLineCmds = "" + self.m_bstrSetLineCmds = b"" diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index 0326e30..9db23ba 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -141,33 +141,33 @@ def Initialize(self): self.SetBar(i, float(0)) def SetOutputIcons(self): - ret = "" + ret = b"" # Make sure we don't send "0" to LCDproc, this would reset bars self.m_iOutputValueIcons |= IMON_ICONS.ICON_DUMMY if self.m_iOutputValueIcons != self.m_iOutputValueOldIcons: self.m_iOutputValueOldIcons = self.m_iOutputValueIcons - ret += "output %d\n" % (self.m_iOutputValueIcons) + ret += b"output %d\n" % (self.m_iOutputValueIcons) return ret def SetOutputBars(self): - ret = "" + ret = b"" if self.m_iOutputValueBars != self.m_iOutputValueOldBars: self.m_iOutputValueOldBars = self.m_iOutputValueBars - ret += "output %d\n" % (self.m_iOutputValueBars) + ret += b"output %d\n" % (self.m_iOutputValueBars) return ret def GetOutputCommands(self): - ret = "" + ret = b"" if self._DoOutputCommand(): ret += self.SetOutputIcons() - if ret == "": + if ret == b"": ret += self.SetOutputBars() return ret @@ -347,4 +347,4 @@ def GetClearAllCmd(self): self.m_iOutputValueIcons = 0 self.m_iOutputValueBars = 0 - return "output 0\n" + return b"output 0\n" diff --git a/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py index 4edf122..d370e62 100644 --- a/resources/lib/lcdproc_extra_mdm166a.py +++ b/resources/lib/lcdproc_extra_mdm166a.py @@ -88,11 +88,11 @@ def Initialize(self): self.SetBar(i, float(0)) def SetOutputIcons(self): - ret = "" + ret = b"" if self.m_iOutputValueIcons != self.m_iOutputValueOldIcons: self.m_iOutputValueOldIcons = self.m_iOutputValueIcons - ret += "output %d\n" % (self.m_iOutputValueIcons) + ret += b"output %d\n" % (self.m_iOutputValueIcons) return ret @@ -149,4 +149,4 @@ def GetClearAllCmd(self): self.m_iOutputValueOldIcons = 0 self.m_iOutputValueIcons = 0 - return "output 0\n" + return b"output 0\n" From bb797a9a1b704255eae3521e7c95274320db0331 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 10 Jun 2018 13:47:41 +0200 Subject: [PATCH 291/337] explicitly specify the used encoding in LCD.xml.defaults Might help the ElementTree parser by making the charset encoding less ambiguous. --- resources/LCD.xml.defaults | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/LCD.xml.defaults b/resources/LCD.xml.defaults index efe6757..411a5a9 100644 --- a/resources/LCD.xml.defaults +++ b/resources/LCD.xml.defaults @@ -1,3 +1,4 @@ + From b89902b1a649d4f4c49434bca081bb0bf1ab0e63 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 10 Jun 2018 16:34:32 +0200 Subject: [PATCH 292/337] py27-compat: enforce utf-8 string in InfoLabel_GetInfoLabel() Although being the default in python3, in python2 a string isn't necessarily encoded as utf-8. This is required though as everything else throughout the script assumes utf-8 encoded strings, up until any strings are going to hit LCDproc via it's telnet interface. Make sure a string with utf-8 charset is returned when running on py2, this fixes any decode errors in conjunction with retrieving strings from Kodi. (This isn't needed for py3, but rather acts as compat change for py2) --- resources/lib/infolabels.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index bc0d057..6b4e76d 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -23,6 +23,7 @@ along with this program. If not, see . ''' +import sys import time import xbmc @@ -62,7 +63,11 @@ def InfoLabel_Initialize(): g_InfoLabel_navTimer = time.time() def InfoLabel_GetInfoLabel(strLabel): - return xbmc.getInfoLabel(strLabel) + ret = xbmc.getInfoLabel(strLabel) + # pre-py3 compat + if sys.version_info.major < 3: + return ret.decode("utf-8") + return ret def InfoLabel_GetBool(strBool): return xbmc.getCondVisibility(strBool) From dcf249552bac3604ab09b772882a4b52a9b11bff Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 10 Jun 2018 18:12:41 +0200 Subject: [PATCH 293/337] remove unused m_strInfoLabelEncoding and the srcline intermediate var m_strInfoLabelEncoding was previously used to hold the charset encoding of any strings retrieved from Kodi. The superfluous conversion was removed and the returned string is a unicode string by now. So, remove this class member variable, and remove the srcline intermediate variable as well, which was used as a temp var for the conditional charset translation. --- resources/lib/lcdbase.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 30253fd..33d8749 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -87,7 +87,6 @@ def __init__(self): self.m_strScrollSeparator = " " # runtime vars/state tracking - self.m_strInfoLabelEncoding = "utf-8" # http://forum.xbmc.org/showthread.php?tid=125492&pid=1045926#pid1045926 self.m_timeDisableOnPlayTimer = time.time() self.m_bCurrentlyDimmed = False self.m_bHaveHD44780Charmap = False @@ -503,19 +502,10 @@ def Render(self, mode, bForce): if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_ICONTEXT: self.SetPlayingStateIcon() - srcline = InfoLabel_GetInfoLabel(self.m_lcdMode[mode][inLine]['text']) + line = InfoLabel_GetInfoLabel(self.m_lcdMode[mode][inLine]['text']) - if len(srcline) > 0: - srcline = self.StripBBCode(srcline) - - if self.m_strInfoLabelEncoding != self.m_strLCDEncoding: - try: - line = srcline - except: - log(LOGDEBUG, "Caught exception on charset conversion: " + srcline) - line = "---" - else: - line = srcline + if len(line) > 0: + line = self.StripBBCode(line) self.SetProgressBar(0, -1) From a971b056af3ae64df2c6e18776437c5307919ef0 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 13 Jun 2018 19:08:34 +0200 Subject: [PATCH 294/337] changelog/addon.xml: note changes and set version to 3.0.1 --- addon.xml | 12 ++++-------- changelog.txt | 3 +++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/addon.xml b/addon.xml index e9efda6..08cc29e 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -22,13 +22,9 @@ resources/icon.png - 3.0.0 (Leia) -- Compatibility with Kodi 18 Leia -- Polish translation by mskalski (thanks!) -- French translation by fengalin (thanks!) -- Strings finally migrated to strings.po format -- New progressbar+time linetype by Truong Ta (thanks!) -- Fixes, cleanups, cosmetics and optimizations all over the place + 3.0.1 +- Imports cleaned up +- Compatibility with Python 3 diff --git a/changelog.txt b/changelog.txt index 2f448f3..3b4f785 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +3.0.1 +- Imports cleaned up +- Compatibility with Python 3 3.0.0 (Leia) - Compatibility with Kodi 18 Leia - Polish translation by mskalski (thanks!) From 9b6177c3401d62c9c5b23e601e1ff4d6e4f280a8 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 24 Jun 2018 17:29:44 +0200 Subject: [PATCH 295/337] refactor main handler into class XBMCLCDproc() The main addon handling currently happens in the main addon entrypoint script (main.py) and even uses a few globals to keep track of object instances and other things. Refactor the whole logic into a new class XBMCLCDproc() in resources/lib/xbmclcdproc.py, this not only allows to store the globals as class members, but also fixes this Travis warning: WARN: Complex entry point. Check: main.py | Counted lines: xx | Lines allowed: 15 --- main.py | 131 ++------------------------------- resources/lib/xbmclcdproc.py | 137 +++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 125 deletions(-) create mode 100644 resources/lib/xbmclcdproc.py diff --git a/main.py b/main.py index 2612e9c..1b96edd 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,8 @@ ''' XBMC LCDproc addon + + Addon entry point + Copyright (C) 2012-2018 Team Kodi Copyright (C) 2012-2018 Daniel 'herrnst' Scheller @@ -21,132 +24,10 @@ along with this program. If not, see . ''' -# base imports -import time - -# Kodi imports -import xbmc -import xbmcgui - -from resources.lib.common import * -from resources.lib.settings import * -from resources.lib.lcdproc import * -from resources.lib.infolabels import * - -global g_failedConnectionNotified -global g_initialConnectAttempt -global g_lcdproc - -global g_xbmcMonitor - -def initGlobals(): - global g_failedConnectionNotified - global g_initialConnectAttempt - global g_lcdproc - global g_xbmcMonitor - - g_failedConnectionNotified = False - g_initialConnectAttempt = True - - g_xbmcMonitor = xbmc.Monitor() - - settings_initGlobals() - g_lcdproc = LCDProc() - - InfoLabel_Initialize() - -# handle dispay of connection notificaiton popups -def HandleConnectionNotification(bConnectSuccess): - global g_failedConnectionNotified - global g_initialConnectAttempt - - if not bConnectSuccess: - if not g_failedConnectionNotified: - g_failedConnectionNotified = True - g_initialConnectAttempt = False - text = KODI_ADDON_SETTINGS.getLocalizedString(32500) - xbmcgui.Dialog().notification(KODI_ADDON_NAME, text, KODI_ADDON_ICON) - else: - text = KODI_ADDON_SETTINGS.getLocalizedString(32501) - if not g_initialConnectAttempt: - xbmcgui.Dialog().notification(KODI_ADDON_NAME, text, KODI_ADDON_ICON) - g_failedConnectionNotified = True - -# returns mode identifier based on currently playing media/active navigation -def getLcdMode(): - ret = LCD_MODE.LCD_MODE_GENERAL - - navActive = InfoLabel_IsNavigationActive() - screenSaver = InfoLabel_IsScreenSaverActive() - playingVideo = InfoLabel_PlayingVideo() - playingTVShow = InfoLabel_PlayingTVShow() - playingMusic = InfoLabel_PlayingAudio() - playingPVRTV = InfoLabel_PlayingLiveTV() - playingPVRRadio = InfoLabel_PlayingLiveRadio() - - if navActive: - ret = LCD_MODE.LCD_MODE_NAVIGATION - elif screenSaver: - ret = LCD_MODE.LCD_MODE_SCREENSAVER - elif playingPVRTV: - ret = LCD_MODE.LCD_MODE_PVRTV - elif playingPVRRadio: - ret = LCD_MODE.LCD_MODE_PVRRADIO - elif playingTVShow: - ret = LCD_MODE.LCD_MODE_TVSHOW - elif playingVideo: - ret = LCD_MODE.LCD_MODE_VIDEO - elif playingMusic: - ret = LCD_MODE.LCD_MODE_MUSIC - - return ret - -def process_lcd(): - global g_xbmcMonitor - - while not g_xbmcMonitor.abortRequested(): - if handleConnectLCD(): - settingsChanged = settings_didSettingsChange() - - if settingsChanged: - g_lcdproc.UpdateGUISettings() - - g_lcdproc.Render(getLcdMode(), settingsChanged) - - time.sleep(1.0 / float(settings_getRefreshRate())) # refresh after configured rate - - g_lcdproc.Shutdown() - -def handleConnectLCD(): - global g_xbmcMonitor - - ret = True - - # make sure not to block things when shutdown is requested - if not g_xbmcMonitor.abortRequested(): - #check for new settings - if settings_checkForNewSettings() or not g_lcdproc.IsConnected(): #networksettings changed? - g_failedConnectionNotified = False #reset notification flag - - ret = g_lcdproc.Initialize() - if not settings_getHideConnPopups(): - HandleConnectionNotification(ret) - - return ret - -###### -# main() -def main(): - # init vars and classes - initGlobals() - - # initialise and load GUI settings - settings_setup() - - # do LCD processing loop (needs to catch xbmc.Monitor().abortRequested() !) - process_lcd() +from resources.lib.xbmclcdproc import XBMCLCDproc ###### # script entry point if __name__ == "__main__": - main() + xbmclcd = XBMCLCDproc() + xbmclcd.RunLCD() diff --git a/resources/lib/xbmclcdproc.py b/resources/lib/xbmclcdproc.py new file mode 100644 index 0000000..c82de49 --- /dev/null +++ b/resources/lib/xbmclcdproc.py @@ -0,0 +1,137 @@ +''' + XBMC LCDproc addon + + Main addon handler/control + + Copyright (C) 2012-2018 Team Kodi + Copyright (C) 2012-2018 Daniel 'herrnst' Scheller + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +# base imports +import time + +# Kodi imports +import xbmc +import xbmcgui + +from .common import * +from .settings import * +from .lcdproc import * +from .infolabels import * + +class XBMCLCDproc(): + + ######## + # ctor + def __init__(self): + self._failedConnectionNotified = False + self._initialConnectAttempt = True + + # instantiate xbmc.Monitor object + self._xbmcMonitor = xbmc.Monitor() + + # instantiate LCDProc object + self._LCDproc = LCDProc() + + # initialize components + settings_initGlobals() + settings_setup() + InfoLabel_Initialize() + + ######## + # HandleConnectionNotification(): + # evaluate and handle dispay of connection notification popups + def HandleConnectionNotification(self, bConnectSuccess): + if not bConnectSuccess: + if not self._failedConnectionNotified: + self._failedConnectionNotified = True + self._initialConnectAttempt = False + text = KODI_ADDON_SETTINGS.getLocalizedString(32500) + xbmcgui.Dialog().notification(KODI_ADDON_NAME, text, KODI_ADDON_ICON) + else: + text = KODI_ADDON_SETTINGS.getLocalizedString(32501) + if not self._initialConnectAttempt: + xbmcgui.Dialog().notification(KODI_ADDON_NAME, text, KODI_ADDON_ICON) + self._failedConnectionNotified = True + + ######## + # GetLCDMode(): + # returns mode identifier based on currently playing media/active navigation + def GetLCDMode(self): + ret = LCD_MODE.LCD_MODE_GENERAL + + navActive = InfoLabel_IsNavigationActive() + screenSaver = InfoLabel_IsScreenSaverActive() + playingVideo = InfoLabel_PlayingVideo() + playingTVShow = InfoLabel_PlayingTVShow() + playingMusic = InfoLabel_PlayingAudio() + playingPVRTV = InfoLabel_PlayingLiveTV() + playingPVRRadio = InfoLabel_PlayingLiveRadio() + + if navActive: + ret = LCD_MODE.LCD_MODE_NAVIGATION + elif screenSaver: + ret = LCD_MODE.LCD_MODE_SCREENSAVER + elif playingPVRTV: + ret = LCD_MODE.LCD_MODE_PVRTV + elif playingPVRRadio: + ret = LCD_MODE.LCD_MODE_PVRRADIO + elif playingTVShow: + ret = LCD_MODE.LCD_MODE_TVSHOW + elif playingVideo: + ret = LCD_MODE.LCD_MODE_VIDEO + elif playingMusic: + ret = LCD_MODE.LCD_MODE_MUSIC + + return ret + + def HandleConnectLCD(self): + ret = True + + # make sure not to block things when shutdown is requested + if not self._xbmcMonitor.abortRequested(): + # check for new settings - networksettings changed? + if settings_checkForNewSettings() or not self._LCDproc.IsConnected(): + # reset notification flag + self._failedConnectionNotified = False + + ret = self._LCDproc.Initialize() + if not settings_getHideConnPopups(): + self.HandleConnectionNotification(ret) + + return ret + + ######## + # RunLCD(): + # Main loop, triggers data inquiry and rendering, handles setting changes and connection issues + def RunLCD(self): + while not self._xbmcMonitor.abortRequested(): + if self.HandleConnectLCD(): + settingsChanged = settings_didSettingsChange() + + if settingsChanged: + self._LCDproc.UpdateGUISettings() + + self._LCDproc.Render(self.GetLCDMode(), settingsChanged) + + # refresh after configured rate + time.sleep(1.0 / float(settings_getRefreshRate())) + + self._LCDproc.Shutdown() From e16d1b44c878920f9bcba589aa105e1dc422ec47 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 24 Jun 2018 18:51:06 +0200 Subject: [PATCH 296/337] don't unnecessarily check for abortRequested() in HandleConnectLCD() HandleConnectLCD() is only called from within RunLCD(), and only immediately after abortRequested() has been checked. Remove the additional check in HandleConnectLCD() to only check for abort at one place throughout the addon. --- resources/lib/xbmclcdproc.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/resources/lib/xbmclcdproc.py b/resources/lib/xbmclcdproc.py index c82de49..191668b 100644 --- a/resources/lib/xbmclcdproc.py +++ b/resources/lib/xbmclcdproc.py @@ -105,16 +105,14 @@ def GetLCDMode(self): def HandleConnectLCD(self): ret = True - # make sure not to block things when shutdown is requested - if not self._xbmcMonitor.abortRequested(): - # check for new settings - networksettings changed? - if settings_checkForNewSettings() or not self._LCDproc.IsConnected(): - # reset notification flag - self._failedConnectionNotified = False - - ret = self._LCDproc.Initialize() - if not settings_getHideConnPopups(): - self.HandleConnectionNotification(ret) + # check for new settings - networksettings changed? + if settings_checkForNewSettings() or not self._LCDproc.IsConnected(): + # reset notification flag + self._failedConnectionNotified = False + + ret = self._LCDproc.Initialize() + if not settings_getHideConnPopups(): + self.HandleConnectionNotification(ret) return ret From 64fbad692c46e06bc9f593d7b45913e902a7e7fb Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 26 Jun 2018 19:33:20 +0200 Subject: [PATCH 297/337] fix the logic that resets failedConnectionNotified If there's no connection to the configured LCDproc server (indicated by LCDproc.IsConnected()), the failedConnectionNotified flag would be reset on every iteration/tick, causing the KaiToast dialog popup permanently and repeatedly to be displayed. Fix this by making sure the flag is really only being reset if any setting that requires a reconnect was changed. This issue is probably present since "the beginning" but wasn't triggered as there was no "global g_failedConnectionNotified" at the beginning of the function so this even might didn't work properly at all, until this problem really surfaced by now since we're now dealing properly with the matching class member. --- resources/lib/xbmclcdproc.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/resources/lib/xbmclcdproc.py b/resources/lib/xbmclcdproc.py index 191668b..3381a97 100644 --- a/resources/lib/xbmclcdproc.py +++ b/resources/lib/xbmclcdproc.py @@ -105,10 +105,14 @@ def GetLCDMode(self): def HandleConnectLCD(self): ret = True + reconnect = settings_checkForNewSettings() + # check for new settings - networksettings changed? - if settings_checkForNewSettings() or not self._LCDproc.IsConnected(): - # reset notification flag - self._failedConnectionNotified = False + if reconnect or not self._LCDproc.IsConnected(): + + # reset notification flag if settingchanges require reconnect + if reconnect: + self._failedConnectionNotified = False ret = self._LCDproc.Initialize() if not settings_getHideConnPopups(): From f4b52c1e7db290d372b9ba10ca7ad9d8847e3e88 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 26 Jun 2018 22:40:12 +0200 Subject: [PATCH 298/337] refactor settings into class Settings() Settings handling currently is implemented using plain functions in the settings module (settings.py) and uses two hands full of globals to track things. Refactor into a class and make the globals class member, and rather instantiate that class and pass the instance around. Part of getting rid of all globals within script.xbmc.lcdproc, and even saves a few lines. --- resources/lib/infolabels.py | 4 +- resources/lib/lcdbase.py | 17 +- resources/lib/lcdproc.py | 16 +- resources/lib/settings.py | 543 +++++++++++++++-------------------- resources/lib/xbmclcdproc.py | 18 +- 5 files changed, 263 insertions(+), 335 deletions(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 6b4e76d..0aedcb1 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -198,14 +198,14 @@ def InfoLabel_GetProgressPercent(): return float(tCurrent)/float(tTotal) -def InfoLabel_IsNavigationActive(): +def InfoLabel_IsNavigationActive(settings): global g_InfoLabel_oldMenu global g_InfoLabel_oldSubMenu global g_InfoLabel_navTimer ret = False - navtimeout = settings_getNavTimeout() + navtimeout = settings.getNavTimeout() menu = InfoLabel_GetInfoLabel("$INFO[System.CurrentWindow]") subMenu = InfoLabel_GetInfoLabel("$INFO[System.CurrentControl]") diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 33d8749..f9b5d44 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -73,7 +73,7 @@ class LCD_LINEALIGN: g_dictEmptyLineDescriptor['align'] = LCD_LINEALIGN.LCD_LINEALIGN_LEFT class LcdBase(): - def __init__(self): + def __init__(self, settings): # configuration vars (from LCD.xml) self.m_lcdMode = [None] * LCD_MODE.LCD_MODE_MAX self.m_extraBars = [None] * (LCD_EXTRABARS_MAX + 1) @@ -100,6 +100,9 @@ def __init__(self): # regex compile cache self.m_reBBCode = None + # class instances + self.m_Settings = settings + # @abstractmethod def _concrete_method(self): pass @@ -212,7 +215,7 @@ def Initialize(self): return True def UpdateGUISettings(self): - str_charset = settings_getCharset() + str_charset = self.m_Settings.getCharset() if str_charset != self.m_strLCDEncoding: if (str_charset == "hd44780-a00" or str_charset == "hd44780-a02") and not self.m_bHaveHD44780Charmap: str_charset = "iso8859-1" @@ -220,7 +223,7 @@ def UpdateGUISettings(self): self.m_strLCDEncoding = str_charset log(LOGDEBUG, "Setting character encoding to %s" % (self.m_strLCDEncoding)) - self.m_iDimOnPlayDelay = settings_getDimDelay() + self.m_iDimOnPlayDelay = self.m_Settings.getDimDelay() def LoadSkin(self, xmlFile, doReset): if doReset == True: @@ -449,7 +452,7 @@ def Reset(self): def Shutdown(self): log(LOGNOTICE, "Shutting down") - if settings_getDimOnShutdown(): + if self.m_Settings.getDimOnShutdown(): self.SetBackLight(0) self.CloseSocket() @@ -528,13 +531,13 @@ def Render(self, mode, bForce): self.FlushLines() def DoDimOnMusic(self, mode): - return (mode == LCD_MODE.LCD_MODE_MUSIC or mode == LCD_MODE.LCD_MODE_PVRRADIO) and settings_getDimOnMusicPlayback() + return (mode == LCD_MODE.LCD_MODE_MUSIC or mode == LCD_MODE.LCD_MODE_PVRRADIO) and self.m_Settings.getDimOnMusicPlayback() def DoDimOnVideo(self, mode): - return (mode == LCD_MODE.LCD_MODE_VIDEO or mode == LCD_MODE.LCD_MODE_TVSHOW or mode == LCD_MODE.LCD_MODE_PVRTV) and settings_getDimOnVideoPlayback() + return (mode == LCD_MODE.LCD_MODE_VIDEO or mode == LCD_MODE.LCD_MODE_TVSHOW or mode == LCD_MODE.LCD_MODE_PVRTV) and self.m_Settings.getDimOnVideoPlayback() def DoDimOnScreensaver(self, mode): - return (mode == LCD_MODE.LCD_MODE_SCREENSAVER) and settings_getDimOnScreensaver() + return (mode == LCD_MODE.LCD_MODE_SCREENSAVER) and self.m_Settings.getDimOnScreensaver() def HandleBacklight(self, mode): # dimming display in case screensaver is active or something is being played back (and not paused!) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 4e3b8c4..7601314 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -43,7 +43,7 @@ INIT_RETRY_INTERVAL_MAX = 60 class LCDProc(LcdBase): - def __init__(self): + def __init__(self, settings): self.m_bStop = True self.m_lastInitAttempt = 0 self.m_initRetryInterval = INIT_RETRY_INTERVAL @@ -64,7 +64,7 @@ def __init__(self): self.m_bstrSetLineCmds = b"" self.m_cExtraIcons = None - LcdBase.__init__(self) + LcdBase.__init__(self, settings) def SendCommand(self, strCmd, bCheckRet): countcmds = strCmd.count(b'\n') @@ -140,7 +140,7 @@ def SetupScreen(self): return False # Turn off heartbeat if desired - if not settings_getHeartBeat(): + if not self.m_Settings.getHeartBeat(): if not self.SendCommand(b"screen_set xbmc -heartbeat off", True): return False @@ -225,7 +225,7 @@ def DetermineExtraSupport(self): rematch_mdm166a = "Targa(.*)mdm166a" rematch_imonvfd = "Soundgraph(.*)VFD" - bUseExtraIcons = settings_getUseExtraElements() + bUseExtraIcons = self.m_Settings.getUseExtraElements() # Never cause script failure/interruption by this! This is totally optional! try: @@ -267,8 +267,8 @@ def Connect(self): self.CloseSocket() try: - ip = settings_getHostIp() - port = settings_getHostPort() + ip = self.m_Settings.getHostIp() + port = self.m_Settings.getHostPort() log(LOGDEBUG,"Open " + str(ip) + ":" + str(port)) self.tn.open(ip, port) @@ -571,8 +571,8 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): strLineLong.strip() iMaxLineLen = dictDescriptor['endx'] - (int(dictDescriptor['startx']) - 1) - iScrollSpeed = settings_getScrollDelay() - bstrScrollMode = settings_getLCDprocScrollMode().encode(self.m_strLCDEncoding) + iScrollSpeed = self.m_Settings.getScrollDelay() + bstrScrollMode = self.m_Settings.getLCDprocScrollMode().encode(self.m_strLCDEncoding) if len(strLineLong) > iMaxLineLen: # if the string doesn't fit the display... if iScrollSpeed != 0: # add separator when scrolling enabled diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 04829a4..6285c2b 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -25,313 +25,236 @@ from .common import * -#general -global g_hostip -global g_hostport -global g_timer -global g_heartbeat -global g_scrolldelay -global g_scrollmode -global g_settingsChanged -global g_dimonscreensaver -global g_dimonshutdown -global g_dimonvideoplayback -global g_dimonmusicplayback -global g_dimdelay -global g_navtimeout -global g_refreshrate -global g_hideconnpopups -global g_usealternatecharset -global g_charset -global g_useextraelements - -#init globals with defaults -def settings_initGlobals(): - global g_hostip - global g_hostport - global g_timer - global g_heartbeat - global g_scrolldelay - global g_scrollmode - global g_settingsChanged - global g_dimonscreensaver - global g_dimonshutdown - global g_dimonvideoplayback - global g_dimonmusicplayback - global g_dimdelay - global g_navtimeout - global g_refreshrate - global g_hideconnpopups - global g_usealternatecharset - global g_charset - global g_useextraelements - - g_hostip = "127.0.0.1" - g_hostport = 13666 - g_timer = time.time() - g_heartbeat = False - g_scrolldelay = 1 - g_scrollmode = "0" - g_settingsChanged = True - g_dimonscreensaver = False - g_dimonshutdown = False - g_dimonvideoplayback = False - g_dimonmusicplayback = False - g_dimdelay = 0 - g_navtimeout = 3 - g_refreshrate = 1 - g_hideconnpopups = True - g_usealternatecharset = False - g_charset = "iso-8859-1" - g_useextraelements = True - -def settings_getHostIp(): - global g_hostip - return g_hostip - -def settings_getHostPort(): - global g_hostport - return g_hostport - -def settings_getHeartBeat(): - global g_heartbeat - return g_heartbeat - -def settings_getUseExtraElements(): - global g_useextraelements - return g_useextraelements - -def settings_getScrollDelay(): - global g_scrolldelay - return g_scrolldelay - -def settings_getScrollMode(): - global g_scrollmode - return g_scrollmode - -def settings_getLCDprocScrollMode(): - global g_scrollmode - if g_scrollmode == "1": - return "h" - return "m" - -def settings_getDimOnScreensaver(): - global g_dimonscreensaver - return g_dimonscreensaver - -def settings_getDimOnShutdown(): - global g_dimonshutdown - return g_dimonshutdown - -def settings_getDimOnVideoPlayback(): - global g_dimonvideoplayback - return g_dimonvideoplayback - -def settings_getDimOnMusicPlayback(): - global g_dimonmusicplayback - return g_dimonmusicplayback - -def settings_getDimDelay(): - global g_dimdelay - return g_dimdelay - -def settings_getNavTimeout(): - global g_navtimeout - return g_navtimeout - -def settings_getRefreshRate(): - global g_refreshrate - return g_refreshrate - -def settings_getHideConnPopups(): - global g_hideconnpopups - return g_hideconnpopups - -def settings_getCharset(): - global g_usealternatecharset - global g_charset - ret = "" - - # if alternatecharset is disabled, return LCDproc's default - if g_usealternatecharset == False: - ret = "iso-8859-1" - else: - # make sure to keep this in sync with settings.xml! - if g_charset == "1": - ret = "iso-8859-15" - elif g_charset == "2": - ret = "koi8-r" - elif g_charset == "3": - ret = "cp1251" - elif g_charset == "4": - ret = "iso-8859-5" - elif g_charset == "5": - ret = "hd44780-a00" - elif g_charset == "6": - ret = "hd44780-a02" - else: - ret = "iso-8859-1" - - return ret - -#check for new settings and handle them if anything changed -#only checks if the last check is 5 secs old -#returns if a reconnect is needed due to settings change -def settings_checkForNewSettings(): -#todo for now impl. stat on addon.getAddonInfo('profile')/settings.xml and use mtime -#check for new settings every 5 secs - global g_timer - reconnect = False - - if time.time() - g_timer > 5: - reconnect = settings_setup() - g_timer = time.time() - return reconnect - -def settings_didSettingsChange(): - global g_settingsChanged - settingsChanged = g_settingsChanged - g_settingsChanged = False - return settingsChanged - -# handle all settings that might require a reinit and/or reconnect -# (e.g. network config changes) -# returns true if reconnect is needed due to network changes -def settings_handleCriticalSettings(): - global g_hostip - global g_hostport - global g_heartbeat - global g_useextraelements - - reconnect = False - - hostip = KODI_ADDON_SETTINGS.getSetting("hostip") - hostport = int(KODI_ADDON_SETTINGS.getSetting("hostport")) - heartbeat = KODI_ADDON_SETTINGS.getSetting("heartbeat") == "true" - useextraelements = KODI_ADDON_SETTINGS.getSetting("useextraelements") == "true" - - #server settings - #we need to reconnect if networkaccess bool changes - #or if network access is enabled and ip or port have changed - if g_hostip != hostip or g_hostport != hostport or g_heartbeat != heartbeat: - if g_hostip != hostip: - log(LOGDEBUG, "settings: changed hostip to " + str(hostip)) - g_hostip = hostip - reconnect = True - - if g_hostport != hostport: - - # make sure valid port number was given - if hostport > 0 and hostport < 65536: - log(LOGDEBUG, "settings: changed hostport to " + str(hostport)) - g_hostport = hostport - reconnect = True - else: - log(LOGDEBUG, "settings: invalid hostport value " + str(hostport) + ", resetting to old value " + str(g_hostport)) - - KODI_ADDON_SETTINGS.setSetting("hostport", str(g_hostport)) - - if g_heartbeat != heartbeat: - log(LOGDEBUG, "settings: toggled heartbeat bool") - g_heartbeat = heartbeat - reconnect = True - - # extra element support needs a reinit+reconnect so the extraelement - # support object resets - if g_useextraelements != useextraelements: - g_useextraelements = useextraelements - reconnect = True - - return reconnect - -def settings_handleLcdSettings(): - global g_scrolldelay - global g_scrollmode - global g_heartbeat - global g_settingsChanged - global g_dimonscreensaver - global g_dimonshutdown - global g_dimonvideoplayback - global g_dimonmusicplayback - global g_dimdelay - global g_navtimeout - global g_refreshrate - global g_hideconnpopups - global g_usealternatecharset - global g_charset - - g_settingsChanged = False - - scrolldelay = int(float(KODI_ADDON_SETTINGS.getSetting("scrolldelay").replace(",", "."))) - scrollmode = KODI_ADDON_SETTINGS.getSetting("scrollmode") - dimonscreensaver = KODI_ADDON_SETTINGS.getSetting("dimonscreensaver") == "true" - dimonshutdown = KODI_ADDON_SETTINGS.getSetting("dimonshutdown") == "true" - dimonvideoplayback = KODI_ADDON_SETTINGS.getSetting("dimonvideoplayback") == "true" - dimonmusicplayback = KODI_ADDON_SETTINGS.getSetting("dimonmusicplayback") == "true" - dimdelay = int(float(KODI_ADDON_SETTINGS.getSetting("dimdelay").replace(",", "."))) - navtimeout = int(float(KODI_ADDON_SETTINGS.getSetting("navtimeout").replace(",", "."))) - refreshrate = int(float(KODI_ADDON_SETTINGS.getSetting("refreshrate").replace(",", "."))) - hideconnpopups = KODI_ADDON_SETTINGS.getSetting("hideconnpopups") == "true" - usealternatecharset = KODI_ADDON_SETTINGS.getSetting("usealternatecharset") == "true" - charset = KODI_ADDON_SETTINGS.getSetting("charset") - - if g_scrolldelay != scrolldelay: - g_scrolldelay = scrolldelay - g_settingsChanged = True - - if g_scrollmode != scrollmode: - g_scrollmode = scrollmode - g_settingsChanged = True - - if g_dimonscreensaver != dimonscreensaver: - g_dimonscreensaver = dimonscreensaver - g_settingsChanged = True - - if g_dimonshutdown != dimonshutdown: - g_dimonshutdown = dimonshutdown - g_settingsChanged = True - - if g_dimonvideoplayback != dimonvideoplayback: - g_dimonvideoplayback = dimonvideoplayback - g_settingsChanged = True - - if g_dimonmusicplayback != dimonmusicplayback: - g_dimonmusicplayback = dimonmusicplayback - g_settingsChanged = True - - if g_dimdelay != dimdelay: - g_dimdelay = dimdelay - g_settingsChanged = True - - if g_navtimeout != navtimeout: - g_navtimeout = navtimeout - g_settingsChanged = True - - if g_refreshrate != refreshrate: - g_refreshrate = refreshrate - - if refreshrate < 1: - g_refreshrate = 1 - - g_settingsChanged = True - - if g_hideconnpopups != hideconnpopups: - g_hideconnpopups = hideconnpopups - g_settingsChanged = True - - if g_usealternatecharset != usealternatecharset: - g_usealternatecharset = usealternatecharset - g_settingsChanged = True - - if g_charset != charset: - g_charset = charset - g_settingsChanged = True - -#handles all settings and applies them as needed -#returns if a reconnect is needed due to settings changes -def settings_setup(): - reconnect = False - reconnect = settings_handleCriticalSettings() - settings_handleLcdSettings() - - return reconnect +class Settings(): + + ######## + # ctor + def __init__(self): + # init class members (settings) with defaults + self._hostip = "127.0.0.1" + self._hostport = 13666 + self._timer = time.time() + self._heartbeat = False + self._scrolldelay = 1 + self._scrollmode = "0" + self._settingsChanged = True + self._dimonscreensaver = False + self._dimonshutdown = False + self._dimonvideoplayback = False + self._dimonmusicplayback = False + self._dimdelay = 0 + self._navtimeout = 3 + self._refreshrate = 1 + self._hideconnpopups = True + self._usealternatecharset = False + self._charset = "iso-8859-1" + self._useextraelements = True + + def getHostIp(self): + return self._hostip + + def getHostPort(self): + return self._hostport + + def getHeartBeat(self): + return self._heartbeat + + def getUseExtraElements(self): + return self._useextraelements + + def getScrollDelay(self): + return self._scrolldelay + + def getScrollMode(self): + return self._scrollmode + + def getLCDprocScrollMode(self): + if self._scrollmode == "1": + return "h" + return "m" + + def getDimOnScreensaver(self): + return self._dimonscreensaver + + def getDimOnShutdown(self): + return self._dimonshutdown + + def getDimOnVideoPlayback(self): + return self._dimonvideoplayback + + def getDimOnMusicPlayback(self): + return self._dimonmusicplayback + + def getDimDelay(self): + return self._dimdelay + + def getNavTimeout(self): + return self._navtimeout + + def getRefreshRate(self): + return self._refreshrate + + def getHideConnPopups(self): + return self._hideconnpopups + + def getCharset(self): + ret = "" + + # if alternatecharset is disabled, return LCDproc's default + if self._usealternatecharset == False: + ret = "iso-8859-1" + else: + # make sure to keep this in sync with settings.xml! + if self._charset == "1": + ret = "iso-8859-15" + elif self._charset == "2": + ret = "koi8-r" + elif self._charset == "3": + ret = "cp1251" + elif self._charset == "4": + ret = "iso-8859-5" + elif self._charset == "5": + ret = "hd44780-a00" + elif self._charset == "6": + ret = "hd44780-a02" + else: + ret = "iso-8859-1" + + return ret + + # check for new settings and handle them if anything changed + # only checks if the last check is 5 secs old + # returns if a reconnect is needed due to settings change + def checkForNewSettings(self): + # TODO: for now impl. stat on addon.getAddonInfo('profile')/settings.xml and use mtime + # check for new settings every 5 secs + reconnect = False + + if time.time() - self._timer > 5: + reconnect = self.setup() + self._timer = time.time() + + return reconnect + + def didSettingsChange(self): + settingsChanged = self._settingsChanged + self._settingsChanged = False + return settingsChanged + + # handle all settings that might require a reinit and/or reconnect + # (e.g. network config changes) + # returns true if reconnect is needed due to network changes + def handleCriticalSettings(self): + reconnect = False + + hostip = KODI_ADDON_SETTINGS.getSetting("hostip") + hostport = int(KODI_ADDON_SETTINGS.getSetting("hostport")) + heartbeat = KODI_ADDON_SETTINGS.getSetting("heartbeat") == "true" + useextraelements = KODI_ADDON_SETTINGS.getSetting("useextraelements") == "true" + + # server settings + # we need to reconnect if networkaccess bool changes + # or if network access is enabled and ip or port have changed + if self._hostip != hostip or self._hostport != hostport or self._heartbeat != heartbeat: + if self._hostip != hostip: + log(LOGDEBUG, "settings: changed hostip to " + str(hostip)) + self._hostip = hostip + reconnect = True + + if self._hostport != hostport: + # make sure valid port number was given + if hostport > 0 and hostport < 65536: + log(LOGDEBUG, "settings: changed hostport to " + str(hostport)) + self._hostport = hostport + reconnect = True + else: + log(LOGDEBUG, "settings: invalid hostport value " + str(hostport) + ", resetting to old value " + str(self._hostport)) + KODI_ADDON_SETTINGS.setSetting("hostport", str(self._hostport)) + + if self._heartbeat != heartbeat: + log(LOGDEBUG, "settings: toggled heartbeat bool") + self._heartbeat = heartbeat + reconnect = True + + # extra element support needs a reinit+reconnect so the extraelement + # support object resets + if self._useextraelements != useextraelements: + self._useextraelements = useextraelements + reconnect = True + + return reconnect + + def handleLcdSettings(self): + scrolldelay = int(float(KODI_ADDON_SETTINGS.getSetting("scrolldelay").replace(",", "."))) + scrollmode = KODI_ADDON_SETTINGS.getSetting("scrollmode") + dimonscreensaver = KODI_ADDON_SETTINGS.getSetting("dimonscreensaver") == "true" + dimonshutdown = KODI_ADDON_SETTINGS.getSetting("dimonshutdown") == "true" + dimonvideoplayback = KODI_ADDON_SETTINGS.getSetting("dimonvideoplayback") == "true" + dimonmusicplayback = KODI_ADDON_SETTINGS.getSetting("dimonmusicplayback") == "true" + dimdelay = int(float(KODI_ADDON_SETTINGS.getSetting("dimdelay").replace(",", "."))) + navtimeout = int(float(KODI_ADDON_SETTINGS.getSetting("navtimeout").replace(",", "."))) + refreshrate = int(float(KODI_ADDON_SETTINGS.getSetting("refreshrate").replace(",", "."))) + hideconnpopups = KODI_ADDON_SETTINGS.getSetting("hideconnpopups") == "true" + usealternatecharset = KODI_ADDON_SETTINGS.getSetting("usealternatecharset") == "true" + charset = KODI_ADDON_SETTINGS.getSetting("charset") + + if self._scrolldelay != scrolldelay: + self._scrolldelay = scrolldelay + self._settingsChanged = True + + if self._scrollmode != scrollmode: + self._scrollmode = scrollmode + self._settingsChanged = True + + if self._dimonscreensaver != dimonscreensaver: + self._dimonscreensaver = dimonscreensaver + self._settingsChanged = True + + if self._dimonshutdown != dimonshutdown: + self._dimonshutdown = dimonshutdown + self._settingsChanged = True + + if self._dimonvideoplayback != dimonvideoplayback: + self._dimonvideoplayback = dimonvideoplayback + self._settingsChanged = True + + if self._dimonmusicplayback != dimonmusicplayback: + self._dimonmusicplayback = dimonmusicplayback + self._settingsChanged = True + + if self._dimdelay != dimdelay: + self._dimdelay = dimdelay + self._settingsChanged = True + + if self._navtimeout != navtimeout: + self._navtimeout = navtimeout + self._settingsChanged = True + + if self._refreshrate != refreshrate: + self._refreshrate = refreshrate + + if refreshrate < 1: + self._refreshrate = 1 + + self._settingsChanged = True + + if self._hideconnpopups != hideconnpopups: + self._hideconnpopups = hideconnpopups + self._settingsChanged = True + + if self._usealternatecharset != usealternatecharset: + self._usealternatecharset = usealternatecharset + self._settingsChanged = True + + if self._charset != charset: + self._charset = charset + self._settingsChanged = True + + # handles all settings and applies them as needed + # returns if a reconnect is needed due to settings changes + def setup(self): + reconnect = False + reconnect = self.handleCriticalSettings() + self.handleLcdSettings() + + return reconnect diff --git a/resources/lib/xbmclcdproc.py b/resources/lib/xbmclcdproc.py index 3381a97..9358878 100644 --- a/resources/lib/xbmclcdproc.py +++ b/resources/lib/xbmclcdproc.py @@ -47,12 +47,14 @@ def __init__(self): # instantiate xbmc.Monitor object self._xbmcMonitor = xbmc.Monitor() + # instantiate Settings object + self._Settings = Settings() + # instantiate LCDProc object - self._LCDproc = LCDProc() + self._LCDproc = LCDProc(self._Settings) # initialize components - settings_initGlobals() - settings_setup() + self._Settings.setup() InfoLabel_Initialize() ######## @@ -77,7 +79,7 @@ def HandleConnectionNotification(self, bConnectSuccess): def GetLCDMode(self): ret = LCD_MODE.LCD_MODE_GENERAL - navActive = InfoLabel_IsNavigationActive() + navActive = InfoLabel_IsNavigationActive(self._Settings) screenSaver = InfoLabel_IsScreenSaverActive() playingVideo = InfoLabel_PlayingVideo() playingTVShow = InfoLabel_PlayingTVShow() @@ -105,7 +107,7 @@ def GetLCDMode(self): def HandleConnectLCD(self): ret = True - reconnect = settings_checkForNewSettings() + reconnect = self._Settings.checkForNewSettings() # check for new settings - networksettings changed? if reconnect or not self._LCDproc.IsConnected(): @@ -115,7 +117,7 @@ def HandleConnectLCD(self): self._failedConnectionNotified = False ret = self._LCDproc.Initialize() - if not settings_getHideConnPopups(): + if not self._Settings.getHideConnPopups(): self.HandleConnectionNotification(ret) return ret @@ -126,7 +128,7 @@ def HandleConnectLCD(self): def RunLCD(self): while not self._xbmcMonitor.abortRequested(): if self.HandleConnectLCD(): - settingsChanged = settings_didSettingsChange() + settingsChanged = self._Settings.didSettingsChange() if settingsChanged: self._LCDproc.UpdateGUISettings() @@ -134,6 +136,6 @@ def RunLCD(self): self._LCDproc.Render(self.GetLCDMode(), settingsChanged) # refresh after configured rate - time.sleep(1.0 / float(settings_getRefreshRate())) + time.sleep(1.0 / float(self._Settings.getRefreshRate())) self._LCDproc.Shutdown() From 29e6fdd26f90a3d7ddf070151845e255d2422525 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 30 Jun 2018 17:55:05 +0200 Subject: [PATCH 299/337] move the LCD mode evaluation into the LcdBase class GetLCDMode() is only used from LcdBase's Render() method, so keeping that logic in the main/core XBMCLCDproc class is stupid. Move that method into class LcdBase instead, this also allow to remove the dependency on the infolabels module in the main class. --- resources/lib/lcdbase.py | 36 +++++++++++++++++++++++++++++++++++- resources/lib/xbmclcdproc.py | 35 +---------------------------------- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index f9b5d44..80401fd 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -103,6 +103,9 @@ def __init__(self, settings): # class instances self.m_Settings = settings + # initialize InfoLabels + InfoLabel_Initialize() + # @abstractmethod def _concrete_method(self): pass @@ -457,6 +460,36 @@ def Shutdown(self): self.CloseSocket() + # GetLCDMode(): + # returns mode identifier based on currently playing media/active navigation + def GetLCDMode(self): + ret = LCD_MODE.LCD_MODE_GENERAL + + navActive = InfoLabel_IsNavigationActive(self.m_Settings) + screenSaver = InfoLabel_IsScreenSaverActive() + playingVideo = InfoLabel_PlayingVideo() + playingTVShow = InfoLabel_PlayingTVShow() + playingMusic = InfoLabel_PlayingAudio() + playingPVRTV = InfoLabel_PlayingLiveTV() + playingPVRRadio = InfoLabel_PlayingLiveRadio() + + if navActive: + ret = LCD_MODE.LCD_MODE_NAVIGATION + elif screenSaver: + ret = LCD_MODE.LCD_MODE_SCREENSAVER + elif playingPVRTV: + ret = LCD_MODE.LCD_MODE_PVRTV + elif playingPVRRadio: + ret = LCD_MODE.LCD_MODE_PVRRADIO + elif playingTVShow: + ret = LCD_MODE.LCD_MODE_TVSHOW + elif playingVideo: + ret = LCD_MODE.LCD_MODE_VIDEO + elif playingMusic: + ret = LCD_MODE.LCD_MODE_MUSIC + + return ret + def StripBBCode(self, strtext): regexbbcode = "\[(?P[0-9a-zA-Z_\-]+?)[0-9a-zA-Z_\- ]*?\](?P.*?)\[\/(?P=tagname)\]" # precompile and remember regex to make sure re's caching won't cause accidential recompilation @@ -488,9 +521,10 @@ def StripBBCode(self, strtext): # return last replace mangling return mangledline - def Render(self, mode, bForce): + def Render(self, bForce): outLine = 0 inLine = 0 + mode = self.GetLCDMode() self.HandleBacklight(mode) diff --git a/resources/lib/xbmclcdproc.py b/resources/lib/xbmclcdproc.py index 9358878..013d198 100644 --- a/resources/lib/xbmclcdproc.py +++ b/resources/lib/xbmclcdproc.py @@ -34,7 +34,6 @@ from .common import * from .settings import * from .lcdproc import * -from .infolabels import * class XBMCLCDproc(): @@ -55,7 +54,6 @@ def __init__(self): # initialize components self._Settings.setup() - InfoLabel_Initialize() ######## # HandleConnectionNotification(): @@ -73,37 +71,6 @@ def HandleConnectionNotification(self, bConnectSuccess): xbmcgui.Dialog().notification(KODI_ADDON_NAME, text, KODI_ADDON_ICON) self._failedConnectionNotified = True - ######## - # GetLCDMode(): - # returns mode identifier based on currently playing media/active navigation - def GetLCDMode(self): - ret = LCD_MODE.LCD_MODE_GENERAL - - navActive = InfoLabel_IsNavigationActive(self._Settings) - screenSaver = InfoLabel_IsScreenSaverActive() - playingVideo = InfoLabel_PlayingVideo() - playingTVShow = InfoLabel_PlayingTVShow() - playingMusic = InfoLabel_PlayingAudio() - playingPVRTV = InfoLabel_PlayingLiveTV() - playingPVRRadio = InfoLabel_PlayingLiveRadio() - - if navActive: - ret = LCD_MODE.LCD_MODE_NAVIGATION - elif screenSaver: - ret = LCD_MODE.LCD_MODE_SCREENSAVER - elif playingPVRTV: - ret = LCD_MODE.LCD_MODE_PVRTV - elif playingPVRRadio: - ret = LCD_MODE.LCD_MODE_PVRRADIO - elif playingTVShow: - ret = LCD_MODE.LCD_MODE_TVSHOW - elif playingVideo: - ret = LCD_MODE.LCD_MODE_VIDEO - elif playingMusic: - ret = LCD_MODE.LCD_MODE_MUSIC - - return ret - def HandleConnectLCD(self): ret = True @@ -133,7 +100,7 @@ def RunLCD(self): if settingsChanged: self._LCDproc.UpdateGUISettings() - self._LCDproc.Render(self.GetLCDMode(), settingsChanged) + self._LCDproc.Render(settingsChanged) # refresh after configured rate time.sleep(1.0 / float(self._Settings.getRefreshRate())) From d84aa8111ab78f510383b53981b1b8f7c2f94c8d Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 30 Jun 2018 20:11:12 +0200 Subject: [PATCH 300/337] refactor infolabels handling into class InfoLabels() Move all InfoLabel_*() functions from the infolabels module into a new InfoLabels class. This further unpollutes the global namespace, especially as the formerly used g_InfoLabel* globals are now class members. The class instance takes a Settings class object which is used for the nav timeout determination. --- resources/lib/infolabels.py | 329 ++++++++++++++++++------------------ resources/lib/lcdbase.py | 86 +++++----- resources/lib/lcdproc.py | 20 +-- 3 files changed, 218 insertions(+), 217 deletions(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 0aedcb1..63805d3 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -31,222 +31,223 @@ from .settings import * -# interesting XBMC GUI Window IDs (no defines seem to exist for this) +# interesting Kodi GUI Window IDs (no defines seem to exist for this) class WINDOW_IDS: - WINDOW_WEATHER = 12600 - WINDOW_PVR = 10601 - WINDOW_PVR_MAX = 10699 - WINDOW_VIDEOS = 10006 - WINDOW_VIDEO_FILES = 10024 - WINDOW_VIDEO_NAV = 10025 - WINDOW_VIDEO_PLAYLIST = 10028 - WINDOW_MUSIC = 10005 - WINDOW_MUSIC_PLAYLIST = 10500 - WINDOW_MUSIC_FILES = 10501 - WINDOW_MUSIC_NAV = 10502 - WINDOW_MUSIC_PLAYLIST_EDITOR = 10503 - WINDOW_PICTURES = 10002 - WINDOW_DIALOG_VOLUME_BAR = 10104 - WINDOW_DIALOG_KAI_TOAST = 10107 - -global g_InfoLabel_oldMenu -global g_InfoLabel_oldSubMenu -global g_InfoLabel_navTimer - -def InfoLabel_Initialize(): - global g_InfoLabel_oldMenu - global g_InfoLabel_oldSubMenu - global g_InfoLabel_navTimer - - g_InfoLabel_oldMenu = "" - g_InfoLabel_oldSubMenu = "" - g_InfoLabel_navTimer = time.time() + WINDOW_WEATHER = 12600 + WINDOW_PVR = 10601 + WINDOW_PVR_MAX = 10699 + WINDOW_VIDEOS = 10006 + WINDOW_VIDEO_FILES = 10024 + WINDOW_VIDEO_NAV = 10025 + WINDOW_VIDEO_PLAYLIST = 10028 + WINDOW_MUSIC = 10005 + WINDOW_MUSIC_PLAYLIST = 10500 + WINDOW_MUSIC_FILES = 10501 + WINDOW_MUSIC_NAV = 10502 + WINDOW_MUSIC_PLAYLIST_EDITOR = 10503 + WINDOW_PICTURES = 10002 + WINDOW_DIALOG_VOLUME_BAR = 10104 + WINDOW_DIALOG_KAI_TOAST = 10107 + +class InfoLabels(): + + ######## + # ctor + def __init__(self, settings): + # take note of Settings instance + self._settings = settings + + # init members + self._nav_oldmenu = "" + self._nav_oldsubmenu = "" + self._navtimer = time.time() -def InfoLabel_GetInfoLabel(strLabel): - ret = xbmc.getInfoLabel(strLabel) - # pre-py3 compat - if sys.version_info.major < 3: - return ret.decode("utf-8") - return ret + # pre-py3 compat + self._py2compat = False + if sys.version_info.major < 3: + self._py2compat = True -def InfoLabel_GetBool(strBool): - return xbmc.getCondVisibility(strBool) + def GetInfoLabel(self, strLabel): + ret = xbmc.getInfoLabel(strLabel) + # pre-py3 compat + if self._py2compat: + return ret.decode("utf-8") + return ret -def InfoLabel_GetActiveWindowID(): - return int(xbmcgui.getCurrentWindowId()) + def GetBool(self, strBool): + return xbmc.getCondVisibility(strBool) -def InfoLabel_timeToSecs(timeAr): - # initialise return - currentSecs = 0 + def GetActiveWindowID(self): + return int(xbmcgui.getCurrentWindowId()) - arLen = len(timeAr) - if arLen == 1: - currentSecs = int(timeAr[0]) - elif arLen == 2: - currentSecs = int(timeAr[0]) * 60 + int(timeAr[1]) - elif arLen == 3: - currentSecs = int(timeAr[0]) * 60 * 60 + int(timeAr[1]) * 60 + int(timeAr[2]) + def timeToSecs(self, timeAr): + # initialise return + currentSecs = 0 - return currentSecs + arLen = len(timeAr) + if arLen == 1: + currentSecs = int(timeAr[0]) + elif arLen == 2: + currentSecs = int(timeAr[0]) * 60 + int(timeAr[1]) + elif arLen == 3: + currentSecs = int(timeAr[0]) * 60 * 60 + int(timeAr[1]) * 60 + int(timeAr[2]) -def InfoLabel_WindowIsActive(WindowID): - return InfoLabel_GetBool("Window.IsActive(" + str(WindowID) + ")") + return currentSecs -def InfoLabel_PlayingVideo(): - return InfoLabel_GetBool("Player.HasVideo") + def WindowIsActive(self, WindowID): + return self.GetBool("Window.IsActive(" + str(WindowID) + ")") -def InfoLabel_PlayingTVShow(): - if InfoLabel_PlayingVideo() and len(InfoLabel_GetInfoLabel("VideoPlayer.TVShowTitle")): - return True - else: - return False + def PlayingVideo(self): + return self.GetBool("Player.HasVideo") -def InfoLabel_PlayingAudio(): - return InfoLabel_GetBool("Player.HasAudio") + def PlayingTVShow(self): + if self.PlayingVideo() and len(self.GetInfoLabel("VideoPlayer.TVShowTitle")): + return True -def InfoLabel_PlayingLiveTV(): - return InfoLabel_GetBool("PVR.IsPlayingTV") + return False -def InfoLabel_PlayingLiveRadio(): - return InfoLabel_GetBool("PVR.IsPlayingRadio") + def PlayingAudio(self): + return self.GetBool("Player.HasAudio") -def InfoLabel_GetSystemTime(): - # apply some split magic for 12h format here, as "hh:mm:ss" - # makes up for format guessing inside XBMC - fix for post-frodo at - # https://github.com/xbmc/xbmc/pull/2321 - ret = "0" + InfoLabel_GetInfoLabel("System.Time(hh:mm:ss)").split(" ")[0] - return ret[-8:] + def PlayingLiveTV(self): + return self.GetBool("PVR.IsPlayingTV") -def InfoLabel_GetPlayerTime(): - if InfoLabel_PlayingLiveTV() or InfoLabel_PlayingLiveRadio(): - return InfoLabel_GetInfoLabel("PVR.EpgEventElapsedTime") + def PlayingLiveRadio(self): + return self.GetBool("PVR.IsPlayingRadio") - return InfoLabel_GetInfoLabel("Player.Time") + def GetSystemTime(self): + # apply some split magic for 12h format here, as "hh:mm:ss" + # makes up for format guessing inside XBMC - fix for post-frodo at + # https://github.com/xbmc/xbmc/pull/2321 + ret = "0" + self.GetInfoLabel("System.Time(hh:mm:ss)").split(" ")[0] + return ret[-8:] -def InfoLabel_GetPlayerDuration(): - if InfoLabel_PlayingLiveTV() or InfoLabel_PlayingLiveRadio(): - return InfoLabel_GetInfoLabel("PVR.EpgEventDuration") + def GetPlayerTime(self): + if self.PlayingLiveTV() or self.PlayingLiveRadio(): + return self.GetInfoLabel("PVR.EpgEventElapsedTime") - return InfoLabel_GetInfoLabel("Player.Duration") + return self.GetInfoLabel("Player.Time") -def InfoLabel_IsPlayerPlaying(): - return InfoLabel_GetBool("Player.HasMedia") + def GetPlayerDuration(self): + if self.PlayingLiveTV() or self.PlayingLiveRadio(): + return self.GetInfoLabel("PVR.EpgEventDuration") -def InfoLabel_IsPlayerPaused(): - return InfoLabel_GetBool("Player.Paused") + return self.GetInfoLabel("Player.Duration") -def InfoLabel_IsPlayerForwarding(): - return InfoLabel_GetBool("Player.Forwarding") + def IsPlayerPlaying(self): + return self.GetBool("Player.HasMedia") -def InfoLabel_IsPlayerRewinding(): - return InfoLabel_GetBool("Player.Rewinding") + def IsPlayerPaused(self): + return self.GetBool("Player.Paused") -def InfoLabel_IsInternetStream(): - return InfoLabel_GetBool("Player.IsInternetStream") + def IsPlayerForwarding(self): + return self.GetBool("Player.Forwarding") -def InfoLabel_IsPassthroughAudio(): - return InfoLabel_GetBool("Player.Passthrough") + def IsPlayerRewinding(self): + return self.GetBool("Player.Rewinding") -def InfoLabel_IsPVRRecording(): - return InfoLabel_GetBool("PVR.IsRecording") + def IsInternetStream(self): + return self.GetBool("Player.IsInternetStream") -def InfoLabel_IsPlaylistRandom(): - return InfoLabel_GetBool("Playlist.IsRandom") + def IsPassthroughAudio(self): + return self.GetBool("Player.Passthrough") -def InfoLabel_IsPlaylistRepeatAll(): - return InfoLabel_GetBool("Playlist.IsRepeat") + def IsPVRRecording(self): + return self.GetBool("PVR.IsRecording") -def InfoLabel_IsPlaylistRepeatOne(): - return InfoLabel_GetBool("Playlist.IsRepeatOne") + def IsPlaylistRandom(self): + return self.GetBool("Playlist.IsRandom") -def InfoLabel_IsPlaylistRepeatAny(): - return (InfoLabel_IsPlaylistRepeatAll() | InfoLabel_IsPlaylistRepeatOne()) + def IsPlaylistRepeatAll(self): + return self.GetBool("Playlist.IsRepeat") -def InfoLabel_IsDiscInDrive(): - return InfoLabel_GetBool("System.HasMediaDVD") + def IsPlaylistRepeatOne(self): + return self.GetBool("Playlist.IsRepeatOne") -def InfoLabel_IsScreenSaverActive(): - return InfoLabel_GetBool("System.ScreenSaverActive") + def IsPlaylistRepeatAny(self): + return (self.IsPlaylistRepeatAll() | self.IsPlaylistRepeatOne()) -def InfoLabel_IsMuted(): - return InfoLabel_GetBool("Player.Muted") + def IsDiscInDrive(self): + return self.GetBool("System.HasMediaDVD") -def InfoLabel_GetVolumePercent(): - volumedb = float(InfoLabel_GetInfoLabel("Player.Volume").replace(",", ".").replace(" dB", "")) - return (100 * (60.0 + volumedb) / 60) + def IsScreenSaverActive(self): + return self.GetBool("System.ScreenSaverActive") -def InfoLabel_GetPlayerTimeSecs(): - currentTimeAr = InfoLabel_GetPlayerTime().split(":") - if currentTimeAr[0] == "": - return 0 + def IsMuted(self): + return self.GetBool("Player.Muted") - return InfoLabel_timeToSecs(currentTimeAr) + def GetVolumePercent(self): + volumedb = float(self.GetInfoLabel("Player.Volume").replace(",", ".").replace(" dB", "")) + return (100 * (60.0 + volumedb) / 60) -def InfoLabel_GetPlayerDurationSecs(): - currentDurationAr = InfoLabel_GetPlayerDuration().split(":") - if currentDurationAr[0] == "": - return 0 + def GetPlayerTimeSecs(self): + currentTimeAr = self.GetPlayerTime().split(":") + if currentTimeAr[0] == "": + return 0 - return InfoLabel_timeToSecs(currentDurationAr) + return self.timeToSecs(currentTimeAr) -def InfoLabel_GetProgressPercent(): - tCurrent = InfoLabel_GetPlayerTimeSecs() - tTotal = InfoLabel_GetPlayerDurationSecs() + def GetPlayerDurationSecs(self): + currentDurationAr = self.GetPlayerDuration().split(":") + if currentDurationAr[0] == "": + return 0 - if float(tTotal) == 0.0: - return 0 + return self.timeToSecs(currentDurationAr) - return float(tCurrent)/float(tTotal) + def GetProgressPercent(self): + tCurrent = self.GetPlayerTimeSecs() + tTotal = self.GetPlayerDurationSecs() -def InfoLabel_IsNavigationActive(settings): - global g_InfoLabel_oldMenu - global g_InfoLabel_oldSubMenu - global g_InfoLabel_navTimer + if float(tTotal) == 0.0: + return 0 - ret = False + return float(tCurrent)/float(tTotal) - navtimeout = settings.getNavTimeout() - menu = InfoLabel_GetInfoLabel("$INFO[System.CurrentWindow]") - subMenu = InfoLabel_GetInfoLabel("$INFO[System.CurrentControl]") + def IsNavigationActive(self): + ret = False - if menu != g_InfoLabel_oldMenu or subMenu != g_InfoLabel_oldSubMenu or (g_InfoLabel_navTimer + navtimeout) > time.time(): - ret = True - if menu != g_InfoLabel_oldMenu or subMenu != g_InfoLabel_oldSubMenu: - g_InfoLabel_navTimer = time.time() - g_InfoLabel_oldMenu = menu - g_InfoLabel_oldSubMenu = subMenu + navtimeout = self._settings.getNavTimeout() + menu = self.GetInfoLabel("$INFO[System.CurrentWindow]") + subMenu = self.GetInfoLabel("$INFO[System.CurrentControl]") - return ret + if menu != self._nav_oldmenu or subMenu != self._nav_oldsubmenu or (self._navtimer + navtimeout) > time.time(): + ret = True + if menu != self._nav_oldmenu or subMenu != self._nav_oldsubmenu: + self._navtimer = time.time() + self._nav_oldmenu = menu + self._nav_oldsubmenu = subMenu -def InfoLabel_IsWindowIDPVR(iWindowID): - if iWindowID >= WINDOW_IDS.WINDOW_PVR and iWindowID <= WINDOW_IDS.WINDOW_PVR_MAX: - return True + return ret - return False + def IsWindowIDPVR(self, iWindowID): + if iWindowID >= WINDOW_IDS.WINDOW_PVR and iWindowID <= WINDOW_IDS.WINDOW_PVR_MAX: + return True -def InfoLabel_IsWindowIDVideo(iWindowID): - if iWindowID in [WINDOW_IDS.WINDOW_VIDEOS, WINDOW_IDS.WINDOW_VIDEO_FILES, - WINDOW_IDS.WINDOW_VIDEO_NAV, WINDOW_IDS.WINDOW_VIDEO_PLAYLIST]: - return True + return False - return False + def IsWindowIDVideo(self, iWindowID): + if iWindowID in [WINDOW_IDS.WINDOW_VIDEOS, WINDOW_IDS.WINDOW_VIDEO_FILES, + WINDOW_IDS.WINDOW_VIDEO_NAV, WINDOW_IDS.WINDOW_VIDEO_PLAYLIST]: + return True -def InfoLabel_IsWindowIDMusic(iWindowID): - if iWindowID in [WINDOW_IDS.WINDOW_MUSIC, WINDOW_IDS.WINDOW_MUSIC_PLAYLIST, - WINDOW_IDS.WINDOW_MUSIC_FILES, WINDOW_IDS.WINDOW_MUSIC_NAV, - WINDOW_IDS.WINDOW_MUSIC_PLAYLIST_EDITOR]: - return True + return False - return False + def IsWindowIDMusic(self, iWindowID): + if iWindowID in [WINDOW_IDS.WINDOW_MUSIC, WINDOW_IDS.WINDOW_MUSIC_PLAYLIST, + WINDOW_IDS.WINDOW_MUSIC_FILES, WINDOW_IDS.WINDOW_MUSIC_NAV, + WINDOW_IDS.WINDOW_MUSIC_PLAYLIST_EDITOR]: + return True -def InfoLabel_IsWindowIDPictures(iWindowID): - if iWindowID == WINDOW_IDS.WINDOW_PICTURES: - return True + return False - return False + def IsWindowIDPictures(self, iWindowID): + if iWindowID == WINDOW_IDS.WINDOW_PICTURES: + return True -def InfoLabel_IsWindowIDWeather(iWindowID): - if iWindowID == WINDOW_IDS.WINDOW_WEATHER: - return True + return False - return False + def IsWindowIDWeather(self, iWindowID): + if iWindowID == WINDOW_IDS.WINDOW_WEATHER: + return True + + return False diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 80401fd..723595f 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -104,7 +104,7 @@ def __init__(self, settings): self.m_Settings = settings # initialize InfoLabels - InfoLabel_Initialize() + self.m_InfoLabels = InfoLabels(self.m_Settings) # @abstractmethod def _concrete_method(self): @@ -465,13 +465,13 @@ def Shutdown(self): def GetLCDMode(self): ret = LCD_MODE.LCD_MODE_GENERAL - navActive = InfoLabel_IsNavigationActive(self.m_Settings) - screenSaver = InfoLabel_IsScreenSaverActive() - playingVideo = InfoLabel_PlayingVideo() - playingTVShow = InfoLabel_PlayingTVShow() - playingMusic = InfoLabel_PlayingAudio() - playingPVRTV = InfoLabel_PlayingLiveTV() - playingPVRRadio = InfoLabel_PlayingLiveRadio() + navActive = self.m_InfoLabels.IsNavigationActive() + screenSaver = self.m_InfoLabels.IsScreenSaverActive() + playingVideo = self.m_InfoLabels.PlayingVideo() + playingTVShow = self.m_InfoLabels.PlayingTVShow() + playingMusic = self.m_InfoLabels.PlayingAudio() + playingPVRTV = self.m_InfoLabels.PlayingLiveTV() + playingPVRRadio = self.m_InfoLabels.PlayingLiveRadio() if navActive: ret = LCD_MODE.LCD_MODE_NAVIGATION @@ -532,14 +532,14 @@ def Render(self, bForce): #parse the progressbar infolabel by ourselfs! if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESS or self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_PROGRESSTIME: # get playtime and duration and convert into seconds - percent = InfoLabel_GetProgressPercent() + percent = self.m_InfoLabels.GetProgressPercent() pixelsWidth = self.SetProgressBar(percent, self.m_lcdMode[mode][inLine]['endx']) line = "p" + str(pixelsWidth) else: if self.m_lcdMode[mode][inLine]['type'] == LCD_LINETYPE.LCD_LINETYPE_ICONTEXT: self.SetPlayingStateIcon() - line = InfoLabel_GetInfoLabel(self.m_lcdMode[mode][inLine]['text']) + line = self.m_InfoLabels.GetInfoLabel(self.m_lcdMode[mode][inLine]['text']) if len(line) > 0: line = self.StripBBCode(line) @@ -579,7 +579,7 @@ def HandleBacklight(self, mode): if self.DoDimOnScreensaver(mode): doDim = True - elif not (InfoLabel_IsPlayerPlaying() and InfoLabel_IsPlayerPaused()) and (self.DoDimOnVideo(mode) or self.DoDimOnMusic(mode)): + elif not (self.m_InfoLabels.IsPlayerPlaying() and self.m_InfoLabels.IsPlayerPaused()) and (self.DoDimOnVideo(mode) or self.DoDimOnMusic(mode)): doDim = True if doDim: @@ -601,18 +601,18 @@ def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): if isplaying: if isvideo: try: - iVideoRes = int(InfoLabel_GetInfoLabel("VideoPlayer.VideoResolution")) + iVideoRes = int(self.m_InfoLabels.GetInfoLabel("VideoPlayer.VideoResolution")) except: iVideoRes = int(0) try: - iScreenRes = int(InfoLabel_GetInfoLabel("System.ScreenHeight")) + iScreenRes = int(self.m_InfoLabels.GetInfoLabel("System.ScreenHeight")) except: iScreenRes = int(0) - if InfoLabel_PlayingLiveTV(): + if self.m_InfoLabels.PlayingLiveTV(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TV, True) - elif InfoLabel_IsInternetStream(): + elif self.m_InfoLabels.IsInternetStream(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_WEBCASTING, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MOVIE, True) @@ -628,7 +628,7 @@ def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_OUTFIT, True) elif isaudio: - if InfoLabel_IsInternetStream(): + if self.m_InfoLabels.IsInternetStream(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_WEBCASTING, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUSIC, True) @@ -636,17 +636,17 @@ def SetExtraInfoPlaying(self, isplaying, isvideo, isaudio): else: # not playing # Set active mode indicator based on current active window - iWindowID = InfoLabel_GetActiveWindowID() + iWindowID = self.m_InfoLabels.GetActiveWindowID() - if InfoLabel_IsWindowIDPVR(iWindowID): + if self.m_InfoLabels.IsWindowIDPVR(iWindowID): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TV, True) - elif InfoLabel_IsWindowIDVideo(iWindowID): + elif self.m_InfoLabels.IsWindowIDVideo(iWindowID): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MOVIE, True) - elif InfoLabel_IsWindowIDMusic(iWindowID): + elif self.m_InfoLabels.IsWindowIDMusic(iWindowID): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUSIC, True) - elif InfoLabel_IsWindowIDPictures(iWindowID): + elif self.m_InfoLabels.IsWindowIDPictures(iWindowID): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PHOTO, True) - elif InfoLabel_IsWindowIDWeather(iWindowID): + elif self.m_InfoLabels.IsWindowIDWeather(iWindowID): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_WEATHER, True) else: self.m_cExtraIcons.ClearIconStates(LCD_EXTRAICONCATEGORIES.LCD_ICONCAT_MODES) @@ -658,19 +658,19 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): iAudioChannels = 0 if isplaying: - if InfoLabel_IsPassthroughAudio(): + if self.m_InfoLabels.IsPassthroughAudio(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SPDIF, False) if isvideo: - strVideoCodec = str(InfoLabel_GetInfoLabel("VideoPlayer.VideoCodec")).lower() - strAudioCodec = str(InfoLabel_GetInfoLabel("VideoPlayer.AudioCodec")).lower() - iAudioChannels = InfoLabel_GetInfoLabel("VideoPlayer.AudioChannels") + strVideoCodec = str(self.m_InfoLabels.GetInfoLabel("VideoPlayer.VideoCodec")).lower() + strAudioCodec = str(self.m_InfoLabels.GetInfoLabel("VideoPlayer.AudioCodec")).lower() + iAudioChannels = self.m_InfoLabels.GetInfoLabel("VideoPlayer.AudioChannels") elif isaudio: strVideoCodec = "" - strAudioCodec = str(InfoLabel_GetInfoLabel("MusicPlayer.Codec")).lower() - iAudioChannels = InfoLabel_GetInfoLabel("MusicPlayer.Channels") + strAudioCodec = str(self.m_InfoLabels.GetInfoLabel("MusicPlayer.Codec")).lower() + iAudioChannels = self.m_InfoLabels.GetInfoLabel("MusicPlayer.Channels") if self.m_bWasStopped: self.m_bWasStopped = False @@ -777,7 +777,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_bWasStopped = True def SetExtraInfoGeneric(self, ispaused): - if InfoLabel_IsMuted(): + if self.m_InfoLabels.IsMuted(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUTE, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_MUTE, False) @@ -787,39 +787,39 @@ def SetExtraInfoGeneric(self, ispaused): else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PAUSE, False) - if InfoLabel_IsPVRRecording(): + if self.m_InfoLabels.IsPVRRecording(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_RECORD, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_RECORD, False) - if InfoLabel_IsPlaylistRandom(): + if self.m_InfoLabels.IsPlaylistRandom(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SHUFFLE, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_SHUFFLE, False) - if InfoLabel_IsPlaylistRepeatAny(): + if self.m_InfoLabels.IsPlaylistRepeatAny(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_REPEAT, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_REPEAT, False) - if InfoLabel_IsDiscInDrive(): + if self.m_InfoLabels.IsDiscInDrive(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_DISC_IN, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_DISC_IN, False) - if InfoLabel_IsScreenSaverActive(): + if self.m_InfoLabels.IsScreenSaverActive(): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TIME, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_TIME, False) - if InfoLabel_WindowIsActive(WINDOW_IDS.WINDOW_DIALOG_VOLUME_BAR): + if self.m_InfoLabels.WindowIsActive(WINDOW_IDS.WINDOW_DIALOG_VOLUME_BAR): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VOLUME, True) self.m_bVolumeChangeActive = True else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VOLUME, False) self.m_bVolumeChangeActive = False - if InfoLabel_WindowIsActive(WINDOW_IDS.WINDOW_DIALOG_KAI_TOAST): + if self.m_InfoLabels.WindowIsActive(WINDOW_IDS.WINDOW_DIALOG_KAI_TOAST): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ALARM, True) else: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ALARM, False) @@ -828,14 +828,14 @@ def SetExtraInfoBars(self, isplaying): for i in range(1, LCD_EXTRABARS_MAX + 1): if self.m_extraBars[i] == "progress": if isplaying: - self.m_cExtraIcons.SetBar(i, (InfoLabel_GetProgressPercent() * 100)) + self.m_cExtraIcons.SetBar(i, (self.m_InfoLabels.GetProgressPercent() * 100)) else: self.m_cExtraIcons.SetBar(i, 0) elif self.m_extraBars[i] == "volume": - self.m_cExtraIcons.SetBar(i, InfoLabel_GetVolumePercent()) + self.m_cExtraIcons.SetBar(i, self.m_InfoLabels.GetVolumePercent()) elif self.m_extraBars[i] == "volumehidden": if self.m_bVolumeChangeActive: - self.m_cExtraIcons.SetBar(i, InfoLabel_GetVolumePercent()) + self.m_cExtraIcons.SetBar(i, self.m_InfoLabels.GetVolumePercent()) else: self.m_cExtraIcons.SetBar(i, 0) elif self.m_extraBars[i] == "menu": @@ -849,11 +849,11 @@ def SetExtraInfoBars(self, isplaying): self.m_cExtraIcons.SetBar(i, 0) def SetExtraInformation(self): - bPaused = InfoLabel_IsPlayerPaused() - bPlaying = InfoLabel_IsPlayerPlaying() + bPaused = self.m_InfoLabels.IsPlayerPaused() + bPlaying = self.m_InfoLabels.IsPlayerPlaying() - bIsVideo = InfoLabel_PlayingVideo() - bIsAudio = InfoLabel_PlayingAudio() + bIsVideo = self.m_InfoLabels.PlayingVideo() + bIsAudio = self.m_InfoLabels.PlayingAudio() self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_PLAYING, bPlaying and not (bPaused and self.m_bDisablePlayIndicatorOnPause)) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 7601314..d78b6d0 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -423,12 +423,12 @@ def GetColumns(self): def GetBigDigitTime(self, mode): ret = "" - if InfoLabel_IsPlayerPlaying(): - if not (mode == LCD_MODE.LCD_MODE_SCREENSAVER and InfoLabel_IsPlayerPaused()): - ret = InfoLabel_GetPlayerTime()[-self.m_iBigDigits:] + if self.m_InfoLabels.IsPlayerPlaying(): + if not (mode == LCD_MODE.LCD_MODE_SCREENSAVER and self.m_InfoLabels.IsPlayerPaused()): + ret = self.m_InfoLabels.GetPlayerTime()[-self.m_iBigDigits:] if ret == "": # no usable timestring, e.g. not playing anything - strSysTime = InfoLabel_GetSystemTime() + strSysTime = self.m_InfoLabels.GetSystemTime() if self.m_iBigDigits >= 8: # return h:m:s ret = strSysTime @@ -492,10 +492,10 @@ def SetProgressBar(self, percent, pxWidth): return self.m_iProgressBarWidth def SetPlayingStateIcon(self): - bPlaying = InfoLabel_IsPlayerPlaying() - bPaused = InfoLabel_IsPlayerPaused() - bForwarding = InfoLabel_IsPlayerForwarding() - bRewinding = InfoLabel_IsPlayerRewinding() + bPlaying = self.m_InfoLabels.IsPlayerPlaying() + bPaused = self.m_InfoLabels.IsPlayerPaused() + bForwarding = self.m_InfoLabels.IsPlayerForwarding() + bRewinding = self.m_InfoLabels.IsPlayerRewinding() self.m_bstrIconName = b"STOP" @@ -537,8 +537,8 @@ def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): if iLine < 0 or iLine >= int(self.m_iRows): return - plTime = InfoLabel_GetPlayerTime() - plDuration = InfoLabel_GetPlayerDuration() + plTime = self.m_InfoLabels.GetPlayerTime() + plDuration = self.m_InfoLabels.GetPlayerDuration() ln = iLine + 1 bExtraForce = False drawLineText = False From 836909b8759e65c98402c90c4fabcd16e3466f96 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 30 Jun 2018 20:17:02 +0200 Subject: [PATCH 301/337] move the WINDOW_IDS value class to the common module Since Kodi window IDs might be used elsewhere, common is a better place to store this. --- resources/lib/common.py | 18 ++++++++++++++++++ resources/lib/infolabels.py | 19 +------------------ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/resources/lib/common.py b/resources/lib/common.py index 67c1c7e..5b3928b 100644 --- a/resources/lib/common.py +++ b/resources/lib/common.py @@ -45,6 +45,24 @@ LOGSEVERE = xbmc.LOGSEVERE LOGWARNING = xbmc.LOGWARNING +# interesting Kodi GUI Window IDs (no defines seem to exist for this) +class WINDOW_IDS: + WINDOW_WEATHER = 12600 + WINDOW_PVR = 10601 + WINDOW_PVR_MAX = 10699 + WINDOW_VIDEOS = 10006 + WINDOW_VIDEO_FILES = 10024 + WINDOW_VIDEO_NAV = 10025 + WINDOW_VIDEO_PLAYLIST = 10028 + WINDOW_MUSIC = 10005 + WINDOW_MUSIC_PLAYLIST = 10500 + WINDOW_MUSIC_FILES = 10501 + WINDOW_MUSIC_NAV = 10502 + WINDOW_MUSIC_PLAYLIST_EDITOR = 10503 + WINDOW_PICTURES = 10002 + WINDOW_DIALOG_VOLUME_BAR = 10104 + WINDOW_DIALOG_KAI_TOAST = 10107 + # log wrapper def log(loglevel, msg): xbmc.log("### [%s] - %s" % (KODI_ADDON_NAME, msg), level=loglevel) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 63805d3..12eb5e0 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -29,26 +29,9 @@ import xbmc import xbmcgui +from .common import WINDOW_IDS from .settings import * -# interesting Kodi GUI Window IDs (no defines seem to exist for this) -class WINDOW_IDS: - WINDOW_WEATHER = 12600 - WINDOW_PVR = 10601 - WINDOW_PVR_MAX = 10699 - WINDOW_VIDEOS = 10006 - WINDOW_VIDEO_FILES = 10024 - WINDOW_VIDEO_NAV = 10025 - WINDOW_VIDEO_PLAYLIST = 10028 - WINDOW_MUSIC = 10005 - WINDOW_MUSIC_PLAYLIST = 10500 - WINDOW_MUSIC_FILES = 10501 - WINDOW_MUSIC_NAV = 10502 - WINDOW_MUSIC_PLAYLIST_EDITOR = 10503 - WINDOW_PICTURES = 10002 - WINDOW_DIALOG_VOLUME_BAR = 10104 - WINDOW_DIALOG_KAI_TOAST = 10107 - class InfoLabels(): ######## From 539d7fb281ce296766d7653af21f80576ab81160 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 1 Jul 2018 15:14:53 +0200 Subject: [PATCH 302/337] cleanup and fix WINDOW_IDS WINDOW_VIDEOS, WINDOW_VIDEO_FILES, WINDOW_MUSIC and WINDOW_MUSIC_FILES even don't exist in Kodi anymore, and PVR goes from 10601 to 10799 by now. --- resources/lib/common.py | 6 +----- resources/lib/infolabels.py | 6 ++---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/resources/lib/common.py b/resources/lib/common.py index 5b3928b..3d4ad74 100644 --- a/resources/lib/common.py +++ b/resources/lib/common.py @@ -49,14 +49,10 @@ class WINDOW_IDS: WINDOW_WEATHER = 12600 WINDOW_PVR = 10601 - WINDOW_PVR_MAX = 10699 - WINDOW_VIDEOS = 10006 - WINDOW_VIDEO_FILES = 10024 + WINDOW_PVR_MAX = 10799 WINDOW_VIDEO_NAV = 10025 WINDOW_VIDEO_PLAYLIST = 10028 - WINDOW_MUSIC = 10005 WINDOW_MUSIC_PLAYLIST = 10500 - WINDOW_MUSIC_FILES = 10501 WINDOW_MUSIC_NAV = 10502 WINDOW_MUSIC_PLAYLIST_EDITOR = 10503 WINDOW_PICTURES = 10002 diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 12eb5e0..f9694a6 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -209,15 +209,13 @@ def IsWindowIDPVR(self, iWindowID): return False def IsWindowIDVideo(self, iWindowID): - if iWindowID in [WINDOW_IDS.WINDOW_VIDEOS, WINDOW_IDS.WINDOW_VIDEO_FILES, - WINDOW_IDS.WINDOW_VIDEO_NAV, WINDOW_IDS.WINDOW_VIDEO_PLAYLIST]: + if iWindowID in [WINDOW_IDS.WINDOW_VIDEO_NAV, WINDOW_IDS.WINDOW_VIDEO_PLAYLIST]: return True return False def IsWindowIDMusic(self, iWindowID): - if iWindowID in [WINDOW_IDS.WINDOW_MUSIC, WINDOW_IDS.WINDOW_MUSIC_PLAYLIST, - WINDOW_IDS.WINDOW_MUSIC_FILES, WINDOW_IDS.WINDOW_MUSIC_NAV, + if iWindowID in [WINDOW_IDS.WINDOW_MUSIC_PLAYLIST, WINDOW_IDS.WINDOW_MUSIC_NAV, WINDOW_IDS.WINDOW_MUSIC_PLAYLIST_EDITOR]: return True From d41da875510f4daac40037deb895437b55e3e480 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 1 Jul 2018 16:34:19 +0200 Subject: [PATCH 303/337] use xbmc.Monitor.waitForAbort() instead of time.sleep() in the main loop Instead of checking the abort condition and waiting separately, the logic can be simplified by just doing xbmc.Monitor.waitForAbort() in the while condition (besides, time.sleep() is discouraged in Kodi addons). --- resources/lib/xbmclcdproc.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/resources/lib/xbmclcdproc.py b/resources/lib/xbmclcdproc.py index 013d198..a16130a 100644 --- a/resources/lib/xbmclcdproc.py +++ b/resources/lib/xbmclcdproc.py @@ -93,7 +93,7 @@ def HandleConnectLCD(self): # RunLCD(): # Main loop, triggers data inquiry and rendering, handles setting changes and connection issues def RunLCD(self): - while not self._xbmcMonitor.abortRequested(): + while not self._xbmcMonitor.waitForAbort(1.0 / float(self._Settings.getRefreshRate())): if self.HandleConnectLCD(): settingsChanged = self._Settings.didSettingsChange() @@ -102,7 +102,4 @@ def RunLCD(self): self._LCDproc.Render(settingsChanged) - # refresh after configured rate - time.sleep(1.0 / float(self._Settings.getRefreshRate())) - self._LCDproc.Shutdown() From 39b224e0b301d8d925661e5e217d8add03d4feb1 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 1 Jul 2018 15:56:48 +0200 Subject: [PATCH 304/337] changelog/addon.xml: version 3.0.2 --- addon.xml | 11 +++++++---- changelog.txt | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/addon.xml b/addon.xml index 08cc29e..fb7e7f0 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -22,9 +22,12 @@ resources/icon.png - 3.0.1 -- Imports cleaned up -- Compatibility with Python 3 + 3.0.2 +- Refactored the main addon handling into class XBMCLCDproc() +- Refactored the settings and infolabels modules into classes +- fixed connection status popup handling logic +- Code/vars move and cleanup +- Window ID cleanup (fixes the extraicon triggers during navigation) diff --git a/changelog.txt b/changelog.txt index 3b4f785..6804893 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +3.0.2 +- Refactored the main addon handling into class XBMCLCDproc() +- Refactored the settings and infolabels modules into classes +- fixed connection status popup handling logic +- Code/vars move and cleanup +- Window ID cleanup (fixes the extraicon triggers during navigation) 3.0.1 - Imports cleaned up - Compatibility with Python 3 From 5e891c772eaaabfcaf417899d0721bd75d8d94a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Skalski?= Date: Tue, 28 Aug 2018 00:33:02 +0200 Subject: [PATCH 305/337] Update Polish translation Add translation for extension information, update displayed strings in configuration --- addon.xml | 2 ++ resources/language/resource.language.pl_pl/strings.po | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addon.xml b/addon.xml index fb7e7f0..1737df6 100644 --- a/addon.xml +++ b/addon.xml @@ -10,9 +10,11 @@ Displays configurable information e.g. about playing media or Kodi status on any LC/VF-display driven by LCDproc, and acts as direct drop-in replacement to the LCD/VFD-feature previously available in Kodi/XBMC's core. Supports additional display elements (icons, bars) on SoundGraph iMON LCD and Targa/Futaba mdm166a VFD hardware. Requires a properly configured and running LCDd either locally or somewhere on the network. Zeigt konfigurierbare Informationen z.B. über aktuelle Wiedergabe oder den Kodi Status auf beliebigen von LCDproc angesteuerten LC/VF-Displays, ersetzt die zuvor im Kodi/XBMC-Kern enthaltene LCD/VFD-Funktion. Unterstützt zusätzliche Elemente (Icons, Balken) von SoundGraph iMON LCD und Targa/Futaba mdm166a VFD Hardware. Benötigt einen konfigurierten, laufenden LCDd auf dem lokalen System oder im Netzwerk. Affiche des informations définies par configuration telles que le média en cours de lecture, l'état de Kodi... et ce sur tout type d'afficheur LC/VF géré par LCDProc. Remplace la fonctionnalité LCD/VFD précédemment disponible par défaut dans Kodi/XBMC. Gère des éléments supplémentaires (icônes, barres) sur les écrans SoundGraph iMON LCD et Targa/Futaba mdm166a VFD. Nécessite un serveur LCDd correctement configuré et disponible localement ou sur le réseau. + Wyświetla konfigurowalne informacje np. o odtwarzanych mediach oraz statusie Kodi na dowolnym wyświetlaczu LCD/VFD sterowanym poprzez LCDproc. Działa jako bezpośredni zamiennik funkcji wyświetlania na LCD/VFD poprzednio dostępnej w rdzeniu Kodi/XBMC. Wspiera wyświetlanie dodatkowych elementów (np. ikon stanu, linijek diodowych lub pasków postępu) na wyświetlaczach SoundGraph iMON (LCD) oraz Targa/Futaba mdm166a (VFD). Wymaga poprawnie skonfigurowanego i uruchomionego serwera LCDd albo lokalnie, albo gdzieś w sieci. Works with LCDproc only. Other LCD services like LCD4Linux or iMON Manager on Win32 are not supported. No liability taken for damaged hardware and/or software caused by this addon. Funktioniert ausschliesslich mit LCDproc. Andere LCD-Dienste wie LCD4Linux, iMON Manager unter Win32 u.a. sind nicht unterstützt. Keine Haftung für durch dieses Addon beschädigte Hard-/Software. Fonctionne uniquement avec LCDProc. Les services tels que LCD4Linux ou iMON Manager sur Win32 ne sont pas gérés. Nous déclinons toute responsabilité en cas de dégats survenus suite à l'utilisation de cette extension. + Działa wyłącznie z LCDproc. Inne usługi LCD jak LCD4Linux lub iMON Manager dla Win32 nie są obsługiwane. Nie ponosimy żadnej odpowiedzialności za uszkodzony sprzęt i/lub oprogramowanie spowodowane tym dodatkiem. GNU GENERAL PUBLIC LICENSE. Version 2, June 1991 all https://github.com/lcdproc/lcdproc diff --git a/resources/language/resource.language.pl_pl/strings.po b/resources/language/resource.language.pl_pl/strings.po index eee0225..afa8ead 100644 --- a/resources/language/resource.language.pl_pl/strings.po +++ b/resources/language/resource.language.pl_pl/strings.po @@ -60,7 +60,7 @@ msgstr "Podświetlenie" msgctxt "#32201" msgid "on screensaver" -msgstr "podczas działania wygaszacza ekrany" +msgstr "podczas działania wygaszacza ekranu" msgctxt "#32202" msgid "Dim on shutdown" @@ -80,7 +80,7 @@ msgstr "Opóźnienie (s)" msgctxt "#32206" msgid "Dim/turn off..." -msgstr "Przyciemnij/wyłącz:" +msgstr "Przyciemnij/wyłącz podświetlenie:" # empty strings from id 32207 to 32299 # Connection From 6c7748b79487c8e6f4f390b2fd8e03064b52cbfa Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 10 Sep 2018 20:08:14 +0200 Subject: [PATCH 306/337] pass "errors=ignore" to string.decode() in InfoLabels.GetInfoLabel() Prevents "UnicodeDecodeError: 'utf8' codec can't decode byte..." exceptions which may occur on some strings with unsupported or broken UTF-8 characters received from Kodi (i.e. stored in media metadata). --- resources/lib/infolabels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index f9694a6..793b3bb 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -54,7 +54,7 @@ def GetInfoLabel(self, strLabel): ret = xbmc.getInfoLabel(strLabel) # pre-py3 compat if self._py2compat: - return ret.decode("utf-8") + return ret.decode("utf-8", errors="ignore") return ret def GetBool(self, strBool): From 82b17693d8c69fb41aeafc725f221e4c6339f51c Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 10 Sep 2018 20:08:20 +0200 Subject: [PATCH 307/337] add videocodec strings, fix mp3 audiocodec evaluation Treat "hevc" as MPEG and "vc1" as WMV. Also, MP3 nowadays is reported as "mp3float", so check for this string. --- resources/lib/lcdbase.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 723595f..89ec5a7 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -690,7 +690,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): # returns the correct codec id. As the display is wrong for VC-1 only, # accept that the codec icon is right only in maybe 70-80% of all playback # cases. This needs fixing in XBMC! See http://trac.xbmc.org/ticket/13969 - if strVideoCodec in ["mpg", "mpeg", "mpeg2video", "h264", "x264", "mpeg4", "hdmv"]: + if strVideoCodec in ["mpg", "mpeg", "mpeg2video", "h264", "x264", "mpeg4", "hdmv", "hevc"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_MPEG, True) # any divx @@ -702,7 +702,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_XVID, True) # wmv and vc-1 - elif strVideoCodec in ["wmv", "wvc1", "vc-1"]: + elif strVideoCodec in ["wmv", "wvc1", "vc-1", "vc1"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_VCODEC_WMV, True) # anything else @@ -727,7 +727,7 @@ def SetExtraInfoCodecs(self, isplaying, isvideo, isaudio): self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_DTS, True) # mp3 - elif strAudioCodec == "mp3": + elif strAudioCodec in ["mp3", "mp3float"]: self.m_cExtraIcons.SetIconState(LCD_EXTRAICONS.LCD_EXTRAICON_ACODEC_MP3, True) # any ogg vorbis From dd1cc4d0066d0c16473b8a4c16db14b435454379 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 10 Sep 2018 20:31:45 +0200 Subject: [PATCH 308/337] changelog/addon.xml: version 3.0.3 --- addon.xml | 12 +++++------- changelog.txt | 4 ++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/addon.xml b/addon.xml index 1737df6..0263699 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -24,12 +24,10 @@ resources/icon.png - 3.0.2 -- Refactored the main addon handling into class XBMCLCDproc() -- Refactored the settings and infolabels modules into classes -- fixed connection status popup handling logic -- Code/vars move and cleanup -- Window ID cleanup (fixes the extraicon triggers during navigation) + 3.0.3 +- Polish translation update by mskalski (thanks!) +- Fixed a possible UTF8 conversion crash/exception +- Updated video/audiocodec strings for extraicon display diff --git a/changelog.txt b/changelog.txt index 6804893..6b5cff8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +3.0.3 +- Polish translation update by mskalski (thanks!) +- Fixed a possible UTF8 conversion crash/exception +- Updated video/audiocodec strings for extraicon display 3.0.2 - Refactored the main addon handling into class XBMCLCDproc() - Refactored the settings and infolabels modules into classes From 31d86c0adf0c21badd69b5a4ba7f68676f4d64fd Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 18 Sep 2018 22:15:03 +0200 Subject: [PATCH 309/337] addon.xml: add lang attribute to the summary tag --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 0263699..a80dd18 100644 --- a/addon.xml +++ b/addon.xml @@ -6,7 +6,7 @@ - Kodi/XBMC LCDproc + Kodi/XBMC LCDproc Displays configurable information e.g. about playing media or Kodi status on any LC/VF-display driven by LCDproc, and acts as direct drop-in replacement to the LCD/VFD-feature previously available in Kodi/XBMC's core. Supports additional display elements (icons, bars) on SoundGraph iMON LCD and Targa/Futaba mdm166a VFD hardware. Requires a properly configured and running LCDd either locally or somewhere on the network. Zeigt konfigurierbare Informationen z.B. über aktuelle Wiedergabe oder den Kodi Status auf beliebigen von LCDproc angesteuerten LC/VF-Displays, ersetzt die zuvor im Kodi/XBMC-Kern enthaltene LCD/VFD-Funktion. Unterstützt zusätzliche Elemente (Icons, Balken) von SoundGraph iMON LCD und Targa/Futaba mdm166a VFD Hardware. Benötigt einen konfigurierten, laufenden LCDd auf dem lokalen System oder im Netzwerk. Affiche des informations définies par configuration telles que le média en cours de lecture, l'état de Kodi... et ce sur tout type d'afficheur LC/VF géré par LCDProc. Remplace la fonctionnalité LCD/VFD précédemment disponible par défaut dans Kodi/XBMC. Gère des éléments supplémentaires (icônes, barres) sur les écrans SoundGraph iMON LCD et Targa/Futaba mdm166a VFD. Nécessite un serveur LCDd correctement configuré et disponible localement ou sur le réseau. From 5d884c567c06f94710d2ec9ee79ea89830c8d1ef Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Mar 2019 10:05:01 +0100 Subject: [PATCH 310/337] py2compat: make sure linetexts are encoded as UTF-8 Parsing LCD.xml may result in lines with text being encoded in something else (most likely ascii) than utf-8, which, when special characters are present in LCD.xml, results in character encoding exceptions. As this shouldn't happen with python3 anymore, add a py2 compat workaround that will encode any line text into utf-8. Fixes https://github.com/herrnst/script.xbmc.lcdproc/issues/54 reported by grzechj. --- resources/lib/lcdbase.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 89ec5a7..6faca10 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -395,7 +395,10 @@ def LoadMode(self, node, mode): linetext = "" else: # prepare text line for XBMC's expected encoding - linetext = line.text.strip() + if self.m_InfoLabels._py2compat: + linetext = line.text.strip().encode("utf-8", errors="ignore") + else: + linetext = line.text.strip() # make sure linetext has something so re.match won't fail if linetext != "": From 816430a9e0f938d7ef06d96005bd32d24afe66c0 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sat, 2 Mar 2019 10:12:40 +0100 Subject: [PATCH 311/337] cosmetics: fix a comment indent in infolabels.py --- resources/lib/infolabels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 793b3bb..90b5cb9 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -64,7 +64,7 @@ def GetActiveWindowID(self): return int(xbmcgui.getCurrentWindowId()) def timeToSecs(self, timeAr): - # initialise return + # initialise return currentSecs = 0 arLen = len(timeAr) From 5127a4e9f2e563807ce28522cbb1c2b734b5aa23 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 7 Mar 2019 23:51:01 +0100 Subject: [PATCH 312/337] changelog/addon.xml: version 3.0.4 --- addon.xml | 8 +++----- changelog.txt | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addon.xml b/addon.xml index a80dd18..7609d96 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -24,10 +24,8 @@ resources/icon.png - 3.0.3 -- Polish translation update by mskalski (thanks!) -- Fixed a possible UTF8 conversion crash/exception -- Updated video/audiocodec strings for extraicon display + 3.0.4 +- Fix possible exception due to improper LCD.xml handling diff --git a/changelog.txt b/changelog.txt index 6b5cff8..ec199cc 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,5 @@ +3.0.4 +- Fix possible exception due to improper LCD.xml handling 3.0.3 - Polish translation update by mskalski (thanks!) - Fixed a possible UTF8 conversion crash/exception From 5a5c37e64836e8e0816e8f872d2eeafd3e262a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Skalski?= Date: Tue, 11 Sep 2018 07:41:52 +0200 Subject: [PATCH 313/337] Add setting to display clock using 3,4,5 or 6 big digits Allows to specify shorter format for lage (>16 columns) displays --- .../resource.language.de_de/strings.po | 28 +++++++++++++++++-- .../resource.language.en_gb/strings.po | 27 ++++++++++++++++-- .../resource.language.fr_fr/strings.po | 28 +++++++++++++++++-- .../resource.language.pl_pl/strings.po | 27 ++++++++++++++++-- resources/lib/infolabels.py | 2 +- resources/lib/settings.py | 20 +++++++++++++ resources/settings.xml | 1 + 7 files changed, 124 insertions(+), 9 deletions(-) diff --git a/resources/language/resource.language.de_de/strings.po b/resources/language/resource.language.de_de/strings.po index dfb8006..63f5c00 100644 --- a/resources/language/resource.language.de_de/strings.po +++ b/resources/language/resource.language.de_de/strings.po @@ -51,7 +51,12 @@ msgctxt "#32107" msgid "Support for extra display elements (e.g. icons)" msgstr "Zusatzdisplayelemente (z.B. Icons) unterstützen" -# empty strings from id 32108 to 32199 +msgctxt "#32108" +msgid "System time format" +msgstr "Systemzeitformat" + + +# empty strings from id 32109 to 32199 # Backlight msgctxt "#32200" @@ -151,7 +156,26 @@ msgctxt "#32417" msgid "HD44780-ROM A02" msgstr "HD44780-ROM A02" -# empty strings from id 32418 to 32499 +# empty strings from id 32418 to 32420 +# Enum values: System time format + +msgctxt "#32421" +msgid "H:MM" +msgstr "" + +msgctxt "#32422" +msgid "HH:MM" +msgstr "" + +msgctxt "#32423" +msgid "H:MM:SS" +msgstr "" + +msgctxt "#32424" +msgid "HH:MM:SS" +msgstr "" + +# empty strings from id 32425 to 32499 # Notifications msgctxt "#32500" diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 4a19d57..eb6bfe5 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -51,7 +51,11 @@ msgctxt "#32107" msgid "Support for extra display elements (e.g. icons)" msgstr "" -# empty strings from id 32108 to 32199 +msgctxt "#32108" +msgid "System time format" +msgstr "" + +# empty strings from id 32109 to 32199 # Backlight msgctxt "#32200" @@ -151,7 +155,26 @@ msgctxt "#32417" msgid "HD44780-ROM A02" msgstr "" -# empty strings from id 32418 to 32499 +# empty strings from id 32418 to 32420 +# Enum values: System time format + +msgctxt "#32421" +msgid "H:MM" +msgstr "" + +msgctxt "#32422" +msgid "HH:MM" +msgstr "" + +msgctxt "#32423" +msgid "H:MM:SS" +msgstr "" + +msgctxt "#32424" +msgid "HH:MM:SS" +msgstr "" + +# empty strings from id 32425 to 32499 # Notifications msgctxt "#32500" diff --git a/resources/language/resource.language.fr_fr/strings.po b/resources/language/resource.language.fr_fr/strings.po index a5cb2f5..d67442f 100644 --- a/resources/language/resource.language.fr_fr/strings.po +++ b/resources/language/resource.language.fr_fr/strings.po @@ -50,7 +50,11 @@ msgctxt "#32107" msgid "Support for extra display elements (e.g. icons)" msgstr "Gestion des éléments d'affichage supplémentaires (ex. icônes)" -# empty strings from id 32108 to 32199 +msgctxt "#32108" +msgid "System time format" +msgstr "Format de l'heure système" + +# empty strings from id 32109 to 32199 # Backlight msgctxt "#32200" msgid "Backlight" @@ -146,8 +150,28 @@ msgctxt "#32417" msgid "HD44780-ROM A02" msgstr "HD44780-ROM A02" -# empty strings from id 32418 to 32499 +# empty strings from id 32418 to 32420 +# Enum values: System time format + +msgctxt "#32421" +msgid "H:MM" +msgstr "" + +msgctxt "#32422" +msgid "HH:MM" +msgstr "" + +msgctxt "#32423" +msgid "H:MM:SS" +msgstr "" + +msgctxt "#32424" +msgid "HH:MM:SS" +msgstr "" + +# empty strings from id 32425 to 32499 # Notifications + msgctxt "#32500" msgid "Failed to connect to LCDProc!" msgstr "Échec lors de la connexion à LCDProc !" diff --git a/resources/language/resource.language.pl_pl/strings.po b/resources/language/resource.language.pl_pl/strings.po index afa8ead..62b2fe8 100644 --- a/resources/language/resource.language.pl_pl/strings.po +++ b/resources/language/resource.language.pl_pl/strings.po @@ -51,7 +51,11 @@ msgctxt "#32107" msgid "Support for extra display elements (e.g. icons)" msgstr "Wsparcie dla dodatkowych elementów wyświetlających (np. ikon)" -# empty strings from id 32108 to 32199 +msgctxt "#32108" +msgid "System time format" +msgstr "Format czasu systemowego" + +# empty strings from id 32109 to 32199 # Backlight msgctxt "#32200" @@ -151,7 +155,26 @@ msgctxt "#32417" msgid "HD44780-ROM A02" msgstr "HD44780-ROM A02" -# empty strings from id 32418 to 32499 +# empty strings from id 32418 to 32420 +# Enum values: System time format + +msgctxt "#32421" +msgid "H:MM" +msgstr "" + +msgctxt "#32422" +msgid "HH:MM" +msgstr "" + +msgctxt "#32423" +msgid "H:MM:SS" +msgstr "" + +msgctxt "#32424" +msgid "HH:MM:SS" +msgstr "" + +# empty strings from id 32425 to 32499 # Notifications msgctxt "#32500" diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 90b5cb9..0c15375 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -102,7 +102,7 @@ def GetSystemTime(self): # apply some split magic for 12h format here, as "hh:mm:ss" # makes up for format guessing inside XBMC - fix for post-frodo at # https://github.com/xbmc/xbmc/pull/2321 - ret = "0" + self.GetInfoLabel("System.Time(hh:mm:ss)").split(" ")[0] + ret = self.GetInfoLabel("System.Time(%s)" % self._settings.getSysTimeFormat()).split(" ")[0] return ret[-8:] def GetPlayerTime(self): diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 6285c2b..90e9754 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -49,6 +49,7 @@ def __init__(self): self._usealternatecharset = False self._charset = "iso-8859-1" self._useextraelements = True + self._systimeformat = 3 def getHostIp(self): return self._hostip @@ -97,6 +98,20 @@ def getRefreshRate(self): def getHideConnPopups(self): return self._hideconnpopups + def getSysTimeFormat(self): + # make sure to keep this in sync with settings.xml! + ret = "HH:mm:ss" + if self._systimeformat == "0": + ret = "H:mm" + elif self._systimeformat == "1": + ret = "HH:mm" + elif self._systimeformat == "2": + ret = "H:mm:ss" + elif self._systimeformat == "3": + ret = "HH:mm:ss" + + return ret + def getCharset(self): ret = "" @@ -197,6 +212,7 @@ def handleLcdSettings(self): hideconnpopups = KODI_ADDON_SETTINGS.getSetting("hideconnpopups") == "true" usealternatecharset = KODI_ADDON_SETTINGS.getSetting("usealternatecharset") == "true" charset = KODI_ADDON_SETTINGS.getSetting("charset") + systimeformat = KODI_ADDON_SETTINGS.getSetting("systimeformat") if self._scrolldelay != scrolldelay: self._scrolldelay = scrolldelay @@ -250,6 +266,10 @@ def handleLcdSettings(self): self._charset = charset self._settingsChanged = True + if self._systimeformat != systimeformat: + self._systimeformat = systimeformat + self._settingsChanged = True + # handles all settings and applies them as needed # returns if a reconnect is needed due to settings changes def setup(self): diff --git a/resources/settings.xml b/resources/settings.xml index 2b006e8..b8d154a 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -10,6 +10,7 @@ + From 0ef4c785e10dd484d8cbd9fa26d16670815edca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Skalski?= Date: Sat, 3 Nov 2018 00:03:23 +0100 Subject: [PATCH 314/337] BigClock: fix not updating last digit if digits start offset change When in BigClock mode and start offset changed (for example if clock is centered and total number of digits gets smaller) extra digits were not cleared due to bug. The problem was that ClearBigDigits() cleared previous internal state, so when extra digits should be cleared, internal state (in self.m_strDigits[]) was already cleared for them, so commands for removing digits from screen were not executed. Fixed by removing call to ClearBigDigits() and marked forced update necessary. --- resources/lib/lcdproc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index d78b6d0..2fed7fa 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -458,8 +458,8 @@ def SetBigDigits(self, strTimeString, bForceUpdate): iOffset = 1; if self.m_iOffset != iOffset: - # on offset change, reset numbers (only) to force redraw - self.ClearBigDigits(False) + # on offset change force redraw + bForceUpdate = True self.m_iOffset = iOffset for i in range(int(iStringOffset), int(iStringLength)): From 4951539baf3267761ab925dd1cefbbdf07c8b5bc Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 28 Mar 2019 19:29:24 +0100 Subject: [PATCH 315/337] changelog/addon.xml: version 3.0.5 --- addon.xml | 6 +++--- changelog.txt | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addon.xml b/addon.xml index 7609d96..f3561d6 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -24,8 +24,8 @@ resources/icon.png - 3.0.4 -- Fix possible exception due to improper LCD.xml handling + 3.0.5 +- selectable BigDigit clock format by mskalski (thanks!) diff --git a/changelog.txt b/changelog.txt index ec199cc..fe6a7dd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,5 @@ +3.0.5 +- selectable BigDigit clock format by mskalski (thanks!) 3.0.4 - Fix possible exception due to improper LCD.xml handling 3.0.3 From fc6d1698e39d62ab7fe2ef025b95c1930e58a700 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 28 Mar 2019 23:29:10 +0100 Subject: [PATCH 316/337] addon.xml: bump xbmc.python dependency to 2.26.0 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index f3561d6..1decbca 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ - + From cf7f770e013422a2d16188edd48be81204461bf8 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 22 Oct 2019 16:56:17 +0200 Subject: [PATCH 317/337] Remove all py2/3 compat switches and bump version to 3.90.0 Also, bump the minimum xbmc.python compat to 3.0.0 --- addon.xml | 8 ++++---- resources/lib/infolabels.py | 11 +---------- resources/lib/lcdbase.py | 5 +---- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/addon.xml b/addon.xml index 1decbca..920308c 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ - + - + @@ -24,8 +24,8 @@ resources/icon.png - 3.0.5 -- selectable BigDigit clock format by mskalski (thanks!) + 3.90.0 +- XBMC LCDproc for Kodi Matrix (Python 3) diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 0c15375..4848974 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -45,17 +45,8 @@ def __init__(self, settings): self._nav_oldsubmenu = "" self._navtimer = time.time() - # pre-py3 compat - self._py2compat = False - if sys.version_info.major < 3: - self._py2compat = True - def GetInfoLabel(self, strLabel): - ret = xbmc.getInfoLabel(strLabel) - # pre-py3 compat - if self._py2compat: - return ret.decode("utf-8", errors="ignore") - return ret + return xbmc.getInfoLabel(strLabel) def GetBool(self, strBool): return xbmc.getCondVisibility(strBool) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 6faca10..89ec5a7 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -395,10 +395,7 @@ def LoadMode(self, node, mode): linetext = "" else: # prepare text line for XBMC's expected encoding - if self.m_InfoLabels._py2compat: - linetext = line.text.strip().encode("utf-8", errors="ignore") - else: - linetext = line.text.strip() + linetext = line.text.strip() # make sure linetext has something so re.match won't fail if linetext != "": From e27d9f357897c5d423d0da8bf2a0bb66e3467957 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 22 Oct 2019 17:21:29 +0200 Subject: [PATCH 318/337] lcdproc: support protocol 0.4 Current LCDproc GIT master carries some protocol changes which will likely be declared as protocol version 0.4 in the next tagged version (at least this is what "hello" reports at the moment). Since there are no incompatible changes at this time (some relaxed menu item handling and a new pbar widget), make XBMC LCDproc run with protocol version 0.4 for now. Closes https://github.com/herrnst/script.xbmc.lcdproc/issues/55 --- resources/lib/lcdproc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 2fed7fa..57855ca 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -286,9 +286,9 @@ def Connect(self): if lcdinfo is None: return False - # protocol version must currently be 0.3 - if float(lcdinfo.group(1)) != 0.3: - log(LOGERROR, "Only LCDproc protocol 0.3 supported (got " + lcdinfo.group(1) +")") + # protocol version must currently either be 0.3 or 0.4 + if float(lcdinfo.group(1)) not in [0.3, 0.4]: + log(LOGERROR, "Only LCDproc protocols 0.3 and 0.4 supported (got " + lcdinfo.group(1) +")") return False # set up class vars From a65093fd704bcc76e20c0342c95f5e3371ddb5c6 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Thu, 21 Nov 2019 16:52:05 +0100 Subject: [PATCH 319/337] changelog/addon.xml: add missing changelog lines Changelogs didn't have the information regarding LCDproc protocol version 0.4 yet. --- addon.xml | 1 + changelog.txt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/addon.xml b/addon.xml index 920308c..2861c9e 100644 --- a/addon.xml +++ b/addon.xml @@ -26,6 +26,7 @@ 3.90.0 - XBMC LCDproc for Kodi Matrix (Python 3) +- Allow LCDproc protocol version 0.4 diff --git a/changelog.txt b/changelog.txt index fe6a7dd..b930769 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +3.90.0 +- XBMC LCDproc for Kodi Matrix (Python 3) +- Allow LCDproc protocol version 0.4 3.0.5 - selectable BigDigit clock format by mskalski (thanks!) 3.0.4 From 80794ac0677f57608f7cf7178ea6bff1e8a0dc90 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 16 Sep 2020 18:22:11 +0200 Subject: [PATCH 320/337] remove and replace LOGNOTICE and LOGSEVERE log levels LOGNOTICE and LOGSEVERE log levels were removed from Kodi as of https://github.com/xbmc/xbmc/pull/18346, so remove and replace all occurences from script.xbmc.lcdproc aswell, using LOGINFO for LOGNOTICE (LOGSEVERE wasn't used besides the definition in common.py at all). Closes https://github.com/herrnst/script.xbmc.lcdproc/issues/58. --- resources/lib/common.py | 2 -- resources/lib/lcdbase.py | 6 +++--- resources/lib/lcdproc.py | 12 ++++++------ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/resources/lib/common.py b/resources/lib/common.py index 3d4ad74..fb11efa 100644 --- a/resources/lib/common.py +++ b/resources/lib/common.py @@ -41,8 +41,6 @@ LOGFATAL = xbmc.LOGFATAL LOGINFO = xbmc.LOGINFO LOGNONE = xbmc.LOGNONE -LOGNOTICE = xbmc.LOGNOTICE -LOGSEVERE = xbmc.LOGSEVERE LOGWARNING = xbmc.LOGWARNING # interesting Kodi GUI Window IDs (no defines seem to exist for this) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 89ec5a7..cdb9efc 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -179,7 +179,7 @@ def ManageLCDXML(self): else: try: shutil.copy2(__lcddefaultxml__, __lcdxml__) - log(LOGNOTICE, "Initialised LCD.xml from defaults") + log(LOGINFO, "Initialised LCD.xml from defaults") ret = True except: log(LOGERROR, "Failed to copy LCD defaults!") @@ -234,7 +234,7 @@ def LoadSkin(self, xmlFile, doReset): bHaveSkin = False - log(LOGNOTICE, "Loading settings from %s" % (xmlFile)) + log(LOGINFO, "Loading settings from %s" % (xmlFile)) try: doc = xmltree.parse(xmlFile) @@ -453,7 +453,7 @@ def Reset(self): self.m_lcdMode[i] = [] #clear list def Shutdown(self): - log(LOGNOTICE, "Shutting down") + log(LOGINFO, "Shutting down") if self.m_Settings.getDimOnShutdown(): self.SetBackLight(0) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 57855ca..039d85f 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -235,13 +235,13 @@ def DetermineExtraSupport(self): # When the LCDd driver doesn't supply a valid string, inform and return if reply == "": - log(LOGNOTICE, "Empty driver information reply") + log(LOGINFO, "Empty driver information reply") return - log(LOGNOTICE, "Driver information reply: " + reply) + log(LOGINFO, "Driver information reply: " + reply) if re.match(rematch_imon, reply): - log(LOGNOTICE, "SoundGraph iMON LCD detected") + log(LOGINFO, "SoundGraph iMON LCD detected") if bUseExtraIcons: self.m_cExtraIcons = LCDproc_extra_imon() @@ -250,12 +250,12 @@ def DetermineExtraSupport(self): self.m_iBigDigits = 7 elif re.match(rematch_mdm166a, reply): - log(LOGNOTICE, "Futaba/Targa USB mdm166a VFD detected") + log(LOGINFO, "Futaba/Targa USB mdm166a VFD detected") if bUseExtraIcons: self.m_cExtraIcons = LCDproc_extra_mdm166a() elif re.match(rematch_imonvfd, reply): - log(LOGNOTICE, "SoundGraph iMON IR/VFD detected") + log(LOGINFO, "SoundGraph iMON IR/VFD detected") if self.m_cExtraIcons is not None: self.m_cExtraIcons.Initialize() @@ -298,7 +298,7 @@ def Connect(self): self.m_iCellHeight = int(lcdinfo.group(5)) # tell users what's going on - log(LOGNOTICE, "Connected to LCDd at %s:%s, Protocol version %s - Geometry %sx%s characters (%sx%s pixels, %sx%s pixels per character)" % (str(ip), str(port), float(lcdinfo.group(1)), str(self.m_iColumns), str(self.m_iRows), str(self.m_iColumns * self.m_iCellWidth), str(self.m_iRows * self.m_iCellHeight), str(self.m_iCellWidth), str(self.m_iCellHeight))) + log(LOGINFO, "Connected to LCDd at %s:%s, Protocol version %s - Geometry %sx%s characters (%sx%s pixels, %sx%s pixels per character)" % (str(ip), str(port), float(lcdinfo.group(1)), str(self.m_iColumns), str(self.m_iRows), str(self.m_iColumns * self.m_iCellWidth), str(self.m_iRows * self.m_iCellHeight), str(self.m_iCellWidth), str(self.m_iCellHeight))) # Set up BigNum values based on display geometry if self.m_iColumns < 13: From c38af90550147b0b19a91b9239901df54414a279 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 16 Sep 2020 19:02:50 +0200 Subject: [PATCH 321/337] use translatePath from xbmcvfs instead of xbmc "xbmc.translatePath is deprecated and might be removed in future kodi versions. Please use xbmcvfs.translatePath instead." --- resources/lib/lcdbase.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index cdb9efc..bcd5155 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -29,7 +29,7 @@ from xml.etree import ElementTree as xmltree from array import array -import xbmc +import xbmcvfs import xbmcgui from .common import * @@ -38,8 +38,8 @@ from .infolabels import * from .charset_hd44780 import * -__lcdxml__ = xbmc.translatePath(os.path.join("special://masterprofile", "LCD.xml")) -__lcddefaultxml__ = xbmc.translatePath(os.path.join(KODI_ADDON_ROOTPATH, "resources", "LCD.xml.defaults")) +__lcdxml__ = xbmcvfs.translatePath(os.path.join("special://masterprofile", "LCD.xml")) +__lcddefaultxml__ = xbmcvfs.translatePath(os.path.join(KODI_ADDON_ROOTPATH, "resources", "LCD.xml.defaults")) class LCD_MODE: LCD_MODE_GENERAL = 0 From 01a2ba76f0841a2e313c9e1a676538f1ffe30a36 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 16 Sep 2020 19:06:25 +0200 Subject: [PATCH 322/337] changelog/addon.xml: version 3.90.1 --- addon.xml | 8 ++++---- changelog.txt | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/addon.xml b/addon.xml index 2861c9e..e06a958 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -24,9 +24,9 @@ resources/icon.png - 3.90.0 -- XBMC LCDproc for Kodi Matrix (Python 3) -- Allow LCDproc protocol version 0.4 + 3.90.1 +- replace LOGNOTICE with LOGINFO, remove LOGSEVERE +- use translatePath from xbmcvfs instead of xbmc diff --git a/changelog.txt b/changelog.txt index b930769..a8eb388 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +3.90.1 +- replace LOGNOTICE with LOGINFO, remove LOGSEVERE +- use translatePath from xbmcvfs instead of xbmc 3.90.0 - XBMC LCDproc for Kodi Matrix (Python 3) - Allow LCDproc protocol version 0.4 From 594f678ecdf6fe2288d94a62b12151f5c137cc41 Mon Sep 17 00:00:00 2001 From: BlackEagle Date: Sun, 28 Feb 2021 18:09:00 +0100 Subject: [PATCH 323/337] replace getiterator with iter getiterator was deprecated but now already removed in python 3.9.x, iter should work for pyton 3.x versions Signed-off-by: BlackEagle --- resources/lib/lcdbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index bcd5155..44be542 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -247,7 +247,7 @@ def LoadSkin(self, xmlFile, doReset): log(LOGERROR, "Parsing of %s failed" % (xmlFile)) return False - for element in doc.getiterator(): + for element in doc.iter(): #PARSE LCD infos if element.tag == "lcd": # load our settings From 5b3aa5259824a0fc4be0def5c0b3e3f8cb2cb5b4 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 10 May 2021 07:43:19 +0200 Subject: [PATCH 324/337] changelog/addon.xml: version 3.90.2 --- addon.xml | 7 +++---- changelog.txt | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addon.xml b/addon.xml index e06a958..6037000 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -24,9 +24,8 @@ resources/icon.png - 3.90.1 -- replace LOGNOTICE with LOGINFO, remove LOGSEVERE -- use translatePath from xbmcvfs instead of xbmc + 3.90.2 +- fix compatibility with Python 3.9+ diff --git a/changelog.txt b/changelog.txt index a8eb388..c636612 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,5 @@ +3.90.2 +- fix compatibility with Python 3.9 3.90.1 - replace LOGNOTICE with LOGINFO, remove LOGSEVERE - use translatePath from xbmcvfs instead of xbmc From a66e1e363fbce51c6d00c59f0db5bd389fa49836 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 2 May 2022 11:09:36 +0200 Subject: [PATCH 325/337] Replace hyphens in the HD44780 charset map names to underscore From the Python docs: "Changed in version 3.9: Hyphens and spaces are converted to underscore." Fixes throwing a Python exception when activating the alternative HD44780 character mapping. Fixes/Closes https://github.com/herrnst/script.xbmc.lcdproc/issues/65 --- resources/lib/charset_hd44780.py | 8 ++++---- resources/lib/lcdbase.py | 2 +- resources/lib/settings.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/resources/lib/charset_hd44780.py b/resources/lib/charset_hd44780.py index 98c1aea..dab379d 100644 --- a/resources/lib/charset_hd44780.py +++ b/resources/lib/charset_hd44780.py @@ -53,9 +53,9 @@ class HD44780_StreamReader(HD44780_Codec,codecs.StreamReader): pass def charset_hd44780(name): - if name == "hd44780-a00": + if name == "hd44780_a00": return codecs.CodecInfo( - name = "hd44780-a00", + name = "hd44780_a00", encode = HD44780_Codec().encode_a00, decode = HD44780_Codec().decode, incrementalencoder = HD44780_IncrementalEncoder_a00, @@ -63,9 +63,9 @@ def charset_hd44780(name): streamreader = HD44780_StreamReader, streamwriter = HD44780_StreamWriter, ) - elif name == "hd44780-a02": + elif name == "hd44780_a02": return codecs.CodecInfo( - name = "hd44780-a02", + name = "hd44780_a02", encode = HD44780_Codec().encode_a02, decode = HD44780_Codec().decode, incrementalencoder = HD44780_IncrementalEncoder_a02, diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 44be542..e11837c 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -220,7 +220,7 @@ def Initialize(self): def UpdateGUISettings(self): str_charset = self.m_Settings.getCharset() if str_charset != self.m_strLCDEncoding: - if (str_charset == "hd44780-a00" or str_charset == "hd44780-a02") and not self.m_bHaveHD44780Charmap: + if (str_charset == "hd44780_a00" or str_charset == "hd44780_a02") and not self.m_bHaveHD44780Charmap: str_charset = "iso8859-1" self.m_strLCDEncoding = str_charset diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 90e9754..d8fa2af 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -129,9 +129,9 @@ def getCharset(self): elif self._charset == "4": ret = "iso-8859-5" elif self._charset == "5": - ret = "hd44780-a00" + ret = "hd44780_a00" elif self._charset == "6": - ret = "hd44780-a02" + ret = "hd44780_a02" else: ret = "iso-8859-1" From bb8d7d6995666b6a1de5242588ca6395a1dc2419 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 2 May 2022 11:15:24 +0200 Subject: [PATCH 326/337] Use passed name directly when registering charset codecs Use the passed name for registration instead of repeating the name. Also, make the variable names less ambiguous. --- resources/lib/charset_hd44780.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/lib/charset_hd44780.py b/resources/lib/charset_hd44780.py index dab379d..91c686f 100644 --- a/resources/lib/charset_hd44780.py +++ b/resources/lib/charset_hd44780.py @@ -52,10 +52,10 @@ class HD44780_StreamWriter(HD44780_Codec,codecs.StreamWriter): class HD44780_StreamReader(HD44780_Codec,codecs.StreamReader): pass -def charset_hd44780(name): - if name == "hd44780_a00": +def charset_hd44780(mapname): + if mapname == "hd44780_a00": return codecs.CodecInfo( - name = "hd44780_a00", + name = mapname, encode = HD44780_Codec().encode_a00, decode = HD44780_Codec().decode, incrementalencoder = HD44780_IncrementalEncoder_a00, @@ -63,9 +63,9 @@ def charset_hd44780(name): streamreader = HD44780_StreamReader, streamwriter = HD44780_StreamWriter, ) - elif name == "hd44780_a02": + elif mapname == "hd44780_a02": return codecs.CodecInfo( - name = "hd44780_a02", + name = mapname, encode = HD44780_Codec().encode_a02, decode = HD44780_Codec().decode, incrementalencoder = HD44780_IncrementalEncoder_a02, From 34cb257dfcae88494750322e45fb232687356120 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Wed, 4 May 2022 08:44:36 +0200 Subject: [PATCH 327/337] changelog/addon.xml: version 4.0.0 --- addon.xml | 6 +++--- changelog.txt | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addon.xml b/addon.xml index 6037000..e588456 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -24,8 +24,8 @@ resources/icon.png - 3.90.2 -- fix compatibility with Python 3.9+ + 4.0.0 +- fix Python exception when using the HD44780 character encodings/translation maps diff --git a/changelog.txt b/changelog.txt index c636612..ee06f32 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,5 @@ +4.0.0 +- fix Python exception when using the HD44780 character encodings/translation maps 3.90.2 - fix compatibility with Python 3.9 3.90.1 From b7d0f319b125cd9ead59e2c423a5be069bf5c607 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 4 Feb 2024 23:19:33 +0100 Subject: [PATCH 328/337] Update copyright year, clean up boilerplates Update copyright to 2024 everywhere. Also, replace the GPLv2 license boiler plate text with a SPDX-License-Identifier (which may help elsewhere anyway). --- README.md | 2 +- main.py | 33 ++++++----------------- resources/lib/charset_hd44780.py | 29 ++++++-------------- resources/lib/charset_map_hd44780_a00.py | 29 ++++++-------------- resources/lib/charset_map_hd44780_a02.py | 29 ++++++-------------- resources/lib/common.py | 33 ++++++----------------- resources/lib/extraicons.py | 32 ++++++---------------- resources/lib/infolabels.py | 32 ++++++---------------- resources/lib/lcdbase.py | 28 +++++-------------- resources/lib/lcdproc.py | 28 +++++-------------- resources/lib/lcdproc_extra_base.py | 32 ++++++---------------- resources/lib/lcdproc_extra_imon.py | 34 +++++++----------------- resources/lib/lcdproc_extra_mdm166a.py | 34 +++++++----------------- resources/lib/settings.py | 28 +++++-------------- resources/lib/xbmclcdproc.py | 33 ++++++----------------- 15 files changed, 109 insertions(+), 327 deletions(-) diff --git a/README.md b/README.md index 69ae5af..d2d142a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Kodi (XBMC) LCDproc Python addon ================================= -Copyright (C) 2012-2018 Team Kodi, Daniel 'herrnst' Scheller +Copyright (C) 2012-2024 Team Kodi, Daniel 'herrnst' Scheller Based on initial work (C) 2012 Memphiz/Team Kodi (formerly Team XBMC) LCDproc support for Kodi implemented in Python, direct drop-in replacement for diff --git a/main.py b/main.py index 1b96edd..bae5480 100644 --- a/main.py +++ b/main.py @@ -1,28 +1,11 @@ -''' - XBMC LCDproc addon - - Addon entry point - - Copyright (C) 2012-2018 Team Kodi - Copyright (C) 2012-2018 Daniel 'herrnst' Scheller - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# +# Addon entry point +# from resources.lib.xbmclcdproc import XBMCLCDproc diff --git a/resources/lib/charset_hd44780.py b/resources/lib/charset_hd44780.py index 91c686f..a81cd18 100644 --- a/resources/lib/charset_hd44780.py +++ b/resources/lib/charset_hd44780.py @@ -1,24 +1,11 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012-2018 Team Kodi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# +# HD44780 charset codec +# import codecs from .charset_map_hd44780_a00 import * diff --git a/resources/lib/charset_map_hd44780_a00.py b/resources/lib/charset_map_hd44780_a00.py index e185c78..76b9afc 100644 --- a/resources/lib/charset_map_hd44780_a00.py +++ b/resources/lib/charset_map_hd44780_a00.py @@ -1,24 +1,11 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012-2018 Team Kodi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# +# HD44780-A00 char map +# encmap_hd44780_a00 = { 0x0000: 0x0000, # NULL diff --git a/resources/lib/charset_map_hd44780_a02.py b/resources/lib/charset_map_hd44780_a02.py index 92460f4..8886d8b 100644 --- a/resources/lib/charset_map_hd44780_a02.py +++ b/resources/lib/charset_map_hd44780_a02.py @@ -1,24 +1,11 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012-2018 Team Kodi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# +# HD44780-A02 char map +# encmap_hd44780_a02 = { 0x0000: 0x0000, # NULL diff --git a/resources/lib/common.py b/resources/lib/common.py index fb11efa..b96145a 100644 --- a/resources/lib/common.py +++ b/resources/lib/common.py @@ -1,28 +1,11 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012-2018 Team Kodi - - resources/lib/common.py: Common defines and functionality used throughout - the whole addon - Copyright (C) 2018 Daniel 'herrnst' Scheller - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# +# Common defines and functionality used throughout the whole addon +# import os diff --git a/resources/lib/extraicons.py b/resources/lib/extraicons.py index 538efff..4584f94 100644 --- a/resources/lib/extraicons.py +++ b/resources/lib/extraicons.py @@ -1,27 +1,11 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012-2018 Team Kodi - - Extra icon defines/enums - Copyright (C) 2012-2018 Daniel 'herrnst' Scheller - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# +# Extra icon defines/enums +# LCD_EXTRABARS_MAX = 4 diff --git a/resources/lib/infolabels.py b/resources/lib/infolabels.py index 4848974..ab11370 100644 --- a/resources/lib/infolabels.py +++ b/resources/lib/infolabels.py @@ -1,27 +1,11 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012-2018 Team Kodi - - InfoLabel handling - Copyright (C) 2012-2018 Daniel 'herrnst' Scheller - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# +# InfoLabel handling +# import sys import time diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index e11837c..171c0cb 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -1,25 +1,9 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012-2018 Team Kodi - Copyright (C) 2012-2018 Daniel 'herrnst' Scheller - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# import os import re diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 039d85f..682ea6a 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -1,25 +1,9 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012-2018 Team Kodi - Copyright (C) 2012-2018 Daniel 'herrnst' Scheller - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# import re import telnetlib diff --git a/resources/lib/lcdproc_extra_base.py b/resources/lib/lcdproc_extra_base.py index 31c6fac..8a83403 100644 --- a/resources/lib/lcdproc_extra_base.py +++ b/resources/lib/lcdproc_extra_base.py @@ -1,27 +1,11 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012-2018 Team Kodi - - Stub class for extra symbol support e.g. on SoundGraph iMON or mdm166a LCDs/VFDs - Copyright (C) 2012-2018 Daniel 'herrnst' Scheller - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# +# Stub class for extra symbol support e.g. on SoundGraph iMON or mdm166a LCDs/VFDs +# class LCDproc_extra_base(): def __init__(self): diff --git a/resources/lib/lcdproc_extra_imon.py b/resources/lib/lcdproc_extra_imon.py index 9db23ba..4e7e648 100644 --- a/resources/lib/lcdproc_extra_imon.py +++ b/resources/lib/lcdproc_extra_imon.py @@ -1,28 +1,12 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012-2018 Team Kodi - - Support for extra symbols on SoundGraph iMON LCD displays - Copyright (C) 2012-2018 Daniel 'herrnst' Scheller - Original C implementation (C) 2010 Christian Leuschen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# +# Support for extra symbols on SoundGraph iMON LCD displays +# Original C implementation (C) 2010 Christian Leuschen +# import time diff --git a/resources/lib/lcdproc_extra_mdm166a.py b/resources/lib/lcdproc_extra_mdm166a.py index d370e62..4bfe229 100644 --- a/resources/lib/lcdproc_extra_mdm166a.py +++ b/resources/lib/lcdproc_extra_mdm166a.py @@ -1,28 +1,12 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012-2018 Team Kodi - - Support for extra symbols on Futaba/Targa USB mdm166a VFD displays - Copyright (C) 2012-2018 Daniel 'herrnst' Scheller - Original C implementation (C) 2010 Christian Leuschen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# +# Support for extra symbols on Futaba/Targa USB mdm166a VFD displays +# Original C implementation (C) 2010 Christian Leuschen +# from .extraicons import * from .lcdproc_extra_base import * diff --git a/resources/lib/settings.py b/resources/lib/settings.py index d8fa2af..c8f3e72 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -1,25 +1,9 @@ -''' - XBMC LCDproc addon - Copyright (C) 2012-2018 Team Kodi - Copyright (C) 2012-2018 Daniel 'herrnst' Scheller - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# import time diff --git a/resources/lib/xbmclcdproc.py b/resources/lib/xbmclcdproc.py index a16130a..84185ff 100644 --- a/resources/lib/xbmclcdproc.py +++ b/resources/lib/xbmclcdproc.py @@ -1,28 +1,11 @@ -''' - XBMC LCDproc addon - - Main addon handler/control - - Copyright (C) 2012-2018 Team Kodi - Copyright (C) 2012-2018 Daniel 'herrnst' Scheller - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' +# SPDX-License-Identifier: GPL-2.0-or-later +# +# XBMC LCDproc addon +# Copyright (C) 2012-2024 Team Kodi +# Copyright (C) 2012-2024 Daniel 'herrnst' Scheller +# +# Main addon handler/control +# # base imports import time From cc6e1ec2d00a85d643b314cda4541b05cc7fe55b Mon Sep 17 00:00:00 2001 From: Alan Swanson Date: Fri, 27 Sep 2024 12:01:34 +0100 Subject: [PATCH 329/337] Fix SyntaxWarning on regex invalid escape sequences Use raw string for regex with escape sequences. Was previously a silent DeprecationWarning but with Python 3.12 it becomes a SyntaxWarning and for future Python releases it will become a SyntaxError. --- resources/lib/lcdbase.py | 12 ++++++------ resources/lib/lcdproc.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/resources/lib/lcdbase.py b/resources/lib/lcdbase.py index 171c0cb..9b61570 100644 --- a/resources/lib/lcdbase.py +++ b/resources/lib/lcdbase.py @@ -366,7 +366,7 @@ def LoadMode(self, node, mode): return # regex to determine any of $INFO[LCD.Time(Wide)21-44] - timeregex = r'' + re.escape('$INFO[LCD.') + 'Time((Wide)?\d?\d?)' + re.escape(']') + timeregex = r'' + re.escape('$INFO[LCD.') + r'Time((Wide)?\d?\d?)' + re.escape(']') for line in node.findall("line"): # initialize line with empty descriptor @@ -414,7 +414,7 @@ def LoadMode(self, node, mode): elif linetext.lower().find("$info[lcd.playicon]") >= 0: linedescriptor['type'] = LCD_LINETYPE.LCD_LINETYPE_ICONTEXT linedescriptor['startx'] = int(1 + self.m_iIconTextOffset) # icon widgets take 2 chars, so shift text offset (default: 2) - linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + '\s?', ' ', linetext, flags=re.IGNORECASE).strip() + linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.PlayIcon]") + r'\s?', ' ', linetext, flags=re.IGNORECASE).strip() # standard (scrolling) text line else: @@ -427,8 +427,8 @@ def LoadMode(self, node, mode): if linetext.lower().find("$info[lcd.alignright]") >= 0: linedescriptor['align'] = LCD_LINEALIGN.LCD_LINEALIGN_RIGHT - linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignCenter]") + '\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE).strip() - linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignRight]") + '\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE).strip() + linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignCenter]") + r'\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE).strip() + linedescriptor['text'] = re.sub(r'\s?' + re.escape("$INFO[LCD.AlignRight]") + r'\s?', ' ', linedescriptor['text'], flags=re.IGNORECASE).strip() self.m_lcdMode[mode].append(linedescriptor) @@ -475,7 +475,7 @@ def GetLCDMode(self): return ret def StripBBCode(self, strtext): - regexbbcode = "\[(?P[0-9a-zA-Z_\-]+?)[0-9a-zA-Z_\- ]*?\](?P.*?)\[\/(?P=tagname)\]" + regexbbcode = r"\[(?P[0-9a-zA-Z_\-]+?)[0-9a-zA-Z_\- ]*?\](?P.*?)\[\/(?P=tagname)\]" # precompile and remember regex to make sure re's caching won't cause accidential recompilation if not self.m_reBBCode: self.m_reBBCode = re.compile(regexbbcode) @@ -494,7 +494,7 @@ def StripBBCode(self, strtext): while True: loopcount = loopcount - 1 try: - mangledline, replacements = re.subn(self.m_reBBCode, "\g", mangledline) + mangledline, replacements = re.subn(self.m_reBBCode, r"\g", mangledline) except: return mangledline diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 682ea6a..ecf867a 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -264,7 +264,7 @@ def Connect(self): log(LOGDEBUG,"Reply: " + reply) # parse reply by regex - lcdinfo = re.match("^connect .+ protocol ([0-9\.]+) lcd wid (\d+) hgt (\d+) cellwid (\d+) cellhgt (\d+)$", reply) + lcdinfo = re.match(r"^connect .+ protocol ([0-9\.]+) lcd wid (\d+) hgt (\d+) cellwid (\d+) cellhgt (\d+)$", reply) # if regex didn't match, LCDproc is incompatible or something's odd if lcdinfo is None: From b0ffde7431178708eeb9d5e13ec660eae004a9e0 Mon Sep 17 00:00:00 2001 From: Martin Wichmann Date: Sun, 10 Nov 2024 20:39:46 +0100 Subject: [PATCH 330/337] Rewritten socket code to support Python 3.13 by replacing telnetlib with raw sockets. --- resources/lib/lcdproc.py | 74 +++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 27 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index ecf867a..b96242a 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -6,7 +6,6 @@ # import re -import telnetlib import time import xbmc @@ -32,8 +31,7 @@ def __init__(self, settings): self.m_lastInitAttempt = 0 self.m_initRetryInterval = INIT_RETRY_INTERVAL self.m_used = True - self.tn = telnetlib.Telnet() - self.tnsocket = None + self.m_socket = None self.m_timeLastSockAction = time.time() self.m_timeSocketIdleTimeout = 2 self.m_strLineText = [None]*MAX_ROWS @@ -50,6 +48,34 @@ def __init__(self, settings): LcdBase.__init__(self, settings) + def socket_read_until_newline(self, searchstr, timeout): + if not self.m_socket: + return b"" + + data = bytearray() + start_time = time.time() + + while True: + # Return current data on timeout + elapsed_time = time.time() - start_time + if elapsed_time > timeout: + break + + # Read new data and break on disconnect (empty bytes object returned; timeout for recv is set on connect) + try: + chunk = self.m_socket.recv(1) + except TimeoutError: + chunk = b'' + if not chunk: + break + data += chunk + + # Break if searchstr is found + if searchstr in data: + break + + return data + def SendCommand(self, strCmd, bCheckRet): countcmds = strCmd.count(b'\n') sendcmd = strCmd @@ -63,7 +89,7 @@ def SendCommand(self, strCmd, bCheckRet): try: # Send to server via raw socket to prevent telnetlib tampering with # certain chars (especially 0xFF -> telnet IAC) - self.tnsocket.sendall(sendcmd) + self.m_socket.sendall(sendcmd) except: # Something bad happened, abort log(LOGERROR, "SendCommand: Telnet exception - send") @@ -78,7 +104,7 @@ def SendCommand(self, strCmd, bCheckRet): while True: try: # Read server reply - reply = self.tn.read_until(b"\n",3) + reply = self.socket_read_until_newline(b"\n", timeout=3) except: # (Re)read failed, abort log(LOGERROR, "SendCommand: Telnet exception - reread") @@ -214,8 +240,8 @@ def DetermineExtraSupport(self): # Never cause script failure/interruption by this! This is totally optional! try: # Retrieve driver name for additional functionality - self.tn.write(b"info\n") - reply = self.tn.read_until(b"\n",3).strip().decode("ascii") + self.m_socket.send(b"info\n") + reply = self.socket_read_until_newline(b"\n", timeout=3).strip().decode("ascii") # When the LCDd driver doesn't supply a valid string, inform and return if reply == "": @@ -255,12 +281,14 @@ def Connect(self): port = self.m_Settings.getHostPort() log(LOGDEBUG,"Open " + str(ip) + ":" + str(port)) - self.tn.open(ip, port) + self.m_socket = socket(AF_INET, SOCK_STREAM) + self.m_socket.connect((ip, port)) + self.m_socket.settimeout(1) # Start a new session - self.tn.write(b"hello\n") + self.m_socket.send(b"hello\n") # Receive LCDproc data to determine row and column information - reply = self.tn.read_until(b"\n",3).decode("ascii") + reply = self.socket_read_until_newline(b"\n", timeout=3).decode("ascii") log(LOGDEBUG,"Reply: " + reply) # parse reply by regex @@ -302,12 +330,6 @@ def Connect(self): log(LOGERROR,"Connect: Caught exception, aborting.") return False - # retrieve raw socket object - self.tnsocket = self.tn.get_socket() - if self.tnsocket is None: - log(LOGERROR, "Retrieval of socket object failed!") - return False - if not self.SetupScreen(): log(LOGERROR, "Screen setup failed!") return False @@ -315,7 +337,7 @@ def Connect(self): return True def CloseSocket(self): - if self.tnsocket: + if self.m_socket: # no pyexceptions, please, we're disconnecting anyway try: # if we served extra elements, (try to) reset them @@ -324,9 +346,9 @@ def CloseSocket(self): log(LOGERROR, "CloseSocket(): Cannot clear extra icons") # do gracefully disconnect (send directly as we won't get any response on this) - self.tn.write(b"bye\n") + self.m_socket.send(b"bye\n") # and close socket afterwards - self.tn.close() + self.m_socket.close() except: # exception caught on this, so what? :) pass @@ -335,12 +357,10 @@ def CloseSocket(self): del self.m_cExtraIcons self.m_cExtraIcons = None - self.tnsocket = None - del self.tn - self.tn = telnetlib.Telnet() + self.m_socket = None def IsConnected(self): - if not self.tnsocket: + if not self.m_socket: return False # Ping only every SocketIdleTimeout seconds @@ -354,7 +374,7 @@ def IsConnected(self): return True def SetBackLight(self, iLight): - if not self.tnsocket: + if not self.m_socket: return log(LOGDEBUG, "Switch Backlight to: " + str(iLight)) @@ -378,7 +398,7 @@ def Stop(self): self.m_bStop = True def Suspend(self): - if self.m_bStop or not self.tnsocket: + if self.m_bStop or not self.m_socket: return # Build command to suspend screen @@ -390,7 +410,7 @@ def Suspend(self): self.CloseSocket() def Resume(self): - if self.m_bStop or not self.tnsocket: + if self.m_bStop or not self.m_socket: return # Build command to resume screen @@ -515,7 +535,7 @@ def ClearLine(self, iLine): self.m_bstrSetLineCmds += b"widget_set xbmc lineScroller%i 1 %i %i %i m 1 \"\"\n" % (iLine, iLine, self.m_iColumns, iLine) def SetLine(self, mode, iLine, strLine, dictDescriptor, bForce): - if self.m_bStop or not self.tnsocket: + if self.m_bStop or not self.m_socket: return if iLine < 0 or iLine >= int(self.m_iRows): From 2b7dbba6e3f9609dc94996de412f3dd1172d2da1 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 11 Nov 2024 16:54:15 +0100 Subject: [PATCH 331/337] Refactor and simplify socket_read_until_newline() to ReadUntil() Do socket reads in chunks of 1024 bytes, split at first occurence of separator and return up to that first occurence while keeping the remains of the read chunk for further invocations of ReadUntil(), and do utilise that cached data until drained, then re-read the socket. Also, there's no need to keep track of timeouts, this is handled by utilising socket.settimeout(). --- resources/lib/lcdproc.py | 42 +++++++++++++++------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index b96242a..271bd51 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -32,6 +32,7 @@ def __init__(self, settings): self.m_initRetryInterval = INIT_RETRY_INTERVAL self.m_used = True self.m_socket = None + self.m_sockreadbuf = b'' self.m_timeLastSockAction = time.time() self.m_timeSocketIdleTimeout = 2 self.m_strLineText = [None]*MAX_ROWS @@ -48,33 +49,19 @@ def __init__(self, settings): LcdBase.__init__(self, settings) - def socket_read_until_newline(self, searchstr, timeout): + def ReadUntil(self, separator): if not self.m_socket: return b"" - data = bytearray() - start_time = time.time() + while separator not in self.m_sockreadbuf: + data = self.m_socket.recv(1024) + if not data: + raise EOFError + self.m_sockreadbuf += data - while True: - # Return current data on timeout - elapsed_time = time.time() - start_time - if elapsed_time > timeout: - break + line, tmp, self.m_sockreadbuf = self.m_sockreadbuf.partition(separator) - # Read new data and break on disconnect (empty bytes object returned; timeout for recv is set on connect) - try: - chunk = self.m_socket.recv(1) - except TimeoutError: - chunk = b'' - if not chunk: - break - data += chunk - - # Break if searchstr is found - if searchstr in data: - break - - return data + return line + b"\n" def SendCommand(self, strCmd, bCheckRet): countcmds = strCmd.count(b'\n') @@ -104,7 +91,7 @@ def SendCommand(self, strCmd, bCheckRet): while True: try: # Read server reply - reply = self.socket_read_until_newline(b"\n", timeout=3) + reply = self.ReadUntil(b"\n") except: # (Re)read failed, abort log(LOGERROR, "SendCommand: Telnet exception - reread") @@ -241,7 +228,7 @@ def DetermineExtraSupport(self): try: # Retrieve driver name for additional functionality self.m_socket.send(b"info\n") - reply = self.socket_read_until_newline(b"\n", timeout=3).strip().decode("ascii") + reply = self.ReadUntil(b"\n").strip().decode("ascii") # When the LCDd driver doesn't supply a valid string, inform and return if reply == "": @@ -282,13 +269,15 @@ def Connect(self): log(LOGDEBUG,"Open " + str(ip) + ":" + str(port)) self.m_socket = socket(AF_INET, SOCK_STREAM) + self.m_socket.settimeout(15) self.m_socket.connect((ip, port)) - self.m_socket.settimeout(1) + self.m_socket.settimeout(3) + # Start a new session self.m_socket.send(b"hello\n") # Receive LCDproc data to determine row and column information - reply = self.socket_read_until_newline(b"\n", timeout=3).decode("ascii") + reply = self.ReadUntil(b"\n").decode("ascii") log(LOGDEBUG,"Reply: " + reply) # parse reply by regex @@ -357,6 +346,7 @@ def CloseSocket(self): del self.m_cExtraIcons self.m_cExtraIcons = None + self.m_sockreadbuf = b'' self.m_socket = None def IsConnected(self): From e3ddcaf643b55503bfb3b90ed9f0bef650b9618f Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 11 Nov 2024 19:46:16 +0100 Subject: [PATCH 332/337] Don't enforce and/or assume ReadUntil() responses have a LF suffix The original telnetlib based approach using read_until() worked based on the fact that the string returned by read_until() always had a trailing LF (\n). This isn't the case with the way the response is returned by the raw socket based implementation (ie. using string.partition()), so don't add a trailing LF to the returned string anymore and fix up all occurances comparing with a string containing a trailing LF. (On a side note, it is simply wrong to statically append a LF where it would rather be correct to append the separator, but well...) --- resources/lib/lcdproc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index 271bd51..c6bb54b 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -61,7 +61,7 @@ def ReadUntil(self, separator): line, tmp, self.m_sockreadbuf = self.m_sockreadbuf.partition(separator) - return line + b"\n" + return line def SendCommand(self, strCmd, bCheckRet): countcmds = strCmd.count(b'\n') @@ -113,10 +113,10 @@ def SendCommand(self, strCmd, bCheckRet): if not bCheckRet: continue # no return checking desired, so be fine - if strCmd == b'noop' and reply == b'noop complete\n': + if strCmd == b'noop' and reply == b'noop complete': continue # noop has special reply - if reply == b'success\n': + if reply == b'success': continue ret = False From b2356d1b07b5bb8d5827498f87d2ec488b3f64b1 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 11 Nov 2024 20:05:35 +0100 Subject: [PATCH 333/337] Be more verbose in Connect() and SendCommand(), cleanup telnet wording Catch and log exception types during socket connect, initial LCDproc init and command submission, so users get a more proper pointer on what's wrong instead of just "Connect failed. Retry in..." or something like "Telnet exception". While at it, clean up mentions of telnet after telnetlib isn't used anymore. --- resources/lib/lcdproc.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/resources/lib/lcdproc.py b/resources/lib/lcdproc.py index c6bb54b..ca65f72 100644 --- a/resources/lib/lcdproc.py +++ b/resources/lib/lcdproc.py @@ -74,12 +74,11 @@ def SendCommand(self, strCmd, bCheckRet): sendcmd += b"\n" try: - # Send to server via raw socket to prevent telnetlib tampering with - # certain chars (especially 0xFF -> telnet IAC) + # Send commands to LCDproc server self.m_socket.sendall(sendcmd) - except: + except Exception as ex: # Something bad happened, abort - log(LOGERROR, "SendCommand: Telnet exception - send") + log(LOGERROR, "SendCommand(): Caught %s on m_socket.sendall()" % type(ex)) return False # Update last socketaction timestamp @@ -92,9 +91,9 @@ def SendCommand(self, strCmd, bCheckRet): try: # Read server reply reply = self.ReadUntil(b"\n") - except: + except Exception as ex: # (Re)read failed, abort - log(LOGERROR, "SendCommand: Telnet exception - reread") + log(LOGERROR, "SendCommand(): Caught %s when reading back response(s)" % type(ex)) return False # Skip these messages @@ -273,6 +272,11 @@ def Connect(self): self.m_socket.connect((ip, port)) self.m_socket.settimeout(3) + except Exception as ex: + log(LOGERROR, "Connect(): Caught %s on initial connect, aborting" % type(ex)) + return False + + try: # Start a new session self.m_socket.send(b"hello\n") @@ -315,8 +319,8 @@ def Connect(self): # (might override e.g. m_iBigDigits!) self.DetermineExtraSupport() - except: - log(LOGERROR,"Connect: Caught exception, aborting.") + except Exception as ex: + log(LOGERROR,"Connect(): Caught %s during hello/info phase, aborting." % type(ex)) return False if not self.SetupScreen(): From c6a338da0489401afad56bc9fa859058aa28e889 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Mon, 11 Nov 2024 20:41:33 +0100 Subject: [PATCH 334/337] changelog/addon.xml: version 4.1.0 --- addon.xml | 8 +++++--- changelog.txt | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/addon.xml b/addon.xml index e588456..12a21f2 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -24,8 +24,10 @@ resources/icon.png - 4.0.0 -- fix Python exception when using the HD44780 character encodings/translation maps + 4.1.0 +- Python 3.13 compat: Use raw strings for regex'es everywhere, fixes SyntaxError's (thanks alanswanson!) +- Python 3.13 compat: Replace long deprecated telnetlib usage with raw sockets (thanks m-wichmann!) +- Minor housekeepings diff --git a/changelog.txt b/changelog.txt index ee06f32..30b4ab6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +4.1.0 +- Python 3.13 compat: Use raw strings for regex'es everywhere, fixes SyntaxError's (thanks alanswanson!) +- Python 3.13 compat: Replace long deprecated telnetlib usage with raw sockets (thanks m-wichmann!) +- Minor housekeepings 4.0.0 - fix Python exception when using the HD44780 character encodings/translation maps 3.90.2 From 807be252432a48fde648bb625c0d5c0a603a55f7 Mon Sep 17 00:00:00 2001 From: Daniel Nylander Date: Tue, 6 May 2025 13:37:51 +0800 Subject: [PATCH 335/337] Adding Swedish translation --- .../resource.language.sv_se/strings.po | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 resources/language/resource.language.sv_se/strings.po diff --git a/resources/language/resource.language.sv_se/strings.po b/resources/language/resource.language.sv_se/strings.po new file mode 100644 index 0000000..5da9dfd --- /dev/null +++ b/resources/language/resource.language.sv_se/strings.po @@ -0,0 +1,184 @@ +# Kodi Media Center Swedish language file +# Addon Name: XBMC LCDproc +# Addon id: script.xbmc.lcdproc +# Addon Provider: Team Kodi: Memphiz, Daniel 'herrnst' Scheller +msgid "" +msgstr "" +"Project-Id-Version: script.xbmc.lcdproc\n" +"Report-Msgid-Bugs-To: https://github.com/herrnst/script.xbmc.lcdproc\n" +"POT-Creation-Date: 2018-06-02 15:55+0200\n" +"PO-Revision-Date: 2025-05-06 07:37+0200\n" +"Last-Translator: Daniel Nylander \n" +"Language-Team: Swedish\n" +"Language: sv\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.6\n" + +# Settings +# Behaviour +msgctxt "#32100" +msgid "Behaviour" +msgstr "Beteende" + +msgctxt "#32101" +msgid "Delay for scrolling text" +msgstr "Fördröjning för rullning av text" + +msgctxt "#32102" +msgid "Scroll mode" +msgstr "Rullningsläge" + +msgctxt "#32103" +msgid "Navigation display duration (s)" +msgstr "Navigationsskärmens varaktighet (s)" + +msgctxt "#32104" +msgid "Display refresh rate (Hz)" +msgstr "Skärmens uppdateringsfrekvens (Hz)" + +msgctxt "#32105" +msgid "Use alternate charset" +msgstr "Använd alternativ teckenuppsättning" + +msgctxt "#32106" +msgid "Charset" +msgstr "Teckenuppsättning" + +msgctxt "#32107" +msgid "Support for extra display elements (e.g. icons)" +msgstr "Stöd för extra visningselement (t.ex. ikoner)" + +msgctxt "#32108" +msgid "System time format" +msgstr "Systemets tidsformat" + +# empty strings from id 32109 to 32199 +# Backlight +msgctxt "#32200" +msgid "Backlight" +msgstr "Bakgrundsbelysning" + +msgctxt "#32201" +msgid "on screensaver" +msgstr "vid skärmsläckare" + +msgctxt "#32202" +msgid "Dim on shutdown" +msgstr "Dimma vid avstängning" + +msgctxt "#32203" +msgid "on video/LiveTV playback" +msgstr "vid uppspelning av video/direktsänd TV" + +msgctxt "#32204" +msgid "on music/radio playback" +msgstr "vid uppspelning av musik/radio" + +msgctxt "#32205" +msgid "Delay (s)" +msgstr "Fördröjning (s)" + +msgctxt "#32206" +msgid "Dim/turn off..." +msgstr "Dimma/slå av..." + +# empty strings from id 32207 to 32299 +# Connection +msgctxt "#32300" +msgid "Connection" +msgstr "Anslutning" + +msgctxt "#32301" +msgid "Use remote LCDProc" +msgstr "Använd fjärr-LCDProc" + +msgctxt "#32302" +msgid "LCDd IP" +msgstr "LCDd IP" + +msgctxt "#32303" +msgid "LCDd port" +msgstr "LCDd-port" + +msgctxt "#32304" +msgid "Show heartbeat symbol" +msgstr "Visa symbol för hjärtslag" + +msgctxt "#32305" +msgid "Hide connection error notifications" +msgstr "Dölj meddelanden om anslutningsfel" + +# empty strings from id 32306 to 32400 +# Enum values: Scroll mode +msgctxt "#32401" +msgid "Marquee" +msgstr "Draperi" + +msgctxt "#32402" +msgid "Left/Right" +msgstr "Vänster/Höger" + +# empty strings from id 32403 to 32410 +# Enum values: Charsets +msgctxt "#32411" +msgid "ISO8859-1 (default)" +msgstr "ISO8859-1 (standard)" + +msgctxt "#32412" +msgid "ISO8859-15" +msgstr "ISO8859-15" + +msgctxt "#32413" +msgid "KOI8-R" +msgstr "KOI8-R" + +msgctxt "#32414" +msgid "CP1251" +msgstr "CP1251" + +msgctxt "#32415" +msgid "ISO8859-5" +msgstr "ISO8859-5" + +msgctxt "#32416" +msgid "HD44780-ROM A00" +msgstr "HD44780-ROM A00" + +msgctxt "#32417" +msgid "HD44780-ROM A02" +msgstr "HD44780-ROM A02" + +# empty strings from id 32418 to 32420 +# Enum values: System time format +msgctxt "#32421" +msgid "H:MM" +msgstr "H:MM" + +msgctxt "#32422" +msgid "HH:MM" +msgstr "HH:MM" + +msgctxt "#32423" +msgid "H:MM:SS" +msgstr "H:MM:SS" + +msgctxt "#32424" +msgid "HH:MM:SS" +msgstr "HH:MM:SS" + +# empty strings from id 32425 to 32499 +# Notifications +msgctxt "#32500" +msgid "Failed to connect to LCDProc!" +msgstr "Misslyckades med att ansluta till LCDProc!" + +msgctxt "#32501" +msgid "Connected to LCDProc!" +msgstr "Ansluten till LCDProc!" + +msgctxt "#32502" +msgid "Warning! Errors in LCD.xml or LCD.xml not found!" +msgstr "Varning! Fel i LCD.xml eller LCD.xml hittades inte!" From aa845d4294f999c41cbeb7f2619d42277475ba7e Mon Sep 17 00:00:00 2001 From: Daniel Nylander Date: Fri, 13 Jun 2025 14:13:41 +0800 Subject: [PATCH 336/337] Adding Swedish to addon.xml (#72) Add Swedish translation to addon.xml --- addon.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addon.xml b/addon.xml index 12a21f2..711b8fd 100644 --- a/addon.xml +++ b/addon.xml @@ -11,10 +11,12 @@ Zeigt konfigurierbare Informationen z.B. über aktuelle Wiedergabe oder den Kodi Status auf beliebigen von LCDproc angesteuerten LC/VF-Displays, ersetzt die zuvor im Kodi/XBMC-Kern enthaltene LCD/VFD-Funktion. Unterstützt zusätzliche Elemente (Icons, Balken) von SoundGraph iMON LCD und Targa/Futaba mdm166a VFD Hardware. Benötigt einen konfigurierten, laufenden LCDd auf dem lokalen System oder im Netzwerk. Affiche des informations définies par configuration telles que le média en cours de lecture, l'état de Kodi... et ce sur tout type d'afficheur LC/VF géré par LCDProc. Remplace la fonctionnalité LCD/VFD précédemment disponible par défaut dans Kodi/XBMC. Gère des éléments supplémentaires (icônes, barres) sur les écrans SoundGraph iMON LCD et Targa/Futaba mdm166a VFD. Nécessite un serveur LCDd correctement configuré et disponible localement ou sur le réseau. Wyświetla konfigurowalne informacje np. o odtwarzanych mediach oraz statusie Kodi na dowolnym wyświetlaczu LCD/VFD sterowanym poprzez LCDproc. Działa jako bezpośredni zamiennik funkcji wyświetlania na LCD/VFD poprzednio dostępnej w rdzeniu Kodi/XBMC. Wspiera wyświetlanie dodatkowych elementów (np. ikon stanu, linijek diodowych lub pasków postępu) na wyświetlaczach SoundGraph iMON (LCD) oraz Targa/Futaba mdm166a (VFD). Wymaga poprawnie skonfigurowanego i uruchomionego serwera LCDd albo lokalnie, albo gdzieś w sieci. + Visar konfigurerbar information, t.ex. om uppspelning av media eller Kodi-status på valfri LC/VF-skärm som drivs av LCDproc, och fungerar som direkt ersättning för LCD/VFD-funktionen som tidigare fanns i Kodi/XBMC:s kärna. Stöder ytterligare skärmelement (ikoner, staplar) på SoundGraph iMON LCD och Targa/Futaba mdm166a VFD-hårdvara. Kräver en korrekt konfigurerad och körande LCDd antingen lokalt eller någonstans i nätverket. Works with LCDproc only. Other LCD services like LCD4Linux or iMON Manager on Win32 are not supported. No liability taken for damaged hardware and/or software caused by this addon. Funktioniert ausschliesslich mit LCDproc. Andere LCD-Dienste wie LCD4Linux, iMON Manager unter Win32 u.a. sind nicht unterstützt. Keine Haftung für durch dieses Addon beschädigte Hard-/Software. Fonctionne uniquement avec LCDProc. Les services tels que LCD4Linux ou iMON Manager sur Win32 ne sont pas gérés. Nous déclinons toute responsabilité en cas de dégats survenus suite à l'utilisation de cette extension. Działa wyłącznie z LCDproc. Inne usługi LCD jak LCD4Linux lub iMON Manager dla Win32 nie są obsługiwane. Nie ponosimy żadnej odpowiedzialności za uszkodzony sprzęt i/lub oprogramowanie spowodowane tym dodatkiem. + Fungerar endast med LCDproc. Andra LCD-tjänster som LCD4Linux eller iMON Manager på Win32 stöds inte. Vi tar inget ansvar för skador på hårdvara och/eller programvara som orsakas av detta tillägg. GNU GENERAL PUBLIC LICENSE. Version 2, June 1991 all https://github.com/lcdproc/lcdproc From a64470ac8e87acb1e7b9d2a07c92bac29dee7aac Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 22 Jun 2025 15:26:15 +0200 Subject: [PATCH 337/337] changelog/addon.xml: version 4.1.1 --- addon.xml | 8 +++----- changelog.txt | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addon.xml b/addon.xml index 711b8fd..440a9ed 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -26,10 +26,8 @@ resources/icon.png - 4.1.0 -- Python 3.13 compat: Use raw strings for regex'es everywhere, fixes SyntaxError's (thanks alanswanson!) -- Python 3.13 compat: Replace long deprecated telnetlib usage with raw sockets (thanks m-wichmann!) -- Minor housekeepings + 4.1.1 +- Swedish translation (thanks yeager!) diff --git a/changelog.txt b/changelog.txt index 30b4ab6..328547b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,5 @@ +4.1.1 +- Swedish translation (thanks yeager!) 4.1.0 - Python 3.13 compat: Use raw strings for regex'es everywhere, fixes SyntaxError's (thanks alanswanson!) - Python 3.13 compat: Replace long deprecated telnetlib usage with raw sockets (thanks m-wichmann!)