Move finished torrent without actual download
Posted: Wed May 09, 2012 2:10 pm
Hello,
I have a web application that takes care of file upload and places the uploaded file in a directory on the same machine deluged is running on. During this upload my
plugin (LobberCore) adds the torrent to deluged and it starts to "download" but the file is already in the download directory. My thought was that the data then should be moved to storage directory and the torrent seeded from there.
But then this bit of code in torrentmanager.py ruins my plan:
What this means for me is that I get a torrent in finished state but it will never be moved.
I would like an explanation to the comment "Get the total_download and if it's 0, do not move.. It's likely that the torrent wasn't downloaded, but just added.". Does that mean that libtorrent sends an finished alert when a torrent is added but not yet finished downloading?
Thank you for a great torrent client.
I have a web application that takes care of file upload and places the uploaded file in a directory on the same machine deluged is running on. During this upload my
plugin (LobberCore) adds the torrent to deluged and it starts to "download" but the file is already in the download directory. My thought was that the data then should be moved to storage directory and the torrent seeded from there.
But then this bit of code in torrentmanager.py ruins my plan:
Code: Select all
def on_alert_torrent_finished(self, alert):
*snip*
# Get the total_download and if it's 0, do not move.. It's likely
# that the torrent wasn't downloaded, but just added.
total_download = torrent.get_status(["total_payload_download"])["total_payload_download"]
# Move completed download to completed folder if needed
if not torrent.is_finished and total_download:
move_path = None
if torrent.options["move_completed"]:
move_path = torrent.options["move_completed_path"]
if torrent.options["download_location"] != move_path:
torrent.move_storage(move_path)
component.get("EventManager").emit(TorrentFinishedEvent(torrent_id))
torrent.is_finished = True
torrent.update_state()
*snip*
I would like an explanation to the comment "Get the total_download and if it's 0, do not move.. It's likely that the torrent wasn't downloaded, but just added.". Does that mean that libtorrent sends an finished alert when a torrent is added but not yet finished downloading?
Thank you for a great torrent client.