src/core.py
@@ -539,23 +553,16 @@ class Manager:
return event
ret = []
while True:
event = pop_event()
if event is None:
break
- # EVENT_FINISHED fires after integrity checks as well, so ensure
- # we actually downloaded torrent now by making sure at least some
- # bytes have been downloaded for it in this session
- if event['event_type'] is self.constants['EVENT_FINISHED'] and \
- self.get_core_torrent_state(event['unique_ID'])['total_payload_download'] == 0:
- continue
-
# print "EVENT: ", event
ret.append(event)
if 'unique_ID' in event and \
event['unique_ID'] not in self.unique_IDs:
continue
@@ -566,20 +573,22 @@ class Manager:
if event['event_type'] is self.constants['EVENT_STORAGE_MOVED']:
if event['message'] == self.unique_IDs[event['unique_ID']].save_dir:
raise StorageMoveFailed(_("You cannot move torrent to a different partition. Please fix your preferences"))
elif event['message'] == self.get_pref('default_finished_path'):
self.unique_IDs[event['unique_ID']].save_dir = self.get_pref('default_finished_path')
elif event['event_type'] is self.constants['EVENT_FINISHED']:
- # Queue seeding torrent to bottom if needed
+
if self.get_pref('enable_move_completed') and not \
- (self.get_pref('default_finished_path') == self.get_pref('default_download_path')):
+ (self.get_pref('default_finished_path') == self.get_pref('default_download_path')) and \
+ event['message'] == "torrent has finished downloading":
deluge_core.move_storage(event['unique_ID'], self.get_pref('default_finished_path'))
+ # Queue seeding torrent to bottom if needed
if self.get_pref('queue_seeds_to_bottom'):
self.queue_bottom(event['unique_ID'])
# If we are autoseeding, then we need to apply the queue
if self.get_pref('auto_seed_ratio') == -1:
self.apply_queue(efficient = False) # To work on current data
#save fast resume once torrent finshes so as to not recheck seed if client crashes
self.save_fastresume_data(event['unique_ID'])
elif event['event_type'] is self.constants['EVENT_TRACKER']:
src/deluge_core.cpp
@@ -706,19 +753,20 @@ static PyObject *torrent_pop_event(PyObj
{
torrent_handle handle = (dynamic_cast<torrent_finished_alert*>(popped_alert))->handle;
long index = get_torrent_index(handle);
if (PyErr_Occurred())
return NULL;
if (handle_exists(handle))
- return Py_BuildValue("{s:i,s:i}", "event_type", EVENT_FINISHED,
+ return Py_BuildValue("{s:i,s:i,s:s}", "event_type", EVENT_FINISHED,
"unique_ID",
- M_torrents->at(index).unique_ID);
+ M_torrents->at(index).unique_ID,
+ "message", a->msg().c_str());
plugins/TorrentNotification/__init__.py
def handle_event(self, event):
- if self.config.get("enable_tray_blink"):
+ if self.config.get("enable_tray_blink") and \
+ event['message'] == "torrent has finished downloading":
self.set_tray_flashing_on()
- if self.config.get("enable_notification"):
+ if self.config.get("enable_notification") and \
+ event['message'] == "torrent has finished downloading":
might want these changes to src/core.py instead
@@ -539,23 +553,16 @@ class Manager:
return event
ret = []
while True:
event = pop_event()
if event is None:
break
- # EVENT_FINISHED fires after integrity checks as well, so ensure
- # we actually downloaded torrent now by making sure at least some
- # bytes have been downloaded for it in this session
- if event['event_type'] is self.constants['EVENT_FINISHED'] and \
- self.get_core_torrent_state(event['unique_ID'])['total_payload_download'] == 0:
- continue
-
# print "EVENT: ", event
ret.append(event)
if 'unique_ID' in event and \
event['unique_ID'] not in self.unique_IDs:
continue
@@ -566,25 +573,26 @@ class Manager:
if event['event_type'] is self.constants['EVENT_STORAGE_MOVED']:
if event['message'] == self.unique_IDs[event['unique_ID']].save_dir:
raise StorageMoveFailed(_("You cannot move torrent to a different partition. Please fix your preferences"))
elif event['message'] == self.get_pref('default_finished_path'):
self.unique_IDs[event['unique_ID']].save_dir = self.get_pref('default_finished_path')
elif event['event_type'] is self.constants['EVENT_FINISHED']:
- # Queue seeding torrent to bottom if needed
- if self.get_pref('enable_move_completed') and not \
- (self.get_pref('default_finished_path') == self.get_pref('default_download_path')):
+ if event['message'] == "torrent has finished downloading":
+ if self.get_pref('enable_move_completed') and not \
+ (self.get_pref('default_finished_path') == self.get_pref('default_download_path')):
deluge_core.move_storage(event['unique_ID'], self.get_pref('default_finished_path'))
- if self.get_pref('queue_seeds_to_bottom'):
- self.queue_bottom(event['unique_ID'])
- # If we are autoseeding, then we need to apply the queue
- if self.get_pref('auto_seed_ratio') == -1:
- self.apply_queue(efficient = False) # To work on current data
+ # Queue seeding torrent to bottom if needed
+ if self.get_pref('queue_seeds_to_bottom'):
+ self.queue_bottom(event['unique_ID'])
+ # If we are autoseeding, then we need to apply the queue
+ if self.get_pref('auto_seed_ratio') == -1:
+ self.apply_queue(efficient = False) # To work on current data