1 from os import path as os_path, remove as os_remove, listdir as os_listdir, system
2 from enigma import eTimer, iPlayableService, iServiceInformation, eServiceReference, iServiceKeys, getDesktop
3 from Screens.Screen import Screen
4 from Screens.MessageBox import MessageBox
5 from Screens.ChoiceBox import ChoiceBox
6 from Screens.HelpMenu import HelpableScreen
7 from Screens.InfoBarGenerics import InfoBarSeek, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarShowHide, InfoBarNotifications
8 from Components.ActionMap import ActionMap, NumberActionMap, HelpableActionMap
9 from Components.Label import Label
10 from Components.Pixmap import Pixmap
11 from Components.FileList import FileList
12 from Components.MenuList import MenuList
13 from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
14 from Components.config import config
15 from Tools.Directories import pathExists, fileExists
16 from Components.Harddisk import harddiskmanager
18 import servicedvd # load c++ part of dvd player plugin
22 class FileBrowser(Screen):
24 <screen name="FileBrowser" position="100,100" size="520,376" title="DVD File Browser" >
25 <widget name="filelist" position="0,0" size="520,376" scrollbarMode="showOnDemand" />
27 def __init__(self, session, dvd_filelist = [ ]):
28 Screen.__init__(self, session)
30 self.dvd_filelist = dvd_filelist
32 self["filelist"] = MenuList(self.dvd_filelist)
35 if lastpath is not None:
36 currDir = lastpath + "/"
38 currDir = "/media/dvd/"
39 if not pathExists(currDir):
42 self.filelist = FileList(currDir, matchingPattern = "(?i)^.*\.(iso)", useServiceRef = True)
43 self["filelist"] = self.filelist
45 self["FilelistActions"] = ActionMap(["OkCancelActions"],
52 if len(self.dvd_filelist):
53 print "OK " + self["filelist"].getCurrent()
54 self.close(self["filelist"].getCurrent())
57 filename = self["filelist"].getFilename()
58 if filename is not None:
59 if filename.upper().endswith("VIDEO_TS/"):
60 print "dvd structure found, trying to open..."
61 dvdpath = filename[0:-9]
62 lastpath = (dvdpath.rstrip("/").rsplit("/",1))[0]
63 print "lastpath video_ts/=", lastpath
66 if self["filelist"].canDescent(): # isDir
67 self["filelist"].descent()
68 pathname = self["filelist"].getCurrentDirectory() or ""
69 if fileExists(pathname+"VIDEO_TS.IFO"):
70 print "dvd structure found, trying to open..."
71 lastpath = (pathname.rstrip("/").rsplit("/",1))[0]
72 print "lastpath video_ts.ifo=", lastpath
75 lastpath = filename[0:filename.rfind("/")]
76 print "lastpath directory=", lastpath
82 class DVDSummary(Screen):
84 <screen position="0,0" size="132,64">
85 <widget source="session.CurrentService" render="Label" position="5,4" size="120,28" font="Regular;12" transparent="1" >
86 <convert type="ServiceName">Name</convert>
88 <widget name="DVDPlayer" position="5,30" size="66,16" font="Regular;12" transparent="1" />
89 <widget name="Chapter" position="72,30" size="54,16" font="Regular;12" transparent="1" halign="right" />
90 <widget source="session.CurrentService" render="Label" position="66,46" size="60,18" font="Regular;16" transparent="1" halign="right" >
91 <convert type="ServicePosition">Position</convert>
93 <widget source="session.CurrentService" render="Progress" position="6,46" size="60,18" borderWidth="1" >
94 <convert type="ServicePosition">Position</convert>
98 def __init__(self, session, parent):
99 Screen.__init__(self, session, parent)
101 self["DVDPlayer"] = Label("DVD Player")
102 self["Title"] = Label("")
103 self["Time"] = Label("")
104 self["Chapter"] = Label("")
106 def updateChapter(self, chapter):
107 self["Chapter"].setText(chapter)
109 def setTitle(self, title):
110 self["Title"].setText(title)
112 class DVDOverlay(Screen):
113 def __init__(self, session, args = None):
114 desktop_size = getDesktop(0).size()
115 DVDOverlay.skin = """<screen name="DVDOverlay" position="0,0" size="%d,%d" flags="wfNoBorder" zPosition="-1" backgroundColor="transparent" />""" %(desktop_size.width(), desktop_size.height())
116 Screen.__init__(self, session)
118 class ChapterZap(Screen):
120 <screen name="ChapterZap" position="235,255" size="250,60" title="Chapter" >
121 <widget name="chapter" position="35,15" size="110,25" font="Regular;23" />
122 <widget name="number" position="145,15" size="80,25" halign="right" font="Regular;23" />
131 self.close(int(self["number"].getText()))
133 def keyNumberGlobal(self, number):
134 self.Timer.start(3000, True) #reset timer
135 self.field = self.field + str(number)
136 self["number"].setText(self.field)
137 if len(self.field) >= 4:
140 def __init__(self, session, number):
141 Screen.__init__(self, session)
142 self.field = str(number)
144 self["chapter"] = Label(_("Chapter:"))
146 self["number"] = Label(self.field)
148 self["actions"] = NumberActionMap( [ "SetupActions" ],
152 "1": self.keyNumberGlobal,
153 "2": self.keyNumberGlobal,
154 "3": self.keyNumberGlobal,
155 "4": self.keyNumberGlobal,
156 "5": self.keyNumberGlobal,
157 "6": self.keyNumberGlobal,
158 "7": self.keyNumberGlobal,
159 "8": self.keyNumberGlobal,
160 "9": self.keyNumberGlobal,
161 "0": self.keyNumberGlobal
164 self.Timer = eTimer()
165 self.Timer.callback.append(self.keyOK)
166 self.Timer.start(3000, True)
168 class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarPVRState, InfoBarShowHide, HelpableScreen, InfoBarCueSheetSupport):
169 # ALLOW_SUSPEND = True
170 ENABLE_RESUME_SUPPORT = True
173 <screen name="DVDPlayer" flags="wfNoBorder" position="0,380" size="720,160" title="InfoBar" backgroundColor="transparent" >
175 <ePixmap position="0,0" zPosition="-2" size="720,160" pixmap="skin_default/info-bg_mp.png" alphatest="off" />
176 <ePixmap position="29,40" zPosition="0" size="665,104" pixmap="skin_default/screws_mp.png" alphatest="on" transparent="1" />
177 <!-- colorbuttons -->
178 <ePixmap position="48,70" zPosition="0" size="108,13" pixmap="skin_default/icons/mp_buttons.png" alphatest="on" />
180 <ePixmap pixmap="skin_default/icons/icon_event.png" position="207,78" zPosition="1" size="15,10" alphatest="on" />
181 <widget source="session.CurrentService" render="Label" position="230,73" size="300,22" font="Regular;20" backgroundColor="#263c59" shadowColor="#1d354c" shadowOffset="-1,-1" transparent="1" noWrap="1">
182 <convert type="ServiceName">Name</convert>
184 <!-- Chapter info -->
185 <widget name="chapterLabel" position="230,96" size="360,22" font="Regular;20" foregroundColor="#c3c3c9" backgroundColor="#263c59" transparent="1" />
186 <!-- Audio track info -->
187 <ePixmap pixmap="skin_default/icons/icon_dolby.png" position="540,60" zPosition="1" size="26,16" alphatest="on"/>
188 <widget name="audioLabel" position="570,60" size="130,22" font="Regular;18" backgroundColor="#263c59" shadowColor="#1d354c" shadowOffset="-1,-1" transparent="1" />
189 <!-- Subtitle track info -->
190 <widget source="session.CurrentService" render="Pixmap" pixmap="skin_default/icons/icon_txt.png" position="540,83" zPosition="1" size="26,16" alphatest="on" >
191 <convert type="ServiceInfo">HasTelext</convert>
192 <convert type="ConditionalShowHide" />
194 <widget name="subtitleLabel" position="570,83" size="130,22" font="Regular;18" backgroundColor="#263c59" shadowColor="#1d354c" shadowOffset="-1,-1" transparent="1" />
196 <widget name="anglePix" pixmap="skin_default/icons/icon_view.png" position="540,106" size="26,16" alphatest="on" />
197 <widget name="angleLabel" position="570,106" size="130,22" font="Regular;18" backgroundColor="#263c59" shadowColor="#1d354c" shadowOffset="-1,-1" transparent="1" />
198 <!-- Elapsed time -->
199 <widget source="session.CurrentService" render="Label" position="205,129" size="100,20" font="Regular;18" halign="center" valign="center" backgroundColor="#06224f" shadowColor="#1d354c" shadowOffset="-1,-1" transparent="1" >
200 <convert type="ServicePosition">Position,ShowHours</convert>
202 <!-- Progressbar (movie position)-->
203 <widget source="session.CurrentService" render="PositionGauge" position="300,133" size="270,10" zPosition="2" pointer="skin_default/position_pointer.png:540,0" transparent="1" >
204 <convert type="ServicePosition">Gauge</convert>
206 <!-- Remaining time -->
207 <widget source="session.CurrentService" render="Label" position="576,129" size="100,20" font="Regular;18" halign="center" valign="center" backgroundColor="#06224f" shadowColor="#1d354c" shadowOffset="-1,-1" transparent="1" >
208 <convert type="ServicePosition">Remaining,Negate,ShowHours</convert>
212 def save_infobar_seek_config(self):
213 self.saved_config_speeds_forward = config.seek.speeds_forward.value
214 self.saved_config_speeds_backward = config.seek.speeds_backward.value
215 self.saved_config_enter_forward = config.seek.enter_forward.value
216 self.saved_config_enter_backward = config.seek.enter_backward.value
217 self.saved_config_seek_stepwise_minspeed = config.seek.stepwise_minspeed.value
218 self.saved_config_seek_stepwise_repeat = config.seek.stepwise_repeat.value
219 self.saved_config_seek_on_pause = config.seek.on_pause.value
220 self.saved_config_seek_speeds_slowmotion = config.seek.speeds_slowmotion.value
222 def change_infobar_seek_config(self):
223 config.seek.speeds_forward.value = [2, 4, 8, 16, 32, 64]
224 config.seek.speeds_backward.value = [8, 16, 32, 64]
225 config.seek.speeds_slowmotion.value = [ ]
226 config.seek.enter_forward.value = "2"
227 config.seek.enter_backward.value = "2"
228 config.seek.stepwise_minspeed.value = "Never"
229 config.seek.stepwise_repeat.value = "3"
230 config.seek.on_pause.value = "play"
232 def restore_infobar_seek_config(self):
233 config.seek.speeds_forward.value = self.saved_config_speeds_forward
234 config.seek.speeds_backward.value = self.saved_config_speeds_backward
235 config.seek.speeds_slowmotion.value = self.saved_config_seek_speeds_slowmotion
236 config.seek.enter_forward.value = self.saved_config_enter_forward
237 config.seek.enter_backward.value = self.saved_config_enter_backward
238 config.seek.stepwise_minspeed.value = self.saved_config_seek_stepwise_minspeed
239 config.seek.stepwise_repeat.value = self.saved_config_seek_stepwise_repeat
240 config.seek.on_pause.value = self.saved_config_seek_on_pause
242 def __init__(self, session, dvd_device = None, dvd_filelist = [ ], args = None):
243 Screen.__init__(self, session)
244 InfoBarBase.__init__(self)
245 InfoBarNotifications.__init__(self)
246 InfoBarCueSheetSupport.__init__(self, actionmap = "MediaPlayerCueSheetActions")
247 InfoBarShowHide.__init__(self)
248 HelpableScreen.__init__(self)
249 self.save_infobar_seek_config()
250 self.change_infobar_seek_config()
251 InfoBarSeek.__init__(self, useSeekBackHack=False)
252 InfoBarPVRState.__init__(self)
253 self.dvdScreen = self.session.instantiateDialog(DVDOverlay)
255 self.oldService = self.session.nav.getCurrentlyPlayingServiceReference()
256 self.session.nav.stopService()
257 self["audioLabel"] = Label("n/a")
258 self["subtitleLabel"] = Label("")
259 self["angleLabel"] = Label("")
260 self["chapterLabel"] = Label("")
261 self["anglePix"] = Pixmap()
262 self["anglePix"].hide()
263 self.last_audioTuple = None
264 self.last_subtitleTuple = None
265 self.last_angleTuple = None
266 self.totalChapters = 0
267 self.currentChapter = 0
269 self.currentTitle = 0
271 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
273 iPlayableService.evStopped: self.__serviceStopped,
274 iPlayableService.evUser: self.__timeUpdated,
275 iPlayableService.evUser+1: self.__statePlay,
276 iPlayableService.evUser+2: self.__statePause,
277 iPlayableService.evUser+3: self.__osdFFwdInfoAvail,
278 iPlayableService.evUser+4: self.__osdFBwdInfoAvail,
279 iPlayableService.evUser+5: self.__osdStringAvail,
280 iPlayableService.evUser+6: self.__osdAudioInfoAvail,
281 iPlayableService.evUser+7: self.__osdSubtitleInfoAvail,
282 iPlayableService.evUser+8: self.__chapterUpdated,
283 iPlayableService.evUser+9: self.__titleUpdated,
284 iPlayableService.evUser+11: self.__menuOpened,
285 iPlayableService.evUser+12: self.__menuClosed,
286 iPlayableService.evUser+13: self.__osdAngleInfoAvail
289 self["DVDPlayerDirectionActions"] = ActionMap(["DirectionActions"],
291 #MENU KEY DOWN ACTIONS
292 "left": self.keyLeft,
293 "right": self.keyRight,
295 "down": self.keyDown,
297 #MENU KEY REPEATED ACTIONS
298 "leftRepeated": self.doNothing,
299 "rightRepeated": self.doNothing,
300 "upRepeated": self.doNothing,
301 "downRepeated": self.doNothing,
304 "leftUp": self.doNothing,
305 "rightUp": self.doNothing,
306 "upUp": self.doNothing,
307 "downUp": self.doNothing,
310 self["OkCancelActions"] = ActionMap(["OkCancelActions"],
313 "cancel": self.keyCancel,
316 self["DVDPlayerPlaybackActions"] = HelpableActionMap(self, "DVDPlayerActions",
319 "dvdMenu": (self.enterDVDMenu, _("show DVD main menu")),
320 "toggleInfo": (self.toggleInfo, _("toggle time, chapter, audio, subtitle info")),
321 "nextChapter": (self.nextChapter, _("forward to the next chapter")),
322 "prevChapter": (self.prevChapter, _("rewind to the previous chapter")),
323 "nextTitle": (self.nextTitle, _("jump forward to the next title")),
324 "prevTitle": (self.prevTitle, _("jump back to the previous title")),
325 "tv": (self.askLeavePlayer, _("exit DVD player or return to file browser")),
326 "dvdAudioMenu": (self.enterDVDAudioMenu, _("(show optional DVD audio menu)")),
327 "nextAudioTrack": (self.nextAudioTrack, _("switch to the next audio track")),
328 "nextSubtitleTrack": (self.nextSubtitleTrack, _("switch to the next subtitle language")),
329 "nextAngle": (self.nextAngle, _("switch to the next angle")),
330 "seekBeginning": self.seekBeginning,
333 self["NumberActions"] = NumberActionMap( [ "NumberActions"],
335 "1": self.keyNumberGlobal,
336 "2": self.keyNumberGlobal,
337 "3": self.keyNumberGlobal,
338 "4": self.keyNumberGlobal,
339 "5": self.keyNumberGlobal,
340 "6": self.keyNumberGlobal,
341 "7": self.keyNumberGlobal,
342 "8": self.keyNumberGlobal,
343 "9": self.keyNumberGlobal,
344 "0": self.keyNumberGlobal,
347 self.onClose.append(self.__onClose)
348 self.physicalDVD = False
349 self.dvd_device = None
351 self.dvd_device = dvd_device
352 self.physicalDVD = True
354 devicepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())
355 if pathExists(devicepath):
356 from Components.Scanner import scanDevice
357 res = scanDevice(devicepath)
358 list = [ (r.description, r, res[r], self.session) for r in res ]
360 (desc, scanner, files, session) = list[0]
363 if file.mimetype == "video/x-dvd":
364 self.dvd_device = devicepath
365 print "physical dvd found:", self.dvd_device
366 self.physicalDVD = True
368 self.dvd_filelist = dvd_filelist
369 self.onFirstExecBegin.append(self.showFileBrowser)
372 self.old_aspect = open("/proc/stb/video/aspect", "r").read()
373 self.old_policy = open("/proc/stb/video/policy", "r").read()
374 self.old_wss = open("/proc/stb/denc/0/wss", "r").read()
376 def keyNumberGlobal(self, number):
377 print "You pressed number " + str(number)
378 self.session.openWithCallback(self.numberEntered, ChapterZap, number)
380 def numberEntered(self, retval):
381 # print self.servicelist
383 self.zapToNumber(retval)
385 def getServiceInterface(self, iface):
386 service = self.service
388 attr = getattr(service, iface, None)
393 def __serviceStopped(self):
394 self.dvdScreen.hide()
395 subs = self.getServiceInterface("subtitle")
397 subs.disableSubtitles(self.session.current_dialog.instance)
399 def serviceStarted(self): #override InfoBarShowHide function
400 self.dvdScreen.show()
402 def doEofInternal(self, playing):
406 def __menuOpened(self):
409 self["NumberActions"].setEnabled(False)
411 def __menuClosed(self):
414 self["NumberActions"].setEnabled(True)
416 def setChapterLabel(self):
418 chapterOSD = "DVD Menu"
419 if self.currentTitle > 0:
420 chapterLCD = "%s %d" % (_("Chap."), self.currentChapter)
421 chapterOSD = "DVD %s %d/%d" % (_("Chapter"), self.currentChapter, self.totalChapters)
422 chapterOSD += " (%s %d/%d)" % (_("Title"), self.currentTitle, self.totalTitles)
423 self["chapterLabel"].setText(chapterOSD)
425 self.session.summary.updateChapter(chapterLCD)
432 def toggleInfo(self):
437 def __timeUpdated(self):
440 def __statePlay(self):
443 def __statePause(self):
446 def __osdFFwdInfoAvail(self):
447 self.setChapterLabel()
448 print "FFwdInfoAvail"
450 def __osdFBwdInfoAvail(self):
451 self.setChapterLabel()
452 print "FBwdInfoAvail"
454 def __osdStringAvail(self):
457 def __osdAudioInfoAvail(self):
458 info = self.getServiceInterface("info")
459 audioTuple = info and info.getInfoObject(iServiceInformation.sUser+6)
460 print "AudioInfoAvail ", repr(audioTuple)
462 audioString = "%d: %s (%s)" % (audioTuple[0],audioTuple[1],audioTuple[2])
463 self["audioLabel"].setText(audioString)
464 if audioTuple != self.last_audioTuple and not self.in_menu:
466 self.last_audioTuple = audioTuple
468 def __osdSubtitleInfoAvail(self):
469 info = self.getServiceInterface("info")
470 subtitleTuple = info and info.getInfoObject(iServiceInformation.sUser+7)
471 print "SubtitleInfoAvail ", repr(subtitleTuple)
474 if subtitleTuple[0] is not 0:
475 subtitleString = "%d: %s" % (subtitleTuple[0],subtitleTuple[1])
476 self["subtitleLabel"].setText(subtitleString)
477 if subtitleTuple != self.last_subtitleTuple and not self.in_menu:
479 self.last_subtitleTuple = subtitleTuple
481 def __osdAngleInfoAvail(self):
482 info = self.getServiceInterface("info")
483 angleTuple = info and info.getInfoObject(iServiceInformation.sUser+8)
484 print "AngleInfoAvail ", repr(angleTuple)
487 if angleTuple[1] > 1:
488 angleString = "%d / %d" % (angleTuple[0],angleTuple[1])
489 self["anglePix"].show()
491 self["anglePix"].hide()
492 self["angleLabel"].setText(angleString)
493 if angleTuple != self.last_angleTuple and not self.in_menu:
495 self.last_angleTuple = angleTuple
497 def __chapterUpdated(self):
498 info = self.getServiceInterface("info")
500 self.currentChapter = info.getInfo(iServiceInformation.sCurrentChapter)
501 self.totalChapters = info.getInfo(iServiceInformation.sTotalChapters)
502 self.setChapterLabel()
503 print "__chapterUpdated: %d/%d" % (self.currentChapter, self.totalChapters)
505 def __titleUpdated(self):
506 info = self.getServiceInterface("info")
508 self.currentTitle = info.getInfo(iServiceInformation.sCurrentTitle)
509 self.totalTitles = info.getInfo(iServiceInformation.sTotalTitles)
510 self.setChapterLabel()
511 print "__titleUpdated: %d/%d" % (self.currentTitle, self.totalTitles)
515 def askLeavePlayer(self):
516 choices = [(_("Exit"), "exit"), (_("Continue playing"), "play")]
517 if not self.physicalDVD:
518 choices.insert(1,(_("Return to file browser"), "browser"))
519 self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list = choices)
521 def sendKey(self, key):
522 keys = self.getServiceInterface("keys")
527 def nextAudioTrack(self):
528 self.sendKey(iServiceKeys.keyUser)
530 def nextSubtitleTrack(self):
531 self.sendKey(iServiceKeys.keyUser+1)
533 def enterDVDAudioMenu(self):
534 self.sendKey(iServiceKeys.keyUser+2)
536 def nextChapter(self):
537 self.sendKey(iServiceKeys.keyUser+3)
539 def prevChapter(self):
540 self.sendKey(iServiceKeys.keyUser+4)
543 self.sendKey(iServiceKeys.keyUser+5)
546 self.sendKey(iServiceKeys.keyUser+6)
548 def enterDVDMenu(self):
549 self.sendKey(iServiceKeys.keyUser+7)
552 self.sendKey(iServiceKeys.keyUser+8)
554 def seekBeginning(self):
556 seekable = self.getSeek()
560 def zapToNumber(self, number):
562 seekable = self.getSeek()
564 print "seek to chapter %d" % number
565 seekable.seekChapter(number)
569 self.sendKey(iServiceKeys.keyRight)
572 self.sendKey(iServiceKeys.keyLeft)
575 self.sendKey(iServiceKeys.keyUp)
578 self.sendKey(iServiceKeys.keyDown)
581 if self.sendKey(iServiceKeys.keyOk) and not self.in_menu:
585 self.askLeavePlayer()
587 def showFileBrowser(self):
588 if self.physicalDVD and len(self.dvd_filelist) == 0:
589 if self.dvd_device == harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()):
590 self.session.openWithCallback(self.DVDdriveCB, MessageBox, text=_("Do you want to play DVD in drive?"), timeout=5 )
592 self.DVDdriveCB(True)
593 elif len(self.dvd_filelist) == 1:
594 self.FileBrowserClosed(self.dvd_filelist[0])
596 self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, self.dvd_filelist)
598 def DVDdriveCB(self, answer):
600 self.FileBrowserClosed(self.dvd_device)
602 self.session.openWithCallback(self.FileBrowserClosed, FileBrowser)
603 self.physicalDVD = False
605 def FileBrowserClosed(self, val):
606 curref = self.session.nav.getCurrentlyPlayingServiceReference()
607 print "FileBrowserClosed", val
609 self.askLeavePlayer()
611 newref = eServiceReference(4369, 0, val)
612 print "play", newref.toString()
613 if curref is None or curref != newref:
614 self.session.nav.playService(newref)
615 self.service = self.session.nav.getCurrentService()
616 print "self.service", self.service
617 print "cur_dlg", self.session.current_dialog
618 subs = self.getServiceInterface("subtitle")
620 subs.enableSubtitles(self.dvdScreen.instance, None)
622 def exitCB(self, answer):
623 if answer is not None:
624 if answer[1] == "exit":
628 if answer[1] == "browser":
629 #TODO check here if a paused dvd playback is already running... then re-start it...
633 self.showFileBrowser()
638 for i in (("/proc/stb/video/aspect", self.old_aspect), ("/proc/stb/video/policy", self.old_policy), ("/proc/stb/denc/0/wss", self.old_wss)):
640 open(i[0], "w").write(i[1])
642 print "restore", i[0], "failed"
643 self.restore_infobar_seek_config()
644 self.session.nav.playService(self.oldService)
646 def playLastCB(self, answer): # overwrite infobar cuesheet function
647 print "playLastCB", answer, self.resume_point
650 seekable = self.getSeek()
652 seekable.seekTo(self.resume_point)
653 pause = self.service.pause()
655 self.hideAfterResume()
657 def showAfterCuesheetOperation(self):
661 def createSummary(self):
664 #override some InfoBarSeek functions
666 self.setSeekState(self.SEEK_STATE_PLAY)
668 def calcRemainingTime(self):
671 def main(session, **kwargs):
672 session.open(DVDPlayer)
674 def menu(menuid, **kwargs):
675 if menuid == "mainmenu":
676 return [(_("DVD Player"), main, "dvd_player", 46)]
679 from Plugins.Plugin import PluginDescriptor
681 def filescan_open(list, session, **kwargs):
682 if len(list) == 1 and list[0].mimetype == "video/x-dvd":
683 splitted = list[0].path.split('/')
684 print "splitted", splitted
685 if len(splitted) > 2:
686 if splitted[1] == 'autofs':
687 session.open(DVDPlayer, dvd_device="/dev/%s" %(splitted[2]))
690 print "splitted[0]", splitted[1]
694 if x.mimetype == "video/x-dvd-iso":
695 dvd_filelist.append(x.path)
696 if x.mimetype == "video/x-dvd":
697 dvd_filelist.append(x.path.rsplit('/',1)[0])
698 session.open(DVDPlayer, dvd_filelist=dvd_filelist)
700 def filescan(**kwargs):
701 from Components.Scanner import Scanner, ScanPath
703 # Overwrite checkFile to only detect local
704 class LocalScanner(Scanner):
705 def checkFile(self, file):
706 return fileExists(file.path)
709 LocalScanner(mimetypes = ["video/x-dvd","video/x-dvd-iso"],
712 ScanPath(path = "video_ts", with_subdirs = False),
713 ScanPath(path = "", with_subdirs = False),
716 description = "Play DVD",
717 openfnc = filescan_open,
720 def Plugins(**kwargs):
721 return [PluginDescriptor(name = "DVDPlayer", description = "Play DVDs", where = PluginDescriptor.WHERE_MENU, fnc = menu),
722 PluginDescriptor(where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)]