Merge remote branch 'origin/acid-burn/bug_670_plugin_restartoption'
[enigma2.git] / lib / python / Screens / EventView.py
index 5d3786fb7a79cfe1837ce35855c92a22938d35ce..cced3ceba1fa60f1535a289aabdb4c319f51372a 100644 (file)
@@ -6,6 +6,7 @@ from Components.Button import Button
 from Components.Label import Label
 from Components.ScrollLabel import ScrollLabel
 from Components.TimerList import TimerList
 from Components.Label import Label
 from Components.ScrollLabel import ScrollLabel
 from Components.TimerList import TimerList
+from Components.UsageConfig import preferredTimerPath
 from enigma import eEPGCache, eTimer, eServiceReference
 from RecordTimer import RecordTimerEntry, parseEvent, AFTEREVENT
 from TimerEntry import TimerEntry
 from enigma import eEPGCache, eTimer, eServiceReference
 from RecordTimer import RecordTimerEntry, parseEvent, AFTEREVENT
 from TimerEntry import TimerEntry
@@ -20,7 +21,7 @@ class EventViewBase:
                self.similarEPGCB = similarEPGCB
                self.cbFunc = callback
                self.currentService=Ref
                self.similarEPGCB = similarEPGCB
                self.cbFunc = callback
                self.currentService=Ref
-               self.isRecording = (not Ref.ref.flags & eServiceReference.isGroup) and len(Ref.ref.getPath())
+               self.isRecording = (not Ref.ref.flags & eServiceReference.isGroup) and Ref.ref.getPath()
                self.event = Event
                self["epg_description"] = ScrollLabel()
                self["datetime"] = Label()
                self.event = Event
                self["epg_description"] = ScrollLabel()
                self["datetime"] = Label()
@@ -71,6 +72,8 @@ class EventViewBase:
                self.key_green_choice = self.ADD_TIMER
        
        def timerAdd(self):
                self.key_green_choice = self.ADD_TIMER
        
        def timerAdd(self):
+               if self.isRecording:
+                       return
                event = self.event
                serviceref = self.currentService
                if event is None:
                event = self.event
                serviceref = self.currentService
                if event is None:
@@ -83,7 +86,7 @@ class EventViewBase:
                                self.session.openWithCallback(cb_func, MessageBox, _("Do you really want to delete %s?") % event.getEventName())
                                break
                else:
                                self.session.openWithCallback(cb_func, MessageBox, _("Do you really want to delete %s?") % event.getEventName())
                                break
                else:
-                       newEntry = RecordTimerEntry(self.currentService, checkOldTimers = True, *parseEvent(self.event))
+                       newEntry = RecordTimerEntry(self.currentService, checkOldTimers = True, dirname = preferredTimerPath(), *parseEvent(self.event))
                        self.session.openWithCallback(self.finishedAdd, TimerEntry, newEntry)
 
        def finishedAdd(self, answer):
                        self.session.openWithCallback(self.finishedAdd, TimerEntry, newEntry)
 
        def finishedAdd(self, answer):
@@ -92,11 +95,11 @@ class EventViewBase:
                        entry = answer[1]
                        simulTimerList = self.session.nav.RecordTimer.record(entry)
                        if simulTimerList is not None:
                        entry = answer[1]
                        simulTimerList = self.session.nav.RecordTimer.record(entry)
                        if simulTimerList is not None:
-                               if (len(simulTimerList) == 2) and (simulTimerList[1].dontSave) and (simulTimerList[1].autoincrease):
-                                       simulTimerList[1].end = entry.begin - 30
-                                       self.session.nav.RecordTimer.timeChanged(simulTimerList[1])
-                                       self.session.nav.RecordTimer.record(entry)
-                               else:
+                               for x in simulTimerList:
+                                       if x.setAutoincreaseEnd(entry):
+                                               self.session.nav.RecordTimer.timeChanged(x)
+                               simulTimerList = self.session.nav.RecordTimer.record(entry)
+                               if simulTimerList is not None:
                                        self.session.openWithCallback(self.finishSanityCorrection, TimerSanityConflict, simulTimerList)
                        self["key_green"].setText(_("Remove timer"))
                        self.key_green_choice = self.REMOVE_TIMER
                                        self.session.openWithCallback(self.finishSanityCorrection, TimerSanityConflict, simulTimerList)
                        self["key_green"].setText(_("Remove timer"))
                        self.key_green_choice = self.REMOVE_TIMER
@@ -134,12 +137,12 @@ class EventViewBase:
                text = event.getEventName()
                short = event.getShortDescription()
                ext = event.getExtendedDescription()
                text = event.getEventName()
                short = event.getShortDescription()
                ext = event.getExtendedDescription()
-               if len(short) > 0 and short != text:
-                       text = text + '\n\n' + short
-               if len(ext) > 0:
-                       if len(text) > 0:
-                               text = text + '\n\n'
-                       text = text + ext
+               if short and short != text:
+                       text += '\n\n' + short
+               if ext:
+                       if text:
+                               text += '\n\n'
+                       text += ext
 
                self.setTitle(event.getEventName())
                self["epg_description"].setText(text)
 
                self.setTitle(event.getEventName())
                self["epg_description"].setText(text)
@@ -189,7 +192,7 @@ class EventViewBase:
                        self["key_red"].setText(_("Similar"))
 
        def openSimilarList(self):
                        self["key_red"].setText(_("Similar"))
 
        def openSimilarList(self):
-               if self.similarEPGCB is not None and len(self["key_red"].getText()):
+               if self.similarEPGCB is not None and self["key_red"].getText():
                        id = self.event and self.event.getEventId()
                        refstr = str(self.currentService)
                        if id is not None:
                        id = self.event and self.event.getEventId()
                        refstr = str(self.currentService)
                        if id is not None: