diff --git a/plugins/TorrentNotification/__init__.py b/plugins/TorrentNotification/__init__.py index cd4d2a342..83177c01b 100644 --- a/plugins/TorrentNotification/__init__.py +++ b/plugins/TorrentNotification/__init__.py @@ -57,10 +57,11 @@ class TorrentNotification: self.dialog = self.glade.get_widget("dialog") def handle_event(self, event): - if self.config.get("enable_tray_blink"): - self.set_tray_flashing_on() - if self.config.get("enable_notification"): - self.show_notification(event) + if event['message'] == "torrent has finished downloading": + if self.config.get("enable_tray_blink"): + self.set_tray_flashing_on() + if self.config.get("enable_notification"): + self.show_notification(event) def unload(self): self.core.disconnect_event(self.core.constants['EVENT_FINISHED'], self.handle_event) diff --git a/src/core.py b/src/core.py index cedfeec50..4e82539d8 100644 --- a/src/core.py +++ b/src/core.py @@ -556,13 +556,6 @@ class Manager: 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) @@ -583,16 +576,21 @@ class Manager: 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 + + # save fast resume once torrent finishes 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']: unique_ID = event['unique_ID'] diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index b75e71c26..7107a4856 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -749,9 +749,10 @@ static PyObject *torrent_pop_event(PyObject *self, PyObject *args) return NULL; if (handle_exists(handle)) - return Py_BuildValue("{s:i,s:i}", "event_type", EVENT_FINISHED, - "unique_ID", - M_torrents->at(index).unique_ID); + return Py_BuildValue("{s:i,s:i,s:s}", + "event_type", EVENT_FINISHED, + "unique_ID", M_torrents->at(index).unique_ID, + "message", a->msg().c_str()); else { Py_INCREF(Py_None); return Py_None; } } else if (dynamic_cast(popped_alert))