move finished downloads to - eternalswd
This commit is contained in:
parent
c5e2b67800
commit
1e1c5ed780
|
@ -527,6 +527,8 @@ class Manager:
|
||||||
|
|
||||||
if event['event_type'] is self.constants['EVENT_FINISHED']:
|
if event['event_type'] is self.constants['EVENT_FINISHED']:
|
||||||
# Queue seeding torrent to bottom if needed
|
# Queue seeding torrent to bottom if needed
|
||||||
|
if(self.get_pref('enable_move_completed')):
|
||||||
|
deluge_core.move_storage(event['unique_ID'], self.get_pref('default_finished_path'))
|
||||||
if self.get_pref('queue_seeds_to_bottom'):
|
if self.get_pref('queue_seeds_to_bottom'):
|
||||||
self.queue_bottom(event['unique_ID'])
|
self.queue_bottom(event['unique_ID'])
|
||||||
# If we are autoseeding, then we need to apply the queue
|
# If we are autoseeding, then we need to apply the queue
|
||||||
|
@ -803,7 +805,7 @@ class Manager:
|
||||||
|
|
||||||
def calc_ratio(self, unique_ID, torrent_state):
|
def calc_ratio(self, unique_ID, torrent_state):
|
||||||
up = float((torrent_state['total_payload_upload'] / 1024) + (self.unique_IDs[unique_ID].uploaded_memory / 1024))
|
up = float((torrent_state['total_payload_upload'] / 1024) + (self.unique_IDs[unique_ID].uploaded_memory / 1024))
|
||||||
down = float(torrent_state["total_done"] / 1024)
|
down = float(torrent_state["total_done"] / 1024)
|
||||||
try:
|
try:
|
||||||
ret = float(up/down)
|
ret = float(up/down)
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -534,6 +534,32 @@ static PyObject *torrent_add_torrent(PyObject *self, PyObject *args)
|
||||||
{ RAISE_PTR(DuplicateTorrentError, "libtorrent reports this is a duplicate torrent"); }
|
{ RAISE_PTR(DuplicateTorrentError, "libtorrent reports this is a duplicate torrent"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *torrent_move_storage(PyObject *self, PyObject *args)
|
||||||
|
{
|
||||||
|
const char *move_dir;
|
||||||
|
python_long unique_ID;
|
||||||
|
if (!PyArg_ParseTuple(args, "is", &unique_ID, &move_dir))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
long index = get_index_from_unique_ID(unique_ID);
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
boost::filesystem::path move_dir_2 (move_dir, empty_name_check);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
/*libtorrent's move_storage only works within same partition
|
||||||
|
move_storage returns afterwards save_path should equal move_dir_2*/
|
||||||
|
M_torrents->at(index).handle.move_storage(move_dir_2);
|
||||||
|
//if(M_torrents->at(index).handle.save_path()!=move_dir_2)
|
||||||
|
//return NULL;
|
||||||
|
//throw error here to let user know
|
||||||
|
}
|
||||||
|
catch (boost::filesystem::filesystem_error&)
|
||||||
|
{ RAISE_PTR(FilesystemError, ""); }
|
||||||
|
|
||||||
|
Py_INCREF(Py_None); return Py_None;
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *torrent_remove_torrent(PyObject *self, PyObject *args)
|
static PyObject *torrent_remove_torrent(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
@ -1407,6 +1433,7 @@ static PyMethodDef deluge_core_methods[] =
|
||||||
{"set_max_uploads", torrent_set_max_uploads, METH_VARARGS, "."},
|
{"set_max_uploads", torrent_set_max_uploads, METH_VARARGS, "."},
|
||||||
{"set_max_connections", torrent_set_max_connections, METH_VARARGS, "."},
|
{"set_max_connections", torrent_set_max_connections, METH_VARARGS, "."},
|
||||||
{"add_torrent", torrent_add_torrent, METH_VARARGS, "."},
|
{"add_torrent", torrent_add_torrent, METH_VARARGS, "."},
|
||||||
|
{"move_storage", torrent_move_storage, METH_VARARGS, "."},
|
||||||
{"remove_torrent", torrent_remove_torrent, METH_VARARGS, "."},
|
{"remove_torrent", torrent_remove_torrent, METH_VARARGS, "."},
|
||||||
{"get_num_torrents", torrent_get_num_torrents, METH_VARARGS, "."},
|
{"get_num_torrents", torrent_get_num_torrents, METH_VARARGS, "."},
|
||||||
{"reannounce", torrent_reannounce, METH_VARARGS, "."},
|
{"reannounce", torrent_reannounce, METH_VARARGS, "."},
|
||||||
|
|
|
@ -45,6 +45,8 @@ class PreferencesDlg:
|
||||||
self.dialog.set_icon_from_file(common.get_pixmap("deluge32.png"))
|
self.dialog.set_icon_from_file(common.get_pixmap("deluge32.png"))
|
||||||
self.glade.signal_autoconnect({
|
self.glade.signal_autoconnect({
|
||||||
'on_chk_use_tray_toggled': self.tray_toggle,
|
'on_chk_use_tray_toggled': self.tray_toggle,
|
||||||
|
'on_save_all_to' : self.toggle_move_chk,
|
||||||
|
'on_ask_save' : self.toggle_move_chk,
|
||||||
'on_btn_testport_clicked': self.TestPort,
|
'on_btn_testport_clicked': self.TestPort,
|
||||||
})
|
})
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
@ -73,8 +75,14 @@ class PreferencesDlg:
|
||||||
self.glade.get_widget("txt_proxy_password").set_text(self.preferences.get("proxy_password"))
|
self.glade.get_widget("txt_proxy_password").set_text(self.preferences.get("proxy_password"))
|
||||||
if(self.preferences.get("use_default_dir")):
|
if(self.preferences.get("use_default_dir")):
|
||||||
self.glade.get_widget("radio_save_all_to").set_active(True)
|
self.glade.get_widget("radio_save_all_to").set_active(True)
|
||||||
|
self.glade.get_widget("chk_move_completed").set_sensitive(True)
|
||||||
|
self.glade.get_widget("finished_path_button").set_sensitive(True)
|
||||||
|
if(self.preferences.get("enable_move_completed")):
|
||||||
|
self.glade.get_widget("chk_move_completed").set_active(True)
|
||||||
else:
|
else:
|
||||||
self.glade.get_widget("radio_ask_save").set_active(True)
|
self.glade.get_widget("radio_ask_save").set_active(True)
|
||||||
|
self.glade.get_widget("chk_move_completed").set_sensitive(False)
|
||||||
|
self.glade.get_widget("finished_path_button").set_sensitive(False)
|
||||||
|
|
||||||
self.glade.get_widget("download_path_button").set_filename(self.preferences.get("default_download_path"))
|
self.glade.get_widget("download_path_button").set_filename(self.preferences.get("default_download_path"))
|
||||||
self.glade.get_widget("chk_compact").set_active(self.preferences.get("use_compact_storage"))
|
self.glade.get_widget("chk_compact").set_active(self.preferences.get("use_compact_storage"))
|
||||||
|
@ -121,6 +129,8 @@ class PreferencesDlg:
|
||||||
self.preferences.set("proxy_hostname", self.glade.get_widget("txt_proxy_hostname").get_text())
|
self.preferences.set("proxy_hostname", self.glade.get_widget("txt_proxy_hostname").get_text())
|
||||||
self.preferences.set("use_default_dir", self.glade.get_widget("radio_save_all_to").get_active())
|
self.preferences.set("use_default_dir", self.glade.get_widget("radio_save_all_to").get_active())
|
||||||
self.preferences.set("default_download_path", self.glade.get_widget("download_path_button").get_filename())
|
self.preferences.set("default_download_path", self.glade.get_widget("download_path_button").get_filename())
|
||||||
|
self.preferences.set("enable_move_completed", self.glade.get_widget("chk_move_completed").get_active())
|
||||||
|
self.preferences.set("default_finished_path", self.glade.get_widget("finished_path_button").get_filename())
|
||||||
self.preferences.set("auto_end_seeding", self.glade.get_widget("chk_autoseed").get_active())
|
self.preferences.set("auto_end_seeding", self.glade.get_widget("chk_autoseed").get_active())
|
||||||
self.preferences.set("auto_seed_ratio", self.glade.get_widget("ratio_spinner").get_value())
|
self.preferences.set("auto_seed_ratio", self.glade.get_widget("ratio_spinner").get_value())
|
||||||
self.preferences.set("use_compact_storage", self.glade.get_widget("chk_compact").get_active())
|
self.preferences.set("use_compact_storage", self.glade.get_widget("chk_compact").get_active())
|
||||||
|
@ -148,7 +158,15 @@ class PreferencesDlg:
|
||||||
self.glade.get_widget("chk_min_on_close").set_sensitive(is_active)
|
self.glade.get_widget("chk_min_on_close").set_sensitive(is_active)
|
||||||
self.glade.get_widget("chk_lock_tray").set_sensitive(is_active)
|
self.glade.get_widget("chk_lock_tray").set_sensitive(is_active)
|
||||||
self.glade.get_widget("txt_tray_passwd").set_sensitive(is_active)
|
self.glade.get_widget("txt_tray_passwd").set_sensitive(is_active)
|
||||||
|
|
||||||
|
def toggle_move_chk(self, widget):
|
||||||
|
if(self.glade.get_widget("radio_ask_save").get_active()):
|
||||||
|
self.glade.get_widget("chk_move_completed").set_active(False)
|
||||||
|
self.glade.get_widget("chk_move_completed").set_sensitive(False)
|
||||||
|
self.glade.get_widget("finished_path_button").set_sensitive(False)
|
||||||
|
else:
|
||||||
|
self.glade.get_widget("chk_move_completed").set_sensitive(True)
|
||||||
|
self.glade.get_widget("finished_path_button").set_sensitive(True)
|
||||||
|
|
||||||
class PluginDlg:
|
class PluginDlg:
|
||||||
def __init__(self, parent, plugins):
|
def __init__(self, parent, plugins):
|
||||||
|
|
|
@ -43,6 +43,8 @@ DEFAULT_PREFS = {
|
||||||
"close_to_tray" : False,
|
"close_to_tray" : False,
|
||||||
"default_download_path" : "",
|
"default_download_path" : "",
|
||||||
"default_load_path" : os.path.expanduser("~/"),
|
"default_load_path" : os.path.expanduser("~/"),
|
||||||
|
"default_finished_path" : "",
|
||||||
|
"enable_move_completed" : False,
|
||||||
"enable_dht" : True,
|
"enable_dht" : True,
|
||||||
"enable_system_tray" : True,
|
"enable_system_tray" : True,
|
||||||
"enabled_plugins" : "",
|
"enabled_plugins" : "",
|
||||||
|
|
Loading…
Reference in New Issue