Can I execute some script when torrent finished
Posted: Wed May 13, 2009 1:15 am
Something like rtorrent, when torrent is finished, exec some script: move/copy/delete some file that downloaded, etc.
Support Forum for the Deluge BitTorrent Client
https://forum.deluge-torrent.org/
Yes? No?jazd wrote:Any ETA on 1.2?
Fair enough, is there any way to run a script when a torrent finishes in 1.1.9 then? I think there is a plugin in the repository or something right? Will it work on 1.1.9?johnnyg wrote:There's no official release date for 1.2; it'll be released when it's ready
Here is an ui client example may helpful.jazd wrote: Fair enough, is there any way to run a script when a torrent finishes in 1.1.9 then? I think there is a plugin in the repository or something right? Will it work on 1.1.9?
Code: Select all
#!/usr/bin/env python
from deluge.ui.client import sclient
sclient.set_core_uri()
torrent_ids = sclient.get_session_state()
TORRENT_KEYS = ['name', 'total_size', 'num_files', 'num_pieces', 'piece_length',
'eta', 'ratio', 'file_progress', 'distributed_copies', 'total_done',
'total_uploaded', 'state', 'paused', 'progress', 'next_announce',
'total_payload_download', 'total_payload_upload', 'download_payload_rate',
'upload_payload_rate', 'num_peers', 'num_seeds', 'total_peers', 'total_seeds',
'total_wanted', 'tracker', 'trackers', 'tracker_status', 'save_path',
'files', 'file_priorities', 'compact', 'max_connections',
'max_upload_slots', 'max_download_speed', 'prioritize_first_last',
'private','max_upload_speed','queue','peers',
"active_time", "seeding_time", "seed_rank", "is_auto_managed", #stats
"stop_at_ratio","stop_ratio","remove_at_ratio" #ratio
]
cmp=([],[])
for id in torrent_ids:
idstatus=sclient.get_torrent_status(id,TORRENT_KEYS)
if idstatus['progress']==100:
#for x in idstatus.keys():
# print x,idstatus[x]
cmp[0].append(id)
cmp[1].append(idstatus['name'])
sclient.remove_torrent(cmp[0],None)
import shutil,os
for x in cmp[1]:
#shutil.move('/home/kevin/Downloads/'+x.encode("utf-8"),'/home/kevin/cmp/')
print 'move ',x,'to','/home/kevin/cmp/'
# http://docs.python.org/library/os.html#os-process
# os.execl('/bin/ls','-al')