diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade index dc237f92a..170600202 100644 --- a/glade/preferences_dialog.glade +++ b/glade/preferences_dialog.glade @@ -67,32 +67,18 @@ 2 2 - + True - False + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER - Select A Folder + Store all downloads in: + Store all downloads in: + 0 + True + True + radio_ask_save + - - 1 - 2 - 1 - 2 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER - Select A Folder - - - 1 - 2 - @@ -112,18 +98,32 @@ - + True - True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Store all downloads in: - Store all downloads in: - 0 - True - True - radio_ask_save - + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + Select A Folder + + 1 + 2 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + Select A Folder + + + 1 + 2 + 1 + 2 + @@ -1012,22 +1012,99 @@ Full Stream 4 2 - + + True + True + The maximum upload slots for all torrents. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + + + 1 + 2 + 3 + 4 + GTK_FILL + + + + + True + True + The maximum upload speed for all torrents. Set -1 for unlimited. + 1 + 0 -1 9000 1 10 10 + 1 + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + The maximum download speed for all torrents. Set -1 for unlimited. + 1 + 0 -1 9000 1 10 10 + 1 + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + The maximum download speed for all torrents. Set -1 for unlimited. + 0 + Maximum Download Speed (KiB/s): + + + 1 + 2 + + + + + True + True + The maximum number of connections allowed. Set -1 for unlimited. + 1 + -1 -1 1000 1 10 10 + 1 + + + 1 + 2 + GTK_FILL + + + + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 10 - + True - The maximum upload speed for all torrents. Set -1 for unlimited. + The maximum number of connections allowed. Set -1 for unlimited. 0 - Maximum Global Upload Slots: + Maximum Connections: - 3 - 4 GTK_FILL @@ -1052,97 +1129,20 @@ Full Stream - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 10 - + True - The maximum number of connections allowed. Set -1 for unlimited. + The maximum upload speed for all torrents. Set -1 for unlimited. 0 - Maximum Connections: + Maximum Upload Slots: - GTK_FILL - - - - - True - True - The maximum number of connections allowed. Set -1 for unlimited. - 1 - -1 -1 1000 1 10 10 - 1 - - - 1 - 2 - GTK_FILL - - - - - True - The maximum download speed for all torrents. Set -1 for unlimited. - 0 - Maximum Download Speed (KiB/s): - - - 1 - 2 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - The maximum download speed for all torrents. Set -1 for unlimited. - 1 - 0 -1 9000 1 10 10 - 1 - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - True - The maximum upload speed for all torrents. Set -1 for unlimited. - 1 - 0 -1 9000 1 10 10 - 1 - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - True - True - The maximum upload slots for all torrents. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 - - - 1 - 2 3 4 GTK_FILL @@ -1155,7 +1155,7 @@ Full Stream True - <b>Bandwidth Usage</b> + <b>Global Bandwidth Usage</b> True @@ -1170,7 +1170,107 @@ Full Stream - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + GTK_SHADOW_NONE + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + 2 + 12 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + 2 + + + True + True + The maximum upload slots per torrent. Set -1 for unlimited. + 1 + -1 -1 1000 1 10 10 + 1 + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + The maximum number of connections per torrent. Set -1 for unlimited. + 1 + -1 -1 1000 1 10 10 + + + 1 + 2 + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Maximum Upload Slots: + + + + + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Maximum Connections: + + + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + <b>Per Torrent Bandwidth Usage</b> + True + + + label_item + + + + + False + 1 + @@ -1245,73 +1345,46 @@ Full Stream - + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8080 0 10000 1 10 10 3 4 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Proxy type + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Username + + 1 2 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Port + Password - 2 - 3 - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Server - - - 2 - 3 - - - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 2 3 - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - 1 - 2 - - True @@ -1330,44 +1403,71 @@ HTTP W/ Auth - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Password - - - 2 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Username - - - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Proxy type - - - - + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + 1 + 2 + 1 + 2 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 2 + 3 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Server + + + 2 + 3 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Port + + + 2 + 3 + 1 + 2 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 8080 0 10000 1 10 10 + 3 4 + 1 + 2 @@ -1439,73 +1539,46 @@ HTTP W/ Auth - + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8080 0 10000 1 10 10 3 4 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Proxy type + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Username + + 1 2 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Port + Password - 2 - 3 - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Server - - - 2 - 3 - - - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 2 3 - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - 1 - 2 - - True @@ -1524,44 +1597,71 @@ HTTP W/ Auth - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Password - - - 2 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Username - - - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Proxy type - - - - + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + 1 + 2 + 1 + 2 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 2 + 3 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Server + + + 2 + 3 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Port + + + 2 + 3 + 1 + 2 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 8080 0 10000 1 10 10 + 3 4 + 1 + 2 @@ -1634,73 +1734,46 @@ HTTP W/ Auth - + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8080 0 10000 1 10 10 3 4 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Proxy type + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Username + + 1 2 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Port + Password - 2 - 3 - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Server - - - 2 - 3 - - - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 2 3 - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - 1 - 2 - - True @@ -1719,44 +1792,71 @@ HTTP W/ Auth - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Password - - - 2 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Username - - - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Proxy type - - - - + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + 1 + 2 + 1 + 2 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 2 + 3 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Server + + + 2 + 3 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Port + + + 2 + 3 + 1 + 2 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 8080 0 10000 1 10 10 + 3 4 + 1 + 2 @@ -1829,73 +1929,46 @@ HTTP W/ Auth - + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8080 0 10000 1 10 10 3 4 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Proxy type + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Username + + 1 2 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Port + Password - 2 - 3 - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Server - - - 2 - 3 - - - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 2 3 - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - 1 - 2 - - True @@ -1914,44 +1987,71 @@ HTTP W/ Auth - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Password - - - 2 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Username - - - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Proxy type - - - - + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + 1 + 2 + 1 + 2 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 2 + 3 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Server + + + 2 + 3 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Port + + + 2 + 3 + 1 + 2 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 8080 0 10000 1 10 10 + 3 4 + 1 + 2 diff --git a/plugins/Locations/plugin.py b/plugins/Locations/plugin.py index f4a7d7a3e..7b720116e 100644 --- a/plugins/Locations/plugin.py +++ b/plugins/Locations/plugin.py @@ -33,11 +33,13 @@ LOCATION_KEYS = [ "auto_end_seeding", "auto_seed_ratio", "end_seed_ratio", - "max_connections", + "max_connections_global", + "max_connections_per_torrent", "max_download_rate", "max_download_rate_bps", "max_number_downloads", - "max_number_uploads", + "max_upload_slots_global", + "max_upload_slots_per_torrent", "max_upload_rate", "max_upload_rate_bps", "max_uploads", diff --git a/src/core.py b/src/core.py index 2c84f3770..d8fd90586 100644 --- a/src/core.py +++ b/src/core.py @@ -69,9 +69,9 @@ DHT_FILENAME = "dht.state" PREF_FUNCTIONS = { "listen_on" : deluge_core.set_listen_on, - "max_connections" : deluge_core.set_max_connections, + "max_connections_global" : deluge_core.set_max_connections_global, "max_active_torrents" : None, # no need for a function, applied constantly - "max_number_uploads" : deluge_core.set_max_uploads, + "max_upload_slots_global" : deluge_core.set_max_upload_slots_global, "auto_seed_ratio" : None, # no need for a function, applied constantly "max_download_speed_bps" : deluge_core.set_download_rate_limit, "max_upload_speed_bps" : deluge_core.set_upload_rate_limit, @@ -903,10 +903,14 @@ class Manager: else: PREF_FUNCTIONS[pref](self.get_pref(pref)) - # We need to reapply priorities to files after preferences were - # changed + # We need to reapply priorities to files and per torrent options after + # preferences were changed. for unique_ID in self.unique_IDs: self.prioritize_files(unique_ID, self.get_priorities(unique_ID)) + self.set_max_connections_per_torrent(unique_ID, + self.get_pref("max_connections_per_torrent")) + self.set_max_upload_slots_per_torrent(unique_ID, + self.get_pref("max_upload_slots_per_torrent")) def set_DHT(self, start=False): if start == True and self.dht_running != True: @@ -957,12 +961,17 @@ class Manager: def replace_trackers(self, unique_ID, trackers): return deluge_core.replace_trackers(unique_ID, trackers) - def set_flp(self, unique_ID, num): - return deluge_core.set_flp(unique_ID, int(num)) - def set_priv(self, unique_ID, on_off): return deluge_core.set_priv(unique_ID, on_off) + def set_max_connections_per_torrent(self, unique_ID, max_connections): + return deluge_core.set_max_connections_per_torrent(unique_ID, + max_connections) + + def set_max_upload_slots_per_torrent(self, unique_ID, max_upload_slots): + return deluge_core.set_max_upload_slots_per_torrent(unique_ID, + max_upload_slots) + def set_per_upload_rate_limit(self, unique_ID, speed): if speed != -1: speed = speed * 1024 diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index 6afb57087..737e4e0ee 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -551,7 +551,7 @@ static PyObject *torrent_listening_port(PyObject *self, PyObject *args) } -static PyObject *torrent_set_max_uploads(PyObject *self, PyObject *args) +static PyObject *torrent_set_max_upload_slots_global(PyObject *self, PyObject *args) { python_long max_up; if (!PyArg_ParseTuple(args, "i", &max_up)) @@ -563,7 +563,7 @@ static PyObject *torrent_set_max_uploads(PyObject *self, PyObject *args) } -static PyObject *torrent_set_max_connections(PyObject *self, PyObject *args) +static PyObject *torrent_set_max_connections_global(PyObject *self, PyObject *args) { python_long max_conn; if (!PyArg_ParseTuple(args, "i", &max_conn)) @@ -1720,28 +1720,6 @@ static PyObject *torrent_replace_trackers(PyObject *self, PyObject *args) h.force_reannounce(); return Py_None; } -static PyObject *torrent_set_flp(PyObject *self, PyObject *args) -{ - python_long unique_ID; - int num; - if (!PyArg_ParseTuple(args, "ii", &unique_ID, &num)) - return NULL; - long index = get_index_from_unique_ID(unique_ID); - if (PyErr_Occurred()) - return NULL; - - torrent_t &t = M_torrents->at(index); - torrent_status s = t.handle.status(); - const torrent_info &i = t.handle.get_torrent_info(); - - int npieces = i.num_pieces() - 1; - - t.handle.piece_priority(0, num); - t.handle.piece_priority(npieces, num); - - return Py_None; -} - static PyObject *torrent_prioritize_files(PyObject *self, PyObject *args) { python_long unique_ID; @@ -1883,65 +1861,98 @@ static PyObject *torrent_set_priv(PyObject *self, PyObject *args) return Py_None; } +static PyObject *torrent_set_max_connections_per_torrent(PyObject *self, PyObject *args) +{ + python_long unique_ID, max_connections; + + if (!PyArg_ParseTuple(args, "ii", &unique_ID, &max_connections)) + return NULL; + long index = get_index_from_unique_ID(unique_ID); + if (PyErr_Occurred()) + return NULL; + + torrent_t &t = M_torrents->at(index); + t.handle.set_max_connections(max_connections); + + return Py_None; +} + +static PyObject *torrent_set_max_upload_slots_per_torrent(PyObject *self, PyObject *args) +{ + python_long unique_ID, max_upload_slots; + + if (!PyArg_ParseTuple(args, "ii", &unique_ID, &max_upload_slots)) + return NULL; + long index = get_index_from_unique_ID(unique_ID); + if (PyErr_Occurred()) + return NULL; + + torrent_t &t = M_torrents->at(index); + t.handle.set_max_uploads(max_upload_slots); + + return Py_None; +} + //==================== // Python Module data //==================== static PyMethodDef deluge_core_methods[] = { - {"pe_settings", torrent_pe_settings, METH_VARARGS, "."}, - {"pre_init", torrent_pre_init, METH_VARARGS, "."}, - {"init", torrent_init, METH_VARARGS, "."}, - {"quit", torrent_quit, METH_VARARGS, "."}, - {"save_fastresume", torrent_save_fastresume, METH_VARARGS, "."}, - {"set_max_half_open", torrent_set_max_half_open, METH_VARARGS, "."}, - {"set_download_rate_limit", torrent_set_download_rate_limit, METH_VARARGS, "."}, - {"set_upload_rate_limit", torrent_set_upload_rate_limit, METH_VARARGS, "."}, - {"set_per_upload_rate_limit", torrent_set_per_upload_rate_limit, METH_VARARGS, "."}, - {"set_per_download_rate_limit", torrent_set_per_download_rate_limit, METH_VARARGS, "."}, - {"set_listen_on", torrent_set_listen_on, METH_VARARGS, "."}, - {"is_listening", torrent_is_listening, METH_VARARGS, "."}, - {"listening_port", torrent_listening_port, METH_VARARGS, "."}, - {"set_max_uploads", torrent_set_max_uploads, METH_VARARGS, "."}, - {"set_max_connections", torrent_set_max_connections, METH_VARARGS, "."}, - {"add_torrent", torrent_add_torrent, METH_VARARGS, "."}, - {"move_storage", torrent_move_storage, METH_VARARGS, "."}, - {"remove_torrent", torrent_remove_torrent, METH_VARARGS, "."}, - {"get_num_torrents", torrent_get_num_torrents, METH_VARARGS, "."}, - {"reannounce", torrent_reannounce, METH_VARARGS, "."}, - {"pause", torrent_pause, METH_VARARGS, "."}, - {"resume", torrent_resume, METH_VARARGS, "."}, - {"get_torrent_state", torrent_get_torrent_state, METH_VARARGS, "."}, - {"pop_event", torrent_pop_event, METH_VARARGS, "."}, - {"get_session_info", torrent_get_session_info, METH_VARARGS, "."}, - {"get_peer_info", torrent_get_peer_info, METH_VARARGS, "."}, - {"get_file_info", torrent_get_file_info, METH_VARARGS, "."}, - {"dump_file_info", torrent_dump_file_info, METH_VARARGS, "."}, - {"constants", torrent_constants, METH_VARARGS, "."}, - {"start_DHT", torrent_start_DHT, METH_VARARGS, "."}, - {"stop_DHT", torrent_stop_DHT, METH_VARARGS, "."}, - {"get_DHT_info", torrent_get_DHT_info, METH_VARARGS, "."}, - {"create_torrent", torrent_create_torrent, METH_VARARGS, "."}, - {"reset_IP_filter", torrent_reset_IP_filter, METH_VARARGS, "."}, - {"add_range_to_IP_filter", torrent_add_range_to_IP_filter, METH_VARARGS, "."}, - {"set_IP_filter", torrent_set_IP_filter, METH_VARARGS, "."}, - {"use_upnp", torrent_use_upnp, METH_VARARGS, "."}, - {"use_natpmp", torrent_use_natpmp, METH_VARARGS, "."}, - {"use_utpex", torrent_use_utpex, METH_VARARGS, "."}, - {"set_ratio", torrent_set_ratio, METH_VARARGS, "."}, - {"proxy_settings", torrent_proxy_settings, METH_VARARGS, "."}, - {"get_trackers", torrent_get_trackers, METH_VARARGS, "."}, - {"dump_trackers", torrent_dump_trackers, METH_VARARGS, "."}, - {"replace_trackers", torrent_replace_trackers, METH_VARARGS, "."}, - {"set_flp", torrent_set_flp, METH_VARARGS, "."}, - {"prioritize_files", torrent_prioritize_files, METH_VARARGS, "."}, - {"prioritize_first_last_pieces", torrent_prioritize_first_last_pieces, METH_VARARGS, "."}, - {"set_priv", torrent_set_priv, METH_VARARGS, "."}, - {"test_duplicate", torrent_test_duplicate, METH_VARARGS, "."}, - {"has_piece", torrent_has_piece, METH_VARARGS, "."}, - {"get_piece_info", torrent_get_piece_info, METH_VARARGS, "."}, - {"get_all_piece_info", torrent_get_all_piece_info, METH_VARARGS, "."}, - {"get_file_piece_range", torrent_get_file_piece_range, METH_VARARGS, "."}, + {"pe_settings", torrent_pe_settings, METH_VARARGS, "."}, + {"pre_init", torrent_pre_init, METH_VARARGS, "."}, + {"init", torrent_init, METH_VARARGS, "."}, + {"quit", torrent_quit, METH_VARARGS, "."}, + {"save_fastresume", torrent_save_fastresume, METH_VARARGS, "."}, + {"set_max_half_open", torrent_set_max_half_open, METH_VARARGS, "."}, + {"set_download_rate_limit", torrent_set_download_rate_limit, METH_VARARGS, "."}, + {"set_upload_rate_limit", torrent_set_upload_rate_limit, METH_VARARGS, "."}, + {"set_per_upload_rate_limit", torrent_set_per_upload_rate_limit, METH_VARARGS, "."}, + {"set_per_download_rate_limit", torrent_set_per_download_rate_limit, METH_VARARGS, "."}, + {"set_listen_on", torrent_set_listen_on, METH_VARARGS, "."}, + {"is_listening", torrent_is_listening, METH_VARARGS, "."}, + {"listening_port", torrent_listening_port, METH_VARARGS, "."}, + {"set_max_upload_slots_global", torrent_set_max_upload_slots_global, METH_VARARGS, "."}, + {"set_max_upload_slots_per_torrent",torrent_set_max_upload_slots_per_torrent, METH_VARARGS, "."}, + {"set_max_connections_global", torrent_set_max_connections_global, METH_VARARGS, "."}, + {"set_max_connections_per_torrent", torrent_set_max_connections_per_torrent, METH_VARARGS, "."}, + {"add_torrent", torrent_add_torrent, METH_VARARGS, "."}, + {"move_storage", torrent_move_storage, METH_VARARGS, "."}, + {"remove_torrent", torrent_remove_torrent, METH_VARARGS, "."}, + {"get_num_torrents", torrent_get_num_torrents, METH_VARARGS, "."}, + {"reannounce", torrent_reannounce, METH_VARARGS, "."}, + {"pause", torrent_pause, METH_VARARGS, "."}, + {"resume", torrent_resume, METH_VARARGS, "."}, + {"get_torrent_state", torrent_get_torrent_state, METH_VARARGS, "."}, + {"pop_event", torrent_pop_event, METH_VARARGS, "."}, + {"get_session_info", torrent_get_session_info, METH_VARARGS, "."}, + {"get_peer_info", torrent_get_peer_info, METH_VARARGS, "."}, + {"get_file_info", torrent_get_file_info, METH_VARARGS, "."}, + {"dump_file_info", torrent_dump_file_info, METH_VARARGS, "."}, + {"constants", torrent_constants, METH_VARARGS, "."}, + {"start_DHT", torrent_start_DHT, METH_VARARGS, "."}, + {"stop_DHT", torrent_stop_DHT, METH_VARARGS, "."}, + {"get_DHT_info", torrent_get_DHT_info, METH_VARARGS, "."}, + {"create_torrent", torrent_create_torrent, METH_VARARGS, "."}, + {"reset_IP_filter", torrent_reset_IP_filter, METH_VARARGS, "."}, + {"add_range_to_IP_filter", torrent_add_range_to_IP_filter, METH_VARARGS, "."}, + {"set_IP_filter", torrent_set_IP_filter, METH_VARARGS, "."}, + {"use_upnp", torrent_use_upnp, METH_VARARGS, "."}, + {"use_natpmp", torrent_use_natpmp, METH_VARARGS, "."}, + {"use_utpex", torrent_use_utpex, METH_VARARGS, "."}, + {"set_ratio", torrent_set_ratio, METH_VARARGS, "."}, + {"proxy_settings", torrent_proxy_settings, METH_VARARGS, "."}, + {"get_trackers", torrent_get_trackers, METH_VARARGS, "."}, + {"dump_trackers", torrent_dump_trackers, METH_VARARGS, "."}, + {"replace_trackers", torrent_replace_trackers, METH_VARARGS, "."}, + {"prioritize_files", torrent_prioritize_files, METH_VARARGS, "."}, + {"prioritize_first_last_pieces", torrent_prioritize_first_last_pieces, METH_VARARGS, "."}, + {"set_priv", torrent_set_priv, METH_VARARGS, "."}, + {"test_duplicate", torrent_test_duplicate, METH_VARARGS, "."}, + {"has_piece", torrent_has_piece, METH_VARARGS, "."}, + {"get_piece_info", torrent_get_piece_info, METH_VARARGS, "."}, + {"get_all_piece_info", torrent_get_all_piece_info, METH_VARARGS, "."}, + {"get_file_piece_range", torrent_get_file_piece_range, METH_VARARGS, "."}, {NULL} }; diff --git a/src/dialogs.py b/src/dialogs.py index 9be68f309..d5756dd62 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -95,9 +95,11 @@ class PreferencesDlg: self.glade.get_widget("spin_port_min").set_value(self.preferences.get("listen_on")[0]) self.glade.get_widget("spin_port_max").set_value(self.preferences.get("listen_on")[1]) self.glade.get_widget("spin_max_upload").set_value(self.preferences.get("max_upload_speed")) - self.glade.get_widget("spin_num_upload").set_value(float(self.preferences.get("max_number_uploads"))) + self.glade.get_widget("spin_max_upload_slots_global").set_value(float(self.preferences.get("max_upload_slots_global"))) + self.glade.get_widget("spin_max_upload_slots_per_torrent").set_value(float(self.preferences.get("max_upload_slots_per_torrent"))) self.glade.get_widget("spin_max_download").set_value(self.preferences.get("max_download_speed")) - self.glade.get_widget("spin_max_connections").set_value(self.preferences.get("max_connections")) + self.glade.get_widget("spin_max_connections_global").set_value(self.preferences.get("max_connections_global")) + self.glade.get_widget("spin_max_connections_per_torrent").set_value(self.preferences.get("max_connections_per_torrent")) self.glade.get_widget("spin_peer_proxy_port").set_value(self.preferences.get("peer_proxy_port")) self.glade.get_widget("spin_tracker_proxy_port").set_value(self.preferences.get("tracker_proxy_port")) self.glade.get_widget("spin_dht_proxy_port").set_value(self.preferences.get("dht_proxy_port")) @@ -199,13 +201,15 @@ class PreferencesDlg: self.preferences.set("use_compact_storage", self.glade.get_widget("chk_compact").get_active()) self.preferences.set("listen_on", [self.glade.get_widget("spin_port_min").get_value(), self.glade.get_widget("spin_port_max").get_value()]) self.preferences.set("max_upload_speed", self.glade.get_widget("spin_max_upload").get_value()) - self.preferences.set("max_number_uploads", int(self.glade.get_widget("spin_num_upload").get_value())) + self.preferences.set("max_upload_slots_global", int(self.glade.get_widget("spin_max_upload_slots_global").get_value())) + self.preferences.set("max_upload_slots_per_torrent", int(self.glade.get_widget("spin_max_upload_slots_per_torrent").get_value())) self.preferences.set("max_download_speed", self.glade.get_widget("spin_max_download").get_value()) self.preferences.set("peer_proxy_port", self.glade.get_widget("spin_peer_proxy_port").get_value()) self.preferences.set("dht_proxy_port", self.glade.get_widget("spin_dht_proxy_port").get_value()) self.preferences.set("web_proxy_port", self.glade.get_widget("spin_web_proxy_port").get_value()) self.preferences.set("tracker_proxy_port", self.glade.get_widget("spin_tracker_proxy_port").get_value()) - self.preferences.set("max_connections", int(self.glade.get_widget("spin_max_connections").get_value())) + self.preferences.set("max_connections_global", int(self.glade.get_widget("spin_max_connections_global").get_value())) + self.preferences.set("max_connections_per_torrent", int(self.glade.get_widget("spin_max_connections_per_torrent").get_value())) self.preferences.set("max_active_torrents", int(self.glade.get_widget("spin_torrents").get_value())) self.preferences.set("queue_seeds_to_bottom", self.glade.get_widget("chk_seedbottom").get_active()) self.preferences.set("enable_dht", self.glade.get_widget("chk_dht").get_active()) diff --git a/src/interface.py b/src/interface.py index f83839ff7..5d8d0a982 100644 --- a/src/interface.py +++ b/src/interface.py @@ -943,10 +943,10 @@ class DelugeGTK: def update_statusbar_and_tray(self): core_state = self.manager.get_state() connections = core_state['num_peers'] - if self.config.get("max_connections") < 0 : + if self.config.get("max_connections_global") < 0 : max_connections = _("Unlimited") else: - max_connections = int(self.config.get("max_connections")) + max_connections = int(self.config.get("max_connections_global")) dlspeed = common.fspeed(core_state['download_rate']) ulspeed = common.fspeed(core_state['upload_rate']) dltotal = common.fsize(core_state['total_downloaded']) diff --git a/src/pref.py b/src/pref.py index 860f6e383..4706f94b7 100644 --- a/src/pref.py +++ b/src/pref.py @@ -62,10 +62,12 @@ DEFAULT_PREFS = { "listen_on" : [6881,6889], "lock_tray" : False, "max_active_torrents" : 8, - "max_connections" : 200, + "max_connections_global" : 200, + "max_connections_per_torrent" : -1, "max_download_speed" : -1, "max_download_speed_bps": -1, - "max_number_uploads" : 10, + "max_upload_slots_global" : 15, + "max_upload_slots_per_torrent" : -1, "max_upload_speed" : -1, "max_upload_speed_bps" : -1, "pref_rc4" : True,