ask to resume on playback
[enigma2.git] / lib / python / Screens / InfoBarGenerics.py
index 9b6712e55a93f4af52ebe5d25f0e49ebe042ae42..42a7eb827b249d63779ebddf808f49c0fbe4ddf4 100644 (file)
@@ -1443,6 +1443,7 @@ class InfoBarCueSheetSupport:
        CUT_TYPE_IN = 0
        CUT_TYPE_OUT = 1
        CUT_TYPE_MARK = 2
+       CUT_TYPE_LAST = 3
        
        def __init__(self):
                self["CueSheetActions"] = HelpableActionMap(self, "InfobarCueSheetActions", 
@@ -1459,8 +1460,26 @@ class InfoBarCueSheetSupport:
                        })
 
        def __serviceStarted(self):
+               if self.is_closing:
+                       return
                print "new service started! trying to download cuts!"
                self.downloadCuesheet()
+               
+               last = None
+               
+               for (pts, what) in self.cut_list:
+                       if what == self.CUT_TYPE_LAST:
+                               last = pts
+                       
+               if last is not None:
+                       self.resume_point = last
+                       Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Do you want to resume this playback?"), timeout=10)
+       
+       def playLastCB(self, answer):
+               if answer == True:
+                       seekable = self.__getSeekable()
+                       if seekable is not None:
+                               seekable.seekTo(self.resume_point)
 
        def __getSeekable(self):
                service = self.session.nav.getCurrentService()