X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/1c12be1f77fee011b3b414d86730c1c73e3650b4..771fbf79eee93a0a348d4bdf25a0233e6e87714f:/lib/python/Plugins/Extensions/DVDPlayer/plugin.py diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 79a13e6a..0d1f65fb 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -22,15 +22,13 @@ class FileBrowser(Screen): """ - def __init__(self, session, dvd_filelist = None): + def __init__(self, session, dvd_filelist = [ ]): Screen.__init__(self, session) - if dvd_filelist: - self.dvd_filelist = dvd_filelist + self.dvd_filelist = dvd_filelist + if len(dvd_filelist): self["filelist"] = MenuList(self.dvd_filelist) - else: - self.dvd_filelist = None global lastpath if lastpath is not None: currDir = lastpath + "/" @@ -49,24 +47,31 @@ class FileBrowser(Screen): }) def ok(self): - if self.dvd_filelist: + if len(self.dvd_filelist): print "OK " + self["filelist"].getCurrent() self.close(self["filelist"].getCurrent()) else: global lastpath filename = self["filelist"].getFilename() if filename is not None: - lastpath = filename[0:filename.rfind("/")] if filename.upper().endswith("VIDEO_TS/"): print "dvd structure found, trying to open..." - self.close(filename[0:-9]) + dvdpath = filename[0:-9] + lastpath = (dvdpath.rstrip("/").rsplit("/",1))[0] + print "lastpath video_ts/=", lastpath + self.close(dvdpath) + return if self["filelist"].canDescent(): # isDir self["filelist"].descent() pathname = self["filelist"].getCurrentDirectory() or "" if fileExists(pathname+"VIDEO_TS.IFO"): print "dvd structure found, trying to open..." + lastpath = (pathname.rstrip("/").rsplit("/",1))[0] + print "lastpath video_ts.ifo=", lastpath self.close(pathname) else: + lastpath = filename[0:filename.rfind("/")] + print "lastpath directory=", lastpath self.close(filename) def exit(self): @@ -228,7 +233,7 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP config.seek.stepwise_repeat.value = self.saved_config_seek_stepwise_repeat config.seek.on_pause.value = self.saved_config_seek_on_pause - def __init__(self, session, dvd_device = None, dvd_filelist = None, args = None): + def __init__(self, session, dvd_device = None, dvd_filelist = [ ], args = None): Screen.__init__(self, session) InfoBarBase.__init__(self) InfoBarNotifications.__init__(self) @@ -456,10 +461,10 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP self.doShow() def askLeavePlayer(self): - if self.physicalDVD: - self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list=[(_("Continue playing"), "play"), (_("Exit"), "exit")]) - else: - self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list=[(_("Continue playing"), "play"), (_("Return to file browser"), "browser"), (_("Exit"), "exit")]) + choices = [(_("Continue playing"), "play"), (_("Exit"), "exit")] + if not self.physicalDVD: + choices.insert(1,(_("Return to file browser"), "browser")) + self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list = choices) def nextAudioTrack(self): if self.service: @@ -533,11 +538,13 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP self.askLeavePlayer() def showFileBrowser(self): - if self.physicalDVD: + if self.physicalDVD and len(self.dvd_filelist) == 0: if self.dvd_device == "/dev/cdroms/cdrom0": self.session.openWithCallback(self.DVDdriveCB, MessageBox, text=_("Do you want to play DVD in drive?"), timeout=5 ) else: self.DVDdriveCB(True) + elif len(self.dvd_filelist) == 1: + self.FileBrowserClosed(self.dvd_filelist[0]) else: self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, self.dvd_filelist) @@ -546,6 +553,7 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP self.FileBrowserClosed(self.dvd_device) else: self.session.openWithCallback(self.FileBrowserClosed, FileBrowser) + self.physicalDVD = False def FileBrowserClosed(self, val): curref = self.session.nav.getCurrentlyPlayingServiceReference() @@ -587,9 +595,12 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def playLastCB(self, answer): # overwrite infobar cuesheet function print "playLastCB", answer, self.resume_point - if self.service and answer == True: + if self.service: seek = self.service.seek() - seek.seekTo(self.resume_point) + if answer == True: + seek.seekTo(self.resume_point) + pause = self.service.pause() + pause.unpause() self.hideAfterResume() def showAfterCuesheetOperation(self):