def __init__(self, session, args=None): Screen.__init__(self, session) InfoBarAudioSelection.__init__(self) InfoBarCueSheetSupport.__init__(self, actionmap="MediaPlayerCueSheetActions") InfoBarNotifications.__init__(self) InfoBarBase.__init__(self) InfoBarSubtitleSupport.__init__(self) HelpableScreen.__init__(self) self.summary = None self.oldService = self.session.nav.getCurrentlyPlayingServiceReference( ) self.session.nav.stopService() self.playlistparsers = {} self.addPlaylistParser(PlaylistIOM3U, "m3u") self.addPlaylistParser(PlaylistIOPLS, "pls") self.addPlaylistParser(PlaylistIOInternal, "e2pls") # 'None' is magic to start at the list of mountpoints defaultDir = config.mediaplayer.defaultDir.getValue() self.filelist = FileList( defaultDir, matchingPattern= "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|m4v|mkv|mp4|m4a|dat|flac|mov|m2ts|flv|dts|3gp|3g2|mts|wmv|asf|wma)", useServiceRef=True, additionalExtensions="4098:m3u 4098:e2pls 4098:pls") self["filelist"] = self.filelist self.playlist = MyPlayList() self.is_closing = False self.delname = "" self["playlist"] = self.playlist self["PositionGauge"] = ServicePositionGauge(self.session.nav) self["currenttext"] = Label("") self["artisttext"] = Label(_("Artist") + ':') self["artist"] = Label("") self["titletext"] = Label(_("Title") + ':') self["title"] = Label("") self["albumtext"] = Label(_("Album") + ':') self["album"] = Label("") self["yeartext"] = Label(_("Year") + ':') self["year"] = Label("") self["genretext"] = Label(_("Genre") + ':') self["genre"] = Label("") self["coverArt"] = MediaPixmap() self["repeat"] = MultiPixmap() self.seek_target = None # from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier # hotplugNotifier.append(self.hotplugCB) class MoviePlayerActionMap(NumberActionMap): def __init__(self, player, contexts=[], actions={}, prio=0): NumberActionMap.__init__(self, contexts, actions, prio) self.player = player def action(self, contexts, action): self.player.show() return NumberActionMap.action(self, contexts, action) self["OkCancelActions"] = HelpableActionMap( self, "OkCancelActions", { "ok": (self.ok, _("add file to playlist")), "cancel": (self.exit, _("exit mediaplayer")), }, -2) self["MediaPlayerActions"] = HelpableActionMap( self, "MediaPlayerActions", { "play": (self.xplayEntry, _("play entry")), "pause": (self.pauseEntry, _("pause")), "stop": (self.stopEntry, _("stop entry")), "previous": (self.previousMarkOrEntry, _("play from previous mark or playlist entry")), "next": (self.nextMarkOrEntry, _("play from next mark or playlist entry")), "menu": (self.showMenu, _("menu")), "skipListbegin": (self.skip_listbegin, _("jump to listbegin")), "skipListend": (self.skip_listend, _("jump to listend")), "prevBouquet": (self.switchToPlayList, _("switch to playlist")), "nextBouquet": (self.switchToFileList, _("switch to filelist")), "delete": (self.deletePlaylistEntry, _("delete playlist entry")), # "shift_stop": (self.clear_playlist, _("clear playlist")), # "shift_record": (self.playlist.PlayListShuffle, _("shuffle playlist")), "shift_stop": self.clear_playlist, "shift_record": self.playlist.PlayListShuffle, "subtitles": (self.subtitleSelection, _("Subtitle selection")), }, -2) self["InfobarEPGActions"] = HelpableActionMap( self, "InfobarEPGActions", { "showEventInfo": (self.showEventInformation, _("show event details")), }) self["actions"] = MoviePlayerActionMap( self, ["DirectionActions"], { "right": self.rightDown, "rightRepeated": self.doNothing, "rightUp": self.rightUp, "left": self.leftDown, "leftRepeated": self.doNothing, "leftUp": self.leftUp, "up": self.up, "upRepeated": self.up, "upUp": self.doNothing, "down": self.down, "downRepeated": self.down, "downUp": self.doNothing, }, -2) InfoBarSeek.__init__(self, actionmap="MediaPlayerSeekActions") self.onClose.append(self.delMPTimer) self.onClose.append(self.__onClose) self.righttimer = False self.rightKeyTimer = eTimer() self.rightKeyTimer.callback.append(self.rightTimerFire) self.lefttimer = False self.leftKeyTimer = eTimer() self.leftKeyTimer.callback.append(self.leftTimerFire) self.currList = "filelist" self.isAudioCD = False self.AudioCD_albuminfo = {} self.cdAudioTrackFiles = [] self.onShown.append(self.applySettings) self.playlistIOInternal = PlaylistIOInternal() list = self.playlistIOInternal.open( resolveFilename(SCOPE_CONFIG, "playlist.e2pls")) if list: for x in list: self.playlist.addFile(x.ref) self.playlist.updateList() self.__event_tracker = ServiceEventTracker( screen=self, eventmap={ iPlayableService.evUpdatedInfo: self.__evUpdatedInfo, iPlayableService.evUser + 10: self.__evAudioDecodeError, iPlayableService.evUser + 11: self.__evVideoDecodeError, iPlayableService.evUser + 12: self.__evPluginError, iPlayableService.evUser + 13: self["coverArt"].embeddedCoverArt })
def __init__(self, session, args=None): Screen.__init__(self, session) InfoBarAudioSelection.__init__(self) InfoBarCueSheetSupport.__init__(self, actionmap="MediaPlayerCueSheetActions") InfoBarNotifications.__init__(self) InfoBarBase.__init__(self) InfoBarScreenSaver.__init__(self) InfoBarSubtitleSupport.__init__(self) HelpableScreen.__init__(self) self.summary = None self.oldService = self.session.nav.getCurrentlyPlayingServiceReference( ) self.session.nav.stopService() self.playlistparsers = {} self.addPlaylistParser(PlaylistIOM3U, "m3u") self.addPlaylistParser(PlaylistIOPLS, "pls") self.addPlaylistParser(PlaylistIOInternal, "e2pls") # 'None' is magic to start at the list of mountpoints defaultDir = config.mediaplayer.defaultDir.getValue() self.filelist = FileList( defaultDir, matchingPattern= "(?i)^.*\.(mp2|mp3|ogg|ts|mts|m2ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|m4v|mkv|mp4|m4a|dat|flac|flv|mov|dts|3gp|3g2|asf|wmv|wma)", useServiceRef=True, additionalExtensions="4098:m3u 4098:e2pls 4098:pls") self["filelist"] = self.filelist self.playlist = MyPlayList() self.is_closing = False self.delname = "" self.playlistname = "" self["playlist"] = self.playlist self["PositionGauge"] = ServicePositionGauge(self.session.nav) self["currenttext"] = Label("") self["artisttext"] = Label(_("Artist") + ':') self["artist"] = Label("") self["titletext"] = Label(_("Title") + ':') self["title"] = Label("") self["albumtext"] = Label(_("Album") + ':') self["album"] = Label("") self["yeartext"] = Label(_("Year") + ':') self["year"] = Label("") self["genretext"] = Label(_("Genre") + ':') self["genre"] = Label("") self["coverArt"] = MediaPixmap() self["repeat"] = MultiPixmap() self.seek_target = None try: from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier hotplugNotifier.append(self.hotplugCB) except Exception, ex: print "[MediaPlayer] No hotplug support", ex
def __init__(self, session, service): self.skin = CutListEditor.skin Screen.__init__(self, session) Screen.setTitle(self, _("Cutlist editor")) InfoBarSeek.__init__(self, actionmap="CutlistSeekActions") InfoBarCueSheetSupport.__init__(self) InfoBarBase.__init__(self, steal_current_service=True) HelpableScreen.__init__(self) self.old_service = session.nav.getCurrentlyPlayingServiceReference() self.service = service session.nav.playService(service) self.pauseService() # disable cutlists. we want to freely browse around in the movie # However, downloading and uploading the cue sheet restores the # default state, so we need to keep disabling it. self.cut_state = 2 self.getCuesheet() # preserve the original cuts to possibly restore them later self.prev_cuts = self.cut_list[:] self.last_mark = [ x for x in self.prev_cuts if x[1] == self.CUT_TYPE_LAST ] self.edited = False self.MovieSelection = isinstance( self.session.current_dialog, MovieSelection) and self.session.current_dialog self["InLen"] = Label() self["OutLen"] = Label() self["Timeline"] = ServicePositionGauge(self.session.nav) self["cutlist"] = List(self.getCutlist()) self["cutlist"].onSelectionChanged.append(self.selectionChanged) self["SeekState"] = Label() self.onPlayStateChanged.append(self.updateStateLabel) self.updateStateLabel(self.seekstate) self["key_red"] = Label(_("Start cut")) self["key_green"] = Label(_("End cut")) self["key_yellow"] = Label(_("Step back")) self["key_blue"] = Label(_("Step forward")) self["SeekActions"].actions.update({"stepFwd": self.stepFwd}) self.helpList.append( (self["SeekActions"], "CutlistSeekActions", [("stepFwd", _("Step forward"))])) desktopSize = getDesktop(0).size() self["Video"] = VideoWindow(decoder=0, fb_width=desktopSize.width(), fb_height=desktopSize.height()) self["actions"] = HelpableActionMap(self, ["CutListEditorActions"], { "setIn": (self.setIn, _("Make this mark an 'in' point")), "setOut": (self.setOut, _("Make this mark an 'out' point")), "setStart": (self.setStart, _("Make this mark the initial 'in' point")), "setEnd": (self.setEnd, _("Make this mark the final 'out' point")), "setMark": (self.setMark, _("Make this mark just a mark")), "addMark": (self.__addMark, _("Add a mark")), "removeMark": (self.__removeMark, _("Remove a mark")), "execute": (self.execute, _("Execute cuts and exit")), "quickExecute": (self.quickExecute, _("Quick execute...")), "leave": (self.exit, _("Exit editor")), "showMenu": (self.showMenu, _("Menu")), "backMenu": (self.backMenu, _("Restore previous cuts...")), }, prio=-4) self.onExecBegin.append(self.showTutorial) self.__event_tracker = ServiceEventTracker( screen=self, eventmap={iPlayableService.evCuesheetChanged: self.refillList}) # to track new entries we save the last version of the cutlist self.last_cuts = self.getCutlist() self.cut_start = None self.cut_end = None self.state = CutListContextMenu.SHOW_DELETECUT self.inhibit_seek = False self.inhibit_cut = False self.onClose.append(self.__onClose) # Use onShown to set the initial list index, since apparently that doesn't # work from here. self.onShown.append(self.__onShown)