aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-04-26 16:09:30 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-04-26 16:09:30 +0000
commit0bd832437c2d361866236751a03887ecb3048c64 (patch)
tree8929a492f17d23f63e53f8dd5929e9f49cb28b8e
parent7466abeda3437afb71ce9ab8c0917cd8ea14482c (diff)
downloadenigma2-0bd832437c2d361866236751a03887ecb3048c64.tar.gz
enigma2-0bd832437c2d361866236751a03887ecb3048c64.zip
timers can now have after events. currently only working events: "do nothing" and "go to deep standby"
-rw-r--r--RecordTimer.py21
-rw-r--r--lib/python/Screens/TimerEntry.py8
2 files changed, 27 insertions, 2 deletions
diff --git a/RecordTimer.py b/RecordTimer.py
index dfddb73c..11986437 100644
--- a/RecordTimer.py
+++ b/RecordTimer.py
@@ -7,6 +7,8 @@ from Components.config import config
import timer
import xml.dom.minidom
+from enigma import quitMainloop
+
from Screens.MessageBox import MessageBox
from Screens.SubserviceSelection import SubserviceSelection
import NavigationInstance
@@ -34,9 +36,14 @@ def parseEvent(ev):
end += config.recording.margin_after.value[0] * 60
return (begin, end, name, description, eit)
+class AFTEREVENT:
+ NONE = 0
+ STANDBY = 1
+ DEEPSTANDBY = 2
+
# please do not translate log messages
class RecordTimerEntry(timer.TimerEntry):
- def __init__(self, serviceref, begin, end, name, description, eit, disabled = False, justplay = False):
+ def __init__(self, serviceref, begin, end, name, description, eit, disabled = False, justplay = False, afterEvent = AFTEREVENT.NONE):
timer.TimerEntry.__init__(self, int(begin), int(end))
assert isinstance(serviceref, ServiceReference)
@@ -51,6 +58,8 @@ class RecordTimerEntry(timer.TimerEntry):
self.record_service = None
self.start_prepare = 0
self.justplay = justplay
+ self.afterEvent = afterEvent
+ self.session = None
self.log_entries = []
self.resetState()
@@ -174,6 +183,11 @@ class RecordTimerEntry(timer.TimerEntry):
if not self.justplay:
self.record_service.stop()
self.record_service = None
+ if self.afterEvent == AFTEREVENT.STANDBY:
+ if self.session is not None:
+ self.session.open(Standby, self)
+ elif self.afterEvent == AFTEREVENT.DEEPSTANDBY:
+ quitMainloop(1)
return True
def getNextActivation(self):
@@ -210,6 +224,8 @@ def createTimer(xml):
repeated = xml.getAttribute("repeated").encode("utf-8")
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]
if xml.hasAttribute("eit") and xml.getAttribute("eit") != "None":
eit = long(xml.getAttribute("eit"))
else:
@@ -217,7 +233,7 @@ def createTimer(xml):
name = xml.getAttribute("name").encode("utf-8")
#filename = xml.getAttribute("filename").encode("utf-8")
- entry = RecordTimerEntry(serviceref, begin, end, name, description, eit, disabled, justplay)
+ entry = RecordTimerEntry(serviceref, begin, end, name, description, eit, disabled, justplay, afterevent)
entry.repeated = int(repeated)
for l in elementsWithTag(xml.childNodes, "log"):
@@ -311,6 +327,7 @@ 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])) + '"')
if timer.eit is not None:
list.append(' eit="' + str(timer.eit) + '"')
list.append(' disabled="' + str(int(timer.disabled)) + '"')
diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py
index 0e557a64..fb560a7f 100644
--- a/lib/python/Screens/TimerEntry.py
+++ b/lib/python/Screens/TimerEntry.py
@@ -11,6 +11,7 @@ from Components.Label import Label
from Components.Pixmap import Pixmap
from Screens.SubserviceSelection import SubserviceSelection
from Screens.MessageBox import MessageBox
+from RecordTimer import AFTEREVENT
from enigma import eEPGCache
import time
import datetime
@@ -59,6 +60,8 @@ class TimerEntry(Screen):
else:
justplay = 1
+ afterevent = { AFTEREVENT.NONE: 0, AFTEREVENT.DEEPSTANDBY: 1, AFTEREVENT.STANDBY: 2}[self.timer.afterEvent]
+
# calculate default values
day = []
weekday = 0
@@ -93,6 +96,7 @@ class TimerEntry(Screen):
day[weekday] = 0
config.timerentry.justplay = configElement_nonSave("config.timerentry.justplay", configSelection, justplay, (("zap", _("zap")), ("record", _("record"))))
+ config.timerentry.afterevent = configElement_nonSave("config.timerentry.afterevent", configSelection, afterevent, (("nothing", _("do nothing")), ("deepstandby", _("go to deep standby"))))
config.timerentry.type = configElement_nonSave("config.timerentry.type", configSelection, type, (_("once"), _("repeated")))
config.timerentry.name = configElement_nonSave("config.timerentry.name", configText, self.timer.name, (configText.extendableSize, self.keyRightCallback))
config.timerentry.description = configElement_nonSave("config.timerentry.description", configText, self.timer.description, (configText.extendableSize, self.keyRightCallback))
@@ -187,6 +191,9 @@ class TimerEntry(Screen):
if currentConfigSelectionElement(config.timerentry.justplay) != "zap":
self.list.append(getConfigListEntry(_("EndTime"), config.timerentry.endtime))
+ if currentConfigSelectionElement(config.timerentry.justplay) != "zap":
+ self.list.append(getConfigListEntry(_("After event"), config.timerentry.afterevent))
+
self.channelEntry = getConfigListEntry(_("Channel"), config.timerentry.service)
self.list.append(self.channelEntry)
@@ -252,6 +259,7 @@ class TimerEntry(Screen):
self.timer.description = config.timerentry.description.value
self.timer.justplay = (currentConfigSelectionElement(config.timerentry.justplay) == "zap")
self.timer.resetRepeated()
+ self.timer.afterEvent = { 0: AFTEREVENT.NONE, 1: AFTEREVENT.DEEPSTANDBY, 2: AFTEREVENT.STANDBY}[config.timerentry.afterevent.value]
if (config.timerentry.type.value == 0): # once
self.timer.begin = self.getTimestamp(config.timerentry.startdate.value, config.timerentry.starttime.value)