Add separate preference for max downloading torrents and max seeding torrents

This commit is contained in:
Marcos Pinto 2007-11-10 02:46:27 +00:00
parent b645417689
commit 6da46bc546
5 changed files with 93 additions and 23 deletions

1
TODO
View File

@ -1,4 +1,3 @@
for 0.5.7
* remap filenames
* decide what to do about the progress bar patch
* distinguish between total seeding torrents and total active torrents

View File

@ -245,23 +245,29 @@
<property name="visible">True</property>
<property name="tooltip" translatable="yes">The number of active torrents that Deluge will run. Set to -1 for unlimited.</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum simultaneous active torrents:</property>
<property name="label" translatable="yes">Maximum simultaneous downloading torrents:</property>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_torrents">
<widget class="GtkAlignment" id="alignment35">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The number of active torrents that Deluge will run. Set to -1 for unlimited.</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 1000 1 10 10</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="update_policy">GTK_UPDATE_IF_VALID</property>
<child>
<widget class="GtkSpinButton" id="spin_torrents">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The number of active torrents that Deluge will run. Set to -1 for unlimited.</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 1000 1 10 10</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="update_policy">GTK_UPDATE_IF_VALID</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
@ -271,6 +277,51 @@
</child>
</widget>
</child>
<child>
<widget class="GtkHBox" id="hbox11">
<property name="visible">True</property>
<property name="spacing">10</property>
<child>
<widget class="GtkLabel" id="label56">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">The number of active torrents that Deluge will run. Set to -1 for unlimited.</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum simultaneous seeding torrents:</property>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment35">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="left_padding">32</property>
<child>
<widget class="GtkSpinButton" id="spin_seed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The number of active torrents that Deluge will run. Set to -1 for unlimited.</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 1000 1 10 10</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="update_policy">GTK_UPDATE_IF_VALID</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">2</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_enable_files_dialog">
<property name="visible">True</property>
@ -283,7 +334,7 @@
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
@ -298,7 +349,7 @@
</widget>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
</widget>
@ -878,11 +929,18 @@ Forced</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="combo_enclevel">
<widget class="GtkAlignment" id="alignment37">
<property name="visible">True</property>
<property name="items" translatable="yes">Handshake
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="left_padding">7</property>
<child>
<widget class="GtkComboBox" id="combo_enclevel">
<property name="visible">True</property>
<property name="items" translatable="yes">Handshake
Full Stream
Either</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">6</property>
@ -1252,6 +1310,7 @@ Either</property>
<property name="xalign">1</property>
<property name="adjustment">0 -1 9000 1 10 10</property>
<property name="climb_rate">1</property>
<property name="digits">1</property>
</widget>
<packing>
<property name="left_attach">1</property>
@ -1269,6 +1328,7 @@ Either</property>
<property name="xalign">1</property>
<property name="adjustment">0 -1 9000 1 10 10</property>
<property name="climb_rate">1</property>
<property name="digits">1</property>
</widget>
<packing>
<property name="left_attach">1</property>

View File

@ -505,6 +505,7 @@ class Manager:
# but having self.is_user_paused(unique_ID) == False is
# also considered active.
active_torrent_cnt = 0
seed_torrent_cnt = 0
# Pause and resume torrents
for torrent in self.state.queue:
@ -516,17 +517,22 @@ class Manager:
if not torrent_state['is_paused'] or \
(torrent_state['is_paused'] and not \
self.is_user_paused(unique_ID)):
self.is_user_paused(unique_ID)) and not torrent_state['is_seed']:
active_torrent_cnt += 1
if torrent_state['is_seed'] and not self.is_user_paused(unique_ID):
seed_torrent_cnt += 1
if (seed_torrent_cnt <= self.get_pref('max_seeding_torrents')) or (self.get_pref('max_seeding_torrents') == -1):
self.resume(unique_ID)
if (seed_torrent_cnt > self.get_pref('max_seeding_torrents')) and (self.get_pref('max_seeding_torrents') != -1):
self.pause(unique_ID)
if (active_torrent_cnt <= self.get_pref('max_active_torrents') or \
self.get_pref('max_active_torrents') == -1) and \
torrent_state['is_paused'] and not \
self.is_user_paused(unique_ID):
# This torrent is a seed so skip all the free space checking
if torrent_state['is_seed']:
self.resume(unique_ID)
continue
self.is_user_paused(unique_ID) and not torrent_state['is_seed']:
# Before we resume, we should check if the torrent is using Full Allocation
# and if there is enough space on to finish this file.
@ -547,10 +553,11 @@ of HD space! Oops!\nWe had to pause at least one torrent"))
print "Not enough free space to resume this torrent!"
else: #We're using compact allocation so lets just resume
self.resume(unique_ID)
elif not torrent_state['is_paused'] and \
((active_torrent_cnt > self.get_pref('max_active_torrents') and \
self.get_pref('max_active_torrents') != -1) or \
self.is_user_paused(unique_ID)):
self.is_user_paused(unique_ID)) and not torrent_state['is_seed']:
self.pause(unique_ID)
# Handle autoseeding - downqueue as needed

View File

@ -144,6 +144,7 @@ class PreferencesDlg:
self.glade.get_widget("spin_web_proxy_port").set_value(self.preferences.get("web_proxy_port"))
self.glade.get_widget("spin_max_half_open").set_value(float(self.preferences.get("max_half_open")))
self.glade.get_widget("spin_torrents").set_value(float(self.preferences.get("max_active_torrents")))
self.glade.get_widget("spin_seed").set_value(float(self.preferences.get("max_seeding_torrents")))
self.glade.get_widget("chk_seedbottom").set_active(self.preferences.get("queue_seeds_to_bottom"))
self.glade.get_widget("chk_queue_above_completed").set_sensitive(self.preferences.get("queue_seeds_to_bottom"))
self.glade.get_widget("chk_queue_above_completed").set_active(self.preferences.get("queue_above_completed"))
@ -264,6 +265,7 @@ class PreferencesDlg:
self.preferences.set("max_connections_per_torrent", int(self.glade.get_widget("spin_max_connections_per_torrent").get_value()))
self.preferences.set("max_half_open", int(self.glade.get_widget("spin_max_half_open").get_value()))
self.preferences.set("max_active_torrents", int(self.glade.get_widget("spin_torrents").get_value()))
self.preferences.set("max_seeding_torrents", int(self.glade.get_widget("spin_seed").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())
self.preferences.set("gui_update_interval", self.glade.get_widget("spin_gui").get_value())

View File

@ -70,6 +70,7 @@ if common.windows_check():
"lock_tray" : False,
"max_half_open" : 8,
"max_active_torrents" : 8,
"max_seeding_torrents" : 8,
"max_connections_global" : 200,
"max_connections_per_torrent" : -1,
"max_download_speed" : -1,
@ -179,6 +180,7 @@ else:
"lock_tray" : False,
"max_half_open" : 8,
"max_active_torrents" : 8,
"max_seeding_torrents" : 8,
"max_connections_global" : 200,
"max_connections_per_torrent" : -1,
"max_download_speed" : -1,