diff --git a/ChangeLog b/ChangeLog
index cd6fc14c5..4a7762b16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@ Deluge 0.5.7 (xx November 2007)
* Blocklist plugin will now display errors, instead of just crashing on a bad
list
* Add preference for the location of torrent files
+ * Add autoload folder
Deluge 0.5.6.2 (31 October 2007)
* Set default piece size to 256-KiB in TorrentCreator plugin and add 2048KiB
diff --git a/TODO b/TODO
index 6e3152c62..0a287efaf 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,3 @@
for 0.5.7
* manual recheck
- * add auto-pickup folder
* remap filenames
diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade
index 2d88b00cc..f53303e95 100644
--- a/glade/preferences_dialog.glade
+++ b/glade/preferences_dialog.glade
@@ -156,6 +156,73 @@
2
+
+
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ GTK_SHADOW_NONE
+
+
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ 12
+
+
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ 1
+ 2
+
+
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ Autoload all torrent files in:
+ 0
+ True
+
+
+
+
+ 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
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
+ Select A Folder
+
+
+
+
+ 1
+ 2
+
+
+
+
+
+
+
+
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ <b>Autoload</b>
+ True
+
+
+ label_item
+
+
+
+
+ False
+ False
+ 2
+ 1
+
+
True
@@ -253,7 +320,7 @@
False
False
2
- 1
+ 2
@@ -335,7 +402,7 @@
False
False
2
- 2
+ 3
diff --git a/src/core.py b/src/core.py
index ae1f38552..2ae3c5e0d 100644
--- a/src/core.py
+++ b/src/core.py
@@ -396,19 +396,6 @@ class Manager:
pass
deluge_core.save_fastresume(uid, self.unique_IDs[uid].filename)
- # Load all NEW torrents in a . The GUI can call this every minute or so,
- # if one wants a directory to be 'watched' (personally, I think it should only be
- # done on user command).os.path.join(
- def autoload_directory(self, directory, save_dir, compact):
- for filename in os.listdir(directory):
- if filename[-len(".torrent"):].lower() == ".torrent":
- try:
- self.add_torrent_ns(self, filename, save_dir, compact)
- except DuplicateTorrentError:
- pass
-
- self.sync()
-
# State retrieval functions
def get_state(self):
@@ -845,11 +832,10 @@ class Manager:
unique_ID = deluge_core.add_torrent(torrent.filename,
torrent.save_dir,
torrent.compact)
- except DelugeError, e:
- print "Error:", e
+ except:
+ print "Error probably bad torrent"
del self.state.torrents[torrent]
raise e
-# print "Got unique ID:", unique_ID
ret = unique_ID
self.unique_IDs[unique_ID] = torrent
diff --git a/src/dialogs.py b/src/dialogs.py
index 9ac27aa36..de5aae3d7 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -93,6 +93,7 @@ class PreferencesDlg:
self.glade.get_widget("combo_dht_proxy_type").set_active(self.preferences.get("dht_proxy_type"))
self.glade.get_widget("combo_tracker_proxy_type").set_active(self.preferences.get("tracker_proxy_type"))
self.glade.get_widget("combo_web_proxy_type").set_active(self.preferences.get("web_proxy_type"))
+ self.glade.get_widget("chk_autoload").set_active(self.preferences.get("autoload"))
self.glade.get_widget("chk_send_info").set_active(self.preferences.get("send_info"))
self.glade.get_widget("chk_pref_rc4").set_active(self.preferences.get("pref_rc4"))
self.glade.get_widget("chk_peer_proxy").set_active(self.preferences.get("peer_proxy"))
@@ -120,6 +121,7 @@ class PreferencesDlg:
self.glade.get_widget("txt_web_proxy_hostname").set_text(self.preferences.get("web_proxy_hostname"))
self.glade.get_widget("txt_web_proxy_username").set_text(self.preferences.get("web_proxy_username"))
self.glade.get_widget("txt_web_proxy_password").set_text(self.preferences.get("web_proxy_password"))
+ self.glade.get_widget("autoload_path_button").set_filename(self.preferences.get("default_autoload_path"))
self.glade.get_widget("download_path_button").set_filename(self.preferences.get("default_download_path"))
self.glade.get_widget("torrent_path_button").set_filename(self.preferences.get("default_torrent_path"))
self.glade.get_widget("chk_enable_files_dialog").set_active(self.preferences.get("enable_files_dialog"))
@@ -202,6 +204,7 @@ class PreferencesDlg:
self.preferences.set("encout_state", self.glade.get_widget("combo_encout").get_active())
self.preferences.set("enclevel_type", self.glade.get_widget("combo_enclevel").get_active())
self.preferences.set("peer_proxy_type", self.glade.get_widget("combo_peer_proxy_type").get_active())
+ self.preferences.set("autoload", self.glade.get_widget("chk_autoload").get_active())
self.preferences.set("send_info", self.glade.get_widget("chk_send_info").get_active())
self.preferences.set("pref_rc4", self.glade.get_widget("chk_pref_rc4").get_active())
self.preferences.set("peer_proxy", self.glade.get_widget("chk_peer_proxy").get_active())
@@ -238,6 +241,7 @@ class PreferencesDlg:
self.preferences.set("peer_proxy_password", self.glade.get_widget("txt_peer_proxy_password").get_text())
self.preferences.set("peer_proxy_hostname", self.glade.get_widget("txt_peer_proxy_hostname").get_text())
self.preferences.set("use_default_dir", self.glade.get_widget("radio_save_all_to").get_active())
+ self.preferences.set("default_autoload_path", self.glade.get_widget("autoload_path_button").get_filename())
self.preferences.set("default_download_path", self.glade.get_widget("download_path_button").get_filename())
self.preferences.set("default_torrent_path", self.glade.get_widget("torrent_path_button").get_filename())
self.preferences.set("enable_files_dialog", self.glade.get_widget("chk_enable_files_dialog").get_active())
@@ -322,6 +326,8 @@ class PreferencesDlg:
value = widget.get_active()
if widget == self.glade.get_widget('radio_save_all_to'):
self.glade.get_widget('download_path_button').set_sensitive(value)
+ self.glade.get_widget('autoload_path_button').set_sensitive(value)
+ self.glade.get_widget('chk_autoload').set_sensitive(value)
elif widget == self.glade.get_widget('chk_autoseed'):
self.glade.get_widget('ratio_spinner').set_sensitive(value)
self.glade.get_widget('chk_clear_max_ratio_torrents').set_sensitive(value)
diff --git a/src/interface.py b/src/interface.py
index baee085e5..c18c98e4a 100644
--- a/src/interface.py
+++ b/src/interface.py
@@ -986,6 +986,17 @@ window, please enter your password"))
## Call via a timer to update the interface
def update(self):
+ if self.config.get("autoload") and self.config.get("default_autoload_path"):
+ for filename in os.listdir(self.config.get("default_autoload_path")):
+ if filename[-len(".torrent"):].lower() == ".torrent":
+ try:
+ self.interactive_add_torrent_path(os.path.join(\
+ self.config.get("default_autoload_path"), filename), \
+ self.config.get("default_download_path"))
+ os.remove(os.path.join(self.config.get("default_autoload_path"), filename))
+ except:
+ pass
+
# We need to apply the queue changes
self.manager.apply_queue()
diff --git a/src/pref.py b/src/pref.py
index 48d2ccec2..2ab77f9d1 100644
--- a/src/pref.py
+++ b/src/pref.py
@@ -44,6 +44,7 @@ if common.windows_check():
"enabled_plugins" : "Torrent Files:Torrent Peers",
"file_manager" : common.FileManager.xdg,
"open_folder_stock" : True,
+ "autoload" : False,
"open_folder_location": "",
"send_info" : True,
"auto_end_seeding" : False,
@@ -52,6 +53,7 @@ if common.windows_check():
"enable_files_dialog" : False,
"queue_above_completed" : False,
"clear_max_ratio_torrents" : False,
+ "default_autoload_path" : os.path.expanduser("~"),
"default_torrent_path" : os.path.join(os.path.expanduser("~"), 'deluge', 'torrentfiles'),
"default_download_path" : os.path.expanduser("~"),
"open_torrent_dialog_path" : os.path.expanduser("~"),
@@ -150,6 +152,7 @@ else:
"enabled_plugins" : "Torrent Files:Torrent Peers",
"file_manager" : common.FileManager.xdg,
"open_folder_stock" : True,
+ "autoload" : False,
"open_folder_location": "",
"send_info" : True,
"auto_end_seeding" : False,
@@ -158,6 +161,7 @@ else:
"enable_files_dialog" : False,
"queue_above_completed" : False,
"clear_max_ratio_torrents" : False,
+ "default_autoload_path" : os.path.expanduser("~"),
"default_torrent_path" : os.path.join(xdg.BaseDirectory.save_config_path('deluge'), 'torrentfiles'),
"default_download_path" : os.path.expanduser("~"),
"open_torrent_dialog_path" : os.path.expanduser("~"),