示例#1
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")
	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 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")
	def addDirToEMCBookmarks(self, path):
		if path and self.addEMCBookmark( path ) \
			and (config.EMC.bookmarks.value == "Both" or config.EMC.bookmarks.value == "EMC") \
			and path == config.EMC.movie_homepath.value:
			#TODO Avoid reload
			# If the custom entry has sortingkeys, maybe an addService will do it
			movieFileCache.delPathFromCache(path)
			self.close("reload")
		else:
			self.close(None)
	def removeDirFromEMCBookmarksConfirmed(self, path, confirm):
		if confirm \
			and path and self.removeEMCBookmark(path) \
			and (config.EMC.bookmarks.value == "Both" or config.EMC.bookmarks.value == "EMC") \
			and path == config.EMC.movie_homepath.value:
			#TODO Avoid reload
			# Just a remove service will do the job
			movieFileCache.delPathFromCache(path)
			self.close("reload")
		else:
			self.close(None)
	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")
	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)
	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"')
	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")