コード例 #1
0
ファイル: gz.py プロジェクト: technic/enigma2-atv
 def unpackModus(self, id):
     print("[GunzipMenuScreen] unpackModus", id)
     pathName = self.sourceDir + self.filename
     if id == 1:
         cmd = ("gunzip", pathName)
     elif id in (2, 3):
         baseName, ext = splitext(self.filename)
         if ext != ".gz":
             return
         if id == 2:
             dest = self.targetDir
         elif id == 3:
             dest = config.usage.default_path.value
         dest += baseName
         cmd = "gunzip -c %s > %s && rm %s" % (
             shellquote(pathName), shellquote(dest), shellquote(pathName))
     self.unpackEConsoleApp(cmd)
コード例 #2
0
ファイル: FileTransfer.py プロジェクト: openhdf/enigma2
	def __init__(self, job, src_file, dst_file, src_isDir, do_copy):
		Task.__init__(self, job, "")
		nice = "ionice -c 3"
		self.src_isDir = src_isDir
		self.src_file = src_file
		self.dst_isDir = False
		self.dst_file = dst_file + "/" + os.path.basename(src_file)
		src_file_append = ""
		if not src_isDir:
			root, ext = os.path.splitext(src_file)
			if ext in ALL_MOVIE_EXTENSIONS:
				src_file = root
				src_file_append = ".*"
		cmd = "mv"
		if do_copy:
			cmd = "cp -pr"
		cmdline = '%s %s %s%s %s' % (nice, cmd, shellquote(src_file), src_file_append, shellquote(dst_file))
		if self.dst_file.endswith("/"):
			self.dst_isDir = True
		self.setCmdline(cmdline)
		self.end = 100
		self.progressTimer = eTimer()
		self.progressTimer.callback.append(self.progressUpdate)
コード例 #3
0
ファイル: FileTransfer.py プロジェクト: TwolDE2/ATV65
	def __init__(self, job, src_file, dst_file, src_isDir, do_copy):
		Task.__init__(self, job, "")
		nice = "ionice -c 3"
		self.src_isDir = src_isDir
		self.src_file = src_file
		self.dst_isDir = False
		self.dst_file = dst_file + "/" + os.path.basename(src_file)
		src_file_append = ""
		if not src_isDir:
			root, ext = os.path.splitext(src_file)
			if ext in ALL_MOVIE_EXTENSIONS:
				src_file = root
				src_file_append = ".*"
		cmd = "mv"
		if do_copy:
			cmd = "cp -pr"
		cmdline = '%s %s %s%s %s' % (nice, cmd, shellquote(src_file), src_file_append, shellquote(dst_file))
		if self.dst_file.endswith("/"):
			self.dst_isDir = True
		self.setCmdline(cmdline)
		self.end = 100
		self.progressTimer = eTimer()
		self.progressTimer.callback.append(self.progressUpdate)
コード例 #4
0
ファイル: ipk.py プロジェクト: TwolDE2/ATV65
	def unpackModus(self, id):
		if id == 1:
			# This is done in a subshell because using two
			# communicating Popen commands can deadlock on the
			# pipe output. Using communicate() avoids deadlock
			# on reading stdout and stderr from the pipe.
			fname = shellquote(self.sourceDir + self.filename)
			p = subprocess.Popen("ar -t %s > /dev/null 2>&1" % fname, shell=True)
			if p.wait():
				cmd = "tar -xOf %s ./data.tar.gz | tar -tzf -" % fname
			else:
				cmd = "ar -p %s data.tar.gz | tar -tzf -" % fname
			self.unpackPopen(cmd, UnpackInfoScreen)
		elif id == 4:
			self.ulist = []
			if fileExists("/usr/bin/opkg"):
				self.session.openWithCallback(self.doCallBack, Console, title=_("Installing Plugin ..."), cmdlist=(("opkg", "install", self.sourceDir + self.filename),))