Merge branch 'master' into enigma2_rel25
authorghost <andreas.monzner@multimedia-labs.de>
Tue, 2 Dec 2008 20:44:34 +0000 (21:44 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Tue, 2 Dec 2008 20:44:34 +0000 (21:44 +0100)
Navigation.py
RecordTimer.py
lib/python/Components/FileList.py
lib/python/Components/Harddisk.py
lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpg.py
lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py
lib/python/Plugins/Extensions/MediaPlayer/plugin.py
lib/python/Screens/TimerEntry.py
lib/service/servicemp3.cpp
mytest.py

index 42733cb..715e886 100644 (file)
@@ -11,7 +11,7 @@ import ServiceReference
 
 # TODO: remove pNavgation, eNavigation and rewrite this stuff in python.
 class Navigation:
-       def __init__(self):
+       def __init__(self, nextRecordTimerAfterEventActionAuto=False):
                if NavigationInstance.instance is not None:
                        raise NavigationInstance.instance
                
@@ -33,7 +33,7 @@ class Navigation:
                        clearFPWasTimerWakeup()
                        if getFPWasTimerWakeup(): # sanity check to detect if the FP driver is working correct!
                                print "buggy fp driver detected!!! please update drivers.... ignore timer wakeup!"
-                       elif len(self.getRecordings()) or abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360:
+                       elif nextRecordTimerAfterEventActionAuto and (len(self.getRecordings()) or abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360):
                                if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
                                        RecordTimer.RecordTimerEntry.TryQuitMainloop(False) # start shutdown handling
                self.SleepTimer = SleepTimer.SleepTimer()
index 28b878a..cac475d 100644 (file)
@@ -47,6 +47,7 @@ class AFTEREVENT:
        NONE = 0
        STANDBY = 1
        DEEPSTANDBY = 2
+       AUTO = 3
 
 # please do not translate log messages
 class RecordTimerEntry(timer.TimerEntry, object):
@@ -91,7 +92,7 @@ class RecordTimerEntry(timer.TimerEntry, object):
                        Notifications.AddNotification(Screens.Standby.TryQuitMainloop, 1, onSessionOpenCallback=RecordTimerEntry.stopTryQuitMainloop, default_yes = default_yes)
 #################################################################
 
-       def __init__(self, serviceref, begin, end, name, description, eit, disabled = False, justplay = False, afterEvent = AFTEREVENT.NONE, checkOldTimers = False, dirname = None, tags = None):
+       def __init__(self, serviceref, begin, end, name, description, eit, disabled = False, justplay = False, afterEvent = AFTEREVENT.AUTO, checkOldTimers = False, dirname = None, tags = None):
                timer.TimerEntry.__init__(self, int(begin), int(end))
 
                if checkOldTimers == True:
@@ -361,7 +362,12 @@ def createTimer(xml):
        disabled = long(xml.getAttribute("disabled") or "0")
        justplay = long(xml.getAttribute("justplay") or "0")
        afterevent = str(xml.getAttribute("afterevent") or "nothing")
-       afterevent = { "nothing": AFTEREVENT.NONE, "standby": AFTEREVENT.STANDBY, "deepstandby": AFTEREVENT.DEEPSTANDBY }[afterevent]
+       afterevent = {
+               "nothing": AFTEREVENT.NONE,
+               "standby": AFTEREVENT.STANDBY,
+               "deepstandby": AFTEREVENT.DEEPSTANDBY,
+               "auto": AFTEREVENT.AUTO
+               }[afterevent]
        if xml.hasAttribute("eit") and xml.getAttribute("eit") != "None":
                eit = long(xml.getAttribute("eit"))
        else:
@@ -493,7 +499,12 @@ class RecordTimer(timer.Timer):
                        list.append(' repeated="' + str(int(timer.repeated)) + '"')
                        list.append(' name="' + str(stringToXML(timer.name)) + '"')
                        list.append(' description="' + str(stringToXML(timer.description)) + '"')
-                       list.append(' afterevent="' + str(stringToXML({ AFTEREVENT.NONE: "nothing", AFTEREVENT.STANDBY: "standby", AFTEREVENT.DEEPSTANDBY: "deepstandby" }[timer.afterEvent])) + '"')
+                       list.append(' afterevent="' + str(stringToXML({
+                               AFTEREVENT.NONE: "nothing",
+                               AFTEREVENT.STANDBY: "standby",
+                               AFTEREVENT.DEEPSTANDBY: "deepstandby",
+                               AFTEREVENT.AUTO: "auto"
+                               }[timer.afterEvent])) + '"')
                        if timer.eit is not None:
                                list.append(' eit="' + str(timer.eit) + '"')
                        if timer.dirname is not None:
@@ -538,6 +549,18 @@ class RecordTimer(timer.Timer):
                        return timer.begin
                return -1
 
+       def isNextRecordAfterEventActionAuto(self):
+               now = time.time()
+               t = None
+               for timer in self.timer_list:
+                       if timer.justplay or timer.begin < now:
+                               continue
+                       if t is None or t.begin == timer.begin:
+                               t = timer
+                               if t.afterEvent == AFTEREVENT.AUTO:
+                                       return True
+               return False
+
        def record(self, entry, ignoreTSC=False, dosave=True):          #wird von loadTimer mit dosave=False aufgerufen
                timersanitycheck = TimerSanityCheck(self.timer_list,entry)
                if not timersanitycheck.check():
index e028ec3..231fde2 100644 (file)
@@ -21,6 +21,7 @@ EXTENSIONS = {
                "bmp": "picture",
                "ts": "movie",
                "avi": "movie",
+               "divx": "movie",
                "mpg": "movie",
                "mpeg": "movie",
                "mkv": "movie",
index f7c3a7c..febd16d 100644 (file)
@@ -19,20 +19,22 @@ class Harddisk:
                s_minor = int(tmp[1])
                for disc in listdir("/dev/discs"):
                        path = readlink('/dev/discs/'+disc)
-                       devidex = '/dev'+path[2:]+'/'
-                       disc = devidex+'disc'
+                       devidex = '/dev/discs/'+disc+'/'
+                       devidex2 = '/dev'+path[2:]+'/'
+                       disc = devidex2+'disc'
                        ret = stat(disc).st_rdev
                        if s_major == major(ret) and s_minor == minor(ret):
                                self.devidex = devidex
-                               print "new Harddisk",  device, self.devidex
+                               self.devidex2 = devidex2
+                               print "new Harddisk", device, '->', self.devidex, '->', self.devidex2
                                break
 
        def __lt__(self, ob):
                return self.device < ob.device
 
        def bus(self):
-               ide_cf = self.device.find("hd") == 0 and self.devidex.find("host0") == -1 # 7025 specific
-               internal = self.device.find("hd") == 0 and self.devidex
+               ide_cf = self.device.find("hd") == 0 and self.devidex2.find("host0") == -1 # 7025 specific
+               internal = self.device.find("hd") == 0
                if ide_cf:
                        ret = "External (CF)"
                elif internal:
index 1af90f1..7f422c9 100644 (file)
@@ -489,7 +489,8 @@ class GraphMultiEPG(Screen):
                if self.zapFunc and self["key_red"].getText() == "Zap":
                        self.closeRecursive = True
                        ref = self["list"].getCurrent()[1]
-                       self.zapFunc(ref.ref)
+                       if ref:
+                               self.zapFunc(ref.ref)
 
        def eventSelected(self):
                self.infoKeyPressed()
index 21d1bfe..0ebcafc 100644 (file)
@@ -93,4 +93,5 @@ def main(session, servicelist, **kwargs):
 def Plugins(**kwargs):
        name = _("Graphical Multi EPG")
        descr = _("A graphical EPG for all services of an specific bouquet")
-       return [ PluginDescriptor(name=name, description=descr, where = PluginDescriptor.WHERE_EVENTINFO, fnc=main) ]
+       return [ PluginDescriptor(name=name, description=descr, where = PluginDescriptor.WHERE_EVENTINFO, fnc=main),
+         PluginDescriptor(name=name, description=descr, where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main) ]
index 607294b..41e6ad1 100644 (file)
@@ -110,7 +110,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
 
                # 'None' is magic to start at the list of mountpoints
                defaultDir = config.mediaplayer.defaultDir.getValue()
-               self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|mkv|mp4|dat|flac)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
+               self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|mkv|mp4|dat|flac|divx)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
                self["filelist"] = self.filelist
 
                self.playlist = MyPlayList()
index 1774061..be8b524 100644 (file)
@@ -46,7 +46,12 @@ class TimerEntry(Screen, ConfigListScreen):
        def createConfig(self):
                        justplay = self.timer.justplay
 
-                       afterevent = { AFTEREVENT.NONE: "nothing", AFTEREVENT.DEEPSTANDBY: "deepstandby", AFTEREVENT.STANDBY: "standby"}[self.timer.afterEvent]
+                       afterevent = {
+                               AFTEREVENT.NONE: "nothing",
+                               AFTEREVENT.DEEPSTANDBY: "deepstandby",
+                               AFTEREVENT.STANDBY: "standby",
+                               AFTEREVENT.AUTO: "auto"
+                               }[self.timer.afterEvent]
 
                        weekday_table = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]
 
@@ -84,7 +89,7 @@ class TimerEntry(Screen, ConfigListScreen):
                                day[weekday] = 1
 
                        self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = {0: "record", 1: "zap"}[justplay])
-                       self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby"))], default = afterevent)
+                       self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby")), ("auto", _("auto"))], default = afterevent)
                        self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
                        self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
                        self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
@@ -250,7 +255,12 @@ class TimerEntry(Screen, ConfigListScreen):
                self.timer.description = self.timerentry_description.value
                self.timer.justplay = self.timerentry_justplay.value == "zap"
                self.timer.resetRepeated()
-               self.timer.afterEvent = {"nothing": AFTEREVENT.NONE, "deepstandby": AFTEREVENT.DEEPSTANDBY, "standby": AFTEREVENT.STANDBY}[self.timerentry_afterevent.value]
+               self.timer.afterEvent = {
+                       "nothing": AFTEREVENT.NONE,
+                       "deepstandby": AFTEREVENT.DEEPSTANDBY,
+                       "standby": AFTEREVENT.STANDBY,
+                       "auto": AFTEREVENT.AUTO
+                       }[self.timerentry_afterevent.value]
                self.timer.service_ref = self.timerentry_service_ref
                self.timer.tags = self.timerentry_tags
 
index 017c58f..9c1972d 100644 (file)
@@ -37,6 +37,7 @@ eServiceFactoryMP3::eServiceFactoryMP3()
                extensions.push_back("wave");
                extensions.push_back("mkv");
                extensions.push_back("avi");
+               extensions.push_back("divx");
                extensions.push_back("dat");
                extensions.push_back("flac");
                extensions.push_back("mp4");
@@ -207,7 +208,7 @@ eServiceMP3::eServiceMP3(const char *filename): m_filename(filename), m_pump(eAp
                sourceinfo.containertype = ctMPEGTS;
        else if ( strcasecmp(ext, ".mkv") == 0 )
                sourceinfo.containertype = ctMKV;
-       else if ( strcasecmp(ext, ".avi") == 0 )
+       else if ( strcasecmp(ext, ".avi") == 0 || strcasecmp(ext, ".divx") == 0)
                sourceinfo.containertype = ctAVI;
        else if ( strcasecmp(ext, ".mp4") == 0 )
                sourceinfo.containertype = ctMP4;
index 88c035a..886efab 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -42,13 +42,14 @@ from skin import readSkin
 
 profile("LOAD:Tools")
 from Tools.Directories import InitFallbackFiles, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
-from Components.config import config, configfile, ConfigText
+from Components.config import config, configfile, ConfigText, ConfigYesNo
 InitFallbackFiles()
 
 profile("ReloadProfiles")
 eDVBDB.getInstance().reloadBouquets()
 
 config.misc.radiopic = ConfigText(default = resolveFilename(SCOPE_SKIN_IMAGE)+"radio.mvi")
+config.misc.isNextRecordTimerAfterEventActionAuto = ConfigYesNo(default=False)
 
 profile("Twisted")
 try:
@@ -415,7 +416,8 @@ def runScreenTest():
        plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
 
        profile("Init:Session")
-       session = Session(desktop = getDesktop(0), summary_desktop = getDesktop(1), navigation = Navigation())
+       nav = Navigation(config.misc.isNextRecordTimerAfterEventActionAuto.value)
+       session = Session(desktop = getDesktop(0), summary_desktop = getDesktop(1), navigation = nav)
 
        CiHandler.setSession(session)
 
@@ -464,8 +466,6 @@ def runScreenTest():
        profile("RunReactor")
        profile_final()
        runReactor()
-       profile("configfile.save")
-       configfile.save()
 
        profile("wakeup")
        from time import time
@@ -473,25 +473,32 @@ def runScreenTest():
        #get currentTime
        nowTime = time()
        wakeupList = [
-               x for x in
-                               [session.nav.RecordTimer.getNextRecordingTime(),
-                               session.nav.RecordTimer.getNextZapTime(),
-                               plugins.getNextWakeupTime()]
-               if x != -1
+               x for x in ((session.nav.RecordTimer.getNextRecordingTime(), 0, session.nav.RecordTimer.isNextRecordAfterEventActionAuto()),
+                                       (session.nav.RecordTimer.getNextZapTime(), 1),
+                                       (plugins.getNextWakeupTime(), 2))
+               if x[0] != -1
        ]
        wakeupList.sort()
+       recordTimerWakeupAuto = False
        if len(wakeupList):
                startTime = wakeupList.pop(0)
-               if (startTime - nowTime) < 330: # no time to switch box back on
+               if (startTime[0] - nowTime) < 330: # no time to switch box back on
                        wptime = nowTime + 30  # so switch back on in 30 seconds
                else:
-                       wptime = startTime - 300
+                       wptime = startTime[0] - 300
                setFPWakeuptime(wptime)
+               recordTimerWakeupAuto = startTime[1] == 0 and startTime[2]
+       config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto
+       config.misc.isNextRecordTimerAfterEventActionAuto.save()
+
        profile("stopService")
        session.nav.stopService()
        profile("nav shutdown")
        session.nav.shutdown()
 
+       profile("configfile.save")
+       configfile.save()
+
        return 0
 
 profile("Init:skin")