Merge commit 'dm/experimental' into vuplus_experimental
[vuplus_dvbapp] / RecordTimer.py
old mode 100644 (file)
new mode 100755 (executable)
index 4907f64..188aae5
@@ -2,6 +2,7 @@ from enigma import eEPGCache, getBestPlayableServiceReference, \
        eServiceReference, iRecordableService, quitMainloop
 
 from Components.config import config
+from Components.UsageConfig import defaultMoviePath
 from Components.TimerSanityCheck import TimerSanityCheck
 
 from Screens.MessageBox import MessageBox
@@ -101,7 +102,10 @@ class RecordTimerEntry(timer.TimerEntry, object):
                
                assert isinstance(serviceref, ServiceReference)
                
-               self.service_ref = serviceref
+               if serviceref.getType() == eServiceReference.idDVB and serviceref.getPath() == "":
+                       self.service_ref = serviceref
+               else:
+                       self.service_ref = ServiceReference(None)
                self.eit = eit
                self.dontSave = False
                self.name = name
@@ -128,6 +132,7 @@ class RecordTimerEntry(timer.TimerEntry, object):
        def calculateFilename(self):
                service_name = self.service_ref.getServiceName()
                begin_date = strftime("%Y%m%d %H%M", localtime(self.begin))
+               begin_shortdate = strftime("%Y%m%d", localtime(self.begin))
                
                print "begin_date: ", begin_date
                print "service_name: ", service_name
@@ -136,16 +141,26 @@ class RecordTimerEntry(timer.TimerEntry, object):
                
                filename = begin_date + " - " + service_name
                if self.name:
-                       filename += " - " + self.name
+                       if config.usage.setup_level.index >= 2: # expert+
+                               if config.recording.filename_composition.value == "short":
+                                       filename = begin_shortdate + " - " + self.name
+                               elif config.recording.filename_composition.value == "long":
+                                       filename += " - " + self.name + " - " + self.description
+                               else:
+                                       filename += " - " + self.name # standard
+                       else:
+                               filename += " - " + self.name
 
                if config.recording.ascii_filenames.value:
                        filename = ASCIItranslit.legacyEncode(filename)
 
-               if self.dirname and not Directories.fileExists(self.dirname, 'w'):
-                       self.dirnameHadToFallback = True
-                       self.Filename = Directories.getRecordingFilename(filename, None)
+               if not self.dirname or not Directories.fileExists(self.dirname, 'w'):
+                       if self.dirname:
+                               self.dirnameHadToFallback = True
+                       dirname = defaultMoviePath()
                else:
-                       self.Filename = Directories.getRecordingFilename(filename, self.dirname)
+                       dirname = self.dirname
+               self.Filename = Directories.getRecordingFilename(filename, dirname)
                self.log(0, "Filename calculated as: '%s'" % self.Filename)
                #begin_date + " - " + service_name + description)
 
@@ -282,13 +297,13 @@ class RecordTimerEntry(timer.TimerEntry, object):
                                self.record_service = None
                        if self.afterEvent == AFTEREVENT.STANDBY:
                                if not Screens.Standby.inStandby: # not already in standby
-                                       Notifications.AddNotificationWithCallback(self.sendStandbyNotification, MessageBox, _("A finished record timer wants to set your\nDreambox to standby. Do that now?"), timeout = 20)
+                                       Notifications.AddNotificationWithCallback(self.sendStandbyNotification, MessageBox, _("A finished record timer wants to set your\nSTB to standby. Do that now?"), timeout = 20)
                        elif self.afterEvent == AFTEREVENT.DEEPSTANDBY:
                                if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
                                        if Screens.Standby.inStandby: # in standby
                                                RecordTimerEntry.TryQuitMainloop() # start shutdown handling without screen
                                        else:
-                                               Notifications.AddNotificationWithCallback(self.sendTryQuitMainloopNotification, MessageBox, _("A finished record timer wants to shut down\nyour Dreambox. Shutdown now?"), timeout = 20)
+                                               Notifications.AddNotificationWithCallback(self.sendTryQuitMainloopNotification, MessageBox, _("A finished record timer wants to shut down\nyour STB. Shutdown now?"), timeout = 20)
                        return True
 
        def setAutoincreaseEnd(self, entry = None):