コード例 #1
0
	def remRogueFilesCB(self, confirmed):
		if confirmed:
			check = RogueFileCheck(self.currentPath)
			path = config.EMC.movie_trashcan_enable.value and config.EMC.movie_trashcan_path.value
			emcTasker.shellExecute( check.getScript(path) )
			self.session.open(MessageBox, check.getStatistics(), MessageBox.TYPE_INFO)
		self.close(None)
コード例 #2
0
 def deleteCutFile(self, confirm):
     if confirm:
         file = self.service.getPath() + ".cuts"
         emcTasker.shellExecute('rm -f "' + file + '"')
         movieFileCache.delPathFromCache(
             os.path.dirname(self.service.getPath()))
     self.close("reload")
コード例 #3
0
 def wakeHDD(self, path, postWakeCommand):
     association = []
     association.append((postWakeCommand, path))
     #wake the device a path is residing on by reading a random sector
     emcTasker.shellExecute(
         "dd if=`df " + path +
         " | awk 'NR == 2 {print $1}'` bs=4096 count=1 of=/dev/null skip=$[($[RANDOM] + 32768*$[RANDOM]) % 1048576];echo 'wakeDevice finished'",
         association, False)
コード例 #4
0
	def remRogueFilesCB(self, confirmed):
		if confirmed:
			movieFileCache.delPathFromCache(self.currentPath)
			check = RogueFileCheck(self.currentPath)
			path = config.EMC.movie_trashcan_enable.value and config.EMC.movie_trashcan_path.value
			emcTasker.shellExecute( check.getScript(path) )
			self.session.open(MessageBox, check.getStatistics(), MessageBox.TYPE_INFO)
		self.close(None)
	def remoteInit(self, ip):
		try:
			if not os.path.exists(config.EMC.folder.value):
				emcTasker.shellExecute("mkdir " + config.EMC.folder.value)
			if ip is not None:
				rec = "/db_%s.rec" %str(ip).replace(", ", ".")[1:-1]
				self.recFile = os.path.join(config.EMC.folder.value, rec)
		except Exception, e:
			emcDebugOut("[emcRC] remoteInit exception:\n" + str(e))
 def remoteInit(self, ip):
     try:
         if not os.path.exists(config.EMC.folder.value):
             emcTasker.shellExecute("mkdir " + config.EMC.folder.value)
         if ip is not None:
             rec = "/db_%s.rec" % str(ip).replace(", ", ".")[1:-1]
             self.recFile = os.path.join(config.EMC.folder.value, rec)
     except Exception, e:
         emcDebugOut("[emcRC] remoteInit exception:\n" + str(e))
コード例 #7
0
	def deleteCutFile(self, confirm):
		if confirm:
			if os.path.isdir(self.service.getPath()):
				emcTasker.shellExecute('find ' + '"' + self.service.getPath() + '" -name "*.cuts" -exec rm -f \'{}\' +')
			else:
				file = self.service.getPath() + ".cuts"
				emcTasker.shellExecute('rm -f "' + file + '"')
				movieFileCache.delPathFromCache(os.path.dirname(self.service.getPath()))
		self.close("reload")
コード例 #8
0
    def recEvent(self, timer):
        # StateWaiting=0, StatePrepared=1, StateRunning=2, StateEnded=3
        try:
            if timer.justplay: return
            inform = False
            try:
                timer.Filename
            except:
                timer.calculateFilename()

            filename = os.path.basename(timer.Filename)
            if timer.state == timer.StatePrepared: pass
            elif timer.state == timer.StateRunning:  # timer.isRunning()
                if config.EMC.files_cache.value:
                    cutfilename = "/" + filename
                    realpath = timer.Filename.replace(cutfilename, '')
                    ext = ".ts"
                    recname = timer.Filename + ext, filename + ext, ext
                    from EMCFileCache import movieFileCache
                    if movieFileCache.IsPathInCache(realpath):
                        movieFileCache.addRecToCacheFileList(realpath, recname)
                if not filename in self.recDict:
                    begin = timer.begin
                    if timer.autoincrease:
                        end = begin
                    else:
                        end = timer.end
                    self.recDict[filename] = (begin,
                                              end, timer.service_ref.ref,
                                              str(timer))
                    inform = True
                    emcDebugOut("[emcRC] REC START for: " + filename)
            else:  #timer.state == timer.StateEnded:
                if filename in self.recDict:
                    del self.recDict[filename]
                    inform = True
                    emcDebugOut("[emcRC] REC END for: " + filename)
                    try:
                        if hasattr(timer, "fixMoveCmd"):
                            emcTasker.shellExecute(timer.fixMoveCmd)
                            emcDebugOut(
                                "[emcRC] File had been moved while recording was in progress, moving left over files.."
                            )
                    except:
                        pass
                if config.EMC.timer_autocln.value:
                    DelayedFunction(
                        2000, self.timerCleanup
                    )  # postpone to avoid crash in basic timer delete by user
            if inform:
                if config.EMC.remote_recordings.value:
                    self.recFileUpdate()
                self.recStateChange(timer)
        except Exception, e:
            emcDebugOut("[emcRC] recEvent exception:\n" + str(e))
コード例 #9
0
	def createLinkCB(self, currentPath, linkPath):
		if currentPath == linkPath or linkPath == None:
			self.close(None)
		else:
			try:
				name = os.path.basename(linkPath)
				cmd = 'ln -s "'+ linkPath +'" "'+ os.path.join(currentPath, name) +'"'
				if cmd != "":
					association = []
					association.append((self.mselection.reloadList))	# Force list reload after creating the link
					emcTasker.shellExecute(cmd, association)
			except Exception, e:
				emcDebugOut("[EMCMM] createLink exception:\n" + str(e))
			self.close(None)
コード例 #10
0
	def createLinkCB(self, currentPath, linkPath):
		if currentPath == linkPath or linkPath == None:
			self.close(None)
		else:
			try:
				movieFileCache.delPathFromCache(currentPath)
				movieFileCache.delPathFromCache(linkPath)
				name = os.path.basename(linkPath)
				cmd = 'ln -s "'+ linkPath +'" "'+ os.path.join(currentPath, name) +'"'
				if cmd != "":
					association = []
					association.append((self.mselection.reloadList))	# Force list reload after creating the link
					emcTasker.shellExecute(cmd, association)
			except Exception, e:
				emcDebugOut("[EMCMM] createLink exception:\n" + str(e))
			self.close(None)
コード例 #11
0
	def recEvent(self, timer):
		# StateWaiting=0, StatePrepared=1, StateRunning=2, StateEnded=3
		try:
			if timer.justplay: return
			inform = False
			try: timer.Filename
			except: timer.calculateFilename()

			filename = os.path.basename(timer.Filename)
			if timer.state == timer.StatePrepared:	pass
			elif timer.state == timer.StateRunning:	# timer.isRunning()
				if config.EMC.files_cache.value:
					cutfilename = "/" + filename
					realpath = timer.Filename.replace(cutfilename, '')
					ext = ".ts"
					recname = timer.Filename + ext, filename + ext, ext
					from EMCFileCache import movieFileCache
					if movieFileCache.IsPathInCache(realpath):
						movieFileCache.addRecToCacheFileList(realpath, recname)
				if not filename in self.recDict:
					begin = timer.begin
					if timer.autoincrease:
						end = begin
					else:
						end = timer.end
					self.recDict[filename] = (begin, end, timer.service_ref.ref, str(timer))
					inform = True
					emcDebugOut("[emcRC] REC START for: " + filename)
			else: #timer.state == timer.StateEnded:
				if filename in self.recDict:
					del self.recDict[filename]
					inform = True
					emcDebugOut("[emcRC] REC END for: " + filename)
					try:
						if hasattr(timer, "fixMoveCmd"):
							emcTasker.shellExecute(timer.fixMoveCmd)
							emcDebugOut("[emcRC] File had been moved while recording was in progress, moving left over files..")
					except: pass
				if config.EMC.timer_autocln.value:
					DelayedFunction(2000, self.timerCleanup)	# postpone to avoid crash in basic timer delete by user
			if inform:
				if config.EMC.remote_recordings.value:
					self.recFileUpdate()
				self.recStateChange(timer)
		except Exception, e:
			emcDebugOut("[emcRC] recEvent exception:\n" + str(e))
def EMCStartup(session):
	emcDebugOut("+++ EMC "+EMCVersion+" startup")
	
	if config.EMC.epglang.value:
		eServiceEvent.setEPGLanguage(config.EMC.epglang.value)
	
	setupKeyResponseValues()
	DelayedFunction(5000, cleanupSetup)

	# Go into standby if the reason for restart was EMC auto-restart
	if config.EMC.restart.value != "":
		if not os.path.exists(config.EMC.folder.value):
			emcTasker.shellExecute("mkdir " + config.EMC.folder.value)
		flag = os.path.join(config.EMC.folder.value, "EMC_standby_flag.tmp")
		if os.path.exists(flag):
			emcDebugOut("+++ Going into Standby mode after auto-restart")
			Notifications.AddNotification(Screens.Standby.Standby)
			emcTasker.shellExecute("rm -f " + flag)
def EMCStartup(session):
	emcDebugOut("+++ EMC "+EMCVersion+" startup")
	
	if config.EMC.epglang.value:
		eServiceEvent.setEPGLanguage(config.EMC.epglang.value)
	
	setupKeyResponseValues()
	DelayedFunction(5000, cleanupSetup)

	# Go into standby if the reason for restart was EMC auto-restart
	if config.EMC.restart.value != "":
		if not os.path.exists(config.EMC.folder.value):
			emcTasker.shellExecute("mkdir " + config.EMC.folder.value)
		flag = os.path.join(config.EMC.folder.value, "EMC_standby_flag.tmp")
		if os.path.exists(flag):
			emcDebugOut("+++ Going into Standby mode after auto-restart")
			Notifications.AddNotification(Screens.Standby.Standby)
			emcTasker.shellExecute("rm -f " + flag)
コード例 #14
0
	def lockDirConfirmed(self, currentPath, locked, confirmed):
		if not locked:
			if confirmed:
				emcTasker.shellExecute('touch "' + currentPath + '/dir.lock"')
				for root, dirs, files in os.walk(currentPath):
					for dir in dirs:
						emcTasker.shellExecute('touch "' + root + '/' + dir +  '/dir.lock"')
		else:
			if confirmed:
				emcTasker.shellExecute('rm -f "' + currentPath + '/dir.lock"')
				for root, dirs, files in os.walk(currentPath):
					for dir in dirs:
						emcTasker.shellExecute('rm -rf "' + root + '/' + dir +  '/dir.lock"')
コード例 #15
0
	def lockDirConfirmed(self, currentPath, locked, confirmed):
		if not locked:
			if confirmed:
				emcTasker.shellExecute('touch "' + currentPath + '/dir.lock"')
				movieFileCache.delPathFromCache(currentPath)
				for root, dirs, files in os.walk(currentPath):
					for dir in dirs:
						movieFileCache.delPathFromCache(root + '/' + dir)
						emcTasker.shellExecute('touch "' + root + '/' + dir +  '/dir.lock"')
		else:
			if confirmed:
				emcTasker.shellExecute('rm -f "' + currentPath + '/dir.lock"')
				movieFileCache.delPathFromCache(currentPath)
				for root, dirs, files in os.walk(currentPath):
					for dir in dirs:
						movieFileCache.delPathFromCache(root + '/' + dir)
						emcTasker.shellExecute('rm -rf "' + root + '/' + dir +  '/dir.lock"')
コード例 #16
0
	def deleteCutFile(self, confirm):
		if confirm:
			file = self.service.getPath() + ".cuts"
			emcTasker.shellExecute('rm -f "' + file + '"')		
		self.close("reload")
コード例 #17
0
	def deleteCutFile(self, confirm):
		if confirm:
			file = self.service.getPath() + ".cuts"
			emcTasker.shellExecute('rm -f "' + file + '"')		
			movieFileCache.delPathFromCache(os.path.dirname(self.service.getPath()))
		self.close("reload")
コード例 #18
0
	def wakeHDD(self, path, postWakeCommand):
		association = []
		association.append((postWakeCommand,path))
		#wake the device a path is residing on by reading a random sector
		emcTasker.shellExecute("dd if=`df " + path + " | awk 'NR == 2 {print $1}'` bs=4096 count=1 of=/dev/null skip=$[($[RANDOM] + 32768*$[RANDOM]) % 1048576];echo 'wakeDevice finished'", association, False)
	def dbgChange(self, element):
		if element.value == True:
			pass
		else:
			emcTasker.shellExecute("rm -f " + os.path.join(config.EMC.folder.value, config.EMC.debugfile.value))
	def dbgChange(self, element):
		if element.value == True:
			pass
		else:
			emcTasker.shellExecute("rm -f " + os.path.join(config.EMC.folder.value, config.EMC.debugfile.value))