From fd59970ee72cdd06332bcfd33c6e0ed948fafdbd Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Fri, 15 Oct 2010 21:28:49 +0200 Subject: [PATCH] Torrent are moved but the file is symlinked to the original position. --- mlmanager.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/mlmanager.py b/mlmanager.py index 987fe63..7d47f80 100644 --- a/mlmanager.py +++ b/mlmanager.py @@ -268,16 +268,13 @@ class Download(): self._notify_error("Destination directory %s does not exists" % destination_folder) return - # Do not move torrents so they not stop seeding - if self._network != "BitTorrent": - shutil.move (self._dest_path, destination_folder + filename) - else: - # Try hard link first (that will work only for files - # and only on the same filesystem, and symlink after - try: - os.link (self._dest_path, destination_folder + filename) - except: - os.symlink (self._dest_path, destination_folder + filename) + # Move the downladed file + shutil.move (self._dest_path, destination_folder + filename) + + # If the file was downloaded via Bittorrent try to symlink the file back + # in the incoming folder so mldonkey does not stop seeding + if self._network == "BitTorrent": + os.symlink (destination_folder + filename, self._dest_path) # Update _dest_path self._dest_path = destination_folder + filename -- 2.1.4