コード例 #1
0
	def __serviceStarted(self):
		if self.is_closing:
			return
		print "new service started! trying to download cuts!"
		self.downloadCuesheet()

		# From Merlin2 InfoBarCueSheetSupport __serviceStarted
		if config.usage.on_movie_start.value == "beginning" and config.EMC.movie_jump_first_mark.value == True:
			self.jumpToFirstMark()
			return

		if self.ENABLE_RESUME_SUPPORT:
			last = None

			for (pts, what) in self.cut_list:
				if what == self.CUT_TYPE_LAST:
					last = pts

			if last is not None:
				self.resume_point = last
				l = last / 90000
				val = config.usage.on_movie_start.value
				if val == "ask" or val == "ask yes":
					Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Do you want to resume this playback?") + "\n" + (_("Resume position at %s") % ("%d:%02d:%02d" % (l/3600, l%3600/60, l%60))), timeout=10, default=True)
				elif val == "ask no":
					Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Do you want to resume this playback?") + "\n" + (_("Resume position at %s") % ("%d:%02d:%02d" % (l/3600, l%3600/60, l%60))), timeout=10, default=False)
				elif val == "resume":
					Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Resuming playback"), timeout=2, type=MessageBox.TYPE_INFO)
			elif config.EMC.movie_jump_first_mark.value == True:
				self.jumpToFirstMark()
		elif config.EMC.movie_jump_first_mark.value == True:
			self.jumpToFirstMark()
コード例 #2
0
	def __init__(self):
		self.allowPiP = True         # both are needed here !
		self.allowPiPSwap = False    # this is needed for vti-images

		for x in	InfoBarShowHide, InfoBarMenu, \
				InfoBarBase, InfoBarSeek, InfoBarShowMovies, \
				InfoBarAudioSelection, InfoBarSimpleEventView, \
				InfoBarServiceNotifications, InfoBarPVRState, \
				InfoBarSubtitleSupport, \
				InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport, InfoBarExtensions, InfoBarNotifications, \
				InfoBarPlugins, InfoBarNumberZap, \
				InfoBarPiP, InfoBarEPG:
				#InfoBarCueSheetSupport
				#InfoBarMoviePlayerSummarySupport
			x.__init__(self)

		# Initialize InfoBarCueSheetSupport because we cannot override __serviceStarted
		#def __init__(self, actionmap = "InfobarCueSheetActions"):
		actionmap = "InfobarCueSheetActions"
		self["CueSheetActions"] = HelpableActionMap(self, actionmap,
			{
				"jumpPreviousMark": (self.jumpPreviousMark, _("jump to previous marked position")),
				"jumpNextMark": (self.jumpNextMark, _("jump to next marked position")),
				"toggleMark": (self.toggleMark, _("toggle a cut mark at the current position"))
			}, prio=1)

		self.cut_list = [ ]
		self.is_closing = False
		self.resume_point = 0

		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
			{
				iPlayableService.evStart: self.__serviceStarted,
			})
コード例 #3
0
	def __init__(self):
		self.allowPiP = True         # both are needed here !
		self.allowPiPSwap = False    # this is needed for vti-images

		for x in	InfoBarShowHide, InfoBarMenu, \
				InfoBarBase, InfoBarSeek, InfoBarShowMovies, \
				InfoBarAudioSelection, InfoBarSimpleEventView, \
				InfoBarServiceNotifications, InfoBarPVRState, \
				InfoBarSubtitleSupport, \
				InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport, InfoBarExtensions, InfoBarNotifications, \
				InfoBarPlugins, InfoBarNumberZap, \
				InfoBarPiP, InfoBarEPG, InfoBarHdmi:
				#InfoBarCueSheetSupport
				#InfoBarMoviePlayerSummarySupport
			x.__init__(self)

		# Initialize InfoBarCueSheetSupport because we cannot override __serviceStarted
		#def __init__(self, actionmap = "InfobarCueSheetActions"):
		actionmap = "InfobarCueSheetActions"
		self["CueSheetActions"] = HelpableActionMap(self, actionmap,
			{
				"jumpPreviousMark": (self.jumpPreviousMark, _("jump to previous marked position")),
				"jumpNextMark": (self.jumpNextMark, _("jump to next marked position")),
				"toggleMark": (self.toggleMark, _("toggle a cut mark at the current position"))
			}, prio=1)

		self.cut_list = [ ]
		self.is_closing = False
		self.resume_point = 0

		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
			{
				iPlayableService.evStart: self.__serviceStarted,
			})
コード例 #4
0
ファイル: InfoBarSupport.py プロジェクト: Akki01/emc-neu
	def __serviceStarted(self):
		if self.is_closing:
			return
		print "new service started! trying to download cuts!"
		self.downloadCuesheet()

		# From Merlin2 InfoBarCueSheetSupport __serviceStarted
		if config.usage.on_movie_start.value == "beginning" and config.EMC.movie_jump_first_mark.value == True:
			self.jumpToFirstMark()
			return

		if self.ENABLE_RESUME_SUPPORT:
			last = None

			for (pts, what) in self.cut_list:
				if what == self.CUT_TYPE_LAST:
					last = pts

			if last is not None:
				self.resume_point = last
				l = last / 90000
				val = config.usage.on_movie_start.value
				if val == "ask" or val == "ask yes":
					Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Do you want to resume this playback?") + "\n" + (_("Resume position at %s") % ("%d:%02d:%02d" % (l/3600, l%3600/60, l%60))), timeout=10, default=True)
				elif val == "ask no":
					Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Do you want to resume this playback?") + "\n" + (_("Resume position at %s") % ("%d:%02d:%02d" % (l/3600, l%3600/60, l%60))), timeout=10, default=False)
				elif val == "resume":
					Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Resuming playback"), timeout=2, type=MessageBox.TYPE_INFO)
			elif config.EMC.movie_jump_first_mark.value == True:
				self.jumpToFirstMark()
		elif config.EMC.movie_jump_first_mark.value == True:
			self.jumpToFirstMark()
	def setChapterLabel(self):
		chapterLCD = "Menu"
		chapterOSD = "DVD Menu"
		if self.currentTitle > 0:
			chapterLCD = "%s %d" % (_("Chap."), self.currentChapter)
			chapterOSD = "DVD %s %d/%d" % (_("Chapter"), self.currentChapter, self.totalChapters)
			chapterOSD += " (%s %d/%d)" % (_("Title"), self.currentTitle, self.totalTitles)
		self["chapterLabel"].setText(chapterOSD)
コード例 #6
0
	def setChapterLabel(self):
		chapterLCD = "Menu"
		chapterOSD = "DVD Menu"
		if self.currentTitle > 0:
			chapterLCD = "%s %d" % (_("Chap."), self.currentChapter)
			chapterOSD = "DVD %s %d/%d" % (_("Chapter"), self.currentChapter, self.totalChapters)
			chapterOSD += " (%s %d/%d)" % (_("Title"), self.currentTitle, self.totalTitles)
		self["chapterLabel"].setText(chapterOSD)
コード例 #7
0
	def okButton(self):
		try:
			self["menu"].getCurrent()[1]()
		#except:pass
		except Exception, e:
			import os, sys, traceback
			print _("exception ") + str(e)
			exc_type, exc_value, exc_traceback = sys.exc_info()
			traceback.print_exception(exc_type, exc_value, exc_traceback, file=sys.stdout)
コード例 #8
0
	def okButton(self):
		try:
			self["menu"].getCurrent()[1]()
		#except:pass
		except Exception, e:
			import os, sys, traceback
			print _("exception ") + str(e)
			exc_type, exc_value, exc_traceback = sys.exc_info()
			traceback.print_exception(exc_type, exc_value, exc_traceback, file=sys.stdout)
コード例 #9
0
	def createLink(self, path):
		self.session.openWithCallback(
				boundFunction( self.createLinkCB, path ),
				LocationBox,
					windowTitle = _("Create Link"),
					text = _("Choose directory"),
					currDir = str(path)+"/",
					bookmarks = config.movielist.videodirs,
					autoAdd = False,
					editDir = True,
					inhibitDirs = ["/bin", "/boot", "/dev", "/etc", "/lib", "/proc", "/sbin", "/sys", "/usr", "/var"],
					minFree = 0 )
コード例 #10
0
	def createLink(self, path):
		self.session.openWithCallback(
				boundFunction( self.createLinkCB, path ),
				LocationBox,
					windowTitle = _("Create Link"),
					text = _("Choose directory"),
					currDir = str(path)+"/",
					bookmarks = config.movielist.videodirs,
					autoAdd = False,
					editDir = True,
					inhibitDirs = ["/bin", "/boot", "/dev", "/etc", "/lib", "/proc", "/sbin", "/sys", "/usr", "/var"],
					minFree = 0 )
コード例 #11
0
	def InitRestart(self):
		if Screens.Standby.inStandby:
			self.LaunchRestart(True)	# no need to query if in standby mode
		else:
			if config.EMC.restart.value == "0": # Standby
				stri = _("Your Box is about to go into Standby, continue?\n Select no to delay one hour")
			elif config.EMC.restart.value == "1": # DeepStandby
				stri = _("Your Box is about to go into DeepStandby, continue?\n Select no to delay one hour")
			elif config.EMC.restart.value == "2": # Reboot
				stri = _("Your Box is about to go into Reboot, continue?\n Select no to delay one hour")
			else: # E2 Restart
				stri = _("Your Box is about to go into E2 Restart, continue?\n Select no to delay one hour")
			self.session.openWithCallback(self.LaunchRestart, MessageBox, stri, MessageBox.TYPE_YESNO, 30)
コード例 #12
0
	def InitRestart(self):
		if Screens.Standby.inStandby:
			self.LaunchRestart(True)	# no need to query if in standby mode
		else:
			if config.EMC.restart.value == "0": # Standby
				stri = _("Your Box is about to go into Standby, continue?\n Select no to delay one hour")
			elif config.EMC.restart.value == "1": # DeepStandby
				stri = _("Your Box is about to go into DeepStandby, continue?\n Select no to delay one hour")
			elif config.EMC.restart.value == "2": # Reboot
				stri = _("Your Box is about to go into Reboot, continue?\n Select no to delay one hour")
			else: # E2 Restart
				stri = _("Your Box is about to go into E2 Restart, continue?\n Select no to delay one hour")
			self.session.openWithCallback(self.LaunchRestart, MessageBox, stri, MessageBox.TYPE_YESNO, 30)
コード例 #13
0
ファイル: MovieSelectionMenu.py プロジェクト: Akki01/emc-neu
 def lockDir(self, currentPath):
     self.hide
     if not os.path.exists(currentPath + '/dir.lock'):
         self.session.openWithCallback(
             boundFunction(self.lockDirConfirmed, currentPath, False),
             MessageBox,
             _("Do you really want to lock the directory %s and all its subfolders?"
               ) % (currentPath), MessageBox.TYPE_YESNO)
     else:
         self.session.openWithCallback(
             boundFunction(self.lockDirConfirmed, currentPath, True),
             MessageBox,
             _("The directory %s is already locked. Do you want to unlock it and all its subfolders?"
               ) % (currentPath), MessageBox.TYPE_YESNO)
コード例 #14
0
	def ShowAutoRestartInfo(self):
		# call the Execute/Stop function to update minutes
		if config.EMC.restart.value != "":
			self.RestartTimerStart(True)
		else:
			self.RestartTimerStop()

		from EnhancedMovieCenter import _
		if self.timerActive:
			mints = self.minutes % 60
			hours = self.minutes / 60
			self.session.open(MessageBox, _("Next auto-start in ")+ str(hours) +" h "+ str(mints) +" min", MessageBox.TYPE_INFO, 4)
		else:
			self.session.open(MessageBox, _("auto-start is currently not active."), MessageBox.TYPE_INFO, 4)
コード例 #15
0
	def ShowAutoRestartInfo(self):
		# call the Execute/Stop function to update minutes
		if config.EMC.restart.value != "":
			self.RestartTimerStart(True)
		else:
			self.RestartTimerStop()

		from EnhancedMovieCenter import _
		if self.timerActive:
			mints = self.minutes % 60
			hours = self.minutes / 60
			self.session.open(MessageBox, _("Next auto-start in ")+ str(hours) +" h "+ str(mints) +" min", MessageBox.TYPE_INFO, 4)
		else:
			self.session.open(MessageBox, _("auto-start is currently not active."), MessageBox.TYPE_INFO, 4)
コード例 #16
0
	def emptyTrash(self):
		self.hide()
		self.session.openWithCallback(
				self.emptyTrashCB,
				MessageBox,
				_("Permanently delete all files in trashcan?"),
				MessageBox.TYPE_YESNO )
コード例 #17
0
	def emptyTrash(self):
		self.hide()
		self.session.openWithCallback(
				self.emptyTrashCB,
				MessageBox,
				_("Permanently delete all files in trashcan?"),
				MessageBox.TYPE_YESNO )
コード例 #18
0
	def remRogueFiles(self):
		self.hide()
		self.session.openWithCallback(
				self.remRogueFilesCB,
				MessageBox,
				_("Locate rogue files and remove them? (permanently if no trashcan available, may take a minute or so)"),
				MessageBox.TYPE_YESNO )
コード例 #19
0
	def remCutListMarker(self):
		self.hide()
		self.session.openWithCallback(
				self.remCutListMarkerCB,
				MessageBox,
				_("Remove all cut file marker permanently?"),
				MessageBox.TYPE_YESNO )
コード例 #20
0
	def resMarker(self):
		self.hide()
		self.session.openWithCallback(
				self.resMarkerCB,
				MessageBox,
				_("Remove all marker permanently?"),
				MessageBox.TYPE_YESNO )
コード例 #21
0
	def remRogueFiles(self):
		self.hide()
		self.session.openWithCallback(
				self.remRogueFilesCB,
				MessageBox,
				_("Locate rogue files and remove them? (permanently if no trashcan available, may take a minute or so)"),
				MessageBox.TYPE_YESNO )
コード例 #22
0
	def removeDirFromEMCBookmarks(self, path):
		if config.EMC.movie_delete_validation.value:
			self.session.openWithCallback(
					boundFunction(self.removeDirFromEMCBookmarksConfirmed, path),
					MessageBox,
					_("Do you really want to remove your bookmark\n%s?") % (path) )
		else:
			self.removeDirFromEMCBookmarksConfirmed(path, True)
コード例 #23
0
	def removeDirFromEMCBookmarks(self, path):
		if config.EMC.movie_delete_validation.value:
			self.session.openWithCallback(
					boundFunction(self.removeDirFromEMCBookmarksConfirmed, path),
					MessageBox,
					_("Do you really want to remove your bookmark\n%s?") % (path) )
		else:
			self.removeDirFromEMCBookmarksConfirmed(path, True)
コード例 #24
0
	def createDirCB(self, currentPath, name):
		if name is not None:
			name = os.path.join(currentPath, name)
			if os.path.exists(name):
				self.session.open(MessageBox, _("Directory %s already exists!") % (name), MessageBox.TYPE_ERROR)
			else:
				try:
					os.mkdir(name)
				except Exception, e:
					emcDebugOut("[EMCMM] createDir exception:\n" + str(e))
				self.close("reload")
コード例 #25
0
	def createDirCB(self, currentPath, name):
		if name is not None:
			name = os.path.join(currentPath, name)
			if os.path.exists(name):
				self.session.open(MessageBox, _("Directory %s already exists!") % (name), MessageBox.TYPE_ERROR)
			else:
				try:
					os.mkdir(name)
					movieFileCache.delPathFromCache(currentPath)
				except Exception, e:
					emcDebugOut("[EMCMM] createDir exception:\n" + str(e))
				self.close("reload")
コード例 #26
0
	def leavePlayer(self, stopped=True):
		#TEST is stopped really necessary
		self.stopped = stopped

		self.setSubtitleState(False)
		if self.dvdScreen:
			self.dvdScreen.close()

		# Possible Problem: Avoid GeneratorExit exception
		#if self.playall:
		#	playall.close()

		if self.service and self.service.type != sidDVB:
			self.makeUpdateCutList()

		reopen = False
		try:
#			self.recordings.returnService = self.service
			if self.stopped:
				emcDebugOut("[EMCPlayer] Player closed by user")
				if config.EMC.movie_reopen.value:
					#self.recordings.show()
					reopen = True
			elif self.closedByDelete:
				emcDebugOut("[EMCPlayer] closed due to file delete")
				#self.recordings.show()
				reopen = True
			else:
				emcDebugOut("[EMCPlayer] closed due to playlist EOF")
				if self.closeAll:
					if config.EMC.record_eof_zap.value == "1":
						AddPopup(
									_("EMC\nZap to Live TV of record"),
									MessageBox.TYPE_INFO,
									3,
									"EMCCloseAllAndZap"
								)
				else:
					if config.EMC.movie_reopenEOF.value: # did the player close while movie list was open?
						#self.recordings.show()
						reopen = True
			#self.service = None
		except Exception, e:
			emcDebugOut("[EMCPlayer] leave exception:\n" + str(e))
コード例 #27
0
	def leavePlayer(self, stopped=True):
		#TEST is stopped really necessary
		self.stopped = stopped

		self.setSubtitleState(False)
		if self.dvdScreen:
			self.dvdScreen.close()

		# Possible Problem: Avoid GeneratorExit exception
		#if self.playall:
		#	playall.close()

		if self.service and self.service.type != sidDVB:
			self.makeUpdateCutList()

		reopen = False
		try:
#			self.recordings.returnService = self.service
			if self.stopped:
				emcDebugOut("[EMCPlayer] Player closed by user")
				if config.EMC.movie_reopen.value:
					#self.recordings.show()
					reopen = True
			elif self.closedByDelete:
				emcDebugOut("[EMCPlayer] closed due to file delete")
				#self.recordings.show()
				reopen = True
			else:
				emcDebugOut("[EMCPlayer] closed due to playlist EOF")
				if self.closeAll:
					if config.EMC.record_eof_zap.value == "1":
						AddPopup(
									_("EMC\nZap to Live TV of record"),
									MessageBox.TYPE_INFO,
									3,
									"EMCCloseAllAndZap"
								)
				else:
					if config.EMC.movie_reopenEOF.value: # did the player close while movie list was open?
						#self.recordings.show()
						reopen = True
			#self.service = None
		except Exception, e:
			emcDebugOut("[EMCPlayer] leave exception:\n" + str(e))
コード例 #28
0
	def deleteCutFileQ(self):
		self.session.openWithCallback(self.deleteCutFile, MessageBox, _("Do you really want to delete the cut file?\nIf you have selected a directory, all cut files within the folder and its subfolders will be deleted!"))
コード例 #29
0
    def evEOF(self, needToClose=False):
        # see if there are more to play
        print "EMC PLAYER evEOF", self.playall, self.playcount, self.playlist
        if self.playall:
            # Play All
            try:
                self.playcount = -1
                self.playlist = [self.playall.next()]
            except StopIteration:
                self.playall = None
                self.playlist = []

        if (self.playcount + 1) < len(self.playlist):
            self.playcount += 1
            service = self.playlist[self.playcount]
            #TODO Problem with VLC
            path = service and service.getPath()
            if os.path.exists(
                    path):  #TODO use ext != vlc but must be prepared first
                cutspath = path + ".cuts"
                if os.path.exists(cutspath):
                    # prepare cut list
                    #try:
                    #	# Workaround for not working E2 cue.setCutListEnable not working :-(
                    #	# We always have to set this permission, we can not detect all stop preview events
                    #	os.chmod(cutspath, 755)
                    #	print "EMC set chmod read and write"
                    #except:
                    #	pass
                    # Workaround for E2 dvb player bug in combination with running recordings and existings cutlists
                    record = getRecording(path)
                    if record:
                        try:
                            os.remove(cutspath)
                        except:
                            pass
                # Further cutlist handling
                toggleProgressService(service, True)
                self.service = service

                if service and service.type == sidDVD:
                    # Only import DVDPlayer, if we want to play a DVDPlayer format
                    if fileExists("%so" % dvdPlayerPlg) or fileExists(
                            "%sc" % dvdPlayerPlg):
                        try:
                            from Plugins.Extensions.DVDPlayer import servicedvd  # load c++ part of dvd player plugin
                        except:
                            pass
                        from Plugins.Extensions.DVDPlayer.plugin import DVDOverlay
                        if not self.dvdScreen:
                            self.dvdScreen = self.session.instantiateDialog(
                                DVDOverlay)
                    else:
                        self.session.open(MessageBox,
                                          _("No DVD-Player found!"),
                                          MessageBox.TYPE_ERROR, 10)
                        self.leavePlayer(True)
                        return
                    self["TeletextActions"].setEnabled(False)
                    self["DVDPlayerPlaybackActions"].setEnabled(True)
                else:
                    if self.dvdScreen:
                        self.dvdScreen.close()
                        self.dvdScreen = None
                    else:
                        self.dvdScreen = None
                    self["TeletextActions"].setEnabled(True)
                    self["DVDPlayerPlaybackActions"].setEnabled(False)

                # Check if the video preview is active and already running
        #				if config.EMC.movie_preview.value:
        #					ref = self.session.nav.getCurrentlyPlayingServiceReference()
        #					if ref and service and ref.getPath() == service.getPath():
        #						#s = self.session.nav.getCurrentService()
        #						#cue = s and s.cueSheet()
        #						#if cue is not None:
        #							#cue.setCutListEnable(1)
        #						self.downloadCuesheet()
        #							#print "EMC cue.setCutListEnable(1)"
        #						#return

        # Is this really necessary
        # TEST for M2TS Audio problem
        #self.session.nav.stopService()

        # Start playing movie
                self.session.nav.playService(service)

                if service and service.type == sidDVD:
                    # Seek will cause problems with DVDPlayer!
                    # ServiceDVD needs this to start
                    subs = self.getServiceInterface("subtitle")
                    if subs and self.dvdScreen:
                        subs.enableSubtitles(self.dvdScreen.instance, None)
                else:
                    # TEST for M2TS Audio problem
                    #self.setSeekState(InfoBarSeek.SEEK_STATE_PLAY)
                    #TODO Do we need this
                    #self.doSeek(0)
                    #TODO AutoSelect subtitle for DVD Player is not implemented yet
                    DelayedFunction(200, self.setAudioTrack)
                    DelayedFunction(400, self.setSubtitleState, True)
            else:
                self.session.open(
                    MessageBox,
                    _("Skipping movie, the file does not exist.\n\n") +
                    service.getPath(), MessageBox.TYPE_ERROR, 10)
                self.evEOF(needToClose)

        else:
            if needToClose or config.usage.on_movie_eof.value != "pause":
                self.closedByDelete = needToClose
                self.leavePlayer(False)
コード例 #30
0
	def evEOF(self, needToClose=False, prevTitle=False):
		# see if there are more to play
		playlist_string = "[ "
		for p in self.playlist:
			playlist_string += (os.path.basename(p.getPath()) + " ")
		playlist_string += "]"
		print "EMC PLAYER evEOF", self.playall, self.playcount, playlist_string
		if self.playall:
			# Play All
			try:
				# for being able to jump back in 'playall' mode, new titles are added to the playlist acting like a cache
				# (the generator 'getNextService' cannot easily be made bidirectional, using os.walk)
				if prevTitle:
					if self.playcount > 0:
						self.playcount -= 2
					else:
						self.playcount -= 1
				else:
					if self.playcount == -1:
						self.playlist = [ self.playall.next() ]
					elif (self.playcount + 1) == len(self.playlist):
						self.playlist.append(self.playall.next())
						if len(self.playlist) > 25:
							del self.playlist[0]
							self.playcount -= 1
			except StopIteration:
				self.playall = None
				self.playlist = []

		if (self.playcount + 1) < len(self.playlist):
			self.playcount += 1
			service = self.playlist[self.playcount]
			#TODO Problem with VLC
			path = service and service.getPath()
			if os.path.exists(path): #TODO use ext != vlc but must be prepared first
				# Why should the file be removed? Maybe that's the problem with "no Cutlist while recording"
				#cutspath = path + ".cuts"
				#if os.path.exists(cutspath):
					# prepare cut list
					#try:
					#	# Workaround for not working E2 cue.setCutListEnable not working :-(
					#	# We always have to set this permission, we can not detect all stop preview events
					#	os.chmod(cutspath, 755)
					#	print "EMC set chmod read and write"
					#except:
					#	pass
					# Workaround for E2 dvb player bug in combination with running recordings and existings cutlists
					#record = getRecording(path)
					#if record:
						#try:
							# os.remove(cutspath)
						#except:
						#	pass
				# Further cutlist handling
				toggleProgressService(service, True)
				self.service = service

				if service and service.type == sidDVD:
					# Only import DVDPlayer, if we want to play a DVDPlayer format
					if fileExists("%so"%dvdPlayerPlg) or fileExists("%sc"%dvdPlayerPlg):
						try:
							from Plugins.Extensions.DVDPlayer import servicedvd # load c++ part of dvd player plugin
						except:
							pass
						from Plugins.Extensions.DVDPlayer.plugin import DVDOverlay
						if not self.dvdScreen:
							self.dvdScreen = self.session.instantiateDialog(DVDOverlay)
					else:
						self.session.open(MessageBox, _("No DVD-Player found!"), MessageBox.TYPE_ERROR, 10)
						self.leavePlayer(True)
						return
					self["TeletextActions"].setEnabled(False)
					self["DVDPlayerPlaybackActions"].setEnabled(True)
				else:
					if self.dvdScreen:
						self.dvdScreen.close()
						self.dvdScreen = None
					else:
						self.dvdScreen = None
					self["TeletextActions"].setEnabled(True)
					self["DVDPlayerPlaybackActions"].setEnabled(False)

				# Check if the video preview is active and already running
		#				if config.EMC.movie_preview.value:
		#					ref = self.session.nav.getCurrentlyPlayingServiceReference()
		#					if ref and service and ref.getPath() == service.getPath():
		#						#s = self.session.nav.getCurrentService()
		#						#cue = s and s.cueSheet()
		#						#if cue is not None:
		#							#cue.setCutListEnable(1)
		#						self.downloadCuesheet()
		#							#print "EMC cue.setCutListEnable(1)"
		#						#return

				# Is this really necessary
				# TEST for M2TS Audio problem
				#self.session.nav.stopService()

				# Start playing movie
				self.session.nav.playService(service)

				if self.service and self.service.type != sidDVB:
					self.realSeekLength = self.getSeekLength()

				if service and service.type == sidDVD:
					# Seek will cause problems with DVDPlayer!
					# ServiceDVD needs this to start
					subs = self.getServiceInterface("subtitle")
					if subs and self.dvdScreen:
						subs.enableSubtitles(self.dvdScreen.instance, None)
				else:
					# TEST for M2TS Audio problem
					#self.setSeekState(InfoBarSeek.SEEK_STATE_PLAY)
					#TODO Do we need this
					#self.doSeek(0)
					#TODO AutoSelect subtitle for DVD Player is not implemented yet
					DelayedFunction(750, self.setAudioTrack)      # we need that to configure! on some images it comes with 200 too early
					DelayedFunction(750, self.setSubtitleState, True)

				### Cover anzeige
				self.showCover()
			else:
				self.session.open(MessageBox, _("Skipping movie, the file does not exist.\n\n") + service.getPath(), MessageBox.TYPE_ERROR, 10)
				self.evEOF(needToClose)

		else:
			if needToClose or config.usage.on_movie_eof.value != "pause":
				self.closedByDelete = needToClose
				self.leavePlayer(False)
コード例 #31
0
	def onDialogShow(self):
		self.setTitle(_("Movie Selection Menu"))
コード例 #32
0
    def __init__(self, session, playlist, playall=None, lastservice=None):

        # The CutList must be initialized very first
        CutList.__init__(self)
        Screen.__init__(self, session)
        HelpableScreen.__init__(self)
        InfoBarSupport.__init__(self)

        # Skin
        self.skinName = "EMCMediaCenter"
        skin = None
        CoolWide = getDesktop(0).size().width()
        if CoolWide == 720:
            skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/CoolSkin/EMCMediaCenter_720.xml"
        elif CoolWide == 1024:
            skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/CoolSkin/EMCMediaCenter_1024.xml"
        elif CoolWide == 1280:
            skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/CoolSkin/EMCMediaCenter_1280.xml"
        if skin:
            Cool = open(skin)
            self.skin = Cool.read()
            Cool.close()

        self.serviceHandler = ServiceCenter.getInstance()

        # EMC Source
        self["Service"] = EMCCurrentService(session.nav, self)

        # Events
        self.__event_tracker = ServiceEventTracker(
            screen=self,
            eventmap={
                # Disabled for tests
                # If we enable them, the sound will be delayed for about 2 seconds ?
                iPlayableService.evStart:
                self.__serviceStarted,
                iPlayableService.evStopped:
                self.__serviceStopped,
                #iPlayableService.evEnd: self.__evEnd,
                #iPlayableService.evEOF: self.__evEOF,
                #iPlayableService.evUser: self.__timeUpdated,
                #iPlayableService.evUser+1: self.__statePlay,
                #iPlayableService.evUser+2: self.__statePause,
                iPlayableService.evUser + 3:
                self.__osdFFwdInfoAvail,
                iPlayableService.evUser + 4:
                self.__osdFBwdInfoAvail,
                #iPlayableService.evUser+5: self.__osdStringAvail,
                iPlayableService.evUser + 6:
                self.__osdAudioInfoAvail,
                iPlayableService.evUser + 7:
                self.__osdSubtitleInfoAvail,
                iPlayableService.evUser + 8:
                self.__chapterUpdated,
                iPlayableService.evUser + 9:
                self.__titleUpdated,
                iPlayableService.evUser + 11:
                self.__menuOpened,
                iPlayableService.evUser + 12:
                self.__menuClosed,
                iPlayableService.evUser + 13:
                self.__osdAngleInfoAvail
            })

        # Keymap
        #		self["SeekActions"] = HelpableActionMap(self, "InfobarSeekActions", 							-1 higher priority
        #		self["MovieListActions"] = HelpableActionMap(self, "InfobarMovieListActions", 		0
        #		self["ShowHideActions"] = ActionMap( ["InfobarShowHideActions"] ,  								0
        #		self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions",									0
        #		self["CueSheetActions"] = HelpableActionMap(self, actionmap,											1 lower priority
        #		self["InstantExtensionsActions"] = HelpableActionMap(self, "InfobarExtensions", 	1 lower priority
        #		self["NumberActions"] = NumberActionMap( [ "NumberActions"],											0 Set by EMC to 2 very lower priority
        #		self["TeletextActions"] = HelpableActionMap(self, "InfobarTeletextActions",				0 Set by EMC to 2 very lower priority
        #		self["MenuActions"] = HelpableActionMap(self, "InfobarMenuActions",  							0 Set by EMC to 2 very lower priority
        if config.EMC.movie_exit.value:
            self["actions"] = HelpableActionMap(self, "CoolPlayerActions", {
                "leavePlayer": (self.leavePlayer, _("Stop playback")),
            })  # default priority
        else:
            self["actions"] = HelpableActionMap(self, "CoolPlayerActions2", {
                "leavePlayer": (self.leavePlayer, _("Stop playback")),
            })  # default priority

        self["DVDPlayerPlaybackActions"] = HelpableActionMap(
            self,
            "EMCDVDPlayerActions",
            {
                "dvdMenu": (self.enterDVDMenu, _("show DVD main menu")),
                #"showInfo": (self.showInfo, _("toggle time, chapter, audio, subtitle info")),
                "nextChapter":
                (self.nextChapter, _("forward to the next chapter")),
                "prevChapter":
                (self.prevChapter, _("rewind to the previous chapter")),
                "nextTitle":
                (self.nextTitle, _("jump forward to the next title")),
                "prevTitle":
                (self.prevTitle, _("jump back to the previous title")),
                "dvdAudioMenu":
                (self.enterDVDAudioMenu, _("(show optional DVD audio menu)")),
                "nextAudioTrack":
                (self.nextAudioTrack, _("switch to the next audio track")),
                "nextSubtitleTrack":
                (self.nextSubtitleTrack,
                 _("switch to the next subtitle language")),
                "nextAngle": (self.nextAngle, _("switch to the next angle")),
            },
            1)  # lower priority
        # Only enabled if playing a dvd
        self["DVDPlayerPlaybackActions"].setEnabled(False)

        self["DVDMenuActions"] = ActionMap(
            ["WizardActions"], {
                "left": self.keyLeft,
                "right": self.keyRight,
                "up": self.keyUp,
                "down": self.keyDown,
                "ok": self.keyOk,
                "back": self.keyBack,
            }, 2)  # lower priority
        # Only enabled during DVD Menu
        self["DVDMenuActions"].setEnabled(False)

        self["GeneralPlayerPlaybackActions"] = HelpableActionMap(
            self, "EMCGeneralPlayerActions", {
                "showExtensions":
                (self.openExtensions, _("view extensions...")),
                "EMCGreen": (self.CoolAVSwitch, _("Format AVSwitch")),
                "seekFwd": (self.seekFwd, _("Seek forward")),
                "seekBack": (self.seekBack, _("Seek backward")),
                "movieInfo": (self.infoMovie, _("Movie information")),
            }, 2)  # lower priority

        self["MenuActions"].prio = 2
        if "TeletextActions" in self:
            self["TeletextActions"].prio = 2
        self["NumberActions"].prio = 2

        # Cover Anzeige
        self["Cover"] = Pixmap()

        # DVD Player
        self["audioLabel"] = Label("")
        self["subtitleLabel"] = Label("")
        self["angleLabel"] = Label("")
        self["chapterLabel"] = Label("")
        self["anglePix"] = Pixmap()
        self["anglePix"].hide()
        self.last_audioTuple = None
        self.last_subtitleTuple = None
        self.last_angleTuple = None
        self.totalChapters = 0
        self.currentChapter = 0
        self.totalTitles = 0
        self.currentTitle = 0
        self.in_menu = None
        self.dvdScreen = None

        # Further initialization
        self.firstStart = True
        self.stopped = False
        self.closedByDelete = False
        self.closeAll = False

        self.lastservice = lastservice or self.session.nav.getCurrentlyPlayingServiceReference(
        )
        self.playlist = playlist
        self.playall = playall
        self.playcount = -1
        self.service = None

        self.picload = ePicLoad()
        self.picload.PictureData.get().append(self.showCoverCallback)

        # Record events
        try:
            NavigationInstance.instance.RecordTimer.on_state_change.append(
                self.recEvent)
        except Exception, e:
            emcDebugOut("[EMCMediaCenter] Record observer add exception:\n" +
                        str(e))
コード例 #33
0
	def lockDir(self, currentPath):
		self.hide
		if not os.path.exists(currentPath + '/dir.lock'):
			self.session.openWithCallback(boundFunction(self.lockDirConfirmed, currentPath, False), MessageBox, _("Do you really want to lock the directory %s and all its subfolders?") % (currentPath), MessageBox.TYPE_YESNO)
		else:
			self.session.openWithCallback(boundFunction(self.lockDirConfirmed, currentPath, True), MessageBox, _("The directory %s is already locked. Do you want to unlock it and all its subfolders?") % (currentPath), MessageBox.TYPE_YESNO)
コード例 #34
0
	def __init__(self, session, playlist, playall=None, lastservice=None):
		
		# The CutList must be initialized very first  
		CutList.__init__(self)
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)
		InfoBarSupport.__init__(self)
		
		# Skin
		self.skinName = "EMCMediaCenter"
		skin = None
		CoolWide = getDesktop(0).size().width()
		if CoolWide == 720:
			skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/CoolSkin/EMCMediaCenter_720.xml"
		elif CoolWide == 1024:
			skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/CoolSkin/EMCMediaCenter_1024.xml"
		elif CoolWide == 1280:
			skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/CoolSkin/EMCMediaCenter_1280.xml"
		if skin:
			Cool = open(skin)
			self.skin = Cool.read()
			Cool.close()

		self.serviceHandler = ServiceCenter.getInstance()

		# EMC Source
		self["Service"] = EMCCurrentService(session.nav, self)
		
		# Events
		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
			{
		# Disabled for tests
		# If we enable them, the sound will be delayed for about 2 seconds ?
				iPlayableService.evStart: self.__serviceStarted,
				iPlayableService.evStopped: self.__serviceStopped,
				#iPlayableService.evEnd: self.__evEnd,
				#iPlayableService.evEOF: self.__evEOF,
				#iPlayableService.evUser: self.__timeUpdated,
				#iPlayableService.evUser+1: self.__statePlay,
				#iPlayableService.evUser+2: self.__statePause,
				iPlayableService.evUser+3: self.__osdFFwdInfoAvail,
				iPlayableService.evUser+4: self.__osdFBwdInfoAvail,
				#iPlayableService.evUser+5: self.__osdStringAvail,
				iPlayableService.evUser+6: self.__osdAudioInfoAvail,
				iPlayableService.evUser+7: self.__osdSubtitleInfoAvail,
				iPlayableService.evUser+8: self.__chapterUpdated,
				iPlayableService.evUser+9: self.__titleUpdated,
				iPlayableService.evUser+11: self.__menuOpened,
				iPlayableService.evUser+12: self.__menuClosed,
				iPlayableService.evUser+13: self.__osdAngleInfoAvail
			})
			
			# Keymap
	#		self["SeekActions"] = HelpableActionMap(self, "InfobarSeekActions", 							-1 higher priority
	#		self["MovieListActions"] = HelpableActionMap(self, "InfobarMovieListActions", 		0
	#		self["ShowHideActions"] = ActionMap( ["InfobarShowHideActions"] ,  								0
	#		self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions",									0
	#		self["CueSheetActions"] = HelpableActionMap(self, actionmap,											1 lower priority
	#		self["InstantExtensionsActions"] = HelpableActionMap(self, "InfobarExtensions", 	1 lower priority
	#		self["NumberActions"] = NumberActionMap( [ "NumberActions"],											0 Set by EMC to 2 very lower priority 
	#		self["TeletextActions"] = HelpableActionMap(self, "InfobarTeletextActions",				0 Set by EMC to 2 very lower priority 
	#		self["MenuActions"] = HelpableActionMap(self, "InfobarMenuActions",  							0 Set by EMC to 2 very lower priority 
		if config.EMC.movie_exit.value:
			self["actions"] = HelpableActionMap(self, "CoolPlayerActions",
				{
					"leavePlayer":	(self.leavePlayer, 		_("Stop playback")),
				}) # default priority
		else:
			self["actions"] = HelpableActionMap(self, "CoolPlayerActions2",
				{
					"leavePlayer":	(self.leavePlayer, 		_("Stop playback")),
				}) # default priority
		
		self["DVDPlayerPlaybackActions"] = HelpableActionMap(self, "EMCDVDPlayerActions",
			{
				"dvdMenu": (self.enterDVDMenu, _("show DVD main menu")),
				#"showInfo": (self.showInfo, _("toggle time, chapter, audio, subtitle info")),
				"nextChapter": (self.nextChapter, _("forward to the next chapter")),
				"prevChapter": (self.prevChapter, _("rewind to the previous chapter")),
				"nextTitle": (self.nextTitle, _("jump forward to the next title")),
				"prevTitle": (self.prevTitle, _("jump back to the previous title")),
				"dvdAudioMenu": (self.enterDVDAudioMenu, _("(show optional DVD audio menu)")),
				"nextAudioTrack": (self.nextAudioTrack, _("switch to the next audio track")),
				"nextSubtitleTrack": (self.nextSubtitleTrack, _("switch to the next subtitle language")),
				"nextAngle": (self.nextAngle, _("switch to the next angle")),
			}, 1) # lower priority
		# Only enabled if playing a dvd
		self["DVDPlayerPlaybackActions"].setEnabled(False)
		
		self["DVDMenuActions"] = ActionMap(["WizardActions"],
			{
				"left": self.keyLeft,
				"right": self.keyRight,
				"up": self.keyUp,
				"down": self.keyDown,
				"ok": self.keyOk,
				"back": self.keyBack,
			}, 2) # lower priority
		# Only enabled during DVD Menu
		self["DVDMenuActions"].setEnabled(False)
		
		self["GeneralPlayerPlaybackActions"] = HelpableActionMap(self, "EMCGeneralPlayerActions",
			{
				"showExtensions": (self.openExtensions, _("view extensions...")),
				"EMCGreen":	(self.CoolAVSwitch,			_("Format AVSwitch")),
				"seekFwd": (self.seekFwd, _("Seek forward")),
				"seekBack": (self.seekBack, _("Seek backward")),
				"movieInfo": (self.infoMovie, _("Movie information")),
			}, 2) # lower priority
		
		self["MenuActions"].prio = 2
		if "TeletextActions" in self:
			self["TeletextActions"].prio = 2
		self["NumberActions"].prio = 2
		
		# Cover Anzeige
		self["Cover"] = Pixmap()
		
		# DVD Player
		self["audioLabel"] = Label("")
		self["subtitleLabel"] = Label("")
		self["angleLabel"] = Label("")
		self["chapterLabel"] = Label("")
		self["anglePix"] = Pixmap()
		self["anglePix"].hide()
		self.last_audioTuple = None
		self.last_subtitleTuple = None
		self.last_angleTuple = None
		self.totalChapters = 0
		self.currentChapter = 0
		self.totalTitles = 0
		self.currentTitle = 0
		self.in_menu = None
		self.dvdScreen = None
		
		# Further initialization
		self.firstStart = True
		self.stopped = False
		self.closedByDelete = False
		self.closeAll = False
		
		self.lastservice = lastservice or self.session.nav.getCurrentlyPlayingServiceReference()
		self.playlist = playlist
		self.playall = playall
		self.playcount = -1
		self.service = None
		
		self.picload = ePicLoad()
		self.picload.PictureData.get().append(self.showCoverCallback)
		
		# Record events
		try:
			NavigationInstance.instance.RecordTimer.on_state_change.append(self.recEvent)
		except Exception, e:
			emcDebugOut("[EMCMediaCenter] Record observer add exception:\n" + str(e))
コード例 #35
0
	def __init__(self, session, menumode, mselection, mlist, service, selections, currentPath):
		Screen.__init__(self, session)
		self.mode = menumode
		self.mselection = mselection
		self.mlist = mlist
		self.service = service
		self.selections = selections
		self.currentPath = currentPath
		self.reloadafterclose = False
		
		self.menu = []
		if menumode == "normal":
			self["title"] = StaticText(_("Choose operation"))
			
			if os.path.realpath(self.currentPath) != os.path.realpath(config.EMC.movie_homepath.value):
				self.menu.append((_("Movie home"), boundFunction(self.close, "Movie home")))
			
			if currentPath == config.EMC.movie_pathlimit.value:
				self.menu.append((_("Directory up"), boundFunction(self.close, "dirup")))
			
			self.menu.append((_("Reload current directory"), boundFunction(self.close, "reloadwithoutcache")))
			
			self.menu.append((_("Play last"), boundFunction(self.close, "Play last")))
			
			self.menu.append((_("Play All"), boundFunction(self.close, "playall")))
			self.menu.append((_("Shuffle All"), boundFunction(self.close, "shuffleall")))
			
			self.menu.append((_("Cover search"), boundFunction(self.close, "imdb")))
			self.menu.append((_("Delete"), boundFunction(self.close, "del")))
			
			if config.EMC.movie_trashcan_enable.value and os.path.exists(config.EMC.movie_trashcan_path.value):
				if service:
					self.menu.append((_("Delete permanently"), boundFunction(self.close, "delete")))
				self.menu.append((_("Empty trashcan"), boundFunction(self.emptyTrash)))
				self.menu.append((_("Go to trashcan"), boundFunction(self.close, "trash")))
			
			self.menu.append((_("Mark all movies"), boundFunction(self.close, "markall")))
			self.menu.append((_("Remove rogue files"), boundFunction(self.remRogueFiles)))
			
			self.menu.append((_("Delete cut file"), boundFunction(self.deleteCutFileQ)))
			
			self.menu.append((_("Create link"), boundFunction(self.createLink, currentPath)))
			self.menu.append((_("Create directory"), boundFunction(self.createDir, currentPath)))
			
			self.menu.append((_("(Un-)Lock Directory"), boundFunction(self.lockDir, currentPath)))
			
			if service:
				if os.path.isfile(service.getPath()):
					self.menu.append((_("Copy Movie"), boundFunction(self.close, "Copy Movie")))
					self.menu.append((_("Move Movie"), boundFunction(self.close, "Move Movie")))
					#self.menu.append((_("Download Movie Information"), boundFunction(self.close, "Movie Information")))
				if service.getPath() != config.EMC.movie_trashcan_path.value:
					if not service.getPath().endswith("/..") and not service.getPath().endswith("/Latest Recordings"):
						self.menu.append((_("Download Movie Information"), boundFunction(self.close, "Movie Information")))
						#self.menu.append((_("Download Movie Cover"), boundFunction(self.close, "dlcover")))
			
			if self.service or self.selections:
				self.menu.append((_("Rename selected movie(s)"), boundFunction(self.renameMovies)))
				self.menu.append((_("Remove cut list marker"), boundFunction(self.remCutListMarker)))
				show_plugins = True
				if self.selections:
					for service in self.selections:
						ext = os.path.splitext(service.getPath())[1].lower()
						if ext not in extTS:
							show_plugins = False
							break
				else:
					ext = os.path.splitext(self.service.getPath())[1].lower()
					if ext not in extTS:
						show_plugins = False
				if show_plugins:
					# Only valid for ts files: CutListEditor, DVDBurn, ...
					self.menu.extend([(p.description, boundFunction(self.execPlugin, p)) for p in plugins.getPlugins(PluginDescriptor.WHERE_MOVIELIST)])
			
			self.menu.append((_("Open E2 Bookmark path"), boundFunction(self.close, "openE2Bookmarks")))
			if not self.isE2Bookmark(currentPath):
				self.menu.append((_("Add directory to E2 Bookmarks"), boundFunction(self.addDirToE2Bookmarks, currentPath)))
			else:
				self.menu.append((_("Remove directory from E2 Bookmarks"), boundFunction(self.removeDirFromE2Bookmarks, currentPath)))
			if service and self.isE2Bookmark(service.getPath()):
				self.menu.append((_("Remove selected E2 Bookmark"), boundFunction(self.close, "removeE2Bookmark", service)))
			
			self.menu.append((_("Open EMC Bookmark path"), boundFunction(self.close, "openEMCBookmarks")))
			if not self.isEMCBookmark(currentPath):
				self.menu.append((_("Add directory to EMC Bookmarks"), boundFunction(self.addDirToEMCBookmarks, currentPath)))
			else:
				self.menu.append((_("Remove directory from EMC Bookmarks"), boundFunction(self.removeDirFromEMCBookmarks, currentPath)))
			if service and self.isEMCBookmark(service.getPath()):
				self.menu.append((_("Remove selected EMC Bookmark"), boundFunction(self.close, "removeEMCBookmark", service)))
			
			self.menu.append((_("Set permanent sort"), boundFunction(self.setPermanentSort, currentPath, mlist.actualSort)))
			if mlist.hasFolderPermanentSort(currentPath):
				self.menu.append((_("Remove permanent sort"), boundFunction(self.removePermanentSort, currentPath)))
			else:
				path = mlist.hasParentPermanentSort(currentPath)
				if path:
					self.menu.append((_("Remove permanent sort from parent"), boundFunction(self.removePermanentSort, path)))
			
			#self.menu.append((_("Open shell script menu"), boundFunction(self.close, "oscripts")))
			self.menu.append((_("EMC Setup"), boundFunction(self.execPlugin, emcsetup)))
			
		elif menumode == "plugins":
			self["title"] = StaticText(_("Choose plugin"))
			if self.service is not None:
				for p in plugins.getPlugins(PluginDescriptor.WHERE_MOVIELIST):
					self.menu.append((p.description, boundFunction(self.execPlugin, p)))
					
		elif menumode == "emcBookmarks":
			self["title"] = StaticText(_("Choose bookmark"))
			bm = self.getEMCBookmarks()
			if bm:
				for line in bm:
					self.menu.append((line, boundFunction(self.close, line)))

		self["menu"] = List(self.menu)
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
			{
				"ok":       self.okButton,
				"cancel":   self.close,
				"red":      self.redButton,
			})
		self.skinName = "Menu"
		self.onShow.append(self.onDialogShow)
コード例 #36
0
	def createDir(self, currentPath):
		self.session.openWithCallback(
				boundFunction(self.createDirCB, currentPath),
				InputBox,
				title=_("Enter name for new directory:"),
				windowTitle=_("Create directory") )
コード例 #37
0
	def evEOF(self, needToClose=False):
		# see if there are more to play
		print "EMC PLAYER evEOF", self.playall, self.playcount, self.playlist
		if self.playall:
			# Play All
			try:
				self.playcount = -1
				self.playlist = [ self.playall.next() ]
			except StopIteration:
				self.playall = None
				self.playlist = []
			
		if (self.playcount + 1) < len(self.playlist):
			self.playcount += 1
			service = self.playlist[self.playcount]
			#TODO Problem with VLC
			path = service and service.getPath()
			if os.path.exists(path): #TODO use ext != vlc but must be prepared first
				# Why should the file be removed? Maybe that's the problem with "no Cutlist while recording"
				#cutspath = path + ".cuts"
				#if os.path.exists(cutspath):
					# prepare cut list
					#try:
					#	# Workaround for not working E2 cue.setCutListEnable not working :-(
					#	# We always have to set this permission, we can not detect all stop preview events
					#	os.chmod(cutspath, 755)
					#	print "EMC set chmod read and write"
					#except:
					#	pass
					# Workaround for E2 dvb player bug in combination with running recordings and existings cutlists
					#record = getRecording(path)
					#if record:
						#try:
							# os.remove(cutspath)
						#except:
						#	pass
				# Further cutlist handling
				toggleProgressService(service, True)
				self.service = service
				
				if service and service.type == sidDVD:
					# Only import DVDPlayer, if we want to play a DVDPlayer format
					if fileExists("%so"%dvdPlayerPlg) or fileExists("%sc"%dvdPlayerPlg):
						try:
							from Plugins.Extensions.DVDPlayer import servicedvd # load c++ part of dvd player plugin
						except:
							pass
						from Plugins.Extensions.DVDPlayer.plugin import DVDOverlay
						if not self.dvdScreen:
							self.dvdScreen = self.session.instantiateDialog(DVDOverlay)
					else:
						self.session.open(MessageBox, _("No DVD-Player found!"), MessageBox.TYPE_ERROR, 10)
						self.leavePlayer(True)
						return
					self["TeletextActions"].setEnabled(False)
					self["DVDPlayerPlaybackActions"].setEnabled(True)
				else:
					if self.dvdScreen:
						self.dvdScreen.close()
						self.dvdScreen = None
					else:
						self.dvdScreen = None
					self["TeletextActions"].setEnabled(True)
					self["DVDPlayerPlaybackActions"].setEnabled(False)
				
				# Check if the video preview is active and already running
		#				if config.EMC.movie_preview.value:
		#					ref = self.session.nav.getCurrentlyPlayingServiceReference()
		#					if ref and service and ref.getPath() == service.getPath():
		#						#s = self.session.nav.getCurrentService()
		#						#cue = s and s.cueSheet()
		#						#if cue is not None:
		#							#cue.setCutListEnable(1)
		#						self.downloadCuesheet()
		#							#print "EMC cue.setCutListEnable(1)"
		#						#return
				
				# Is this really necessary 
				# TEST for M2TS Audio problem
				#self.session.nav.stopService() 
				
				# Start playing movie
				self.session.nav.playService(service)
				
				if service and service.type == sidDVD:
					# Seek will cause problems with DVDPlayer!
					# ServiceDVD needs this to start
					subs = self.getServiceInterface("subtitle")
					if subs and self.dvdScreen:
						subs.enableSubtitles(self.dvdScreen.instance, None)
				else:
					# TEST for M2TS Audio problem
					#self.setSeekState(InfoBarSeek.SEEK_STATE_PLAY)
					#TODO Do we need this
					#self.doSeek(0)
					#TODO AutoSelect subtitle for DVD Player is not implemented yet
					DelayedFunction(200, self.setAudioTrack)
					DelayedFunction(400, self.setSubtitleState, True)
			else:
				self.session.open(MessageBox, _("Skipping movie, the file does not exist.\n\n") + service.getPath(), MessageBox.TYPE_ERROR, 10)
				self.evEOF(needToClose)
				
		else:
			if needToClose or config.usage.on_movie_eof.value != "pause":
				self.closedByDelete = needToClose
				self.leavePlayer(False)
コード例 #38
0
	def createDir(self, currentPath):
		self.session.openWithCallback(
				boundFunction(self.createDirCB, currentPath),
				InputBox,
				title=_("Enter name for new directory:"),
				windowTitle=_("Create directory") )
コード例 #39
0
	def __init__(self, session, menumode, mselection, mlist, service, selections, currentPath, playlist=False):
		Screen.__init__(self, session)
		self.mode = menumode
		self.mselection = mselection
		self.mlist = mlist
		self.service = service
		self.selections = selections
		self.currentPath = currentPath
		self.plist = playlist
		self.reloadafterclose = False

		self.menu = []
		if menumode == "normal":
			self["title"] = StaticText(_("Choose operation"))

			if os.path.realpath(self.currentPath) != os.path.realpath(config.EMC.movie_homepath.value):
				self.menu.append((_("Movie home"), boundFunction(self.close, "Movie home")))

			if currentPath == config.EMC.movie_pathlimit.value:
				self.menu.append((_("Directory up"), boundFunction(self.close, "dirup")))

			self.menu.append((_("Reload current directory"), boundFunction(self.close, "reloadwithoutcache")))

			self.menu.append((_("Playlist Options"), boundFunction(self.close, "emcPlaylist")))
			if service is not None:
				ext = os.path.splitext(service.getPath())[1].lower()
				if ext in extMedia:
					self.menu.append((_("Add to current Playlist"), boundFunction(self.close, "addPlaylist")))

			self.menu.append((_("Play last"), boundFunction(self.close, "Play last")))

			self.menu.append((_("Play All"), boundFunction(self.close, "playall")))
			self.menu.append((_("Shuffle All"), boundFunction(self.close, "shuffleall")))

			self.menu.append((_("Cover search"), boundFunction(self.close, "imdb")))
			if service is not None:
				if os.path.isdir(service.getPath()):
					self.menu.append((_("Directory-Cover search"), boundFunction(self.close, "imdbdirectory")))
			self.menu.append((_("Delete"), boundFunction(self.close, "del")))

			if config.EMC.movie_trashcan_enable.value and os.path.exists(config.EMC.movie_trashcan_path.value):
				if service is not None:
					self.menu.append((_("Delete permanently"), boundFunction(self.close, "delete")))
				self.menu.append((_("Empty trashcan"), boundFunction(self.emptyTrash)))
				self.menu.append((_("Go to trashcan"), boundFunction(self.close, "trash")))

			self.menu.append((_("Mark all movies"), boundFunction(self.close, "markall")))
			self.menu.append((_("Remove rogue files"), boundFunction(self.remRogueFiles)))

			self.menu.append((_("Delete cut file(s)"), boundFunction(self.deleteCutFileQ)))

			self.menu.append((_("Create link"), boundFunction(self.createLink, currentPath)))
			self.menu.append((_("Create directory"), boundFunction(self.createDir, currentPath)))

			self.menu.append((_("(Un-)Lock Directory"), boundFunction(self.lockDir, currentPath)))

			if service is not None:
				if os.path.isfile(service.getPath()):
					self.menu.append((_("Copy Movie"), boundFunction(self.close, "Copy Movie")))
					self.menu.append((_("Move Movie"), boundFunction(self.close, "Move Movie")))
					#self.menu.append((_("Download Movie Information"), boundFunction(self.close, "Movie Information")))
				if service.getPath() != config.EMC.movie_trashcan_path.value:
					if not service.getPath().endswith("/..") and not service.getPath().endswith("/Latest Recordings"):
						self.menu.append((_("Download Movie Information"), boundFunction(self.close, "Movie Information")))
						#self.menu.append((_("Download Movie Cover"), boundFunction(self.close, "dlcover")))

			if self.service is not None or self.selections:
				self.menu.append((_("Rename selected movie(s)"), boundFunction(self.renameMovies)))
				self.menu.append((_("Remove cut list marker"), boundFunction(self.remCutListMarker)))
				self.menu.append((_("Reset marker from selected movie(s)"), boundFunction(self.resMarker)))
				show_plugins = True
				if self.selections:
					for service in self.selections:
						ext = os.path.splitext(service.getPath())[1].lower()
						if ext not in extTS:
							show_plugins = False
							break
				else:
					ext = os.path.splitext(self.service.getPath())[1].lower()
					if ext not in extTS:
						show_plugins = False
				if show_plugins:
					# Only valid for ts files: CutListEditor, DVDBurn, ...
					self.menu.extend([(p.description, boundFunction(self.execPlugin, p)) for p in plugins.getPlugins(PluginDescriptor.WHERE_MOVIELIST)])

			self.menu.append((_("Open E2 Bookmark path"), boundFunction(self.close, "openE2Bookmarks")))
			if not self.isE2Bookmark(currentPath):
				self.menu.append((_("Add directory to E2 Bookmarks"), boundFunction(self.addDirToE2Bookmarks, currentPath)))
			else:
				self.menu.append((_("Remove directory from E2 Bookmarks"), boundFunction(self.removeDirFromE2Bookmarks, currentPath)))
			if service is not None:
				if self.isE2Bookmark(service.getPath()):
					self.menu.append((_("Remove selected E2 Bookmark"), boundFunction(self.close, "removeE2Bookmark", service)))

			self.menu.append((_("Open EMC Bookmark path"), boundFunction(self.close, "openEMCBookmarks")))
			if not self.isEMCBookmark(currentPath):
				self.menu.append((_("Add directory to EMC Bookmarks"), boundFunction(self.addDirToEMCBookmarks, currentPath)))
			else:
				self.menu.append((_("Remove directory from EMC Bookmarks"), boundFunction(self.removeDirFromEMCBookmarks, currentPath)))
			if service is not None:
				if self.isEMCBookmark(service.getPath()):
					self.menu.append((_("Remove selected EMC Bookmark"), boundFunction(self.close, "removeEMCBookmark", service)))

			self.menu.append((_("Set permanent sort"), boundFunction(self.setPermanentSort, currentPath, mlist.actualSort)))
			if mlist.hasFolderPermanentSort(currentPath):
				self.menu.append((_("Remove permanent sort"), boundFunction(self.removePermanentSort, currentPath)))
			else:
				path = mlist.hasParentPermanentSort(currentPath)
				if path:
					self.menu.append((_("Remove permanent sort from parent"), boundFunction(self.removePermanentSort, path)))

			#self.menu.append((_("Open shell script menu"), boundFunction(self.close, "oscripts")))
			self.menu.append((_("EMC Setup"), boundFunction(self.execPlugin, emcsetup)))

		elif menumode == "plugins":
			self["title"] = StaticText(_("Choose plugin"))
			if self.service is not None:
				for p in plugins.getPlugins(PluginDescriptor.WHERE_MOVIELIST):
					self.menu.append((p.description, boundFunction(self.execPlugin, p)))

		elif menumode == "emcBookmarks":
			self["title"] = StaticText(_("Choose bookmark"))
			bm = self.getEMCBookmarks()
			if bm:
				for line in bm:
					self.menu.append((line, boundFunction(self.close, line)))

		elif menumode == "emcPlaylist":
			self["title"] = StaticText(_("Playlist Options"))
			self.menu.append((_("Show current Playlist"), boundFunction(self.close, "showPlaylist")))
			if service is not None:
				ext = os.path.splitext(service.getPath())[1].lower()
				if ext in extMedia:
					self.menu.append((_("Add to current Playlist"), boundFunction(self.close, "addPlaylist")))
			if self.plist:
				self.menu.append((_("Play current Playlist"), boundFunction(self.close, "playPlaylist")))
				self.menu.append((_("Play random current Playlist"), boundFunction(self.close, "playPlaylistRandom")))
				self.menu.append((_("Delete current Playlist"), boundFunction(self.close, "delPlaylist")))

		self["menu"] = List(self.menu)
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
			{
				"ok":       self.okButton,
				"cancel":   self.close,
				"red":      self.redButton,
			})
		self.onShow.append(self.onDialogShow)
コード例 #40
0
	def onDialogShow(self):
		self.setTitle(_("Movie Selection Menu"))