Ejemplo n.º 1
0
 def transfer(self, filename):
     # need to single-quote the *path* for the purposes of the remote shell so it doesn't fail, because the path is used in the remote shell
     path = os.path.join(self.incoming_dir, filename)
     path = util.shell_quote(path)
     path = "%s:%s" % (self.ssh_hostname, path)
     opts = ["-arvzP"]
     cmdline = [ "rsync" ] + opts + [ path , self.local_download_dir ]
     returncode = util.passthru(cmdline)
     return returncode
Ejemplo n.º 2
0
 def transfer(self, filename):
     # in this implementation, get_finished_torrents MUST BE called first
     # or else this will bomb out with an attribute error
     # need to single-quote the *path* for the purposes of the remote shell so it doesn't fail, because the path is used in the remote shell
     path = util.shell_quote(self.path_for_filename_cache[filename])
     path = "%s:%s" % (self.ssh_hostname, path)
     opts = ["-arvzP"]
     cmdline = [ "rsync" ] + opts + [ path , self.local_download_dir ]
     returncode = util.passthru(cmdline)
     return returncode
Ejemplo n.º 3
0
 def remove_remote_download(self, filename):
     if not hasattr(self, "torrent_to_id_map"): self.get_finished_torrents()
     if not hasattr(self, "filename_to_torrent_map"):
         self.filename_to_torrent_map = dict(
             (self.get_file_name(torrentname), torrentname) for torrentname, _ in self.get_finished_torrents()
         )
     torrent = self.filename_to_torrent_map[filename]
     torrent_id = self.torrent_to_id_map[torrent]
     returncode = util.passthru([
         "env", "LANG=C",
         self.transmission_remote_path,
         self.hostname,
         "--auth=%s:%s" % (self.transmission_remote_user, self.transmission_remote_password),
         "-t", torrent_id,
         "--remove-and-delete"
     ])
     if returncode == 0: return
     elif returncode == -2: raise IOError(4, "remove_remote_download interrupted")
     else: raise AssertionError, "remove dirs only returned %s" % returncode