add preference for torrent files location
This commit is contained in:
parent
91d8ad33ae
commit
580d2a2e84
|
@ -1,6 +1,7 @@
|
||||||
Deluge 0.5.7 (xx November 2007)
|
Deluge 0.5.7 (xx November 2007)
|
||||||
* Blocklist plugin will now display errors, instead of just crashing on a bad
|
* Blocklist plugin will now display errors, instead of just crashing on a bad
|
||||||
list
|
list
|
||||||
|
* Add preference for the location of torrent files
|
||||||
|
|
||||||
Deluge 0.5.6.2 (31 October 2007)
|
Deluge 0.5.6.2 (31 October 2007)
|
||||||
* Set default piece size to 256-KiB in TorrentCreator plugin and add 2048KiB
|
* Set default piece size to 256-KiB in TorrentCreator plugin and add 2048KiB
|
||||||
|
|
7
TODO
7
TODO
|
@ -1,5 +1,4 @@
|
||||||
for 0.5.7
|
for 0.5.7
|
||||||
1. manual recheck
|
* manual recheck
|
||||||
2. preference for .torrent location
|
* add auto-pickup folder
|
||||||
4. add auto-pickup folder
|
* remap filenames
|
||||||
5. remap filenames
|
|
||||||
|
|
|
@ -98,6 +98,43 @@
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkTable" id="table10">
|
||||||
|
<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="n_rows">1</property>
|
||||||
|
<property name="n_columns">2</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label38">
|
||||||
|
<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="label" translatable="yes">Store all torrent files in:</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkAlignment" id="alignment32">
|
||||||
|
<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">15</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkFileChooserButton" id="torrent_path_button">
|
||||||
|
<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="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
|
||||||
|
<property name="title" translatable="yes">Select A Folder</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
25
src/core.py
25
src/core.py
|
@ -190,10 +190,17 @@ class Manager:
|
||||||
# completely fresh. When quitting, the old files will be overwritten
|
# completely fresh. When quitting, the old files will be overwritten
|
||||||
def __init__(self, client_ID, version, user_agent, base_dir, blank_slate=False):
|
def __init__(self, client_ID, version, user_agent, base_dir, blank_slate=False):
|
||||||
self.base_dir = base_dir
|
self.base_dir = base_dir
|
||||||
|
# Keeps track of DHT running state
|
||||||
|
self.dht_running = False
|
||||||
|
|
||||||
|
# Load the preferences
|
||||||
|
self.config = pref.Preferences(os.path.join(self.base_dir, PREFS_FILENAME))
|
||||||
|
|
||||||
|
TORRENTS_SUBDIR = self.config.get("default_torrent_path")
|
||||||
|
|
||||||
# Ensure directories exist
|
# Ensure directories exist
|
||||||
if not TORRENTS_SUBDIR in os.listdir(self.base_dir):
|
if not os.path.exists(TORRENTS_SUBDIR):
|
||||||
os.mkdir(os.path.join(self.base_dir, TORRENTS_SUBDIR))
|
os.mkdir(TORRENTS_SUBDIR)
|
||||||
|
|
||||||
# Pre-initialize the core's data structures
|
# Pre-initialize the core's data structures
|
||||||
deluge_core.pre_init(DelugeError,
|
deluge_core.pre_init(DelugeError,
|
||||||
|
@ -233,16 +240,10 @@ class Manager:
|
||||||
# manner.
|
# manner.
|
||||||
self.cached_core_torrent_file_infos = \
|
self.cached_core_torrent_file_infos = \
|
||||||
cached_data(deluge_core.get_file_info)
|
cached_data(deluge_core.get_file_info)
|
||||||
|
|
||||||
# Keeps track of DHT running state
|
|
||||||
self.dht_running = False
|
|
||||||
|
|
||||||
# Load the preferences
|
|
||||||
self.config = pref.Preferences(os.path.join(self.base_dir, PREFS_FILENAME))
|
|
||||||
|
|
||||||
# Apply preferences. Note that this is before any torrents are added
|
# Apply preferences. Note that this is before any torrents are added
|
||||||
self.apply_prefs()
|
self.apply_prefs()
|
||||||
|
|
||||||
# Event callbacks for use with plugins
|
# Event callbacks for use with plugins
|
||||||
self.event_callbacks = {}
|
self.event_callbacks = {}
|
||||||
|
|
||||||
|
@ -368,10 +369,10 @@ class Manager:
|
||||||
# A function to try and reload a torrent from a previous session. This is
|
# A function to try and reload a torrent from a previous session. This is
|
||||||
# used in the event that Deluge crashes and a blank state is loaded.
|
# used in the event that Deluge crashes and a blank state is loaded.
|
||||||
def add_old_torrent(self, filename, save_dir, compact):
|
def add_old_torrent(self, filename, save_dir, compact):
|
||||||
if not filename in os.listdir(os.path.join(self.base_dir, TORRENTS_SUBDIR)):
|
if not filename in os.listdir(self.config.get("default_torrent_path")):
|
||||||
raise InvalidTorrentError(_("File was not found") + ": " + filename)
|
raise InvalidTorrentError(_("File was not found") + ": " + filename)
|
||||||
|
|
||||||
full_new_name = os.path.join(self.base_dir, TORRENTS_SUBDIR, filename)
|
full_new_name = os.path.join(self.config.get("default_torrent_path"), filename)
|
||||||
|
|
||||||
# Create torrent object
|
# Create torrent object
|
||||||
new_torrent = torrent_info(full_new_name, save_dir, compact)
|
new_torrent = torrent_info(full_new_name, save_dir, compact)
|
||||||
|
@ -801,7 +802,7 @@ class Manager:
|
||||||
# if filename_short in os.listdir(self.base_dir + "/" + TORRENTS_SUBDIR):
|
# if filename_short in os.listdir(self.base_dir + "/" + TORRENTS_SUBDIR):
|
||||||
# raise DuplicateTorrentError("Duplicate Torrent, it appears: " + filename_short)
|
# raise DuplicateTorrentError("Duplicate Torrent, it appears: " + filename_short)
|
||||||
|
|
||||||
full_new_name = os.path.join(self.base_dir, TORRENTS_SUBDIR, filename_short)
|
full_new_name = os.path.join(self.config.get("default_torrent_path"), filename_short)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
shutil.copy(filename, full_new_name)
|
shutil.copy(filename, full_new_name)
|
||||||
|
|
|
@ -121,6 +121,7 @@ class PreferencesDlg:
|
||||||
self.glade.get_widget("txt_web_proxy_username").set_text(self.preferences.get("web_proxy_username"))
|
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("txt_web_proxy_password").set_text(self.preferences.get("web_proxy_password"))
|
||||||
self.glade.get_widget("download_path_button").set_filename(self.preferences.get("default_download_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"))
|
self.glade.get_widget("chk_enable_files_dialog").set_active(self.preferences.get("enable_files_dialog"))
|
||||||
self.glade.get_widget("chk_prioritize_first_last_pieces").set_active(self.preferences.get("prioritize_first_last_pieces"))
|
self.glade.get_widget("chk_prioritize_first_last_pieces").set_active(self.preferences.get("prioritize_first_last_pieces"))
|
||||||
self.glade.get_widget("radio_compact_allocation").set_active(self.preferences.get("use_compact_storage"))
|
self.glade.get_widget("radio_compact_allocation").set_active(self.preferences.get("use_compact_storage"))
|
||||||
|
@ -238,6 +239,7 @@ class PreferencesDlg:
|
||||||
self.preferences.set("peer_proxy_hostname", self.glade.get_widget("txt_peer_proxy_hostname").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("use_default_dir", self.glade.get_widget("radio_save_all_to").get_active())
|
||||||
self.preferences.set("default_download_path", self.glade.get_widget("download_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())
|
self.preferences.set("enable_files_dialog", self.glade.get_widget("chk_enable_files_dialog").get_active())
|
||||||
self.preferences.set("prioritize_first_last_pieces", self.glade.get_widget("chk_prioritize_first_last_pieces").get_active())
|
self.preferences.set("prioritize_first_last_pieces", self.glade.get_widget("chk_prioritize_first_last_pieces").get_active())
|
||||||
self.preferences.set("auto_end_seeding", self.glade.get_widget("chk_autoseed").get_active())
|
self.preferences.set("auto_end_seeding", self.glade.get_widget("chk_autoseed").get_active())
|
||||||
|
|
111
src/pref.py
111
src/pref.py
|
@ -37,8 +37,10 @@
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
import common
|
import common
|
||||||
import os.path
|
import os.path
|
||||||
|
import xdg
|
||||||
|
|
||||||
DEFAULT_PREFS = {
|
if common.windows_check():
|
||||||
|
DEFAULT_PREFS = {
|
||||||
"enabled_plugins" : "Torrent Files:Torrent Peers",
|
"enabled_plugins" : "Torrent Files:Torrent Peers",
|
||||||
"file_manager" : common.FileManager.xdg,
|
"file_manager" : common.FileManager.xdg,
|
||||||
"open_folder_stock" : True,
|
"open_folder_stock" : True,
|
||||||
|
@ -50,6 +52,113 @@ DEFAULT_PREFS = {
|
||||||
"enable_files_dialog" : False,
|
"enable_files_dialog" : False,
|
||||||
"queue_above_completed" : False,
|
"queue_above_completed" : False,
|
||||||
"clear_max_ratio_torrents" : False,
|
"clear_max_ratio_torrents" : False,
|
||||||
|
"default_torrent_path" : os.path.join(os.path.expanduser("~"), 'deluge', 'torrentfiles'),
|
||||||
|
"default_download_path" : os.path.expanduser("~"),
|
||||||
|
"open_torrent_dialog_path" : os.path.expanduser("~"),
|
||||||
|
"choose_directory_dialog_path": os.path.expanduser("~"),
|
||||||
|
"enable_dht" : True,
|
||||||
|
"enable_system_tray" : True,
|
||||||
|
"enabled_plugins" : "Torrent Files:Torrent Peers",
|
||||||
|
"encin_state" : common.EncState.enabled,
|
||||||
|
"encout_state" : common.EncState.enabled,
|
||||||
|
"enclevel_type" : common.EncLevel.both,
|
||||||
|
"end_seed_ratio" : 0.0,
|
||||||
|
"gui_update_interval" : 1.0,
|
||||||
|
"listen_on" : [6881,6889],
|
||||||
|
"lock_tray" : False,
|
||||||
|
"max_half_open" : 8,
|
||||||
|
"max_active_torrents" : 8,
|
||||||
|
"max_connections_global" : 200,
|
||||||
|
"max_connections_per_torrent" : -1,
|
||||||
|
"max_download_speed" : -1,
|
||||||
|
"max_download_speed_bps": -1,
|
||||||
|
"max_upload_slots_global" : 4,
|
||||||
|
"max_upload_slots_per_torrent" : -1,
|
||||||
|
"max_upload_speed" : -1,
|
||||||
|
"max_upload_speed_bps" : -1,
|
||||||
|
"pref_rc4" : True,
|
||||||
|
"prioritize_first_last_pieces" : False,
|
||||||
|
"web_proxy_type" : common.ProxyType.none,
|
||||||
|
"peer_proxy_type" : common.ProxyType.none,
|
||||||
|
"dht_proxy_type" : common.ProxyType.none,
|
||||||
|
"tracker_proxy_type" : common.ProxyType.none,
|
||||||
|
"peer_proxy" : False,
|
||||||
|
"tracker_proxy" : False,
|
||||||
|
"dht_proxy" : False,
|
||||||
|
"peer_proxy_hostname" : "",
|
||||||
|
"peer_proxy_username" : "",
|
||||||
|
"peer_proxy_password" : "",
|
||||||
|
"peer_proxy_port": 8080,
|
||||||
|
"dht_proxy_hostname" : "",
|
||||||
|
"dht_proxy_username" : "",
|
||||||
|
"dht_proxy_password" : "",
|
||||||
|
"dht_proxy_port": 8080,
|
||||||
|
"web_proxy_hostname" : "",
|
||||||
|
"web_proxy_username" : "",
|
||||||
|
"web_proxy_password" : "",
|
||||||
|
"web_proxy_port": 8080,
|
||||||
|
"tracker_proxy_hostname" : "",
|
||||||
|
"tracker_proxy_username" : "",
|
||||||
|
"tracker_proxy_password" : "",
|
||||||
|
"tracker_proxy_port": 8080,
|
||||||
|
"queue_seeds_to_bottom" : False,
|
||||||
|
"random_port" : False,
|
||||||
|
"show_availability" : True,
|
||||||
|
"show_dl" : True,
|
||||||
|
"show_eta" : True,
|
||||||
|
"show_infopane" : True,
|
||||||
|
"show_peers" : True,
|
||||||
|
"show_seeders" : True,
|
||||||
|
"show_share" : True,
|
||||||
|
"show_size" : True,
|
||||||
|
"show_status" : True,
|
||||||
|
"show_toolbar" : True,
|
||||||
|
"show_ul" : True,
|
||||||
|
"start_in_tray" : False,
|
||||||
|
"tray_downloadspeedlist" : [5.0, 10.0, 30.0, 80.0, 300.0],
|
||||||
|
"tray_passwd" : "",
|
||||||
|
"tray_uploadspeedlist" : [5.0, 10.0, 30.0, 80.0, 300.0],
|
||||||
|
"use_compact_storage" : False,
|
||||||
|
"use_default_dir" : False,
|
||||||
|
"use_natpmp" : False,
|
||||||
|
"use_upnp" : True,
|
||||||
|
"use_utpex" : True,
|
||||||
|
"new_releases" : True,
|
||||||
|
"window_height" : 480,
|
||||||
|
"window_maximized" : False,
|
||||||
|
"window_pane_position" : -1,
|
||||||
|
"window_width" : 640,
|
||||||
|
"window_x_pos" : 0,
|
||||||
|
"window_y_pos" : 0,
|
||||||
|
"availability_width" : 50,
|
||||||
|
"queue_width" : 40,
|
||||||
|
"name_width" : 175,
|
||||||
|
"dl_width" : 110,
|
||||||
|
"ul_width" : 110,
|
||||||
|
"eta_width" : 65,
|
||||||
|
"peer_width" : 85,
|
||||||
|
"seed_width" : 85,
|
||||||
|
"share_width" : 60,
|
||||||
|
"size_width" : 71,
|
||||||
|
"status_width" : 150,
|
||||||
|
"filename_f_width" : 220,
|
||||||
|
"size_f_width" : 90,
|
||||||
|
"priority_f_width" : 140
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
DEFAULT_PREFS = {
|
||||||
|
"enabled_plugins" : "Torrent Files:Torrent Peers",
|
||||||
|
"file_manager" : common.FileManager.xdg,
|
||||||
|
"open_folder_stock" : True,
|
||||||
|
"open_folder_location": "",
|
||||||
|
"send_info" : True,
|
||||||
|
"auto_end_seeding" : False,
|
||||||
|
"auto_seed_ratio" : 0,
|
||||||
|
"close_to_tray" : False,
|
||||||
|
"enable_files_dialog" : False,
|
||||||
|
"queue_above_completed" : False,
|
||||||
|
"clear_max_ratio_torrents" : False,
|
||||||
|
"default_torrent_path" : os.path.join(xdg.BaseDirectory.save_config_path('deluge'), 'torrentfiles'),
|
||||||
"default_download_path" : os.path.expanduser("~"),
|
"default_download_path" : os.path.expanduser("~"),
|
||||||
"open_torrent_dialog_path" : os.path.expanduser("~"),
|
"open_torrent_dialog_path" : os.path.expanduser("~"),
|
||||||
"choose_directory_dialog_path": os.path.expanduser("~"),
|
"choose_directory_dialog_path": os.path.expanduser("~"),
|
||||||
|
|
Loading…
Reference in New Issue