- fix some inefficiencies,
authorMoritz Venn <ritzmo@users.schwerkraft.elitedvb.net>
Fri, 11 Sep 2009 17:33:49 +0000 (17:33 +0000)
committerMoritz Venn <ritzmo@users.schwerkraft.elitedvb.net>
Fri, 11 Sep 2009 17:33:49 +0000 (17:33 +0000)
- cleanup imports,
- remove stray whitespaces

20 files changed:
webinterface/src/WebComponents/Sources/About.py
webinterface/src/WebComponents/Sources/AudioTracks.py
webinterface/src/WebComponents/Sources/CurrentService.py
webinterface/src/WebComponents/Sources/EPG.py
webinterface/src/WebComponents/Sources/Frontend.py
webinterface/src/WebComponents/Sources/Hdd.py
webinterface/src/WebComponents/Sources/LocationsAndTags.py
webinterface/src/WebComponents/Sources/MP.py
webinterface/src/WebComponents/Sources/Message.py
webinterface/src/WebComponents/Sources/Movie.py
webinterface/src/WebComponents/Sources/Network.py
webinterface/src/WebComponents/Sources/ParentControl.py
webinterface/src/WebComponents/Sources/RemoteControl.py
webinterface/src/WebComponents/Sources/ServiceListRecursive.py
webinterface/src/WebComponents/Sources/ServiceListReload.py
webinterface/src/WebComponents/Sources/Settings.py
webinterface/src/WebComponents/Sources/SubServices.py
webinterface/src/WebComponents/Sources/Timer.py
webinterface/src/WebComponents/Sources/Volume.py
webinterface/src/WebComponents/Sources/WAPfunctions.py

index 6d62b13..ef9a3b7 100644 (file)
@@ -1,16 +1,6 @@
 # Parts of Code and idea by Homey
 from Components.Sources.Source import Source
-from Components.Harddisk import harddiskmanager
-from Components.NimManager import nimmanager
 from Components.Network import iNetwork
-from Components.About import about
-
-from Tools.DreamboxHardware import getFPVersion
-
-from ServiceReference import ServiceReference
-from enigma import iServiceInformation
-
-from Components.config import config
 
 class About(Source):
        def __init__(self, session):
@@ -22,32 +12,36 @@ class About(Source):
 
        def command(self):
                def ConvertIP(list):
-                       if(len(list) == 4):
+                       if len(list) == 4:
                                retstr = "%s.%s.%s.%s" % (list[0], list[1], list[2], list[3])
                        else:
                                retstr = "0.0.0.0"
                        return retstr
-               
+
                list = []
 
                if iNetwork.getNumberOfAdapters > 0:
                        iface = iNetwork.getAdapterList()[0]
                        print "[WebComponents.About] iface: %s" % iface
-                       list.append(iNetwork.getAdapterAttribute(iface, "mac"))
-                       list.append(iNetwork.getAdapterAttribute(iface, "dhcp"))
-                       list.append(ConvertIP(iNetwork.getAdapterAttribute(iface, "ip")))
-                       list.append(ConvertIP(iNetwork.getAdapterAttribute(iface, "netmask")))
-                       list.append(ConvertIP(iNetwork.getAdapterAttribute(iface, "gateway")))
+                       list.extend((
+                               iNetwork.getAdapterAttribute(iface, "mac"),
+                               iNetwork.getAdapterAttribute(iface, "dhcp"),
+                               ConvertIP(iNetwork.getAdapterAttribute(iface, "ip")),
+                               ConvertIP(iNetwork.getAdapterAttribute(iface, "netmask")),
+                               ConvertIP(iNetwork.getAdapterAttribute(iface, "gateway")),
+                       ))
                else:
                        print "[WebComponents.About] no network iface configured!"
-                       list.append("N/A")
-                       list.append("N/A")
-                       list.append("N/A")
-                       list.append("N/A")
-                       list.append("N/A")
+                       list.extend((
+                               "N/A",
+                               "N/A",
+                               "N/A",
+                               "N/A",
+                               "N/A",
+                       ))
+
+               return (list,)
 
-               return [list]
-       
        list = property(command)
        lut = { "lanMac": 0
                        , "lanDHCP": 1
index 3b3c701..f09d0e8 100644 (file)
@@ -48,7 +48,8 @@ class AudioTracks(Source):
                        if n > 0:
                                print "[AudioTracks.py] got %s Audiotracks!" % (n)
 
-                               for x in range(n):
+                               x = 0
+                               while x < n:
                                        cnt = 0
                                        i = audio.getTrackInfo(x)
 
@@ -66,7 +67,7 @@ class AudioTracks(Source):
                                                        language += lang
                                                cnt += 1
 
-                                       if len(description):
+                                       if description:
                                                description += " (" + language + ")"
                                        else:
                                                description = language
@@ -77,6 +78,7 @@ class AudioTracks(Source):
                                                active = "False"
 
                                        tracklist.append((description, x, pid, active))
+                                       x += 1
 
                return tracklist
 
index 70e6554..0b96482 100644 (file)
@@ -1,5 +1,4 @@
 from Components.Sources.Source import Source
-from ServiceReference import ServiceReference
 
 class CurrentService(Source):
        def __init__(self, session):
index 5c4933a..6984628 100644 (file)
@@ -1,5 +1,4 @@
 from Components.Sources.Source import Source
-from ServiceReference import ServiceReference
 from enigma import eServiceCenter, eServiceReference, eEPGCache
 
 class EPG(Source):
@@ -42,7 +41,7 @@ class EPG(Source):
                 func = self.getServiceEPGNext
 
             return func(self.command)
-        return []
+        return ()
 
     def getBouquetEPGNow(self, ref):
         return self.getEPGNowNext(ref, 0)
@@ -74,7 +73,7 @@ class EPG(Source):
 
         if events:
             return events
-        return []
+        return ()
 
     def getEPGofService(self, ref, options='IBDTSERN'):
         print "getting EPG of Service", ref
@@ -85,7 +84,7 @@ class EPG(Source):
                 return list
 
             return events
-        return []
+        return ()
 
     def insertEndTime(self, events):
         list = []
@@ -109,7 +108,7 @@ class EPG(Source):
         print "[WebComponents.EPG] getting EPG for Bouquet", param
 
         if not param.has_key('bRef'):
-            return []
+            return ()
 
         time = -1
         if param.has_key('time'):
@@ -131,7 +130,7 @@ class EPG(Source):
 
         if events:
             return events
-        return []
+        return ()
 
     def searchEvent(self, needle):
         print "[WebComponents.EPG] searching EPG: ", needle
@@ -139,7 +138,7 @@ class EPG(Source):
         events = self.epgcache.search(('IBDTSERN', 256, eEPGCache.PARTIAL_TITLE_SEARCH, needle, 1));
         if events:
             return events
-        return []
+        return ()
 
     def searchSimilarEvent(self, needle):
         print "[WebComponents.EPG] searching similar eventid: ",needle
@@ -147,7 +146,7 @@ class EPG(Source):
         events = self.epgcache.search(('IBDTSERN', 256, eEPGCache.SIMILAR_BROADCASTINGS_SEARCH, needle['sRef'], int(needle['eventid'])));
         if events:
             return events
-        return []
+        return ()
 
     def getLut(self):
         if self.endtime:
index 1ccf8bd..d9d8b80 100644 (file)
@@ -4,19 +4,18 @@ from Components.NimManager import nimmanager
 class Frontend(Source, object):
        def __init__(self):
                Source.__init__(self)
-               
+
        def getList(self):
                nims = []
                for nim in nimmanager.nimList():
                        info = nim.split(":")
-                       nims.append([
+                       nims.append((
                                                info[0],
                                                info[1]
-                                       ])
+                                       ))
                return nims
-                       
-                       
-       list = property(getList)        
+
+       list = property(getList)
        lut = {
                "Name" : 0,
                "Type" : 1
index 7dae817..d6fa8bb 100644 (file)
@@ -7,7 +7,7 @@ class Hdd(Source):
                self.devicecount = devicecount
 
        def getHddData(self):
-               if len(harddiskmanager.hdd) > 0:
+               if harddiskmanager.hdd:
                        return harddiskmanager.hdd[0]
                else:
                        return None
@@ -25,17 +25,13 @@ class Hdd(Source):
                        else:
                                free = float(hdd.free()) / float(1024)
                                free = "%.3f GB" % free
-                       disk = [model, capacity, free]
-                       disks.append(disk)
-               
+                       disks.append((model, capacity, free))
+
                return disks
-               
-                       
-       list = property(getList)        
+
+       list = property(getList)
        lut = { "Model" : 0,
                        "Capacity" : 1,
-                       "Free" : 2              
+                       "Free" : 2
                }
 
-       def destroy(self):
-               Source.destroy(self)
index be0939a..6f13c31 100644 (file)
@@ -10,7 +10,7 @@ class LocationsAndTags(Source):
                self.func = func
                Source.__init__(self)
                self.session = session
-               self.result = [ False, "one two three four unknown command" ]
+               self.result = ( False, "one two three four unknown command" )
 
        def handleCommand(self, cmd):
                if self.func is self.CURRLOCATION:
@@ -36,7 +36,7 @@ class LocationsAndTags(Source):
                                tags.remove("")
                        file.close()
                except IOError, ioe:
-                       tags = []
+                       tags = ()
                return tags
 
        def getText(self):
@@ -51,8 +51,8 @@ class LocationsAndTags(Source):
                self.handleCommand(None)
                list = self.result
                if list is None:
-                       list = []
-               
+                       list = ()
+
                return list
 
        text = property(getText)
index 7a46191..86817a8 100644 (file)
@@ -15,7 +15,7 @@ class MP(Source):
                self.func = func
                self.session = session
                error = "unknown command (%s)" % func
-               self.result = [[error, error, error]]
+               self.result = ((error, error, error),)
 
        def handleCommand(self, cmd):
                self.cmd = cmd
@@ -51,23 +51,18 @@ class MP(Source):
        def getFileList(self, param):
                print "getFileList:", param
 
-               returnList = []
-
                if param["path"] == "playlist":
                        # TODO: Fix dummy return if unable to load mp
                        if not self.tryOpenMP():
-                               returnList.append(["empty", "True", "playlist"])
-                               return returnList
+                               return (("empty", "True", "playlist"),)
 
                        mp = self.session.mediaplayer
-                       if len(mp.playlist) != 0:
-                               serviceRefList = mp.playlist.getServiceRefList()
-                               for count in range(len(serviceRefList)):
-                                       returnList.append([serviceRefList[count].toString(), "True", "playlist"])
+                       if mp.playlist:
+                               return [(serviceRef.toString(), "True", "playlist") for serviceRef in mp.playlist.getServiceRefList()]
                        else:
-                               returnList.append(["empty", "True", "playlist"])
+                               return (("empty", "True", "playlist"),)
 
-                       return returnList
+               returnList = []
 
                matchingPattern = "(?i)^.*\.(mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob)" #MediaPlayer-Match
                useServiceRef = False
@@ -87,14 +82,14 @@ class MP(Source):
                for x in list:
                        if useServiceRef == True:
                                if x[0][1] == False: #isDir
-                                       returnList.append([x[0][0].toString(), x[0][1], param["path"]])
+                                       returnList.append((x[0][0].toString(), x[0][1], param["path"]))
                                else:
-                                       returnList.append([x[0][0], x[0][1], param["path"]])
+                                       returnList.append((x[0][0], x[0][1], param["path"]))
                        else:
                                if x[0][1] == False: #isDir
-                                       returnList.append([param["path"] + x[0][0], x[0][1], param["path"]])
+                                       returnList.append((param["path"] + x[0][0], x[0][1], param["path"]))
                                else:
-                                       returnList.append([x[0][0], x[0][1], param["path"]])
+                                       returnList.append((x[0][0], x[0][1], param["path"]))
 
                return returnList
 
@@ -118,12 +113,14 @@ class MP(Source):
                mp.playlist.addFile(ref)
 
                #mp.playServiceRefEntry(ref)
+               sRefList = mp.playlist.getServiceRefList()
+               Len = len(sRefList)
                print "len len(mp.playlist.getServiceRefList()): ", len(mp.playlist.getServiceRefList())
-               if len(mp.playlist.getServiceRefList()):
-                       lastEntry = len(mp.playlist.getServiceRefList()) - 1
-                       currref = mp.playlist.getServiceRefList()[lastEntry]
+               if Len:
+                       lastEntry = Len - 1
+                       currref = sRefList[lastEntry]
                        if self.session.nav.getCurrentlyPlayingServiceReference() is None or currref != self.session.nav.getCurrentlyPlayingServiceReference():
-                               self.session.nav.playService(mp.playlist.getServiceRefList()[lastEntry])
+                               self.session.nav.playService(sRefList[lastEntry])
                                info = eServiceCenter.getInstance().info(currref)
                                description = info and info.getInfoString(currref, iServiceInformation.sDescription) or ""
                                mp["title"].setText(description)
@@ -132,7 +129,6 @@ class MP(Source):
 
                mp.playlist.updateList()
                mp.infoTimerFire()
-               return
 
        def writePlaylist(self, param):
                print "writePlaylist: ", param
@@ -168,12 +164,7 @@ class MP(Source):
                elif param == "exit":
                        mp.exit()
 
-               return
-
-       def getList(self):
-               return self.result
-
-       list = property(getList)
+       list = property(lambda self: self.result)
        lut = {"ServiceReference": 0
                        , "IsDirectory": 1
                        , "Root": 2
index f466175..6033a5f 100644 (file)
@@ -14,7 +14,7 @@ class Message(Source):
                self.func = func
                Source.__init__(self)
                error = "unknown command (%s)" % func
-               self.res = [False, error]
+               self.res = (False, error)
 
        def handleCommand(self, cmd):
                self.cmd = cmd
@@ -27,14 +27,14 @@ class Message(Source):
                print "printMessage"
 
                if self.cmd['text'] == "" or self.cmd['text'] is None:
-                       return [ False, "No Messagetext given" ]
+                       return ( False, "No Messagetext given" )
                else:
                        mtext = self.cmd['text']
 
                try:
                        typeint = int(self.cmd['type'])
                except ValueError, e:
-                       return [ False, "type %s is not a number" % self.cmd['type'] ]
+                       return ( False, "type %s is not a number" % self.cmd['type'] )
 
                if typeint == MessageBox.TYPE_YESNO:
                        #dont know how to give the result to the webif back
@@ -46,7 +46,7 @@ class Message(Source):
                elif typeint == MessageBox.TYPE_ERROR:
                        mtype = MessageBox.TYPE_ERROR
                else:
-                       return [ False, "Unsupported Messagetype %s" % self.cmd['type'] ]
+                       return ( False, "Unsupported Messagetype %s" % self.cmd['type'] )
 
                try:
                        mtimeout = int(self.cmd['timeout'])
@@ -58,7 +58,7 @@ class Message(Source):
                else:
                        self.session.open(MessageBox, mtext, type=mtype , timeout=mtimeout)
 
-               return [ True, "Message sent successfully!" ]
+               return ( True, "Message sent successfully!" )
 
        def yesNoAnswer(self, confirmed):
                print "yesNoAnswer", confirmed
@@ -83,13 +83,10 @@ class Message(Source):
                        system(cmdstr)
                        print "Answer: (%s)" % lines[0]
                        if lines[0] == "yes":
-                               return [ True, "Answer is YES!" ]
+                               return ( True, "Answer is YES!" )
                        else:
-                               return [ True, "Answer is NO!" ]
+                               return ( True, "Answer is NO!" )
                else:
-                       return [ False, "No answer in time" ]
-       
-       def getResult(self):
-               return self.res
-               
-       result = property(getResult)
+                       return ( False, "No answer in time" )
+
+       result = property(lambda self: self.res)
index ffbcff1..90a8025 100644 (file)
@@ -21,7 +21,7 @@ class Movie(Source):
                self.movielist = movielist #MovieList(self.root)
                self.movielist.load(self.root, None)
                self.cmd = ""
-               self.res = [ False, "Missing or Wrong Argument" ]
+               self.res = ( False, "Missing or Wrong Argument" )
 
        def handleCommand(self, cmd):
                if cmd is not None:
@@ -54,11 +54,11 @@ class Movie(Source):
                                        result = True
 
                        if result == False:
-                               return [ result, "Could not delete Movie '%s'" % name ]
+                               return ( result, "Could not delete Movie '%s'" % name )
                        else:
-                               return [ result, "Movie '%s' deleted" % name ]
+                               return ( result, "Movie '%s' deleted" % name )
 
-               return [ result, "Illegal Parameter Value: sRef - '%s'" % param ]
+               return ( result, "Illegal Parameter Value: sRef - '%s'" % param )
 
        def getMovieList(self):
                self.movielist.reload(root=self.root, filter_tags=self.tagfilter)
@@ -94,7 +94,7 @@ class Movie(Source):
 
                        if not tag or tag in info.getInfoString(serviceref, iServiceInformation.sTags).lower():
                                """ add movie only to list, if a given tag is applied to the movie """
-                               list.append([
+                               list.append((
                                        serviceref.toString(),
                                        ServiceReference(serviceref).getServiceName(),
                                        info.getInfoString(serviceref, iServiceInformation.sDescription),
@@ -106,17 +106,16 @@ class Movie(Source):
                                        ext,
                                        filename,
                                        os_stat(filename)[6]
-                               ])
+                               ))
                return list
 
        def getResult(self):
                if self.func is self.DEL:
                        return self.res
-               
-               return [ False, "illegal call" ]
-       
-       
-       result = property(getResult)    
+
+               return ( False, "illegal call" )
+
+       result = property(getResult)
 
        list = property(getMovieList)
        lut = {"ServiceReference": 0
index 57d9ffe..569d771 100644 (file)
@@ -13,14 +13,13 @@ class Interface:
 class Network(Source):
        LAN = 0
        WLAN = 1
-       
+
        def __init__(self, device=LAN):
                Source.__init__(self)
                if device is self.LAN:
                        self.iface = "eth0"
                elif device is self.WLAN:
                        self.iface = "ath0"
-                       
 
        def ConvertIP(self, list):
                if(len(list) == 4):
@@ -29,7 +28,6 @@ class Network(Source):
                        retstr = "0.0.0.0"
                return retstr
 
-               
        def getInterface(self):
                iface = Interface(self.iface)
                iface.mac = iNetwork.getAdapterAttribute(self.iface, "mac")
@@ -37,30 +35,27 @@ class Network(Source):
                iface.ip = self.ConvertIP(iNetwork.getAdapterAttribute(self.iface, "ip"))
                iface.netmask = self.ConvertIP(iNetwork.getAdapterAttribute(self.iface, "netmask"))
                iface.gateway = self.ConvertIP(iNetwork.getAdapterAttribute(self.iface, "gateway"))
-               
+
                return iface
-       
+
        interface = property(getInterface)
-       
+
        def getList(self):
-               ifaces = []
-               for ifname in iNetwork.getConfiguredAdapters():
-                       iface = [
+               return [
+                       (
                                        ifname,
                                        iNetwork.getAdapterAttribute(ifname, "mac"),
                                        iNetwork.getAdapterAttribute(ifname, "dhcp"),
                                        self.ConvertIP(iNetwork.getAdapterAttribute(ifname, "ip")),
                                        self.ConvertIP(iNetwork.getAdapterAttribute(ifname, "netmask")),
                                        self.ConvertIP(iNetwork.getAdapterAttribute(ifname, "gateway"))
-                               ]                       
-                       ifaces.append(iface)
-               
-               return ifaces
+                       )
+                       for ifname in iNetwork.getConfiguredAdapters()
+               ]
 
-               
        list = property(getList)
-       
-       lut = { 
+
+       lut = {
                        "Name": 0,
                        "Mac" : 1,
                        "Dhcp" : 2,
@@ -68,7 +63,4 @@ class Network(Source):
                        "Netmask" : 4,
                        "Gateway" : 5,
                   }
-       
-       
-       def destroy(self):
-               Source.destroy(self)
+
index aeedf7e..2c8a283 100644 (file)
@@ -21,7 +21,7 @@ class ParentControl(Source):
                                servicelist = parentalControl.blacklist
 
                        for service_ref in servicelist:
-                               list.append([str(service_ref), ServiceReference(service_ref).getServiceName()])
+                               list.append((str(service_ref), ServiceReference(service_ref).getServiceName()))
 
                print "list", list
                return list
index 035c409..11c0d79 100644 (file)
@@ -7,7 +7,7 @@ class RemoteControl(Source):
         self.cmd = None
         self.session = session
         Source.__init__(self)
-        self.res = [ False, "Missing or wrong argument" ]
+        self.res = ( False, "Missing or wrong argument" )
 
     def handleCommand(self, cmd):
         self.cmd = cmd
@@ -21,7 +21,7 @@ class RemoteControl(Source):
         type = int(self.cmd)
         if type <= 0:
             print "[RemoteControl.py] command <= 0 (%s)" % type
-            return  [ False, "the command was not > 0" ]
+            return ( False, "the command was not > 0" )
 
         dataon = pack('iiHHi', 0, 0, 1, type, 1)
         dataoff = pack('iiHHi', 0, 0, 1, type, 0)
@@ -35,10 +35,6 @@ class RemoteControl(Source):
         fp.close()
 
         print "[RemoteControl.py] command was was sent (%s)" % type
-        return [ True, "command was was sent" ]
+        return ( True, "command was was sent" )
 
-    def getResult(self):
-        return self.res
-
-
-    result = property(getResult)
+       result = property(lambda self: self.res)
index 1754b34..d74a863 100644 (file)
@@ -5,53 +5,50 @@ from enigma import eServiceReference
 
 class ServiceListRecursive(Source):
        FETCH = 0
-       
+
        def __init__(self, session, func=FETCH):
                Source.__init__(self)
-               
+
                self.session = session
                self.func = func
                self.servicelist = {}
                self.xml = ""
                self.command = eServiceReference(service_types_tv + ' FROM BOUQUET "bouquets.tv" ORDER BY bouquet')
-       
+
        def handleCommand(self, cmd):
                self.command = eServiceReference(cmd)
-       
+
        def do_func(self):
                if self.func == self.FETCH:
                        func = self.buildList
                else:
                        func = self.buildList
-               
+
                return func(self.command)
-       
+
        def buildList(self, ref):
                self.servicelist = ServiceList(ref, command_func=self.getServiceList, validate_commands=False)
                list = self.servicelist.getServicesAsList()
-               for index in range(len(list)): 
-                       item = list[index]
-                       
+               for item in list:
                        self.servicelist.setRoot(eServiceReference(item[0]))
                        sub = self.servicelist.getServicesAsList()
-                       
-                       if len(sub) > 0:
-                               # list[index] = ( item[0] , item[1], sub )
+
+                       if sub:
                                self.xml += "\t<e2bouquet>\n"
                                bouquet = True
-                               
+
                                subxml = ""
                                for (ref, name) in sub:
                                        subxml += "\t\t\t<e2service>\n"
                                        subxml += "\t\t\t\t<e2servicereference>%s</e2servicereference>\n\t\t\t\t<e2servicename>%s</e2servicename>\n" % (self.filterXML(ref), self.filterXML(name))
                                        subxml += "\t\t\t</e2service>\n"
-                       
+
                        else:
                                self.xml += "\t\t<e2service>\n"
                                bouquet = False
-                       
+
                        self.xml += "\t\t<e2servicereference>%s</e2servicereference>\n\t\t<e2servicename>%s</e2servicename>\n" % (self.filterXML(item[0]), self.filterXML(item[1]))
-                       
+
                        if bouquet:
                                self.xml += "\t\t<e2servicelist>\n"
                                self.xml += subxml
@@ -59,17 +56,17 @@ class ServiceListRecursive(Source):
                                self.xml += "\t</e2bouquet>\n"
                        else:
                                self.xml += "\t</e2service>\n"
-               
+
                return self.xml
-       
+
        def filterXML(self, item):
                item = item.replace("&", "&amp;").replace("<", "&lt;").replace('"', '&quot;').replace(">", "&gt;")
                return item
-       
+
        def getServiceList(self, ref):
                self.servicelist.root = ref
-                       
+
        text = property(do_func)
-               
+
 #      list = property(do_func)
 #      lut = {"ServiceReference": 0, "ServiceName": 1 }
index 7a98ea3..c331ca7 100644 (file)
@@ -18,13 +18,13 @@ class ServiceListReload(Source):
                        if self.cmd is self.BOTH:
                                self.reloadLameDB()
                                self.reloadUserBouquets()
-                               self.res = [ True, 'reloaded both' ]
+                               self.res = ( True, 'reloaded both' )
                        elif self.cmd is self.LAMEDB:
                                self.res = self.reloadLameDB()
-                               self.res = [ True, 'reloaded lamedb' ]
+                               self.res = ( True, 'reloaded lamedb' )
                        elif self.cmd is self.USERBOUQUETS:
                                self.res = self.reloadUserBouquets()
-                               self.res = [ True, 'reloaded bouquets' ]                                
+                               self.res = ( True, 'reloaded bouquets' )
                except Exception, e:
                        pass
 
@@ -40,6 +40,6 @@ class ServiceListReload(Source):
                if self.res:
                        return self.res
                else:
-                       return [ False, "missing or wrong parameter mode [%i=both, %i=lamedb only, %i=userbouqets only]" % (self.BOTH, self.LAMEDB, self.USERBOUQUETS) ]
+                       return ( False, "missing or wrong parameter mode [%i=both, %i=lamedb only, %i=userbouqets only]" % (self.BOTH, self.LAMEDB, self.USERBOUQUETS) )
 
        result = property(getResult)
index e4001d8..72b5af7 100644 (file)
@@ -21,9 +21,9 @@ class Settings(Source):
                        if isinstance(val, dict):
                                self.pickle_this(name, val, result)
                        elif isinstance(val, tuple):
-                               result.append([name, val[0]])
+                               result.append((name, val[0]))
                        else:
-                               result.append([name, val])
+                               result.append((name, val))
 
        list = property(do_func)
        lut = {"Name": 0
index 9dd1da0..1dca0d0 100644 (file)
@@ -8,66 +8,71 @@ class SubServices(Source):
                self.session = session
                self.streamingScreens = streamingScreens
                self.cmd = None
-       
+
        def handleCommand(self, cmd):
                if cmd is not None:
                        print "[SubServices].handleCommand %s" %cmd
                        self.cmd = cmd
-       
+
        def getSubservices(self):
                print "[SubServices].getSubservices called"
                list = []
-               
+
                if self.streamingScreens is None:
                        currentServiceRef = self.session.nav.getCurrentlyPlayingServiceReference()
                        if currentServiceRef is not None:
-                               list.append([currentServiceRef.toString(),
-                                                        ServiceReference(currentServiceRef).getServiceName()]
-                                                        )
-       
+                               list.append((
+                                       currentServiceRef.toString(),
+                                        ServiceReference(currentServiceRef).getServiceName()
+                               ))
+
                                currentService = self.session.nav.getCurrentService()
                                subservices = currentService and currentService.subServices()
                                if subservices or subservices.getNumberOfSubservices() != 0:
                                        n = subservices and subservices.getNumberOfSubservices()
-                                       for x in range(n):
+                                       x = 0
+                                       while x < n:
                                                sub = subservices.getSubservice(x)
-                                               list.append([sub.toString(), sub.getName()])
-       
+                                               list.append((sub.toString(), sub.getName()))
+                                               x += 1
+
                        else:
-                               list.append(["N/A", "N/A"])
-       
+                               list = (("N/A", "N/A"),)
+
                        print "SubServices is returning list ", list
                        return list
-               
+
                elif self.cmd is not None:
                        print "[SubServices].getSubservices for Streaming Service"
                        for screen in self.streamingScreens:
                                if screen is not None:
                                        service = screen.getRecordService()
-                                       sref = ServiceReference(screen.getRecordServiceRef())                                           
-                                       if service is not None:                                         
+                                       sref = ServiceReference(screen.getRecordServiceRef())
+                                       if service is not None:
                                                print "[SubServices] serviceref: %s | cmd: %s" %(sref, self.cmd)
-                                               
+
                                                if sref.__str__() == self.cmd:
-                                                       list.append([sref.__str__(), sref.getServiceName()])
+                                                       list.append((sref.__str__(), sref.getServiceName()))
                                                        print "[SubServices] Matching recordSerivce found!"
                                                        subservices = service and service.subServices()
                                                        if subservices or subservices.getNumberOfSubservices() != 0:
                                                                n = subservices and subservices.getNumberOfSubservices()
-                                                               for x in range(n):
+                                                               x = 0
+                                                               while x < n:
                                                                        sub = subservices.getSubservice(x)
-                                                                       list.append([sub.toString(), sub.getName()])
-                                                               
+                                                                       list.append((sub.toString(), sub.getName()))
+                                                                       x += 1
+
                                                                return list
                                                        else:
                                                                print "[SubServices] no items: %s" %subservices
                                        else:
                                                print "[SubServices] Service is None!"
-               if len(list) == 0:
-                       list.append(["N/A", "N/A"])
+               if not list:
+                       return (("N/A", "N/A"),)
 
                return list
-       
+
        list = property(getSubservices)
        lut = {"ServiceReference": 0,
                        "Name": 1
index e6b135b..a8f3dad 100644 (file)
@@ -26,47 +26,47 @@ class Timer(Source):
                self.session = session
                self.recordtimer = session.nav.RecordTimer
                self.epgcache = eEPGCache.getInstance()
-               self.res = [ False, "unknown command" ]
+               self.res = ( False, "unknown command" )
 
        def handleCommand(self, cmd):
                if self.func is self.ADDBYID:
                        self.res = self.addTimerByEventID(cmd)
                        self.writeTimerList()
-                       
+
                elif self.func is self.ADD:
                        self.res = self.editTimer(cmd)
                        self.writeTimerList()
-                       
+
                elif self.func is self.TVBROWSER:
                        self.res = self.tvBrowser(cmd)
                        self.writeTimerList()
-                       
+
                elif self.func is self.DEL:
                        self.res = self.delTimer(cmd)
                        self.writeTimerList()
-                       
+
                elif self.func is self.CHANGE:
                        self.res = self.editTimer(cmd)
                        self.writeTimerList()
-                       
+
                elif self.func is self.WRITE:
                        self.res = self.writeTimerList(force=True)
-                       
-               elif self.func is self.RECNOW:                  
-                       self.res = self.recordNow(cmd)  
-                                       
+
+               elif self.func is self.RECNOW:
+                       self.res = self.recordNow(cmd)
+
                elif self.func is self.CLEANUP:
                        self.res = self.cleanupTimer()
-                                       
+
                else:
-                       self.res = [ False, "Unknown function: '%s'" % (self.func) ]
+                       self.res = ( False, "Unknown function: '%s'" % (self.func) )
 
        def cleanupTimer(self):
                print "[WebComponents.Timer] cleanupTimer"
-               
+
                self.session.nav.RecordTimer.cleanup()
-               return [ True, "List of Timers has been cleaned" ]
-               
+               return ( True, "List of Timers has been cleaned" )
+
 
        def delTimer(self, param):
                print "[WebComponents.Timer] delTimer"
@@ -74,17 +74,17 @@ class Timer(Source):
                if param.has_key('sRef'):
                        service_ref = ServiceReference(param['sRef'])
                else:
-                       return [ False, "Missing Parameter: sRef" ]
+                       return ( False, "Missing Parameter: sRef" )
 
                if param.has_key('begin'):
                        begin = int(float(param['begin']))
                else:
-                       return [ False, "Missing Parameter: begin" ]
+                       return ( False, "Missing Parameter: begin" )
 
                if param.has_key('end'):
                        end = int(float(param['end']))
                else:
-                       return [ False, "Missing Parameter: end" ]
+                       return ( False, "Missing Parameter: end" )
 
                try:
                        for timer in self.recordtimer.timer_list + self.recordtimer.processed_timers:
@@ -92,7 +92,7 @@ class Timer(Source):
                                        self.recordtimer.removeEntry(timer)
                                        return True, "The timer '%s' has been deleted successfully" % (timer.name)
                except:
-                       return [ False, "The timer has NOT been deleted" ]
+                       return ( False, "The timer has NOT been deleted" )
 
                return False, "No matching Timer found"
 
@@ -112,11 +112,11 @@ class Timer(Source):
                """
                print "[WebComponents.Timer] tvbrowser"
 
-               listDate = ['year', 'month', 'day', 'shour', 'smin', 'ehour', 'emin']
+               listDate = ('year', 'month', 'day', 'shour', 'smin', 'ehour', 'emin')
                for element in listDate:
                        if param[element] is None:
                                if param['s' + element] is None:
-                                       return [ False, "%s missing" % element ]
+                                       return ( False, "%s missing" % element )
                                else:
                                        param[element] = int(param['s' + element])
                        else:
@@ -129,7 +129,7 @@ class Timer(Source):
                        del param[element]
 
                if param['sRef'] is None:
-                       return [ False, "Missing Parameter: sRef" ]
+                       return ( False, "Missing Parameter: sRef" )
                else:
                        takeApart = param['sRef'].split('|')
                        if len(takeApart) > 1:
@@ -137,8 +137,7 @@ class Timer(Source):
 
                repeated = int(param.get('repeated') or 0)
                if repeated == 0:
-                       list = ["mo", "tu", "we", "th", "fr", "sa", "su", "ms", "mf"]
-                       for element in list:
+                       for element in ("mo", "tu", "we", "th", "fr", "sa", "su", "ms", "mf"):
                                if param.has_key(element):
                                        number = param[element] or 0
                                        del param[element]
@@ -157,25 +156,25 @@ class Timer(Source):
                        del param['command']
                        return self.editTimer(param)
                else:
-                       return [ False, "Unknown command: '%s'" % param['command'] ]
+                       return ( False, "Unknown command: '%s'" % param['command'] )
 
        def recordNow(self, param):
-               ret = [ True, "Instant record for current Event started" ]
-               
                limitEvent = True
                if param == "undefinitely" or param == "infinite":
                        ret = (True, "Infinite Instant recording started")
                        limitEvent = False
+               else:
+                       ret = ( True, "Instant record for current Event started" )
 
                serviceref = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference().toString())
-               
+
                event = None
-               
+
                try:
                        service = self.session.nav.getCurrentService()
                        event = service.info().getEvent(0)
                except:
-                       print "[Webcomponents.Timer] recordNow Exception!"                      
+                       print "[Webcomponents.Timer] recordNow Exception!"
 
                begin = time()
                end = begin + 3600 * 10
@@ -190,17 +189,16 @@ class Timer(Source):
                        eventid = curEvent[4]
                        if limitEvent:
                                end = curEvent[1]
-                               
                else:
                        if limitEvent:
-                               ret = [ False, "No event found! Not recording!" ]
-               
+                               ret = ( False, "No event found! Not recording!" )
+
                if ret[0]:
                        location = config.movielist.last_videodir.value
                        timer = RecordTimerEntry(serviceref, begin, end, name, description, eventid, False, False, 0, dirname=location)
                        timer.dontSave = True
                        self.recordtimer.record(timer)
-               
+
                return ret
 
 
@@ -221,16 +219,16 @@ class Timer(Source):
                if param.has_key('sRef'):
                        service_ref = ServiceReference(param['sRef'])
                else:
-                       return [ False, "Missing Parameter: sRef" ]
+                       return ( False, "Missing Parameter: sRef" )
 
                repeated = int(param.get('repeated') or 0)
 
                if not param.has_key('begin'):
-                       return [ False, "Missing Parameter: begin" ]
+                       return ( False, "Missing Parameter: begin" )
                begin = int(float(param['begin']))
 
                if not param.has_key('end'):
-                       return [ False, "Missing Parameter: end" ]
+                       return ( False, "Missing Parameter: end" )
                end = int(float(param['end']))
 
                tm = time()
@@ -239,17 +237,17 @@ class Timer(Source):
                elif tm > begin and tm < end and repeated == 0:
                        begin = time()
                elif repeated == 0:
-                       return [ False, "Illegal Parameter value for Parameter begin : '%s'" % begin ]
+                       return ( False, "Illegal Parameter value for Parameter begin : '%s'" % begin )
 
                if param.has_key('name'):
                        name = param['name']
                else:
-                       return [ False, "Missing Parameter: name" ]
+                       return ( False, "Missing Parameter: name" )
 
                if param.has_key('description'):
                        description = param['description'].replace("\n", " ")
                else:
-                       return [ False, "Missing Parameter: description" ]
+                       return ( False, "Missing Parameter: description" )
 
                disabled = False #Default to: Enabled
                if param.has_key('disabled'):
@@ -286,19 +284,19 @@ class Timer(Source):
                        if param.has_key('channelOld') and param['channelOld'] != '':
                                channelOld = ServiceReference(param['channelOld'])
                        else:
-                               return [ False, "Missing Parameter: channelOld" ]
+                               return ( False, "Missing Parameter: channelOld" )
                        # We do need all of the following Parameters, too, for being able of finding the Timer.
                        # Therefore so we can neither use default values in this part nor can we
                        # continue if a parameter is missing
                        if param.has_key('beginOld'):
                                beginOld = int(param['beginOld'])
                        else:
-                               return [ False, "Missing Parameter: beginOld" ]
+                               return ( False, "Missing Parameter: beginOld" )
 
                        if param.has_key('endOld'):
                                endOld = int(param['endOld'])
                        else:
-                               return [ False, "Missing Parameter: endOld" ]
+                               return ( False, "Missing Parameter: endOld" )
 
                        #let's try to find the timer
                        try:
@@ -323,12 +321,12 @@ class Timer(Source):
                                                                #send the changed timer back to enigma2 and hope it's good
                                                                self.session.nav.RecordTimer.timeChanged(timer)
                                                                print "[WebComponents.Timer] editTimer: Timer changed!"
-                                                               return [ True, "Timer %s has been changed!" % (timer.name) ]
+                                                               return ( True, "Timer %s has been changed!" % (timer.name) )
                        except:
                                #obviously some value was not good, return an error
-                               return [ False, "Changing the timer for '%s' failed!" % name ]
+                               return ( False, "Changing the timer for '%s' failed!" % name )
 
-                       return [ False, "Could not find timer '%s' with given start and end time!" % name ]
+                       return ( False, "Could not find timer '%s' with given start and end time!" % name )
 
                #Try adding a new Timer
 
@@ -338,19 +336,19 @@ class Timer(Source):
                        timer.repeated = repeated
                        #add the new timer
                        self.recordtimer.record(timer)
-                       return [ True, "Timer added successfully!" ]
+                       return ( True, "Timer added successfully!" )
                except:
                        #something went wrong, most possibly one of the given paramater-values was wrong
-                       return [ False, "Could not add timer '%s'!" % name ]
+                       return ( False, "Could not add timer '%s'!" % name )
 
-               return [ False, "Unexpected Error" ]
+               return ( False, "Unexpected Error" )
 
        def addTimerByEventID(self, param):
                print "[WebComponents.Timer] addTimerByEventID", param
                if param['sRef'] is None:
-                       return [ False, "Missing Parameter: sRef" ]
+                       return ( False, "Missing Parameter: sRef" )
                if param['eventid'] is None:
-                       return [ False, "Missing Parameter: eventid" ]
+                       return ( False, "Missing Parameter: eventid" )
 
                justplay = False
                if param['justplay'] is not None:
@@ -367,22 +365,22 @@ class Timer(Source):
                epgcache = eEPGCache.getInstance()
                event = epgcache.lookupEventId(eServiceReference(param['sRef']), int(param['eventid']))
                if event is None:
-                       return [ False, "EventId not found" ]
+                       return ( False, "EventId not found" )
 
                (begin, end, name, description, eit) = parseEvent(event)
 
                timer = RecordTimerEntry(ServiceReference(param['sRef']), begin , end, name, description, eit, False, justplay, AFTEREVENT.NONE, dirname=location, tags=tags)
                self.recordtimer.record(timer)
-               return [ True, "Timer '%s' added" % (timer.name) ]
+               return ( True, "Timer '%s' added" % (timer.name) )
 
        def writeTimerList(self, force=False):
                # is there an easier and better way? :\
                if config.plugins.Webinterface.autowritetimer.value or force:
                        print "Timer.py writing timer to flash"
                        self.session.nav.RecordTimer.saveTimer()
-                       return [ True, "TimerList has been saved " ]
+                       return ( True, "TimerList has been saved " )
                else:
-                       return [ False, "TimerList has not been saved " ]
+                       return ( False, "TimerList has not been saved " )
 
 
        def getResult(self):
@@ -395,58 +393,40 @@ class Timer(Source):
                timerlist = []
 
                for item in self.recordtimer.timer_list + self.recordtimer.processed_timers:
-                       timer = []
-                       timer.append(item.service_ref)
-                       timer.append(item.service_ref.getServiceName())
-                       timer.append(item.eit)
-                       timer.append(item.name)
-                       timer.append(item.description)
-
-                       if item.disabled:
-                               timer.append("1")
-                       else:
-                               timer.append("0")
-
-                       timer.append(item.begin)
-                       timer.append(item.end)
-                       timer.append(item.end - item.begin)
-                       timer.append(item.start_prepare)
-
-                       if item.justplay:
-                               timer.append(1)
-                       else:
-                               timer.append(0)
-
-                       timer.append(item.afterEvent)
-
-                       timer.append(item.dirname)
-                       timer.append(" ".join(item.tags))
-
-                       timer.append(item.log_entries)
+                       timer = [
+                               item.service_ref,
+                               item.service_ref.getServiceName(),
+                               item.eit,
+                               item.name,
+                               item.description,
+                               "1" if item.disabled else "0",
+                               item.begin,
+                               item.end,
+                               item.end - item.begin,
+                               item.start_prepare,
+                               1 if item.justplay else 0,
+                               item.afterEvent,
+                               item.dirname,
+                               " ".join(item.tags),
+                               item.log_entries,
+                               item.backoff,
+                               item.first_try_prepare,
+                               item.state,
+                               item.repeated,
+                               1 if item.dontSave else 0,
+                               item.cancelled,
+                       ]
 
                        try:
                                timer.append(item.Filename)
                        except:
                                timer.append("")
 
-                       timer.append(item.backoff)
-
                        try:
                                timer.append(item.next_activation)
                        except:
                                timer.append("")
 
-                       timer.append(item.first_try_prepare)
-                       timer.append(item.state)
-                       timer.append(item.repeated)
-
-                       if item.dontSave:
-                               timer.append(1)
-                       else:
-                               timer.append(0)
-
-                       timer.append(item.cancelled)
-
                        if item.eit is not None:
                                event = self.epgcache.lookupEvent(['EX', ("%s" % item.service_ref , 2, item.eit)])
                                if event and event[0][0] is not None:
@@ -458,11 +438,9 @@ class Timer(Source):
 
                        #toggleDisabled
                        if item.disabled:
-                               timer.append("0")
-                               timer.append("on")
+                               timer.extend(("0", "on"))
                        else:
-                               timer.append("1")
-                               timer.append("off")
+                               timer.extend(("1", "off"))
 
                        timerlist.append(timer)
 
@@ -485,14 +463,14 @@ class Timer(Source):
                                "Location":12,
                                "Tags":13,
                                "LogEntries":14,
-                               "Filename":15,
-                               "Backoff":16,
-                               "nextActivation":17,
-                               "firstTryPrepare":18,
-                               "State":19,
-                               "Repeated":20,
-                               "dontSave":21,
-                               "Cancled":22,
+                               "Backoff":15,
+                               "firstTryPrepare":16,
+                               "State":17,
+                               "Repeated":18,
+                               "dontSave":19,
+                               "Cancled":20,
+                               "Filename":21,
+                               "nextActivation":22,
                                "DescriptionExtended":23,
                                "toggleDisabled":24,
                                "toggleDisabledIMG":25,
index 3171f2e..c7d0bad 100644 (file)
@@ -10,7 +10,7 @@ class Volume(Source):
                global globalActionMap # hackalert :)
                self.actionmap = globalActionMap
                self.volctrl = eDVBVolumecontrol.getInstance() # this is not nice
-               self.vol = [ True, "State", self.volctrl.getVolume(), self.volctrl.isMuted() ]
+               self.vol = ( True, "State", self.volctrl.getVolume(), self.volctrl.isMuted() )
 
        def handleCommand(self, cmd):
                self.cmd = cmd
@@ -19,20 +19,16 @@ class Volume(Source):
        def handleVolume(self):
                list = []
                if self.cmd == "state":
-                       list.append(True)
-                       list.append("State")
+                       list.extend((True, "State"))
                elif self.cmd == "up":
                        self.actionmap.actions["volumeUp"]()
-                       list.append(True)
-                       list.append("Volume changed")
+                       list.extend((True, "Volume changed"))
                elif self.cmd == "down":
                        self.actionmap.actions["volumeDown"]()
-                       list.append(True)
-                       list.append("Volume changed")
+                       list.extend((True, "Volume changed"))
                elif self.cmd == "mute":
                        self.actionmap.actions["volumeMute"]()
-                       list.append(True)
-                       list.append("Mute toggled")
+                       list.extend((True, "Mute toggled"))
                elif self.cmd.startswith("set"):
                        try:
                                targetvol = int(self.cmd[3:])
@@ -43,22 +39,15 @@ class Volume(Source):
 
                                self.volctrl.setVolume(targetvol, targetvol)
 
-                               list.append(True)
-                               list.append("Volume set to %i" % targetvol)
+                               list.extend((True, "Volume set to %i" % targetvol))
                        except ValueError: # if cmd was set12NotInt
-                               list.append(False)
-                               list.append("Wrong parameter format 'set=%s'. Use set=set15 " % self.cmd)
+                               list.extend((False, "Wrong parameter format 'set=%s'. Use set=set15 " % self.cmd))
                else:
-                       list.append(False)
-                       list.append("Unknown Volume command %s" % self.cmd)
-               
-               list.append(self.volctrl.getVolume())
-               list.append(self.volctrl.isMuted())
+                       list.extend((False, "Unknown Volume command %s" % self.cmd))
+
+               list.extend((self.volctrl.getVolume(), self.volctrl.isMuted()))
 
                return list
-       
-       def getVolume(self):
-               return self.vol
-       
-       volume = property(getVolume)
+
+       volume = property(lambda self: self.vol)
 
index 78da3e4..dec49e2 100644 (file)
@@ -17,17 +17,17 @@ class WAPfunctions(Source):
        LOCATIONLIST = 5
        TAGLIST = 6
        DELETEOLD = 7
-       
+
        lut = { "Name":0,
                        "Value":1,
                        "Selected":2
        }
-       
+
        def __init__(self, session, func=LISTTIME):
                self.func = func
-               Source.__init__(self)           
+               Source.__init__(self)
                self.session = session
-               self.result = ["unknown command (%s)" % self.func]
+               self.result = ( "unknown command (%s)" % (self.func), )
 
        def handleCommand(self, cmd):
                print "WAPfunctions: handleCommand", cmd
@@ -48,15 +48,15 @@ class WAPfunctions(Source):
                elif self.func is self.DELETEOLD:
                        self.result = self.deleteOldSaved(cmd)
                else:
-                       self.result = ["unknown command cmd(%s) self.func(%s)" % (cmd, self.func)]
+                       self.result = ( "unknown command cmd(%s) self.func(%s)" % (cmd, self.func), )
 
        def fillListTime(self, param):
                print "fillListTime", param
-               
+
                input = 0
                start = 1
                end = 1
-               
+
                timeNow = time()
                timePlusTwo = timeNow + 7200
 
@@ -72,7 +72,7 @@ class WAPfunctions(Source):
                        del param['end']
                        if end > 0:
                                timePlusTwo = end
-               
+
                t = {}
                t["sday"] = t["day"] = strftime("%d", localtime(timeNow))
                t["smonth"] = t["month"] = strftime("%m", localtime(timeNow))
@@ -81,7 +81,7 @@ class WAPfunctions(Source):
                t["shour"] = strftime("%H", localtime(timeNow))
                t["emin"] = strftime("%M", localtime(timePlusTwo))
                t["ehour"] = strftime("%H", localtime(timePlusTwo))
-               
+
                key = ""
                for i in param:
                        p = str(i)
@@ -103,16 +103,16 @@ class WAPfunctions(Source):
                else:
                        start = int(t[key])
                        end = int(t[key]) + 2
-               
+
                if param[key] == "now" or param[key] == "end" or param[key] == "begin":
                        input = int(t[key])
                else:
                        input = param[key] or 0
                        input = int(input)
-               
+
                self.result = self.fillOptionListAny(input, start, end)
                return self.result
-       
+
        def fillOptionListAny(self, input, start, end):
                returnList = []
                for i in range(start, end + 1, 1):
@@ -120,26 +120,25 @@ class WAPfunctions(Source):
                        j = str(i)
                        if len(j) == 1:
                                j = "0%s" % j
-                       returnList1.append(j)
-                       returnList1.append(i)
+                       returnList1.extend((j, i))
                        if i == input:
                                returnList1.append("selected")
                        else:
                                returnList1.append("")
                        returnList.append(returnList1)
                return returnList
-               
+
        def fillRepeated(self, param):
                print "fillRepeated", param
                repeated = param or 0
                repeated = int(repeated)
-               
+
                self.lut = {"Name":0
                        , "Value":1
                        , "Description":2
                        , "Selected":3
                }
-               
+
                mo = ["mo",     1, "Mo "]#"Monday"]
                tu = ["tu",     2, "Tu "]#"Tuesday"]
                we = ["we",     4, "We "]#"Wednesday"]
@@ -149,25 +148,25 @@ class WAPfunctions(Source):
                su = ["su", 64, "Su "]#"Sunday"]
                mf = ["mf", 31, "Mo-Fr"]
                ms = ["ms", 127, "Mo-Su"]
-               
+
                if repeated == 127:
                        repeated = repeated - 127
                        ms.append("checked")
                else:
                        ms.append("")
-               
+
                if repeated >= 64:
                        repeated = repeated - 64
                        su.append("checked")
                else:
                        su.append("")
-               
+
                if repeated >= 32:
                        repeated = repeated - 32
                        sa.append("checked")
                else:
                        sa.append("")
-               
+
                if repeated == 31:
                        repeated = repeated - 31
                        mf.append("checked")
@@ -185,38 +184,37 @@ class WAPfunctions(Source):
                        th.append("checked")
                else:
                        th.append("")
-               
+
                if repeated >= 4:
                        repeated = repeated - 4
                        we.append("checked")
                else:
                        we.append("")
-               
+
                if repeated >= 2:
                        repeated = repeated - 2
                        tu.append("checked")
                else:
                        tu.append("")
-               
+
                if repeated == 1:
                        repeated = repeated - 1
                        mo.append("checked")
                else:
                        mo.append("")
-                       
-               returnList = []
-               returnList.append(mo)
-               returnList.append(tu)
-               returnList.append(we)
-               returnList.append(th)
-               returnList.append(fr)
-               returnList.append(sa)
-               returnList.append(su)
-               returnList.append(mf)
-               returnList.append(ms)
 
-               return returnList
-       
+               return [
+                       mo,
+                       tu,
+                       we,
+                       th,
+                       fr,
+                       sa,
+                       su,
+                       mf,
+                       ms,
+               ]
+
        def serviceListOne(self, bouquet, selref):
                ref = eServiceReference(bouquet)
                self.servicelist = ServiceList(ref, command_func=self.getServiceList, validate_commands=False)
@@ -224,9 +222,10 @@ class WAPfunctions(Source):
                returnList = []
                for (ref2, name) in self.servicelist.getServicesAsList():
                        print "ref2: (", ref2, ") name: (", name, ")"
-                       returnListPart = []
-                       returnListPart.append(name)
-                       returnListPart.append(ref2)
+                       returnListPart = [
+                               name,
+                               ref2
+                       ]
                        if ref2 == str(selref):
                                returnListPart.append("selected")
                                self.sRefFound = 1
@@ -240,7 +239,7 @@ class WAPfunctions(Source):
                sRef = str(param["sRef"])
                bouquet = str(param["bouquet"])
                self.sRefFound = 0
-               
+
                if bouquet == '':
                        returnList = []
                        bouquet = '1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "bouquets.tv" ORDER BY bouquet'
@@ -302,47 +301,50 @@ class WAPfunctions(Source):
 
        def fillOptionList(self, param):
                print "fillOptionList", param
-               returnList = []
                if param.has_key("justplay"):
                        number = param["justplay"] or 0
                        number = int(number)
-                       returnList.append(["Record", 0, number == 0 and "selected" or ""])
-                       returnList.append(["Zap", 1, number == 1 and "selected" or ""])
+                       return (
+                               ("Record", 0, number == 0 and "selected" or ""),
+                               ("Zap", 1, number == 1 and "selected" or "")
+                       )
                elif param.has_key("afterevent"):
                        number = param["afterevent"] or 0
                        number = int(number)
-                       returnList.append(["Nothing", 0, number == 0 and "selected" or ""])
-                       returnList.append(["Standby", 1, number == 1 and "selected" or ""])
-                       returnList.append(["Deepstandby/Shutdown", 2, number == 2 and "selected" or ""])
-                       returnList.append(["Auto", 3, number == 3 and "selected" or ""])
-               return returnList
-       
+                       return (
+                               ("Nothing", 0, number == 0 and "selected" or ""),
+                               ("Standby", 1, number == 1 and "selected" or ""),
+                               ("Deepstandby/Shutdown", 2, number == 2 and "selected" or ""),
+                               ("Auto", 3, number == 3 and "selected" or "")
+                       )
+               else:
+                       return ()
+
        def deleteOldSaved(self, param):
                print "deleteOldSaved", param
-               returnList = []
-               returnList.append(["deleteOldOnSave", param["deleteOldOnSave"], ""])
-               returnList.append(["command", param["command"], ""])
+               returnList = [
+                       ("deleteOldOnSave", param["deleteOldOnSave"], ""),
+                       ("command", param["command"], "")
+               ]
                if int(param["deleteOldOnSave"]) == 1:
-                       returnList.append(["channelOld", param["sRef"], ""])
-                       returnList.append(["beginOld", param["begin"], ""])
-                       returnList.append(["endOld", param["end"], ""])
+                       returnList.extend((
+                               ("channelOld", param["sRef"], ""),
+                               ("beginOld", param["begin"], ""),
+                               ("endOld", param["end"], "")
+                       ))
                return returnList
-                       
-       
+
        def fillValue(self, param):
                print "fillValue: ", param
-               return [["", param, ""]]
+               return (("", param, ""),)
 
        def getText(self):
                (result, text) = self.result
                return text
-       
+
        def filterXML(self, item):
                item = item.replace("&", "&amp;").replace("<", "&lt;").replace('"', '&quot;').replace(">", "&gt;")
                return item
 
-       def getList(self):
-               return self.result
-
        text = property(getText)
-       list = property(getList)
+       list = property(lambda self: self.result)