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.Sources.StaticText import StaticText
11 from Components.Pixmap import Pixmap
12 from Components.FileList import FileList
13 from Components.MenuList import MenuList
14 from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
15 from Components.config import config
16 from Tools.Directories import pathExists, fileExists
17 from Components.Harddisk import harddiskmanager
19 import servicedvd # load c++ part of dvd player plugin
23 class FileBrowser(Screen):
25 def __init__(self, session, dvd_filelist = [ ]):
26 Screen.__init__(self, session)
28 # for the skin: first try FileBrowser_DVDPlayer, then FileBrowser, this allows individual skinning
29 self.skinName = ["FileBrowser_DVDPlayer", "FileBrowser" ]
31 self.dvd_filelist = dvd_filelist
33 self["filelist"] = MenuList(self.dvd_filelist)
36 if lastpath is not None:
37 currDir = lastpath + "/"
39 currDir = "/media/dvd/"
40 if not pathExists(currDir):
43 self.filelist = FileList(currDir, matchingPattern = "(?i)^.*\.(iso)", useServiceRef = True)
44 self["filelist"] = self.filelist
46 self["FilelistActions"] = ActionMap(["SetupActions"],
52 self["key_red"] = StaticText(_("Cancel"))
53 self["key_green"] = StaticText(_("OK"))
54 self.onLayoutFinish.append(self.layoutFinished)
56 def layoutFinished(self):
57 self.setTitle(_("DVD File Browser"))
60 if len(self.dvd_filelist):
61 print "OK " + self["filelist"].getCurrent()
62 self.close(self["filelist"].getCurrent())
65 filename = self["filelist"].getFilename()
66 if filename is not None:
67 if filename.upper().endswith("VIDEO_TS/"):
68 print "dvd structure found, trying to open..."
69 dvdpath = filename[0:-9]
70 lastpath = (dvdpath.rstrip("/").rsplit("/",1))[0]
71 print "lastpath video_ts/=", lastpath
74 if self["filelist"].canDescent(): # isDir
75 self["filelist"].descent()
76 pathname = self["filelist"].getCurrentDirectory() or ""
77 if fileExists(pathname+"VIDEO_TS.IFO"):
78 print "dvd structure found, trying to open..."
79 lastpath = (pathname.rstrip("/").rsplit("/",1))[0]
80 print "lastpath video_ts.ifo=", lastpath
83 lastpath = filename[0:filename.rfind("/")]
84 print "lastpath directory=", lastpath
90 class DVDSummary(Screen):
92 <screen position="0,0" size="132,64">
93 <widget source="session.CurrentService" render="Label" position="5,4" size="120,28" font="Regular;12" transparent="1" >
94 <convert type="ServiceName">Name</convert>
96 <widget name="DVDPlayer" position="5,30" size="66,16" font="Regular;11" transparent="1" />
97 <widget name="Chapter" position="72,30" size="54,16" font="Regular;12" transparent="1" halign="right" />
98 <widget source="session.CurrentService" render="Label" position="66,46" size="60,18" font="Regular;16" transparent="1" halign="right" >
99 <convert type="ServicePosition">Position</convert>
101 <widget source="session.CurrentService" render="Progress" position="6,46" size="60,18" borderWidth="1" >
102 <convert type="ServicePosition">Position</convert>
106 def __init__(self, session, parent):
107 Screen.__init__(self, session, parent)
109 self["DVDPlayer"] = Label("DVD Player")
110 self["Title"] = Label("")
111 self["Time"] = Label("")
112 self["Chapter"] = Label("")
114 def updateChapter(self, chapter):
115 self["Chapter"].setText(chapter)
117 def setTitle(self, title):
118 self["Title"].setText(title)
120 class DVDOverlay(Screen):
121 def __init__(self, session, args = None):
122 desktop_size = getDesktop(0).size()
123 DVDOverlay.skin = """<screen name="DVDOverlay" position="0,0" size="%d,%d" flags="wfNoBorder" zPosition="-1" backgroundColor="transparent" />""" %(desktop_size.width(), desktop_size.height())
124 Screen.__init__(self, session)
126 class ChapterZap(Screen):
128 <screen name="ChapterZap" position="235,255" size="250,60" title="Chapter" >
129 <widget name="chapter" position="35,15" size="110,25" font="Regular;23" />
130 <widget name="number" position="145,15" size="80,25" halign="right" font="Regular;23" />
139 self.close(int(self["number"].getText()))
141 def keyNumberGlobal(self, number):
142 self.Timer.start(3000, True) #reset timer
143 self.field = self.field + str(number)
144 self["number"].setText(self.field)
145 if len(self.field) >= 4:
148 def __init__(self, session, number):
149 Screen.__init__(self, session)
150 self.field = str(number)
152 self["chapter"] = Label(_("Chapter:"))
154 self["number"] = Label(self.field)
156 self["actions"] = NumberActionMap( [ "SetupActions" ],
160 "1": self.keyNumberGlobal,
161 "2": self.keyNumberGlobal,
162 "3": self.keyNumberGlobal,
163 "4": self.keyNumberGlobal,
164 "5": self.keyNumberGlobal,
165 "6": self.keyNumberGlobal,
166 "7": self.keyNumberGlobal,
167 "8": self.keyNumberGlobal,
168 "9": self.keyNumberGlobal,
169 "0": self.keyNumberGlobal
172 self.Timer = eTimer()
173 self.Timer.callback.append(self.keyOK)
174 self.Timer.start(3000, True)
176 class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarPVRState, InfoBarShowHide, HelpableScreen, InfoBarCueSheetSupport):
177 ALLOW_SUSPEND = Screen.SUSPEND_PAUSES
178 ENABLE_RESUME_SUPPORT = True
181 <screen name="DVDPlayer" flags="wfNoBorder" position="0,380" size="720,160" title="InfoBar" backgroundColor="transparent" >
183 <ePixmap position="0,0" zPosition="-2" size="720,160" pixmap="skin_default/info-bg_mp.png" alphatest="off" />
184 <ePixmap position="29,40" zPosition="0" size="665,104" pixmap="skin_default/screws_mp.png" alphatest="on" transparent="1" />
185 <!-- colorbuttons -->
186 <ePixmap position="48,70" zPosition="0" size="108,13" pixmap="skin_default/icons/mp_buttons.png" alphatest="on" />
188 <ePixmap pixmap="skin_default/icons/icon_event.png" position="207,78" zPosition="1" size="15,10" alphatest="on" />
189 <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">
190 <convert type="ServiceName">Name</convert>
192 <!-- Chapter info -->
193 <widget name="chapterLabel" position="230,96" size="360,22" font="Regular;20" foregroundColor="#c3c3c9" backgroundColor="#263c59" transparent="1" />
194 <!-- Audio track info -->
195 <ePixmap pixmap="skin_default/icons/icon_dolby.png" position="540,60" zPosition="1" size="26,16" alphatest="on"/>
196 <widget name="audioLabel" position="570,60" size="130,22" font="Regular;18" backgroundColor="#263c59" shadowColor="#1d354c" shadowOffset="-1,-1" transparent="1" />
197 <!-- Subtitle track info -->
198 <widget source="session.CurrentService" render="Pixmap" pixmap="skin_default/icons/icon_txt.png" position="540,83" zPosition="1" size="26,16" alphatest="on" >
199 <convert type="ServiceInfo">HasTelext</convert>
200 <convert type="ConditionalShowHide" />
202 <widget name="subtitleLabel" position="570,83" size="130,22" font="Regular;18" backgroundColor="#263c59" shadowColor="#1d354c" shadowOffset="-1,-1" transparent="1" />
204 <widget name="anglePix" pixmap="skin_default/icons/icon_view.png" position="540,106" size="26,16" alphatest="on" />
205 <widget name="angleLabel" position="570,106" size="130,22" font="Regular;18" backgroundColor="#263c59" shadowColor="#1d354c" shadowOffset="-1,-1" transparent="1" />
206 <!-- Elapsed time -->
207 <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" >
208 <convert type="ServicePosition">Position,ShowHours</convert>
210 <!-- Progressbar (movie position)-->
211 <widget source="session.CurrentService" render="PositionGauge" position="300,133" size="270,10" zPosition="2" pointer="skin_default/position_pointer.png:540,0" transparent="1" >
212 <convert type="ServicePosition">Gauge</convert>
214 <!-- Remaining time -->
215 <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" >
216 <convert type="ServicePosition">Remaining,Negate,ShowHours</convert>
220 def save_infobar_seek_config(self):
221 self.saved_config_speeds_forward = config.seek.speeds_forward.value
222 self.saved_config_speeds_backward = config.seek.speeds_backward.value
223 self.saved_config_enter_forward = config.seek.enter_forward.value
224 self.saved_config_enter_backward = config.seek.enter_backward.value
225 self.saved_config_seek_stepwise_minspeed = config.seek.stepwise_minspeed.value
226 self.saved_config_seek_stepwise_repeat = config.seek.stepwise_repeat.value
227 self.saved_config_seek_on_pause = config.seek.on_pause.value
228 self.saved_config_seek_speeds_slowmotion = config.seek.speeds_slowmotion.value
230 def change_infobar_seek_config(self):
231 config.seek.speeds_forward.value = [2, 4, 8, 16, 32, 64]
232 config.seek.speeds_backward.value = [8, 16, 32, 64]
233 config.seek.speeds_slowmotion.value = [ ]
234 config.seek.enter_forward.value = "2"
235 config.seek.enter_backward.value = "2"
236 config.seek.stepwise_minspeed.value = "Never"
237 config.seek.stepwise_repeat.value = "3"
238 config.seek.on_pause.value = "play"
240 def restore_infobar_seek_config(self):
241 config.seek.speeds_forward.value = self.saved_config_speeds_forward
242 config.seek.speeds_backward.value = self.saved_config_speeds_backward
243 config.seek.speeds_slowmotion.value = self.saved_config_seek_speeds_slowmotion
244 config.seek.enter_forward.value = self.saved_config_enter_forward
245 config.seek.enter_backward.value = self.saved_config_enter_backward
246 config.seek.stepwise_minspeed.value = self.saved_config_seek_stepwise_minspeed
247 config.seek.stepwise_repeat.value = self.saved_config_seek_stepwise_repeat
248 config.seek.on_pause.value = self.saved_config_seek_on_pause
250 def __init__(self, session, dvd_device = None, dvd_filelist = [ ], args = None):
251 Screen.__init__(self, session)
252 InfoBarBase.__init__(self)
253 InfoBarNotifications.__init__(self)
254 InfoBarCueSheetSupport.__init__(self, actionmap = "MediaPlayerCueSheetActions")
255 InfoBarShowHide.__init__(self)
256 HelpableScreen.__init__(self)
257 self.save_infobar_seek_config()
258 self.change_infobar_seek_config()
259 InfoBarSeek.__init__(self, useSeekBackHack=False)
260 InfoBarPVRState.__init__(self)
261 self.dvdScreen = self.session.instantiateDialog(DVDOverlay)
263 self.oldService = self.session.nav.getCurrentlyPlayingServiceReference()
264 self.session.nav.stopService()
265 self["audioLabel"] = Label("n/a")
266 self["subtitleLabel"] = Label("")
267 self["angleLabel"] = Label("")
268 self["chapterLabel"] = Label("")
269 self["anglePix"] = Pixmap()
270 self["anglePix"].hide()
271 self.last_audioTuple = None
272 self.last_subtitleTuple = None
273 self.last_angleTuple = None
274 self.totalChapters = 0
275 self.currentChapter = 0
277 self.currentTitle = 0
279 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
281 iPlayableService.evStopped: self.__serviceStopped,
282 iPlayableService.evUser: self.__timeUpdated,
283 iPlayableService.evUser+1: self.__statePlay,
284 iPlayableService.evUser+2: self.__statePause,
285 iPlayableService.evUser+3: self.__osdFFwdInfoAvail,
286 iPlayableService.evUser+4: self.__osdFBwdInfoAvail,
287 iPlayableService.evUser+5: self.__osdStringAvail,
288 iPlayableService.evUser+6: self.__osdAudioInfoAvail,
289 iPlayableService.evUser+7: self.__osdSubtitleInfoAvail,
290 iPlayableService.evUser+8: self.__chapterUpdated,
291 iPlayableService.evUser+9: self.__titleUpdated,
292 iPlayableService.evUser+11: self.__menuOpened,
293 iPlayableService.evUser+12: self.__menuClosed,
294 iPlayableService.evUser+13: self.__osdAngleInfoAvail
297 self["DVDPlayerDirectionActions"] = ActionMap(["DirectionActions"],
299 #MENU KEY DOWN ACTIONS
300 "left": self.keyLeft,
301 "right": self.keyRight,
303 "down": self.keyDown,
305 #MENU KEY REPEATED ACTIONS
306 "leftRepeated": self.doNothing,
307 "rightRepeated": self.doNothing,
308 "upRepeated": self.doNothing,
309 "downRepeated": self.doNothing,
312 "leftUp": self.doNothing,
313 "rightUp": self.doNothing,
314 "upUp": self.doNothing,
315 "downUp": self.doNothing,
318 self["OkCancelActions"] = ActionMap(["OkCancelActions"],
321 "cancel": self.keyCancel,
324 self["DVDPlayerPlaybackActions"] = HelpableActionMap(self, "DVDPlayerActions",
327 "dvdMenu": (self.enterDVDMenu, _("show DVD main menu")),
328 "toggleInfo": (self.toggleInfo, _("toggle time, chapter, audio, subtitle info")),
329 "nextChapter": (self.nextChapter, _("forward to the next chapter")),
330 "prevChapter": (self.prevChapter, _("rewind to the previous chapter")),
331 "nextTitle": (self.nextTitle, _("jump forward to the next title")),
332 "prevTitle": (self.prevTitle, _("jump back to the previous title")),
333 "tv": (self.askLeavePlayer, _("exit DVD player or return to file browser")),
334 "dvdAudioMenu": (self.enterDVDAudioMenu, _("(show optional DVD audio menu)")),
335 "nextAudioTrack": (self.nextAudioTrack, _("switch to the next audio track")),
336 "nextSubtitleTrack": (self.nextSubtitleTrack, _("switch to the next subtitle language")),
337 "nextAngle": (self.nextAngle, _("switch to the next angle")),
338 "seekBeginning": self.seekBeginning,
341 self["NumberActions"] = NumberActionMap( [ "NumberActions"],
343 "1": self.keyNumberGlobal,
344 "2": self.keyNumberGlobal,
345 "3": self.keyNumberGlobal,
346 "4": self.keyNumberGlobal,
347 "5": self.keyNumberGlobal,
348 "6": self.keyNumberGlobal,
349 "7": self.keyNumberGlobal,
350 "8": self.keyNumberGlobal,
351 "9": self.keyNumberGlobal,
352 "0": self.keyNumberGlobal,
355 self.onClose.append(self.__onClose)
357 from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier
358 hotplugNotifier.append(self.hotplugCB)
360 self.autoplay = dvd_device or dvd_filelist
363 self.physicalDVD = True
367 self.dvd_filelist = dvd_filelist
368 self.onFirstExecBegin.append(self.opened)
372 def keyNumberGlobal(self, number):
373 print "You pressed number " + str(number)
374 self.session.openWithCallback(self.numberEntered, ChapterZap, number)
376 def numberEntered(self, retval):
377 # print self.servicelist
379 self.zapToNumber(retval)
381 def getServiceInterface(self, iface):
382 service = self.service
384 attr = getattr(service, iface, None)
389 def __serviceStopped(self):
390 self.dvdScreen.hide()
391 subs = self.getServiceInterface("subtitle")
393 subs.disableSubtitles(self.session.current_dialog.instance)
395 def serviceStarted(self): #override InfoBarShowHide function
396 self.dvdScreen.show()
398 def doEofInternal(self, playing):
402 def __menuOpened(self):
405 self["NumberActions"].setEnabled(False)
407 def __menuClosed(self):
410 self["NumberActions"].setEnabled(True)
412 def setChapterLabel(self):
414 chapterOSD = "DVD Menu"
415 if self.currentTitle > 0:
416 chapterLCD = "%s %d" % (_("Chap."), self.currentChapter)
417 chapterOSD = "DVD %s %d/%d" % (_("Chapter"), self.currentChapter, self.totalChapters)
418 chapterOSD += " (%s %d/%d)" % (_("Title"), self.currentTitle, self.totalTitles)
419 self["chapterLabel"].setText(chapterOSD)
421 self.session.summary.updateChapter(chapterLCD)
428 def toggleInfo(self):
433 def __timeUpdated(self):
436 def __statePlay(self):
439 def __statePause(self):
442 def __osdFFwdInfoAvail(self):
443 self.setChapterLabel()
444 print "FFwdInfoAvail"
446 def __osdFBwdInfoAvail(self):
447 self.setChapterLabel()
448 print "FBwdInfoAvail"
450 def __osdStringAvail(self):
453 def __osdAudioInfoAvail(self):
454 info = self.getServiceInterface("info")
455 audioTuple = info and info.getInfoObject(iServiceInformation.sUser+6)
456 print "AudioInfoAvail ", repr(audioTuple)
458 audioString = "%d: %s (%s)" % (audioTuple[0],audioTuple[1],audioTuple[2])
459 self["audioLabel"].setText(audioString)
460 if audioTuple != self.last_audioTuple and not self.in_menu:
462 self.last_audioTuple = audioTuple
464 def __osdSubtitleInfoAvail(self):
465 info = self.getServiceInterface("info")
466 subtitleTuple = info and info.getInfoObject(iServiceInformation.sUser+7)
467 print "SubtitleInfoAvail ", repr(subtitleTuple)
470 if subtitleTuple[0] is not 0:
471 subtitleString = "%d: %s" % (subtitleTuple[0],subtitleTuple[1])
472 self["subtitleLabel"].setText(subtitleString)
473 if subtitleTuple != self.last_subtitleTuple and not self.in_menu:
475 self.last_subtitleTuple = subtitleTuple
477 def __osdAngleInfoAvail(self):
478 info = self.getServiceInterface("info")
479 angleTuple = info and info.getInfoObject(iServiceInformation.sUser+8)
480 print "AngleInfoAvail ", repr(angleTuple)
483 if angleTuple[1] > 1:
484 angleString = "%d / %d" % (angleTuple[0],angleTuple[1])
485 self["anglePix"].show()
487 self["anglePix"].hide()
488 self["angleLabel"].setText(angleString)
489 if angleTuple != self.last_angleTuple and not self.in_menu:
491 self.last_angleTuple = angleTuple
493 def __chapterUpdated(self):
494 info = self.getServiceInterface("info")
496 self.currentChapter = info.getInfo(iServiceInformation.sCurrentChapter)
497 self.totalChapters = info.getInfo(iServiceInformation.sTotalChapters)
498 self.setChapterLabel()
499 print "__chapterUpdated: %d/%d" % (self.currentChapter, self.totalChapters)
501 def __titleUpdated(self):
502 info = self.getServiceInterface("info")
504 self.currentTitle = info.getInfo(iServiceInformation.sCurrentTitle)
505 self.totalTitles = info.getInfo(iServiceInformation.sTotalTitles)
506 self.setChapterLabel()
507 print "__titleUpdated: %d/%d" % (self.currentTitle, self.totalTitles)
511 def askLeavePlayer(self):
512 choices = [(_("Exit"), "exit"), (_("Continue playing"), "play")]
513 if True or not self.physicalDVD:
514 choices.insert(1,(_("Return to file browser"), "browser"))
516 cur = self.session.nav.getCurrentlyPlayingServiceReference()
517 if cur and not cur.toString().endswith(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())):
518 choices.insert(0,(_("Play DVD"), "playPhysical" ))
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()
588 if self.autoplay and self.dvd_filelist:
589 # opened via autoplay
590 self.FileBrowserClosed(self.dvd_filelist[0])
591 elif self.autoplay and self.physicalDVD:
592 self.playPhysicalCB(True)
593 elif self.physicalDVD:
594 # opened from menu with dvd in drive
595 self.session.openWithCallback(self.playPhysicalCB, MessageBox, text=_("Do you want to play DVD in drive?"), timeout=5 )
597 # opened from menu without dvd in drive
598 self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, self.dvd_filelist)
600 def playPhysicalCB(self, answer):
602 self.FileBrowserClosed(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()))
604 self.session.openWithCallback(self.FileBrowserClosed, FileBrowser)
606 def FileBrowserClosed(self, val):
607 curref = self.session.nav.getCurrentlyPlayingServiceReference()
608 print "FileBrowserClosed", val
610 self.askLeavePlayer()
612 newref = eServiceReference(4369, 0, val)
613 print "play", newref.toString()
614 if curref is None or curref != newref:
615 self.session.nav.playService(newref)
616 self.service = self.session.nav.getCurrentService()
617 print "self.service", self.service
618 print "cur_dlg", self.session.current_dialog
619 subs = self.getServiceInterface("subtitle")
621 subs.enableSubtitles(self.dvdScreen.instance, None)
623 def exitCB(self, answer):
624 if answer is not None:
625 if answer[1] == "exit":
629 if answer[1] == "browser":
630 #TODO check here if a paused dvd playback is already running... then re-start it...
634 self.session.openWithCallback(self.FileBrowserClosed, FileBrowser)
635 if answer[1] == "playPhysical":
638 self.playPhysicalCB(True)
643 self.restore_infobar_seek_config()
644 self.session.nav.playService(self.oldService)
645 from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier
646 hotplugNotifier.remove(self.hotplugCB)
648 def playLastCB(self, answer): # overwrite infobar cuesheet function
649 print "playLastCB", answer, self.resume_point
652 seekable = self.getSeek()
654 seekable.seekTo(self.resume_point)
655 pause = self.service.pause()
657 self.hideAfterResume()
659 def showAfterCuesheetOperation(self):
663 def createSummary(self):
666 #override some InfoBarSeek functions
668 self.setSeekState(self.SEEK_STATE_PLAY)
670 def calcRemainingTime(self):
673 def hotplugCB(self, dev, media_state):
674 print "[hotplugCB]", dev, media_state
675 if dev == harddiskmanager.getCD():
676 if media_state == "1":
679 self.physicalDVD = False
681 def scanHotplug(self):
682 devicepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())
683 if pathExists(devicepath):
684 from Components.Scanner import scanDevice
685 res = scanDevice(devicepath)
686 list = [ (r.description, r, res[r], self.session) for r in res ]
688 (desc, scanner, files, session) = list[0]
691 if file.mimetype == "video/x-dvd":
692 print "physical dvd found:", devicepath
693 self.physicalDVD = True
695 self.physicalDVD = False
697 def main(session, **kwargs):
698 session.open(DVDPlayer)
700 def menu(menuid, **kwargs):
701 if menuid == "mainmenu":
702 return [(_("DVD Player"), main, "dvd_player", 46)]
705 from Plugins.Plugin import PluginDescriptor
707 def filescan_open(list, session, **kwargs):
708 if len(list) == 1 and list[0].mimetype == "video/x-dvd":
709 splitted = list[0].path.split('/')
710 print "splitted", splitted
711 if len(splitted) > 2:
712 if splitted[1] == 'autofs':
713 session.open(DVDPlayer, dvd_device="/dev/%s" %(splitted[2]))
716 print "splitted[0]", splitted[1]
720 if x.mimetype == "video/x-dvd-iso":
721 dvd_filelist.append(x.path)
722 if x.mimetype == "video/x-dvd":
723 dvd_filelist.append(x.path.rsplit('/',1)[0])
724 session.open(DVDPlayer, dvd_filelist=dvd_filelist)
726 def filescan(**kwargs):
727 from Components.Scanner import Scanner, ScanPath
729 # Overwrite checkFile to only detect local
730 class LocalScanner(Scanner):
731 def checkFile(self, file):
732 return fileExists(file.path)
735 LocalScanner(mimetypes = ["video/x-dvd","video/x-dvd-iso"],
738 ScanPath(path = "video_ts", with_subdirs = False),
739 ScanPath(path = "VIDEO_TS", with_subdirs = False),
740 ScanPath(path = "", with_subdirs = False),
743 description = _("Play DVD"),
744 openfnc = filescan_open,
747 def Plugins(**kwargs):
748 return [PluginDescriptor(name = "DVDPlayer", description = "Play DVDs", where = PluginDescriptor.WHERE_MENU, fnc = menu),
749 PluginDescriptor(where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)]