class MediaPlayer(Screen, InfoBarBase, InfoBarScreenSaver, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, InfoBarSubtitleSupport, HelpableScreen): ALLOW_SUSPEND = True ENABLE_RESUME_SUPPORT = True 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.value self.filelist = FileList( defaultDir, matchingPattern= "(?i)^.*\.(mp2|mp3|ogg|ts|trp|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 class MoviePlayerActionMap(NumberActionMap): def __init__(self, player, contexts=None, actions=None, prio=0): if not contexts: contexts = [] if not actions: actions = {} 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 beginning of list")), "skipListend": (self.skip_listend, _("Jump to end of list")), "prevBouquet": (self.switchLists, _("Switch between filelist/playlist")), "nextBouquet": (self.switchLists, _("Switch between filelist/playlist")), "delete": (self.deletePlaylistEntry, _("Delete playlist entry")), "shift_stop": (self.clear_playlist, _("Clear playlist")), "shift_record": (self.playlist.PlayListShuffle, _("Shuffle playlist")), "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.mediaPlayerInfoBar = self.session.instantiateDialog( MediaPlayerInfoBar) self.onClose.append(self.delMPTimer) self.onClose.append(self.__onClose) self.onShow.append(self.timerHideMediaPlayerInfoBar) 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.hideMediaPlayerInfoBar = eTimer() self.hideMediaPlayerInfoBar.callback.append( self.timerHideMediaPlayerInfoBar) self.currList = "filelist" self.isAudioCD = False self.ext = None 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 })