Exemplo n.º 1
0
	def __init__(self, session, parent):
		from Components.Sources.StaticText import StaticText
		Screen.__init__(self, session)
		self.skin = """
			<screen name="MediaPlayerSettings" position="center,150" size="610,200" title="Edit settings">
			<ePixmap pixmap="skin_default/buttons/red.png" position="110,0" size="140,40" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/green.png" position="360,0" size="140,40" alphatest="on" />
			<widget source="key_red" render="Label" position="110,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
			<widget source="key_green" render="Label" position="360,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
			<widget name="config" position="10,44" size="590,146" />
			</screen>"""
		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("Save"))
		self.skinName = 'MediaPlayerSettings2'

		ConfigListScreen.__init__(self, [])
		self.parent = parent
		self.initConfigList()
		config.plugins.mediaplayer2.saveDirOnExit.addNotifier(self.initConfigList)

		self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
		{
		    "green": self.save,
		    "red": self.cancel,
		    "cancel": self.cancel,
		    "ok": self.ok,
		}, -2)
Exemplo n.º 2
0
    def __init__(self, session, parent):
        from Components.Sources.StaticText import StaticText
        Screen.__init__(self, session)
        self.skin = """
			<screen name="MediaPlayerSettings" position="center,150" size="610,200" title="Edit settings">
			<ePixmap pixmap="skin_default/buttons/red.png" position="110,0" size="140,40" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/green.png" position="360,0" size="140,40" alphatest="on" />
			<widget source="key_red" render="Label" position="110,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
			<widget source="key_green" render="Label" position="360,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
			<widget name="config" position="10,44" size="590,146" />
			</screen>"""
        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("Save"))
        self.skinName = 'MediaPlayerSettings2'

        ConfigListScreen.__init__(self, [])
        self.parent = parent
        self.initConfigList()
        config.plugins.mediaplayer2.saveDirOnExit.addNotifier(
            self.initConfigList)

        self["setupActions"] = ActionMap(
            ["SetupActions", "ColorActions"], {
                "green": self.save,
                "red": self.cancel,
                "cancel": self.cancel,
                "ok": self.ok,
            }, -2)
Exemplo n.º 3
0
	def leavePlayer(self):
		self.is_closing = True

		if config.usage.on_movie_stop.value == "ask":
			list = []
			list.append((_("Yes"), "quit"))
			list.append((_("No"), "continue"))
			if config.usage.setup_level.index >= 2: # expert+
				list.append((_("No, but restart from begin"), "restart"))
			self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list=list)
		else:
			self.close(0)
Exemplo n.º 4
0
	def exit(self):
		if self.savePlaylistOnExit and not config.plugins.mediaplayer2.savePlaylistOnExit.getValue():
			self.savePlaylistOnExit = False
		if config.plugins.mediaplayer2.askOnExit.getValue():
			if not self.savePlaylistOnExit:
				self.session.openWithCallback(self.exitCB, MessageBox, _("Do you really want to exit?"), timeout=5)
			else:
				list = []
				list.append((_("No"), "no"))
				list.append((_("Yes"), "yes"))
				self.session.openWithCallback(self.exitCBsave, ChoiceBox, title=_("save playlist before exit?"), list=list)
		else:
			self.exitCB(True)
Exemplo n.º 5
0
def filescan(**kwargs):
	from Components.Scanner import Scanner, ScanPath
	mediatypes = [
		Scanner(mimetypes=["video/mpeg", "video/MP2T", "video/x-msvideo"],
			paths_to_scan=
				[
					ScanPath(path="", with_subdirs=False),
				],
			name="Movie",
			description=_("View Movies..."),
			openfnc=filescan_open,
		),
		Scanner(mimetypes=["video/x-vcd"],
			paths_to_scan=
				[
					ScanPath(path="mpegav", with_subdirs=False),
					ScanPath(path="MPEGAV", with_subdirs=False),
				],
			name="Video CD",
			description=_("View Video CD..."),
			openfnc=filescan_open,
		),
		Scanner(mimetypes=["audio/mpeg", "audio/x-wav", "application/ogg", "audio/x-flac"],
			paths_to_scan=
				[
					ScanPath(path="", with_subdirs=False),
				],
			name="Music",
			description=_("Play Music..."),
			openfnc=filescan_open,
		)]
	try:
		from Plugins.Extensions.CDInfo.plugin import Query
		mediatypes.append(
		Scanner(mimetypes=["audio/x-cda"],
			paths_to_scan=
				[
					ScanPath(path="", with_subdirs=False),
				],
			name="Audio-CD",
			description=_("Play Audio-CD..."),
			openfnc=audioCD_open,
		))
		return mediatypes
	except ImportError:
		return mediatypes
Exemplo n.º 6
0
 def initConfigList(self, element=None):
     print "[initConfigList]", element
     try:
         self.list = []
         self.list.append(
             getConfigListEntry(_("repeat playlist"),
                                config.plugins.mediaplayer2.repeat))
         self.list.append(
             getConfigListEntry(
                 _("save playlist on exit"),
                 config.plugins.mediaplayer2.savePlaylistOnExit))
         self.list.append(
             getConfigListEntry(_("ask on exit"),
                                config.plugins.mediaplayer2.askOnExit))
         self.list.append(
             getConfigListEntry(_("save last directory on exit"),
                                config.plugins.mediaplayer2.saveDirOnExit))
         self.list.append(
             getConfigListEntry(_("show in extensions menu"),
                                config.plugins.mediaplayer2.extensionsMenu))
         self.list.append(
             getConfigListEntry(
                 _("replace default MediaPlayer in main menu"),
                 config.plugins.mediaplayer2.mainMenu))
         if not config.plugins.mediaplayer2.saveDirOnExit.getValue():
             self.list.append(
                 getConfigListEntry(_("start directory"),
                                    config.plugins.mediaplayer2.defaultDir))
         self["config"].setList(self.list)
     except KeyError:
         print "keyError"
Exemplo n.º 7
0
 def ok(self):
     if self["config"].getCurrent(
     )[1] == config.plugins.mediaplayer2.defaultDir:
         self.session.openWithCallback(
             self.LocationBoxClosed,
             LocationBox,
             _("Please select the path for the Startdirectory"),
             currDir=self.parent.filelist.getCurrentDirectory(),
             bookmarks=config.movielist.videodirs)
Exemplo n.º 8
0
	def __init__(self, session, service):
		Screen.__init__(self, session)
		
		self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
			{
				"aspectChange": (self.aspectChange, _("changing aspect")),
				"leavePlayer": (self.leavePlayer, _("leave movie player...")),
				"audioSelection": (self.audioSelection, _("Audio Options..."))
			}, -5)
			
		self["MediaPlayerActions"] = HelpableActionMap(self, "MediaPlayerActions",
			{
				"previous": (self.previousMarkOrEntry, _("play from previous mark or playlist entry")),
				"next": (self.nextMarkOrEntry, _("play from next mark or playlist entry")),
				"aspectratio" : (self.aspectChange, _("AspectRatioChange")),
			}, -2)
		
		for x in HelpableScreen, InfoBarShowHide, \
				InfoBarSeek, \
				InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
				InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
				InfoBarMoviePlayerSummarySupport, SubsSupport, \
				InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport:
			x.__init__(self)
		
		self.resetSubs(True)
		if os.path.isdir(os.path.dirname(service.getPath())):
			self.__subsDir = os.path.dirname(service.getPath())
			subPath = os.path.splitext(service.getPath())[0] + '.srt'
			if os.path.isfile(subPath):
				self.loadSubs(subPath)
			
		self.session.nav.playService(service)
		self.returning = False
Exemplo n.º 9
0
	def deleteConfirmed_offline(self, confirmed):
		if confirmed:
			serviceHandler = eServiceCenter.getInstance()
			offline = serviceHandler.offlineOperations(self.service)
			result = False
			if offline is not None:
				# really delete!
				if not offline.deleteFromDisk(0):
					result = True
			if result == False:
				self.session.open(MessageBox, _("Delete failed!"), MessageBox.TYPE_ERROR)
			else:
				self.removeListEntry()
Exemplo n.º 10
0
	def deleteFile(self):
		if self.currList == "filelist":
			self.service = self.filelist.getServiceRef()
		else:
			self.service = self.playlist.getSelection()
		if self.service is None:
			return
		if self.service.type != 4098 and self.session.nav.getCurrentlyPlayingServiceReference() is not None:
			if self.service == self.session.nav.getCurrentlyPlayingServiceReference():
				self.stopEntry()

		serviceHandler = eServiceCenter.getInstance()
		offline = serviceHandler.offlineOperations(self.service)
		info = serviceHandler.info(self.service)
		name = info and info.getName(self.service)
		result = False
		if offline is not None:
			# simulate first
			if not offline.deleteFromDisk(1):
				result = True
		if result == True:
			self.session.openWithCallback(self.deleteConfirmed_offline, MessageBox, _("Do you really want to delete %s?") % (name))
		else:
			self.session.openWithCallback(self.close, MessageBox, _("You cannot delete this!"), MessageBox.TYPE_ERROR)      
Exemplo n.º 11
0
def Plugins(**kwargs):
	name = 'MediaPlayer2'
	descr = _('Play back media files with subtitles')
	list = []
	list.append(PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_PLUGINMENU, icon="plugin.png", fnc=main))
	if config.plugins.mediaplayer2.extensionsMenu.getValue():
		list.append(PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main))
		
	if config.plugins.mediaplayer2.mainMenu.getValue():
		for p in plugins.getPlugins(where=PluginDescriptor.WHERE_MENU):
			if p.name == "MediaPlayer":
				plugins.removePlugin(p)
				break
		list.append(PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_MENU, needsRestart=False, fnc=startSetup))
	return list
Exemplo n.º 12
0
	def initConfigList(self, element=None):
		print "[initConfigList]", element
		try:
			self.list = []
			self.list.append(getConfigListEntry(_("repeat playlist"), config.plugins.mediaplayer2.repeat))
			self.list.append(getConfigListEntry(_("save playlist on exit"), config.plugins.mediaplayer2.savePlaylistOnExit))
			self.list.append(getConfigListEntry(_("ask on exit"), config.plugins.mediaplayer2.askOnExit))
			self.list.append(getConfigListEntry(_("save last directory on exit"), config.plugins.mediaplayer2.saveDirOnExit))
			self.list.append(getConfigListEntry(_("show in extensions menu"), config.plugins.mediaplayer2.extensionsMenu))
			self.list.append(getConfigListEntry(_("replace default MediaPlayer in main menu"), config.plugins.mediaplayer2.mainMenu))
			if not config.plugins.mediaplayer2.saveDirOnExit.getValue():
				self.list.append(getConfigListEntry(_("start directory"), config.plugins.mediaplayer2.defaultDir))
			self["config"].setList(self.list)
		except KeyError:
			print "keyError"
Exemplo n.º 13
0
	def deleteConfirmed(self, confirmed):
		if confirmed:
			try:
				os_remove(self.delname)
			except OSError, e:
				self.session.open(MessageBox, _("Delete failed!, %s") % e, MessageBox.TYPE_ERROR)
Exemplo n.º 14
0
	def DeletePlaylistSelected(self, path):
		if path is not None:
			self.delname = path[1]
			self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Do you really want to delete %s?") % (path[1]))
Exemplo n.º 15
0
	def save_playlist(self):
		self.session.openWithCallback(self.save_playlist2, InputBox, title=_("Please enter filename (empty = use current date)"), windowTitle=_("Save Playlist"))
Exemplo n.º 16
0
	def doPathSelect(self):
		self.session.openWithCallback(self.gotPath, LocationBox, _("Please select the path..."), currDir=self.filelist.getCurrentDirectory(), bookmarks=config.movielist.videodirs)
Exemplo n.º 17
0
	def showMenu(self):
		menu = []
		if len(self.cdAudioTrackFiles):
			menu.insert(0, (_("Play Audio-CD..."), "audiocd"))
		if self.currList == "filelist":
			#menu.append((_("add selection after current playing"), "addAfterCurrent"))
			if self.filelist.canDescent():
				menu.append((_("add directory to playlist"), "copydir"))
			else:
				menu.append((_("add files to playlist"), "copyfiles"))
			menu.append((_("switch to playlist"), "playlist"))
		else:
			menu.append((_("switch to filelist"), "filelist"))
			menu.append((_("clear playlist"), "clear"))
			menu.append((_("Delete entry"), "deleteentry"))
			if config.usage.setup_level.index >= 1: # intermediate+
				menu.append((_("shuffle playlist"), "shuffle"))
		if pathExists("/usr/lib/enigma2/python/Plugins/Extensions/PicturePlayer/"):
			menu.append((_("PicturePlayer"), "PicturePlayer"));
		if config.usage.setup_level.index >= 1: # intermediate+
			menu.append((_("delete file"), "deletefile"))
		menu.append((_("hide player"), "hide"));
		menu.append((_("load playlist"), "loadplaylist"));
		if config.usage.setup_level.index >= 1: # intermediate+
			menu.append((_("save playlist"), "saveplaylist"));
			menu.append((_("delete saved playlist"), "deleteplaylist"));
			menu.append((_("Edit settings"), "settings"))
			menu.append((_("add/remove bookmarks (locationbox)"), "locationbox"))
		if self.currList == "filelist":
			menu.append((_("---------------------- bookmarks -------------------"), "line"))
			for x in self.bookmarks.value:
				menu.append((x, x))
		self.session.openWithCallback(self.menuCallback, ChoiceBox, title="", list=menu)
Exemplo n.º 18
0
			if self.playlistparsers.has_key(extension):
				playlist = self.playlistparsers[extension]()
				list = playlist.open(path[1])
				for x in list:
					self.playlist.addFile(x.ref)
			self.playlist.updateList()

	def delete_saved_playlist(self):
		listpath = []
		playlistdir = resolveFilename(SCOPE_PLAYLIST)
		try:
			for i in os_listdir(playlistdir):
				listpath.append((i, playlistdir + i))
		except IOError, e:
			print "Error while scanning subdirs ", e
		self.session.openWithCallback(self.DeletePlaylistSelected, ChoiceBox, title=_("Please select a playlist to delete..."), list=listpath)

	def DeletePlaylistSelected(self, path):
		if path is not None:
			self.delname = path[1]
			self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Do you really want to delete %s?") % (path[1]))

	def deleteConfirmed(self, confirmed):
		if confirmed:
			try:
				os_remove(self.delname)
			except OSError, e:
				self.session.open(MessageBox, _("Delete failed!, %s") % e, MessageBox.TYPE_ERROR)

	def clear_playlist(self):
		self.isAudioCD = False
Exemplo n.º 19
0
def startSetup(menuid, **kwargs):
	if menuid == "mainmenu":
		return [(_("Media player"), main, "media_player", 45)]
	return []
Exemplo n.º 20
0
	def __init__(self, session, args=None):
		Screen.__init__(self, session)
		InfoBarAudioSelection.__init__(self)
		InfoBarNotifications.__init__(self)
		InfoBarBase.__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")
		self.title = 'MediaPlayer2'
		# 'None' is magic to start at the list of mountpoints
		defaultDir = config.plugins.mediaplayer2.defaultDir.getValue()
		self.filelist = FileList(defaultDir, matchingPattern="(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|m2ts|avi|divx|mkv|mp4|m4a|dat|flac|rec)", useServiceRef=True, additionalExtensions="4098:m3u 4098:e2pls 4098:pls")
		self["filelist"] = self.filelist

		self.playlist = MyPlayList()
		self.is_closing = False
		self.MoviePlayerOpen = 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
		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",
			{	
				"csfd": (self.csfd, _("show csfd info")),
				"play": (self.xplayEntry, _("play entry")),
				"pause": (self.pauseEntry, _("pause")),
				"stop": (self.stopEntry, _("stop entry")),
				"previous": (self.previousEntry, _("play from previous playlist entry")),
				"next": (self.nextEntry, _("play from next 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")),
			}, -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.onShown.append(self.setWindowTitle)
		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.savePlaylistOnExit = False
		self.cdAudioTrackFiles = []
		self.applySettings()
		self.bookmarks = config.movielist.videodirs

		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
			})
Exemplo n.º 21
0
	def ok(self):
		if self["config"].getCurrent()[1] == config.plugins.mediaplayer2.defaultDir:
			self.session.openWithCallback(self.LocationBoxClosed, LocationBox, _("Please select the path for the Startdirectory"), currDir=self.parent.filelist.getCurrentDirectory(), bookmarks=config.movielist.videodirs)
Exemplo n.º 22
0
	def __evVideoDecodeError(self):
		currPlay = self.session.nav.getCurrentService()
		sVideoType = currPlay.info().getInfoString(iServiceInformation.sVideoType)
		print "[__evVideoDecodeError] video-codec %s can't be decoded by hardware" % (sVideoType)
		self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sVideoType, type=MessageBox.TYPE_INFO, timeout=20)