From: Stefan Pluecken Date: Sun, 2 Apr 2006 22:13:38 +0000 (+0000) Subject: add support for multiple instant recordings X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=d8733ed57694bbb5309afc396cabe2bfc6f35c16 add support for multiple instant recordings --- diff --git a/data/skin_default.xml b/data/skin_default.xml index 087239a..d9ec7e7 100644 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -128,6 +128,9 @@ + + + diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index e96a034..f8b185f 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -15,6 +15,7 @@ from Components.ServiceEventTracker import ServiceEventTracker from Components.ServiceName import ServiceName from Components.config import config, configElement, ConfigSubsection, configSequence, configElementBoolean from Components.config import configfile, configsequencearg +from Components.TimerList import TimerEntryComponent from EpgSelection import EPGSelection from Plugins.Plugin import PluginDescriptor @@ -26,6 +27,7 @@ from Screens.EventView import EventViewEPGSelect, EventViewSimple from Screens.InputBox import InputBox from Screens.MessageBox import MessageBox from Screens.MinuteInput import MinuteInput +from Screens.TimerSelection import TimerSelection from ServiceReference import ServiceReference from Tools import Notifications @@ -983,15 +985,16 @@ class InfoBarInstantRecord: { "instantRecord": (self.instantRecord, "Instant Record..."), }) - self.recording = None + self.recording = [] self["BlinkingPoint"] = BlinkingPixmapConditional() self["BlinkingPoint"].hide() self["BlinkingPoint"].setConnect(self.session.nav.RecordTimer.isRecording) - def stopCurrentRecording(self): - self.session.nav.RecordTimer.removeEntry(self.recording) - self.recording = None - + def stopCurrentRecording(self, entry = -1): + if entry is not None and entry != -1: + self.session.nav.RecordTimer.removeEntry(self.recording[entry]) + self.recording.remove(self.recording[entry]) + def startInstantRecording(self, limitEvent = False): serviceref = self.session.nav.getCurrentlyPlayingServiceReference() @@ -1027,27 +1030,39 @@ class InfoBarInstantRecord: data = (begin, end, name, description, eventid) - self.recording = self.session.nav.recordWithTimer(serviceref, *data) - self.recording.dontSave = True + recording = self.session.nav.recordWithTimer(serviceref, *data) + recording.dontSave = True + self.recording.append(recording) #self["BlinkingPoint"].setConnect(lambda: self.recording.isRunning()) def isInstantRecordRunning(self): - if self.recording != None: - if self.recording.isRunning(): - return True + print "self.recording:", self.recording + if len(self.recording) > 0: + for x in self.recording: + if x.isRunning(): + return True return False def recordQuestionCallback(self, answer): if answer is None or answer[1] == "no": return - - if self.isInstantRecordRunning(): - if answer[1] == "manualduration": - self.session.openWithCallback(self.inputCallback, InputBox, title=_("How many minutes do you want to record?"), text="5", maxSize=False, type=Input.NUMBER) + list = [] + for x in self.recording: + if x.dontSave: + list.append(TimerEntryComponent(x, False)) + + if answer[1] == "changeduration": + if len(self.recording) == 1: + self.changeDuration(0) else: - self.stopCurrentRecording() - else: + self.session.openWithCallback(self.changeDuration, TimerSelection, list) + elif answer[1] == "stop": + if len(self.recording) == 1: + self.stopCurrentRecording(0) + else: + self.session.openWithCallback(self.stopCurrentRecording, TimerSelection, list) + if answer[1] == "indefinitely" or answer[1] == "manualduration" or answer[1] == "event": limitEvent = False if answer[1] == "event": limitEvent = True @@ -1055,12 +1070,16 @@ class InfoBarInstantRecord: self.session.openWithCallback(self.inputCallback, InputBox, title=_("How many minutes do you want to record?"), text="5", maxSize=False, type=Input.NUMBER) self.startInstantRecording(limitEvent = limitEvent) + def changeDuration(self, entry): + if entry is not None: + self.selectedEntry = entry + self.session.openWithCallback(self.inputCallback, InputBox, title=_("How many minutes do you want to record?"), text="5", maxSize=False, type=Input.NUMBER) + def inputCallback(self, value): if value is not None: print "stopping recording after", int(value), "minutes." - if self.recording is not None: - self.recording.end = time.time() + 60 * int(value) - self.session.nav.RecordTimer.timeChanged(self.recording) + self.recording[self.selectedEntry].end = time.time() + 60 * int(value) + self.session.nav.RecordTimer.timeChanged(self.recording[self.selectedEntry]) def instantRecord(self): try: @@ -1070,11 +1089,9 @@ class InfoBarInstantRecord: return if self.isInstantRecordRunning(): - self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("A recording is currently running.\nWhat do you want to do?"), list=[(_("stop recording"), "yes"), (_("enter recording duration"), "manualduration"), (_("do nothing"), "no")]) -# self.session.openWithCallback(self.recordQuestionCallback, MessageBox, _("Do you want to stop the current\n(instant) recording?")) + self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("A recording is currently running.\nWhat do you want to do?"), list=[(_("stop recording"), "stop"), (_("change recording (duration)"), "changeduration"), (_("add recording (indefinitely)"), "indefinitely"), (_("add recording (stop after current event)"), "event"), (_("add recording (enter recording duration)"), "manualduration"), (_("do nothing"), "no")]) else: - self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("Start recording?"), list=[(_("record indefinitely"), "indefinitely"), (_("stop after current event"), "event"), (_("enter recording duration"), "manualduration"),(_("don't record"), "no")]) - #self.session.openWithCallback(self.recordQuestionCallback, MessageBox, _("Start recording?")) + self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("Start recording?"), list=[(_("add recording (indefinitely)"), "indefinitely"), (_("add recording (stop after current event)"), "event"), (_("add recording (enter recording duration)"), "manualduration"),(_("don't record"), "no")]) from Screens.AudioSelection import AudioSelection diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index ea314e2..031e608 100644 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -10,4 +10,4 @@ install_PYTHON = \ Dish.py SubserviceSelection.py LanguageSelection.py StartWizard.py \ TutorialWizard.py PluginBrowser.py MinuteInput.py Scart.py PVRState.py \ Console.py InputBox.py ChoiceBox.py SimpleSummary.py ImageWizard.py \ - MediaPlayer.py + MediaPlayer.py TimerSelection.py diff --git a/lib/python/Screens/TimerSelection.py b/lib/python/Screens/TimerSelection.py new file mode 100644 index 0000000..7a1d9ec --- /dev/null +++ b/lib/python/Screens/TimerSelection.py @@ -0,0 +1,25 @@ +from Screen import Screen +from Components.TimerList import TimerList +from Components.ActionMap import ActionMap + +class TimerSelection(Screen): + def __init__(self, session, list): + Screen.__init__(self, session) + + self.list = list + + self["timerlist"] = TimerList(self.list) + + self["actions"] = ActionMap(["OkCancelActions"], + { + "ok": self.selected, + "cancel": self.leave, + }, -1) + + + def leave(self): + self.close(None) + + def selected(self): + self.close(self["timerlist"].getCurrentIndex()) + \ No newline at end of file diff --git a/lib/python/Screens/__init__.py b/lib/python/Screens/__init__.py index c25426f..60bb48d 100644 --- a/lib/python/Screens/__init__.py +++ b/lib/python/Screens/__init__.py @@ -5,4 +5,5 @@ __all__ = ["ChannelSelection", "ClockDisplay", "ConfigMenu", "Satconfig", "Scanconfig", "Ci.py", "Volume.py", "Mute.py", "EpgSelection", "EventView", "Standby", "ServiceInfo", "AudioSelection", "SubserviceSelection", "InfoBarGenerics", "HelpMenu", "Wizard", - "PVRState", "Console", "InputBox", "ChoiceBox", "SimpleSummary" ] + "PVRState", "Console", "InputBox", "ChoiceBox", "SimpleSummary", + "TimerSelection" ]