Compare commits
143 Commits
deluge-1.0
...
deluge-1.0
Author | SHA1 | Date | |
---|---|---|---|
f59e4ced7a | |||
e80fe4584a | |||
2dcc3368b0 | |||
ad252697bc | |||
e38ce4fb20 | |||
f7d6dcb425 | |||
d35de1986b | |||
b18f1cddbc | |||
00cf7a8f34 | |||
1afef3425f | |||
18cc95933a | |||
aeb6b96987 | |||
318b81f62b | |||
14e34c8f03 | |||
cfec86be75 | |||
0fe3d4d1af | |||
f42564b1aa | |||
ae1ac12ff8 | |||
b96833d92c | |||
49ea917368 | |||
0aacfca848 | |||
ebd6229c77 | |||
fb0d46fefe | |||
964c5fbc4f | |||
b70aabd129 | |||
0f73da5a6a | |||
8a2d110ef6 | |||
eefa2f49a0 | |||
1f94e7db20 | |||
ce54df008a | |||
88346a5722 | |||
98f65f13cf | |||
d880cfa8d2 | |||
f9d30b7071 | |||
80ab83b363 | |||
bb4927d513 | |||
2f64f74325 | |||
442a42a1e2 | |||
342ddbe4ad | |||
9601ca2f86 | |||
e0356b7f10 | |||
9698b36523 | |||
840eff412e | |||
37471572da | |||
f046f0e1cf | |||
ab76923de3 | |||
b20c95bb6a | |||
045533bcb8 | |||
3106f54c35 | |||
ba6b6cfd77 | |||
4e4fbbc87c | |||
dac3c5d3e9 | |||
1ca215d8f5 | |||
7dff5178e6 | |||
87a8085ef7 | |||
4f59847ef7 | |||
257f3274d0 | |||
810f332ae8 | |||
1d49ec4bfb | |||
49d2a544a8 | |||
5e13fae1ee | |||
613ca12bc2 | |||
1e38e4865d | |||
3ae023774f | |||
790dcc49ca | |||
43c8d0ead2 | |||
87cc010d5b | |||
65c8b04723 | |||
c5ffbd04e8 | |||
80318855f9 | |||
040337982f | |||
e89251b545 | |||
0661c70594 | |||
3b1e93bf88 | |||
43d5df5a0a | |||
3ef8ddac10 | |||
b72ae5d5cc | |||
bacb57a795 | |||
45eecc5c25 | |||
8a092a2f79 | |||
12a6be4e20 | |||
bf7b9ec09f | |||
10181dc7ee | |||
30cb3673f1 | |||
5ce2bbcbcc | |||
feaee5f344 | |||
97fb9f8aee | |||
dd86ac9bcc | |||
1fbf983ff6 | |||
e4c72c7dce | |||
0c9a3751e4 | |||
0e9c61d4be | |||
b5fdadc2aa | |||
7d10b60811 | |||
87e77565fc | |||
ce191efc54 | |||
3360c9c754 | |||
63c314843e | |||
be2b266ba8 | |||
1458db6b03 | |||
16ba61dbf5 | |||
46352b6f13 | |||
82d15c856a | |||
5315620ca2 | |||
40d6716e74 | |||
efec531c75 | |||
cc7e6d1ff2 | |||
e2b9d5d936 | |||
5f8fef7996 | |||
03a37062d4 | |||
0534b24609 | |||
130d7c08a0 | |||
ea6a6ec9bc | |||
d0da82de21 | |||
8cc74af9c3 | |||
f75c0cf096 | |||
244ba86b8a | |||
054cc120de | |||
fbdb1479ad | |||
ec8c45e940 | |||
1b29b6bfc9 | |||
158bfbcb6e | |||
a37d739b0b | |||
353795f02a | |||
798b27cf34 | |||
acd64e6381 | |||
70c588dba6 | |||
8d10642ec7 | |||
76eac8b51c | |||
a168265753 | |||
eafb404b7b | |||
fa42b06e34 | |||
56b806ce78 | |||
c2427ccb7d | |||
090de9bfa8 | |||
cd2084b421 | |||
4b5dc6bc28 | |||
9486b24907 | |||
7ee5547066 | |||
c432b82e69 | |||
26d58d4057 | |||
1cf863a022 | |||
8660209d28 |
132
ChangeLog
132
ChangeLog
@ -1,4 +1,102 @@
|
||||
Deluge 1.0.0 - "Sharks are bulletproof" (21 September 2008)
|
||||
Deluge 1.0.6 (01 December 2008)
|
||||
Core:
|
||||
* Fix #475 catch unicode decoding errors
|
||||
* Add an option to not include IP overhead in rate limiting (this is equivalent
|
||||
to how 0.5.x behaves)
|
||||
|
||||
GtkUI:
|
||||
* Display the proper downloaded value in the statistics tab
|
||||
|
||||
Deluge 1.0.5 (09 November 2008)
|
||||
GtkUI:
|
||||
* Increase the per-torrent stop share ratio max to 99999.0
|
||||
* Fix #528 make sure gtkui config file is written before exiting
|
||||
* Fix UDP tracker support
|
||||
|
||||
WebUi:
|
||||
* Javascript auto refresh for both templates.
|
||||
|
||||
Windows:
|
||||
* Fix #577 adding torrents by drag n' drop
|
||||
* Fix association in Vista
|
||||
* Fix WebUI launch
|
||||
|
||||
Debian:
|
||||
* SID packages now requires Boost 1.36
|
||||
|
||||
Ubuntu:
|
||||
* Jaunty packages are now provided
|
||||
|
||||
Deluge 1.0.4 (31 October 2008)
|
||||
Core:
|
||||
* Fix #560 force an int value for global max connections
|
||||
* Fix #545 use proper values in ratio calculation
|
||||
* Fix UPnP again..
|
||||
|
||||
GtkUI:
|
||||
* Fix #565 wait for the deluged process to start to prevent defunct processes
|
||||
|
||||
OS X:
|
||||
* Fix issues with gettext
|
||||
|
||||
Windows:
|
||||
* Fix starting on non-English versions of Windows
|
||||
|
||||
Deluge 1.0.3 (18 October 2008)
|
||||
Core:
|
||||
* Fix upnp - it should work on more routers now too
|
||||
* Fix issue where Deluge would send improper stats to the tracker after a
|
||||
pause/resume.
|
||||
* Fix issue where fastresume files would be rejected when using FAT32. This
|
||||
would cause the torrent to be rechecked on every startup.
|
||||
* Fix ip filtering
|
||||
|
||||
GtkUI:
|
||||
* Re-add the "Max Connections Per Second" option with a default setting of 20
|
||||
|
||||
WebUI:
|
||||
* Fix White template for Opera
|
||||
|
||||
Misc:
|
||||
* Deluge will now use a system libtorrent library if available.
|
||||
* The build system will no longer build libtorrent if a system library is
|
||||
detected.
|
||||
|
||||
Deluge 1.0.2 (10 October 2008)
|
||||
Core:
|
||||
* Fix issue where torrents will not be properly added to the session
|
||||
|
||||
Deluge 1.0.1 (10 October 2008)
|
||||
Core:
|
||||
* Change the default max global upload slots to 4 instead of -1 since libtorrent
|
||||
will automatically open more slots to meet the upload speed limit.
|
||||
* Fix display of tracker error messages
|
||||
* Fix add_torrent_url() to download the torrent file in a thread to prevent
|
||||
the main thread from blocking and causing the daemon to freeze.
|
||||
* Removed the 'Maximum Connections Per Second' setting and replaced it with a
|
||||
default setting of 20. This should alleviate speed issues some are experiencing.
|
||||
* Changed max half-open connections default limit to 8 on XP/2000 and 4 on Vista
|
||||
* Prevent being able to set file priorities for compactly allocated torrents as
|
||||
it is not intended to work.
|
||||
* Fix freezing on start-up issues on systems that do not have a properly
|
||||
configured localhost entry.
|
||||
* Change max connections default setting to 200
|
||||
* Fix issue with invalid bencoding from some trackers
|
||||
* Plenty of libtorrent updates that should improve core stability
|
||||
|
||||
GtkUI:
|
||||
* Improve performance of files tab by only updating when values change
|
||||
|
||||
Misc:
|
||||
* Fix #187 set a 5 second timer to save the config file after a config value
|
||||
has been changed.
|
||||
* Fix #503 change the boost lib detection logic to first look for -mt and
|
||||
if not available, fall back to regular boost lib (non-multithreaded)
|
||||
|
||||
WebUI:
|
||||
* Add enable "Auto Add" checkbox
|
||||
|
||||
Deluge 1.0.0 - "Sharks Are Bulletproof" (21 September 2008)
|
||||
Core:
|
||||
* Include GeoIP database for country look-ups
|
||||
* Fix upgrading from 0.5.x state where torrents would have no trackers
|
||||
@ -10,7 +108,7 @@ Deluge 0.9.09 - "1.0.0_RC9" (15 September 2008)
|
||||
* Fix fastresume issue causing loss of data by deleting the fastresume file
|
||||
before writing a new one
|
||||
* Fix #475 the use of unicode paths when adding torrents
|
||||
|
||||
|
||||
GtkUI:
|
||||
* Fix add torrent dialog closing preventing another dialog from being shown
|
||||
* Fix various issues when not using English
|
||||
@ -20,15 +118,15 @@ Deluge 0.9.08 - "1.0.0_RC8" (27 August 2008)
|
||||
Core:
|
||||
* Attempt to automatically upgrade a 0.5.x state file to new format
|
||||
* Tracker errors now change the tracker status
|
||||
|
||||
|
||||
Plugins:
|
||||
* Fix bug in Blocklist that prevented downloading a new file every X days
|
||||
|
||||
|
||||
GtkUI:
|
||||
* Sort filenames alphabetically in add torrent dialog
|
||||
* Fix setting file priorities on folders
|
||||
* Fix #453 allow showing of text in the toolbar buttons
|
||||
|
||||
|
||||
Deluge 0.9.07 - "1.0.0_RC7" (18 August 2008)
|
||||
Core:
|
||||
* Fix loading torrents from state when fastresume file is missing
|
||||
@ -48,35 +146,35 @@ Deluge 0.9.07 - "1.0.0_RC7" (18 August 2008)
|
||||
|
||||
Null:
|
||||
* Fix #415 crash when using 'config-set' with no parameters
|
||||
|
||||
|
||||
Windows:
|
||||
* Fix Vista slowness issue
|
||||
* Fix properly shutting Deluge down when system shuts down
|
||||
* Fix opening folders/files
|
||||
|
||||
|
||||
Deluge 0.9.06 - "1.0.0_RC6" (13 August 2008)
|
||||
Core:
|
||||
* Fix CPU spikes
|
||||
|
||||
GtkUI:
|
||||
* Fix move storage dialog when connected to a remote daemon
|
||||
|
||||
|
||||
Deluge 0.9.05 - "1.0.0_RC5" (04 August 2008)
|
||||
Core:
|
||||
* Fix deluged running with ssh X forwarding by removing the Gnome lib import
|
||||
* Save resume data periodically to help prevent data loss
|
||||
* Fix queue order shuffling on restart
|
||||
|
||||
|
||||
GtkUI:
|
||||
* Handle shutting down more cleanly
|
||||
* Add translators to credits
|
||||
|
||||
|
||||
Plugins:
|
||||
* Improve the Blocklist plugin preferences page.
|
||||
|
||||
|
||||
Windows:
|
||||
* Fix drag n' drop support
|
||||
|
||||
|
||||
Deluge 0.9.04 - "1.0.0_RC4" (29 July 2008)
|
||||
Core:
|
||||
* Fix building with gcc 4.3
|
||||
@ -91,14 +189,14 @@ Deluge 0.9.04 - "1.0.0_RC4" (29 July 2008)
|
||||
* Fix displaying of torrents when language is not English
|
||||
* Fix the view options to be persistent between sessions
|
||||
* Fix signalreceiver when switching between daemons
|
||||
|
||||
|
||||
Deluge 0.9.03 - "1.0.0_RC3" (21 July 2008)
|
||||
Core:
|
||||
* File progress fixes from libtorrent
|
||||
* Fix building on FreeBSD
|
||||
* Fix #350 stop seeds when stop ratio is reached
|
||||
* Fix #358 properly emit torrent_removed signal when remove_at_ratio happens
|
||||
|
||||
|
||||
UI:
|
||||
* Default to gtkui when running 'deluge' instead of defaulting to last used.
|
||||
|
||||
@ -108,13 +206,13 @@ Deluge 0.9.03 - "1.0.0_RC3" (21 July 2008)
|
||||
|
||||
Windows:
|
||||
* Fix torrent file association and adding files from command line
|
||||
|
||||
|
||||
Plugins:
|
||||
* Blocklist plugin has been rewritten
|
||||
|
||||
|
||||
Misc:
|
||||
* Some changes for python 2.6 compatibility
|
||||
|
||||
|
||||
Deluge 0.9.02 - "1.0.0_RC2" (15 July 2008)
|
||||
Core:
|
||||
* Fix displaying of file progress
|
||||
|
19
README
19
README
@ -10,6 +10,15 @@ Authors:
|
||||
|
||||
Homepage: http://deluge-torrent.org
|
||||
|
||||
==========================
|
||||
License
|
||||
==========================
|
||||
Deluge is under the GNU GPLv3 license.
|
||||
Icon data/pixmaps/deluge.svg and derivatives in data/icons are copyright
|
||||
Andrew Wedderburn and are under the GNU GPLv3.
|
||||
All other icons in data/pixmaps are copyright Andrew Resch and are under
|
||||
the GNU GPLv3.
|
||||
|
||||
==========================
|
||||
Contact/Support:
|
||||
==========================
|
||||
@ -24,7 +33,7 @@ We have two options available for support:
|
||||
Installation Instructions:
|
||||
==========================
|
||||
|
||||
First, make sure you have the proper build dependencies installed. On a normal
|
||||
First, make sure you have the proper build dependencies installed. On a normal
|
||||
Debian or Ubuntu system:
|
||||
|
||||
sudo apt-get install g++ make python-all-dev python-all python-dbus \
|
||||
@ -59,11 +68,11 @@ I started "deluge" but i don't see the gtk-ui
|
||||
|
||||
The deluge command remembers the last interface it started. Be explicit and type one of the full "deluge -u <interface>" commands listed above.
|
||||
|
||||
Why is deluge still listed in my system tray even after I close it ?
|
||||
Why is deluge still listed in my system tray even after I close it ?
|
||||
|
||||
You closed the gtk user-interface but you did not close the daemon. Choose "Quit & Shutdown Daemon" to close both Daemon and gtk-ui.
|
||||
|
||||
How do I start the daemon ?
|
||||
How do I start the daemon ?
|
||||
|
||||
deluged
|
||||
|
||||
@ -71,10 +80,10 @@ How do I start the daemon with logging to console ?
|
||||
|
||||
deluged -d
|
||||
|
||||
I can't connect to the daemon from another machine
|
||||
I can't connect to the daemon from another machine
|
||||
|
||||
* Configure the daemon to allow remote connections
|
||||
* Restart the daemon.
|
||||
* Restart the daemon.
|
||||
|
||||
Note: do not do this on a public ip , use the webui for unsecure networks.
|
||||
|
||||
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,5 +1,5 @@
|
||||
deluge-torrent (1.0.0-1) unstable; urgency=low
|
||||
deluge-torrent (1.0.6-1) unstable; urgency=low
|
||||
|
||||
* 1.0.0 - "Sharks are bulletproof"
|
||||
* 1.0.6
|
||||
|
||||
-- Andrew Resch (andar) <andrewresch@gmail.com> Sun, 21 Sep 2008 02:10:00 -0000
|
||||
-- Andrew Resch (andar) <andrewresch@gmail.com> Mon, 01 Dec 2008 02:10:00 -0000
|
||||
|
3
debian/manpages
vendored
3
debian/manpages
vendored
@ -1 +1,2 @@
|
||||
debian/deluge.1
|
||||
deluge/docs/man/deluge.1
|
||||
deluge/docs/man/deluged.1
|
||||
|
@ -1,40 +1,33 @@
|
||||
#
|
||||
# common.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
"""Common functions for various parts of Deluge to use."""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import platform
|
||||
|
||||
import pkg_resources
|
||||
import xdg, xdg.BaseDirectory
|
||||
@ -89,9 +82,9 @@ def get_revision():
|
||||
f.close()
|
||||
except IOError, e:
|
||||
pass
|
||||
|
||||
|
||||
return revision
|
||||
|
||||
|
||||
def get_default_config_dir(filename=None):
|
||||
""" Returns the config path if no filename is specified
|
||||
Returns the config directory + filename as a path if filename is specified
|
||||
@ -117,11 +110,13 @@ def get_default_download_dir():
|
||||
def windows_check():
|
||||
"""Checks if the current platform is Windows. Returns True if it is Windows
|
||||
and False if not."""
|
||||
import platform
|
||||
if platform.system() in ('Windows', 'Microsoft'):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return platform.system() in ('Windows', 'Microsoft')
|
||||
|
||||
def vista_check():
|
||||
return platform.release() == "Vista"
|
||||
|
||||
def osx_check():
|
||||
return platform.system() == "Darwin"
|
||||
|
||||
def get_pixmap(fname):
|
||||
"""Returns a pixmap file included with deluge"""
|
||||
@ -131,7 +126,7 @@ def get_pixmap(fname):
|
||||
def get_logo(size):
|
||||
"""Returns a deluge logo pixbuf based on the size parameter."""
|
||||
import gtk
|
||||
if windows_check():
|
||||
if windows_check():
|
||||
return gtk.gdk.pixbuf_new_from_file_at_size(get_pixmap("deluge.png"), \
|
||||
size, size)
|
||||
else:
|
||||
@ -158,16 +153,16 @@ def open_url_in_browser(url):
|
||||
webbrowser.open(self.url)
|
||||
BrowserThread(url).start()
|
||||
return False
|
||||
|
||||
|
||||
import gobject
|
||||
gobject.idle_add(start_browser)
|
||||
|
||||
|
||||
def build_menu_radio_list(value_list, callback, pref_value=None,
|
||||
suffix=None, show_notset=False, notset_label=None, notset_lessthan=0,
|
||||
def build_menu_radio_list(value_list, callback, pref_value=None,
|
||||
suffix=None, show_notset=False, notset_label=None, notset_lessthan=0,
|
||||
show_other=False, show_activated=False, activated_label=None):
|
||||
# Build a menu with radio menu items from a list and connect them to
|
||||
# the callback. The pref_value is what you would like to test for the
|
||||
# Build a menu with radio menu items from a list and connect them to
|
||||
# the callback. The pref_value is what you would like to test for the
|
||||
# default active radio item.
|
||||
import gtk
|
||||
if notset_label is None:
|
||||
@ -182,14 +177,14 @@ def build_menu_radio_list(value_list, callback, pref_value=None,
|
||||
if pref_value > -1 and pref_value not in value_list:
|
||||
value_list.pop()
|
||||
value_list.append(pref_value)
|
||||
|
||||
|
||||
for value in sorted(value_list):
|
||||
if suffix != None:
|
||||
menuitem = gtk.RadioMenuItem(group, str(value) + " " + \
|
||||
suffix)
|
||||
else:
|
||||
menuitem = gtk.RadioMenuItem(group, str(value))
|
||||
|
||||
|
||||
group = menuitem
|
||||
|
||||
if value == pref_value and pref_value != None:
|
||||
@ -203,7 +198,7 @@ def build_menu_radio_list(value_list, callback, pref_value=None,
|
||||
if show_activated is True:
|
||||
for value in sorted(value_list):
|
||||
menuitem = gtk.RadioMenuItem(group, str(activated_label))
|
||||
|
||||
|
||||
group = menuitem
|
||||
|
||||
if value == pref_value and pref_value != None:
|
||||
@ -223,7 +218,7 @@ def build_menu_radio_list(value_list, callback, pref_value=None,
|
||||
menuitem.set_active(True)
|
||||
menuitem.connect("toggled", callback)
|
||||
menu.append(menuitem)
|
||||
|
||||
|
||||
# Add the Other... menuitem
|
||||
if show_other is True:
|
||||
menuitem = gtk.SeparatorMenuItem()
|
||||
@ -232,7 +227,7 @@ def build_menu_radio_list(value_list, callback, pref_value=None,
|
||||
menuitem.set_name(_("Other..."))
|
||||
menuitem.connect("activate", callback)
|
||||
menu.append(menuitem)
|
||||
|
||||
|
||||
return menu
|
||||
|
||||
def show_other_dialog(string, default=None):
|
||||
@ -240,7 +235,7 @@ def show_other_dialog(string, default=None):
|
||||
import gtk
|
||||
import gtk.glade
|
||||
dialog_glade = gtk.glade.XML(
|
||||
pkg_resources.resource_filename("deluge.ui.gtkui",
|
||||
pkg_resources.resource_filename("deluge.ui.gtkui",
|
||||
"glade/dgtkpopups.glade"))
|
||||
speed_dialog = dialog_glade.get_widget("speed_dialog")
|
||||
spin_title = dialog_glade.get_widget("spin_title")
|
||||
@ -255,10 +250,10 @@ def show_other_dialog(string, default=None):
|
||||
else:
|
||||
speed_dialog.destroy()
|
||||
return None
|
||||
|
||||
|
||||
speed_dialog.destroy()
|
||||
return value
|
||||
|
||||
|
||||
## Formatting text functions
|
||||
|
||||
def fsize(fsize_b):
|
||||
@ -289,7 +284,7 @@ def fpeer(num_peers, total_peers):
|
||||
return "%d (%d)" % (num_peers, total_peers)
|
||||
else:
|
||||
return "%d" % num_peers
|
||||
|
||||
|
||||
def ftime(seconds):
|
||||
"""Returns a formatted time string"""
|
||||
if seconds == 0:
|
||||
@ -317,10 +312,10 @@ def ftime(seconds):
|
||||
def is_url(url):
|
||||
"""A simple regex test to check if the URL is valid."""
|
||||
import re
|
||||
return bool(re.search('^(https?|ftp)://', url))
|
||||
return bool(re.search('^(https?|ftp|udp)://', url))
|
||||
|
||||
def fetch_url(url):
|
||||
"""Downloads a torrent file from a given
|
||||
"""Downloads a torrent file from a given
|
||||
URL and checks the file's validity."""
|
||||
import urllib
|
||||
from deluge.log import LOG as log
|
||||
@ -335,7 +330,7 @@ def fetch_url(url):
|
||||
else:
|
||||
log.debug("URL doesn't appear to be a valid torrent file: %s", url)
|
||||
return None
|
||||
|
||||
|
||||
def pythonize(var):
|
||||
"""Translates DBUS types back to basic Python types."""
|
||||
if isinstance(var, list):
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# component.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import gobject
|
||||
from deluge.log import LOG as log
|
||||
@ -47,18 +39,18 @@ class Component:
|
||||
self._interval = interval
|
||||
self._timer = None
|
||||
self._state = COMPONENT_STATE.index("Stopped")
|
||||
|
||||
|
||||
def get_state(self):
|
||||
return self._state
|
||||
|
||||
|
||||
def start(self):
|
||||
pass
|
||||
|
||||
|
||||
def _start(self):
|
||||
self._state = COMPONENT_STATE.index("Started")
|
||||
if self._update():
|
||||
self._timer = gobject.timeout_add(self._interval, self._update)
|
||||
|
||||
|
||||
def stop(self):
|
||||
pass
|
||||
|
||||
@ -68,20 +60,20 @@ class Component:
|
||||
gobject.source_remove(self._timer)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def _pause(self):
|
||||
self._state = COMPONENT_STATE.index("Paused")
|
||||
try:
|
||||
gobject.source_remove(self._timer)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def _resume(self):
|
||||
self._start()
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
|
||||
def _update(self):
|
||||
try:
|
||||
self.update()
|
||||
@ -90,29 +82,29 @@ class Component:
|
||||
# update method.
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
||||
|
||||
class ComponentRegistry:
|
||||
def __init__(self):
|
||||
self.components = {}
|
||||
self.depend = {}
|
||||
|
||||
|
||||
def register(self, name, obj, depend):
|
||||
"""Registers a component.. depend must be list or None"""
|
||||
log.debug("Registered %s with ComponentRegistry..", name)
|
||||
self.components[name] = obj
|
||||
if depend != None:
|
||||
self.depend[name] = depend
|
||||
|
||||
|
||||
def get(self, name):
|
||||
"""Returns a reference to the component 'name'"""
|
||||
return self.components[name]
|
||||
|
||||
|
||||
def start(self):
|
||||
"""Starts all components"""
|
||||
for component in self.components.keys():
|
||||
self.start_component(component)
|
||||
|
||||
|
||||
def start_component(self, name):
|
||||
"""Starts a component"""
|
||||
# Check to see if this component has any dependencies
|
||||
@ -125,24 +117,24 @@ class ComponentRegistry:
|
||||
log.debug("Starting component %s..", name)
|
||||
self.components[name].start()
|
||||
self.components[name]._start()
|
||||
|
||||
|
||||
def stop(self):
|
||||
"""Stops all components"""
|
||||
for component in self.components.keys():
|
||||
self.stop_component(component)
|
||||
|
||||
|
||||
def stop_component(self, component):
|
||||
if self.components[component].get_state() != \
|
||||
COMPONENT_STATE.index("Stopped"):
|
||||
log.debug("Stopping component %s..", component)
|
||||
self.components[component].stop()
|
||||
self.components[component]._stop()
|
||||
|
||||
|
||||
def pause(self):
|
||||
"""Pauses all components. Stops calling update()"""
|
||||
for component in self.components.keys():
|
||||
self.pause_component(component)
|
||||
|
||||
|
||||
def pause_component(self, component):
|
||||
if self.components[component].get_state() not in \
|
||||
[COMPONENT_STATE.index("Paused"), COMPONENT_STATE.index("Stopped")]:
|
||||
@ -153,11 +145,11 @@ class ComponentRegistry:
|
||||
"""Resumes all components. Starts calling update()"""
|
||||
for component in self.components.keys():
|
||||
self.resume_component(component)
|
||||
|
||||
|
||||
def resume_component(self, component):
|
||||
if self.components[component].get_state() == COMPONENT_STATE.index("Paused"):
|
||||
log.debug("Resuming component %s..", component)
|
||||
self.components[component]._resume()
|
||||
self.components[component]._resume()
|
||||
|
||||
def update(self):
|
||||
"""Updates all components"""
|
||||
@ -166,9 +158,9 @@ class ComponentRegistry:
|
||||
if self.components[component].get_state() == \
|
||||
COMPONENT_STATE.index("Started"):
|
||||
self.components[component].update()
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
"""Shuts down all components. This should be called when the program
|
||||
exits so that components can do any necessary clean-up."""
|
||||
@ -180,8 +172,8 @@ class ComponentRegistry:
|
||||
self.components[component].shutdown()
|
||||
except Exception, e:
|
||||
log.debug("Unable to call shutdown(): %s", e)
|
||||
|
||||
|
||||
|
||||
|
||||
_ComponentRegistry = ComponentRegistry()
|
||||
|
||||
def register(name, obj, depend=None):
|
||||
@ -215,7 +207,7 @@ def resume(component=None):
|
||||
_ComponentRegistry.resume()
|
||||
else:
|
||||
_ComponentRegistry.resume_component(component)
|
||||
|
||||
|
||||
def update():
|
||||
"""Updates all components"""
|
||||
_ComponentRegistry.update()
|
||||
@ -223,7 +215,7 @@ def update():
|
||||
def shutdown():
|
||||
"""Shutdowns all components"""
|
||||
_ComponentRegistry.shutdown()
|
||||
|
||||
|
||||
def get(component):
|
||||
"""Return a reference to the component"""
|
||||
return _ComponentRegistry.get(component)
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# config.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
"""Configuration class used to access/create/modify configuration files."""
|
||||
|
||||
@ -42,7 +34,7 @@ from deluge.log import LOG as log
|
||||
|
||||
class Config:
|
||||
"""This class is used to access configuration files."""
|
||||
|
||||
|
||||
def __init__(self, filename, defaults=None, config_dir=None):
|
||||
log.debug("Config created with filename: %s", filename)
|
||||
log.debug("Config defaults: %s", defaults)
|
||||
@ -50,7 +42,7 @@ class Config:
|
||||
self.previous_config = {}
|
||||
self.set_functions = {}
|
||||
self._change_callback = None
|
||||
|
||||
|
||||
# If defaults is not None then we need to use "defaults".
|
||||
if defaults != None:
|
||||
self.config = defaults
|
||||
@ -60,14 +52,18 @@ class Config:
|
||||
self.config_file = deluge.common.get_default_config_dir(filename)
|
||||
else:
|
||||
self.config_file = os.path.join(config_dir, filename)
|
||||
|
||||
|
||||
self.load(self.config_file)
|
||||
# Save
|
||||
self.save()
|
||||
|
||||
|
||||
# This will get set with a gobject.timeout_add whenever a config option
|
||||
# is set.
|
||||
self.save_timer = None
|
||||
|
||||
def __del__(self):
|
||||
self.save()
|
||||
|
||||
|
||||
def load(self, filename=None):
|
||||
"""Load a config file either by 'filename' or the filename set during
|
||||
construction of this object."""
|
||||
@ -84,7 +80,7 @@ class Config:
|
||||
log.warning("IOError: Unable to load file '%s'", filename)
|
||||
except EOFError:
|
||||
pkl_file.close()
|
||||
|
||||
|
||||
def save(self, filename=None):
|
||||
"""Save configuration to either 'filename' or the filename set during
|
||||
construction of this object."""
|
||||
@ -99,17 +95,20 @@ class Config:
|
||||
pkl_file.close()
|
||||
if filedump == self.config:
|
||||
# The config has not changed so lets just return
|
||||
self.save_timer = None
|
||||
return
|
||||
except (EOFError, IOError):
|
||||
log.warning("IOError: Unable to open file: '%s'", filename)
|
||||
|
||||
|
||||
try:
|
||||
pkl_file = open(filename, "wb")
|
||||
cPickle.dump(self.config, pkl_file)
|
||||
pkl_file.close()
|
||||
except IOError:
|
||||
log.warning("IOError: Unable to save file '%s'", filename)
|
||||
|
||||
|
||||
self.save_timer = None
|
||||
|
||||
def set(self, key, value):
|
||||
"""Set the 'key' with 'value'."""
|
||||
# Sets the "key" with "value" in the config dict
|
||||
@ -128,10 +127,15 @@ class Config:
|
||||
except:
|
||||
pass
|
||||
|
||||
# We set the save_timer for 5 seconds if not already set
|
||||
log.debug("save_timer: %s", self.save_timer)
|
||||
if not self.save_timer:
|
||||
self.save_timer = gobject.timeout_add(5000, self.save)
|
||||
|
||||
def get(self, key):
|
||||
"""Get the value of 'key'. If it is an invalid key then get() will
|
||||
return None."""
|
||||
# Attempts to get the "key" value and returns None if the key is
|
||||
# Attempts to get the "key" value and returns None if the key is
|
||||
# invalid
|
||||
try:
|
||||
value = self.config[key]
|
||||
@ -144,15 +148,15 @@ class Config:
|
||||
def get_config(self):
|
||||
"""Returns the entire configuration as a dictionary."""
|
||||
return self.config
|
||||
|
||||
|
||||
def get_previous_config(self):
|
||||
"""Returns the config prior to the last set()"""
|
||||
return self.previous_config
|
||||
|
||||
|
||||
def register_change_callback(self, callback):
|
||||
"""Registers a callback that will be called when a value is changed"""
|
||||
self._change_callback = callback
|
||||
|
||||
|
||||
def register_set_function(self, key, function, apply_now=True):
|
||||
"""Register a function to be run when a config value changes."""
|
||||
log.debug("Registering function for %s key..", key)
|
||||
@ -161,13 +165,13 @@ class Config:
|
||||
if apply_now:
|
||||
self.set_functions[key](key, self.config[key])
|
||||
return
|
||||
|
||||
|
||||
def apply_all(self):
|
||||
"""Runs all set functions"""
|
||||
log.debug("Running all set functions..")
|
||||
for key in self.set_functions.keys():
|
||||
self.set_functions[key](key, self.config[key])
|
||||
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.config[key]
|
||||
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# configmanager.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import gobject
|
||||
import os
|
||||
@ -62,36 +54,36 @@ class _ConfigManager:
|
||||
os.makedirs(directory)
|
||||
except Exception, e:
|
||||
log.warning("Unable to make config directory: %s", e)
|
||||
|
||||
|
||||
self.config_directory = directory
|
||||
|
||||
|
||||
def get_config_dir(self):
|
||||
log.debug("get_config_dir: %s", self.config_directory)
|
||||
return self.config_directory
|
||||
|
||||
|
||||
def close(self, config):
|
||||
"""Closes a config file."""
|
||||
try:
|
||||
del self.config_files[config]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
def save(self):
|
||||
"""Saves all the configs to disk."""
|
||||
for key in self.config_files.keys():
|
||||
self.config_files[key].save()
|
||||
# We need to return True to keep the timer active
|
||||
return True
|
||||
|
||||
|
||||
def get_config(self, config_file, defaults=None):
|
||||
"""Get a reference to the Config object for this filename"""
|
||||
log.debug("Getting config '%s'", config_file)
|
||||
# Create the config object if not already created
|
||||
if config_file not in self.config_files.keys():
|
||||
self.config_files[config_file] = Config(config_file, defaults, self.config_directory)
|
||||
|
||||
|
||||
return self.config_files[config_file]
|
||||
|
||||
|
||||
# Singleton functions
|
||||
_configmanager = _ConfigManager()
|
||||
|
||||
@ -107,6 +99,6 @@ def get_config_dir(filename=None):
|
||||
return os.path.join(_configmanager.get_config_dir(), filename)
|
||||
else:
|
||||
return _configmanager.get_config_dir()
|
||||
|
||||
|
||||
def close(config):
|
||||
return _configmanager.close(config)
|
||||
|
@ -1,42 +1,37 @@
|
||||
#
|
||||
# alertmanager.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
"""The AlertManager handles all the libtorrent alerts."""
|
||||
|
||||
import gobject
|
||||
|
||||
import deluge.component as component
|
||||
import deluge.libtorrent as lt
|
||||
try:
|
||||
import libtorrent as lt
|
||||
except ImportError:
|
||||
import deluge.libtorrent as lt
|
||||
from deluge.log import LOG as log
|
||||
|
||||
class AlertManager(component.Component):
|
||||
@ -51,17 +46,17 @@ class AlertManager(component.Component):
|
||||
lt.alert.category_t.tracker_notification |
|
||||
lt.alert.category_t.status_notification |
|
||||
lt.alert.category_t.ip_block_notification)
|
||||
|
||||
|
||||
# handlers is a dictionary of lists {"alert_type": [handler1,h2,..]}
|
||||
self.handlers = {}
|
||||
|
||||
def update(self):
|
||||
self.handle_alerts()
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
del self.session
|
||||
del self.handlers
|
||||
|
||||
|
||||
def register_handler(self, alert_type, handler):
|
||||
"""Registers a function that will be called when 'alert_type' is pop'd
|
||||
in handle_alerts. The handler function should look like:
|
||||
@ -72,11 +67,11 @@ class AlertManager(component.Component):
|
||||
# There is no entry for this alert type yet, so lets make it with an
|
||||
# empty list.
|
||||
self.handlers[alert_type] = []
|
||||
|
||||
|
||||
# Append the handler to the list in the handlers dictionary
|
||||
self.handlers[alert_type].append(handler)
|
||||
log.debug("Registered handler for alert %s", alert_type)
|
||||
|
||||
|
||||
def deregister_handler(self, handler):
|
||||
"""De-registers the 'handler' function from all alert types."""
|
||||
# Iterate through all handlers and remove 'handler' where found
|
||||
@ -84,7 +79,7 @@ class AlertManager(component.Component):
|
||||
if handler in value:
|
||||
# Handler is in this alert type list
|
||||
value.remove(handler)
|
||||
|
||||
|
||||
def handle_alerts(self, wait=False):
|
||||
"""Pops all libtorrent alerts in the session queue and handles them
|
||||
appropriately."""
|
||||
@ -92,13 +87,13 @@ class AlertManager(component.Component):
|
||||
while alert is not None:
|
||||
# Loop through all alerts in the queue
|
||||
# Do some magic to get the alert type as a string
|
||||
alert_type = str(type(alert)).split("'")[1].split(".")[2]
|
||||
alert_type = str(type(alert)).split("'")[1].split(".")[-1]
|
||||
# Display the alert message
|
||||
try:
|
||||
log.debug("%s: %s", alert_type, alert.message())
|
||||
except RuntimeError:
|
||||
log.debug("%s", alert_type)
|
||||
|
||||
|
||||
# Call any handlers for this alert type
|
||||
if alert_type in self.handlers.keys():
|
||||
for handler in self.handlers[alert_type]:
|
||||
@ -106,7 +101,7 @@ class AlertManager(component.Component):
|
||||
gobject.idle_add(handler, alert)
|
||||
else:
|
||||
handler(alert)
|
||||
|
||||
|
||||
alert = self.session.pop_alert()
|
||||
|
||||
# Return True so that the timer continues
|
||||
|
@ -1,39 +1,34 @@
|
||||
#
|
||||
# autoadd.py
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import os
|
||||
|
||||
import deluge.libtorrent as lt
|
||||
try:
|
||||
import libtorrent as lt
|
||||
except ImportError:
|
||||
import deluge.libtorrent as lt
|
||||
import deluge.component as component
|
||||
from deluge.configmanager import ConfigManager
|
||||
from deluge.log import LOG as log
|
||||
@ -45,7 +40,7 @@ class AutoAdd(component.Component):
|
||||
component.Component.__init__(self, "AutoAdd", depend=["TorrentManager"], interval=5000)
|
||||
# Get the core config
|
||||
self.config = ConfigManager("core.conf")
|
||||
|
||||
|
||||
# A list of filenames
|
||||
self.invalid_torrents = []
|
||||
# Filename:Attempts
|
||||
@ -56,19 +51,19 @@ class AutoAdd(component.Component):
|
||||
self._on_autoadd_enable, apply_now=True)
|
||||
self.config.register_set_function("autoadd_location",
|
||||
self._on_autoadd_location)
|
||||
|
||||
|
||||
def update(self):
|
||||
if not self.config["autoadd_enable"]:
|
||||
# We shouldn't be updating because autoadd is not enabled
|
||||
component.pause("AutoAdd")
|
||||
return
|
||||
|
||||
|
||||
# Check the auto add folder for new torrents to add
|
||||
if not os.path.exists(self.config["autoadd_location"]):
|
||||
log.warning("Invalid AutoAdd folder: %s", self.config["autoadd_location"])
|
||||
component.pause("AutoAdd")
|
||||
return
|
||||
|
||||
|
||||
for filename in os.listdir(self.config["autoadd_location"]):
|
||||
if filename.split(".")[-1] == "torrent":
|
||||
filepath = os.path.join(self.config["autoadd_location"], filename)
|
||||
@ -85,16 +80,16 @@ class AutoAdd(component.Component):
|
||||
os.rename(filepath, filepath + ".invalid")
|
||||
del self.attempts[filename]
|
||||
self.invalid_torrents.remove(filename)
|
||||
else:
|
||||
else:
|
||||
self.invalid_torrents.append(filename)
|
||||
self.attempts[filename] = 1
|
||||
continue
|
||||
|
||||
|
||||
# The torrent looks good, so lets add it to the session
|
||||
component.get("TorrentManager").add(filedump=filedump, filename=filename)
|
||||
|
||||
os.remove(filepath)
|
||||
|
||||
|
||||
def load_torrent(self, filename):
|
||||
try:
|
||||
log.debug("Attempting to open %s for add.", filename)
|
||||
@ -106,10 +101,10 @@ class AutoAdd(component.Component):
|
||||
except IOError, e:
|
||||
log.warning("Unable to open %s: %s", filename, e)
|
||||
raise e
|
||||
|
||||
|
||||
# Get the info to see if any exceptions are raised
|
||||
info = lt.torrent_info(lt.bdecode(filedump))
|
||||
|
||||
|
||||
return filedump
|
||||
|
||||
def _on_autoadd_enable(self, key, value):
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# core.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import gettext
|
||||
import locale
|
||||
@ -46,7 +38,11 @@ import gobject
|
||||
import threading
|
||||
import socket
|
||||
|
||||
import deluge.libtorrent as lt
|
||||
try:
|
||||
import libtorrent as lt
|
||||
except ImportError:
|
||||
import deluge.libtorrent as lt
|
||||
|
||||
import deluge.configmanager
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
@ -56,7 +52,7 @@ from deluge.core.alertmanager import AlertManager
|
||||
from deluge.core.signalmanager import SignalManager
|
||||
from deluge.core.autoadd import AutoAdd
|
||||
from deluge.log import LOG as log
|
||||
|
||||
|
||||
DEFAULT_PREFS = {
|
||||
"config_location": deluge.configmanager.get_config_dir(),
|
||||
"send_info": False,
|
||||
@ -81,12 +77,13 @@ DEFAULT_PREFS = {
|
||||
"enc_out_policy": 1,
|
||||
"enc_level": 2,
|
||||
"enc_prefer_rc4": True,
|
||||
"max_connections_global": -1,
|
||||
"max_connections_global": 200,
|
||||
"max_upload_speed": -1.0,
|
||||
"max_download_speed": -1.0,
|
||||
"max_upload_slots_global": -1,
|
||||
"max_half_open_connections": -1,
|
||||
"max_connections_per_second": -1,
|
||||
"max_upload_slots_global": 4,
|
||||
"max_half_open_connections": (lambda: deluge.common.windows_check() and
|
||||
(lambda: deluge.common.vista_check() and 4 or 8)() or -1)(),
|
||||
"max_connections_per_second": 20,
|
||||
"ignore_limits_on_local_network": True,
|
||||
"max_connections_per_torrent": -1,
|
||||
"max_upload_slots_per_torrent": -1,
|
||||
@ -111,28 +108,29 @@ DEFAULT_PREFS = {
|
||||
"move_completed": False,
|
||||
"move_completed_path": deluge.common.get_default_download_dir(),
|
||||
"new_release_check": True,
|
||||
"rate_limit_ip_overhead": True
|
||||
}
|
||||
|
||||
|
||||
class Core(
|
||||
ThreadingMixIn,
|
||||
ThreadingMixIn,
|
||||
SimpleXMLRPCServer.SimpleXMLRPCServer,
|
||||
component.Component):
|
||||
def __init__(self, port):
|
||||
log.debug("Core init..")
|
||||
component.Component.__init__(self, "Core")
|
||||
self.client_address = None
|
||||
|
||||
|
||||
# Get config
|
||||
self.config = deluge.configmanager.ConfigManager("core.conf", DEFAULT_PREFS)
|
||||
|
||||
if port == None:
|
||||
port = self.config["daemon_port"]
|
||||
|
||||
|
||||
if self.config["allow_remote"]:
|
||||
hostname = ""
|
||||
else:
|
||||
hostname = "localhost"
|
||||
|
||||
hostname = "127.0.0.1"
|
||||
|
||||
# Setup the xmlrpc server
|
||||
try:
|
||||
log.info("Starting XMLRPC server on port %s", port)
|
||||
@ -143,35 +141,28 @@ class Core(
|
||||
sys.exit(0)
|
||||
|
||||
self.register_multicall_functions()
|
||||
|
||||
|
||||
# Register all export_* functions
|
||||
for func in dir(self):
|
||||
if func.startswith("export_"):
|
||||
self.register_function(getattr(self, "%s" % func), func[7:])
|
||||
|
||||
self.register_introspection_functions()
|
||||
|
||||
# Initialize gettext
|
||||
if deluge.common.windows_check():
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
else:
|
||||
locale.setlocale(locale.LC_MESSAGES, '')
|
||||
locale.bindtextdomain("deluge",
|
||||
pkg_resources.resource_filename(
|
||||
"deluge", "i18n"))
|
||||
locale.textdomain("deluge")
|
||||
|
||||
gettext.bindtextdomain("deluge",
|
||||
pkg_resources.resource_filename(
|
||||
"deluge", "i18n"))
|
||||
# Initialize gettext
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
if hasattr(locale, "bindtextdomain"):
|
||||
locale.bindtextdomain("deluge", pkg_resources.resource_filename("deluge", "i18n"))
|
||||
if hasattr(locale, "textdomain"):
|
||||
locale.textdomain("deluge")
|
||||
gettext.bindtextdomain("deluge", pkg_resources.resource_filename("deluge", "i18n"))
|
||||
gettext.textdomain("deluge")
|
||||
gettext.install("deluge",
|
||||
pkg_resources.resource_filename(
|
||||
"deluge", "i18n"))
|
||||
gettext.install("deluge", pkg_resources.resource_filename("deluge", "i18n"))
|
||||
|
||||
# Setup signals
|
||||
signal.signal(signal.SIGINT, self._shutdown)
|
||||
signal.signal(signal.SIGTERM, self._shutdown)
|
||||
if not deluge.common.windows_check():
|
||||
if not deluge.common.windows_check():
|
||||
signal.signal(signal.SIGHUP, self._shutdown)
|
||||
else:
|
||||
from win32api import SetConsoleCtrlHandler
|
||||
@ -193,7 +184,7 @@ class Core(
|
||||
request, client_address = self.socket.accept()
|
||||
self.client_address = client_address[0]
|
||||
return (request, client_address)
|
||||
|
||||
|
||||
def run(self):
|
||||
"""Starts the core"""
|
||||
|
||||
@ -204,24 +195,31 @@ class Core(
|
||||
while len(version) < 4:
|
||||
version.append(0)
|
||||
fingerprint = lt.fingerprint("DE", *version)
|
||||
|
||||
|
||||
# Start the libtorrent session
|
||||
log.debug("Starting libtorrent session..")
|
||||
self.session = lt.session(fingerprint)
|
||||
|
||||
self.session = lt.session(fingerprint, flags=0)
|
||||
|
||||
# Set the user agent
|
||||
self.settings = lt.session_settings()
|
||||
self.settings.user_agent = "Deluge %s" % deluge.common.get_version()
|
||||
|
||||
# Load the GeoIP DB for country look-ups
|
||||
self.session.load_country_db(
|
||||
pkg_resources.resource_filename("deluge", os.path.join("data", "GeoIP.dat")))
|
||||
|
||||
# Load the GeoIP DB for country look-ups if available
|
||||
geoip_db = pkg_resources.resource_filename("deluge", os.path.join("data", "GeoIP.dat"))
|
||||
if os.path.exists(geoip_db):
|
||||
self.session.load_country_db(geoip_db)
|
||||
|
||||
# Set session settings
|
||||
self.settings.lazy_bitfields = 1
|
||||
self.settings.send_redundant_have = True
|
||||
self.session.set_settings(self.settings)
|
||||
|
||||
|
||||
# Create an ip filter
|
||||
self.ip_filter = lt.ip_filter()
|
||||
# This keeps track of the timer to set the ip filter.. We do this a few
|
||||
# seconds aftering adding a rule so that 'batch' adding of rules isn't slow.
|
||||
self._set_ip_filter_timer = None
|
||||
|
||||
# Load metadata extension
|
||||
self.session.add_extension(lt.create_metadata_plugin)
|
||||
|
||||
@ -230,7 +228,7 @@ class Core(
|
||||
self._on_set_torrentfiles_location)
|
||||
self.config.register_set_function("state_location",
|
||||
self._on_set_state_location)
|
||||
self.config.register_set_function("listen_ports",
|
||||
self.config.register_set_function("listen_ports",
|
||||
self._on_set_listen_ports)
|
||||
self.config.register_set_function("random_port",
|
||||
self._on_set_random_port)
|
||||
@ -281,27 +279,29 @@ class Core(
|
||||
self.new_release_timer = None
|
||||
self.config.register_set_function("new_release_check",
|
||||
self._on_new_release_check)
|
||||
self.config.register_set_function("rate_limit_ip_overhead",
|
||||
self._on_rate_limit_ip_overhead)
|
||||
|
||||
self.config.register_change_callback(self._on_config_value_change)
|
||||
# Start the AlertManager
|
||||
self.alerts = AlertManager(self.session)
|
||||
|
||||
|
||||
# Start the SignalManager
|
||||
self.signals = SignalManager()
|
||||
self.signals = SignalManager()
|
||||
|
||||
# Load plugins
|
||||
self.plugins = PluginManager(self)
|
||||
|
||||
# Start the TorrentManager
|
||||
self.torrents = TorrentManager(self.session, self.alerts)
|
||||
|
||||
|
||||
# Create the AutoAdd component
|
||||
self.autoadd = AutoAdd()
|
||||
self.autoadd = AutoAdd()
|
||||
|
||||
component.start()
|
||||
|
||||
|
||||
self._should_shutdown = False
|
||||
|
||||
|
||||
self.listen_thread = threading.Thread(target=self.handle_thread)
|
||||
self.listen_thread.setDaemon(False)
|
||||
self.listen_thread.start()
|
||||
@ -318,10 +318,10 @@ class Core(
|
||||
while not self._should_shutdown:
|
||||
self.handle_request()
|
||||
self._should_shutdown = False
|
||||
|
||||
|
||||
except Exception, e:
|
||||
log.debug("handle_thread: %s", e)
|
||||
|
||||
|
||||
def _shutdown(self, *data):
|
||||
"""This is called by a thread from shutdown()"""
|
||||
log.info("Shutting down core..")
|
||||
@ -353,7 +353,7 @@ class Core(
|
||||
def export_ping(self):
|
||||
"""A method to see if the core is running"""
|
||||
return True
|
||||
|
||||
|
||||
def export_shutdown(self):
|
||||
"""Shutdown the core"""
|
||||
# Make shutdown an async call
|
||||
@ -365,66 +365,68 @@ class Core(
|
||||
self.signals.register_client(self.client_address, port)
|
||||
if self.config["new_release_check"]:
|
||||
self.check_new_release()
|
||||
|
||||
|
||||
def export_deregister_client(self):
|
||||
"""De-registers a client with the signal manager."""
|
||||
self.signals.deregister_client(self.client_address)
|
||||
|
||||
|
||||
def export_add_torrent_file(self, filename, filedump, options):
|
||||
"""Adds a torrent file to the libtorrent session
|
||||
This requires the torrents filename and a dump of it's content
|
||||
"""
|
||||
gobject.idle_add(self._add_torrent_file, filename, filedump, options)
|
||||
|
||||
|
||||
def _add_torrent_file(self, filename, filedump, options):
|
||||
# Turn the filedump into a torrent_info
|
||||
if not isinstance(filedump, str):
|
||||
filedump = filedump.data
|
||||
|
||||
|
||||
if len(filedump) == 0:
|
||||
log.warning("Torrent file is corrupt!")
|
||||
return
|
||||
|
||||
|
||||
try:
|
||||
torrent_info = lt.torrent_info(lt.bdecode(filedump))
|
||||
except RuntimeError, e:
|
||||
log.warning("Unable to decode torrent file: %s", e)
|
||||
return None
|
||||
|
||||
|
||||
torrent_id = self.torrents.add(filedump=filedump, options=options, filename=filename)
|
||||
|
||||
|
||||
# Run the plugin hooks for 'post_torrent_add'
|
||||
self.plugins.run_post_torrent_add(torrent_id)
|
||||
|
||||
def export_add_torrent_url(self, url, save_path, options):
|
||||
def export_add_torrent_url(self, url, options):
|
||||
log.info("Attempting to add url %s", url)
|
||||
|
||||
|
||||
threading.Thread(target=self.fetch_torrent_url_thread, args=(self.export_add_torrent_file, url, options)).start()
|
||||
|
||||
def fetch_torrent_url_thread(self, callback, url, options):
|
||||
# Get the actual filename of the torrent from the url provided.
|
||||
filename = url.split("/")[-1]
|
||||
|
||||
|
||||
# Get the .torrent file from the url
|
||||
torrent_file = deluge.common.fetch_url(url)
|
||||
if torrent_file is None:
|
||||
return False
|
||||
|
||||
|
||||
# Dump the torrents file contents to a string
|
||||
try:
|
||||
filedump = open(torrent_file, "rb").read()
|
||||
except IOError:
|
||||
log.warning("Unable to open %s for reading.", torrent_file)
|
||||
return False
|
||||
|
||||
|
||||
# Add the torrent to session
|
||||
return self.export_add_torrent_file(
|
||||
filename, filedump, options)
|
||||
|
||||
return callback(filename, filedump, options)
|
||||
|
||||
def export_remove_torrent(self, torrent_ids, remove_torrent, remove_data):
|
||||
log.debug("Removing torrent %s from the core.", torrent_ids)
|
||||
for torrent_id in torrent_ids:
|
||||
if self.torrents.remove(torrent_id, remove_torrent, remove_data):
|
||||
# Run the plugin hooks for 'post_torrent_remove'
|
||||
self.plugins.run_post_torrent_remove(torrent_id)
|
||||
|
||||
|
||||
def export_force_reannounce(self, torrent_ids):
|
||||
log.debug("Forcing reannouncment to: %s", torrent_ids)
|
||||
for torrent_id in torrent_ids:
|
||||
@ -435,24 +437,24 @@ class Core(
|
||||
for torrent_id in torrent_ids:
|
||||
if not self.torrents[torrent_id].pause():
|
||||
log.warning("Error pausing torrent %s", torrent_id)
|
||||
|
||||
|
||||
def export_move_storage(self, torrent_ids, dest):
|
||||
log.debug("Moving storage %s to %s", torrent_ids, dest)
|
||||
for torrent_id in torrent_ids:
|
||||
if not self.torrents[torrent_id].move_storage(dest):
|
||||
log.warning("Error moving torrent %s to %s", torrent_id, dest)
|
||||
|
||||
|
||||
def export_pause_all_torrents(self):
|
||||
"""Pause all torrents in the session"""
|
||||
if not self.torrents.pause_all():
|
||||
log.warning("Error pausing all torrents..")
|
||||
|
||||
|
||||
def export_resume_all_torrents(self):
|
||||
"""Resume all torrents in the session"""
|
||||
if self.torrents.resume_all():
|
||||
# Emit the 'torrent_all_resumed' signal
|
||||
self.torrent_all_resumed()
|
||||
|
||||
|
||||
def export_resume_torrent(self, torrent_ids):
|
||||
log.debug("Resuming: %s", torrent_ids)
|
||||
for torrent_id in torrent_ids:
|
||||
@ -463,16 +465,17 @@ class Core(
|
||||
# Build the status dictionary
|
||||
try:
|
||||
status = self.torrents[torrent_id].get_status(keys)
|
||||
except KeyError:
|
||||
except KeyError, e:
|
||||
log.debug(e)
|
||||
# The torrent_id is not found in the torrentmanager, so return None
|
||||
return None
|
||||
|
||||
|
||||
# Get the leftover fields and ask the plugin manager to fill them
|
||||
leftover_fields = list(set(keys) - set(status.keys()))
|
||||
if len(leftover_fields) > 0:
|
||||
status.update(self.plugins.get_status(torrent_id, leftover_fields))
|
||||
return status
|
||||
|
||||
|
||||
def export_get_torrents_status(self, torrent_ids, keys):
|
||||
status_dict = {}.fromkeys(torrent_ids)
|
||||
|
||||
@ -480,32 +483,33 @@ class Core(
|
||||
for torrent_id in torrent_ids:
|
||||
try:
|
||||
status = self.torrents[torrent_id].get_status(keys)
|
||||
except KeyError:
|
||||
except KeyError, e:
|
||||
log.debug(e)
|
||||
return None
|
||||
# Get the leftover fields and ask the plugin manager to fill them
|
||||
leftover_fields = list(set(keys) - set(status.keys()))
|
||||
if len(leftover_fields) > 0:
|
||||
status.update(
|
||||
self.plugins.get_status(torrent_id, leftover_fields))
|
||||
|
||||
|
||||
status_dict[torrent_id] = status
|
||||
# Emit the torrent_status signal to the clients
|
||||
return status_dict
|
||||
|
||||
|
||||
def export_get_session_state(self):
|
||||
"""Returns a list of torrent_ids in the session."""
|
||||
# Get the torrent list from the TorrentManager
|
||||
return self.torrents.get_torrent_list()
|
||||
|
||||
|
||||
def export_save_state(self):
|
||||
"""Save the current session state to file."""
|
||||
# Have the TorrentManager save it's state
|
||||
self.torrents.save_state()
|
||||
|
||||
|
||||
def export_get_config(self):
|
||||
"""Get all the preferences as a dictionary"""
|
||||
return self.config.get_config()
|
||||
|
||||
|
||||
def export_get_config_value(self, key):
|
||||
"""Get the config value for key"""
|
||||
try:
|
||||
@ -523,15 +527,15 @@ class Core(
|
||||
if isinstance(config[key], unicode) or isinstance(config[key], str):
|
||||
config[key] = config[key].encode("utf8")
|
||||
self.config[key] = config[key]
|
||||
|
||||
|
||||
def export_get_listen_port(self):
|
||||
"""Returns the active listen port"""
|
||||
return self.session.listen_port()
|
||||
|
||||
|
||||
def export_get_num_connections(self):
|
||||
"""Returns the current number of connections"""
|
||||
return self.session.num_connections()
|
||||
|
||||
|
||||
def export_get_dht_nodes(self):
|
||||
"""Returns the number of dht nodes"""
|
||||
return self.session.status().dht_nodes
|
||||
@ -543,7 +547,7 @@ class Core(
|
||||
def export_get_upload_rate(self):
|
||||
"""Returns the payload upload rate"""
|
||||
return self.session.status().payload_upload_rate
|
||||
|
||||
|
||||
def export_get_available_plugins(self):
|
||||
"""Returns a list of plugins available in the core"""
|
||||
return self.plugins.get_available_plugins()
|
||||
@ -555,73 +559,74 @@ class Core(
|
||||
def export_enable_plugin(self, plugin):
|
||||
self.plugins.enable_plugin(plugin)
|
||||
return None
|
||||
|
||||
|
||||
def export_disable_plugin(self, plugin):
|
||||
self.plugins.disable_plugin(plugin)
|
||||
return None
|
||||
|
||||
|
||||
def export_force_recheck(self, torrent_ids):
|
||||
"""Forces a data recheck on torrent_ids"""
|
||||
for torrent_id in torrent_ids:
|
||||
self.torrents[torrent_id].force_recheck()
|
||||
|
||||
|
||||
def export_set_torrent_trackers(self, torrent_id, trackers):
|
||||
"""Sets a torrents tracker list. trackers will be [{"url", "tier"}]"""
|
||||
return self.torrents[torrent_id].set_trackers(trackers)
|
||||
|
||||
|
||||
def export_set_torrent_max_connections(self, torrent_id, value):
|
||||
"""Sets a torrents max number of connections"""
|
||||
return self.torrents[torrent_id].set_max_connections(value)
|
||||
|
||||
|
||||
def export_set_torrent_max_upload_slots(self, torrent_id, value):
|
||||
"""Sets a torrents max number of upload slots"""
|
||||
return self.torrents[torrent_id].set_max_upload_slots(value)
|
||||
|
||||
|
||||
def export_set_torrent_max_upload_speed(self, torrent_id, value):
|
||||
"""Sets a torrents max upload speed"""
|
||||
return self.torrents[torrent_id].set_max_upload_speed(value)
|
||||
|
||||
|
||||
def export_set_torrent_max_download_speed(self, torrent_id, value):
|
||||
"""Sets a torrents max download speed"""
|
||||
return self.torrents[torrent_id].set_max_download_speed(value)
|
||||
|
||||
|
||||
def export_set_torrent_file_priorities(self, torrent_id, priorities):
|
||||
"""Sets a torrents file priorities"""
|
||||
return self.torrents[torrent_id].set_file_priorities(priorities)
|
||||
|
||||
|
||||
def export_set_torrent_prioritize_first_last(self, torrent_id, value):
|
||||
"""Sets a higher priority to the first and last pieces"""
|
||||
return self.torrents[torrent_id].set_prioritize_first_last(value)
|
||||
|
||||
|
||||
def export_set_torrent_auto_managed(self, torrent_id, value):
|
||||
"""Sets the auto managed flag for queueing purposes"""
|
||||
return self.torrents[torrent_id].set_auto_managed(value)
|
||||
|
||||
|
||||
def export_set_torrent_stop_at_ratio(self, torrent_id, value):
|
||||
"""Sets the torrent to stop at 'stop_ratio'"""
|
||||
return self.torrents[torrent_id].set_stop_at_ratio(value)
|
||||
|
||||
|
||||
def export_set_torrent_stop_ratio(self, torrent_id, value):
|
||||
"""Sets the ratio when to stop a torrent if 'stop_at_ratio' is set"""
|
||||
return self.torrents[torrent_id].set_stop_ratio(value)
|
||||
|
||||
|
||||
def export_set_torrent_remove_at_ratio(self, torrent_id, value):
|
||||
"""Sets the torrent to be removed at 'stop_ratio'"""
|
||||
return self.torrents[torrent_id].set_remove_at_ratio(value)
|
||||
|
||||
|
||||
def export_block_ip_range(self, range):
|
||||
"""Block an ip range"""
|
||||
try:
|
||||
self.ip_filter.add_rule(range[0], range[1], 1)
|
||||
except AttributeError:
|
||||
self.export_reset_ip_filter()
|
||||
self.ip_filter.add_rule(range[0], range[1], 1)
|
||||
|
||||
self.ip_filter.add_rule(range[0], range[1], 1)
|
||||
|
||||
# Start a 2 second timer (and remove the previous one if it exists)
|
||||
if self._set_ip_filter_timer:
|
||||
gobject.source_remove(self._set_ip_filter_timer)
|
||||
self._set_ip_filter_timer = gobject.timeout_add(2000, self.session.set_ip_filter, self.ip_filter)
|
||||
|
||||
def export_reset_ip_filter(self):
|
||||
"""Clears the ip filter"""
|
||||
self.ip_filter = lt.ip_filter()
|
||||
self.session.set_ip_filter(self.ip_filter)
|
||||
|
||||
|
||||
def export_get_health(self):
|
||||
"""Returns True if we have established incoming connections"""
|
||||
return self.session.status().has_incoming_connections
|
||||
@ -676,7 +681,7 @@ class Core(
|
||||
"""Emitted when a torrent has been removed from the core"""
|
||||
log.debug("torrent_remove signal emitted")
|
||||
self.signals.emit("torrent_removed", torrent_id)
|
||||
|
||||
|
||||
def torrent_paused(self, torrent_id):
|
||||
"""Emitted when a torrent is paused"""
|
||||
log.debug("torrent_paused signal emitted")
|
||||
@ -706,31 +711,31 @@ class Core(
|
||||
"""Emitted when a torrent queue position is changed"""
|
||||
log.debug("torrent_queue_changed signal emitted")
|
||||
self.signals.emit("torrent_queue_changed")
|
||||
|
||||
|
||||
# Config set functions
|
||||
def _on_config_value_change(self, key, value):
|
||||
self.config_value_changed(key, value)
|
||||
|
||||
|
||||
def _on_set_torrentfiles_location(self, key, value):
|
||||
if self.config["copy_torrent_file"]:
|
||||
try:
|
||||
os.makedirs(value)
|
||||
except Exception, e:
|
||||
log.debug("Unable to make directory: %s", e)
|
||||
|
||||
|
||||
def _on_set_state_location(self, key, value):
|
||||
if not os.access(value, os.F_OK):
|
||||
try:
|
||||
os.makedirs(value)
|
||||
except Exception, e:
|
||||
log.debug("Unable to make directory: %s", e)
|
||||
|
||||
|
||||
def _on_set_listen_ports(self, key, value):
|
||||
# Only set the listen ports if random_port is not true
|
||||
if self.config["random_port"] is not True:
|
||||
log.debug("listen port range set to %s-%s", value[0], value[1])
|
||||
self.session.listen_on(value[0], value[1])
|
||||
|
||||
|
||||
def _on_set_random_port(self, key, value):
|
||||
log.debug("random port value set to %s", value)
|
||||
# We need to check if the value has been changed to true and false
|
||||
@ -743,12 +748,12 @@ class Core(
|
||||
listen_ports.append(listen_ports[0]+10)
|
||||
else:
|
||||
listen_ports = self.config["listen_ports"]
|
||||
|
||||
|
||||
# Set the listen ports
|
||||
log.debug("listen port range set to %s-%s", listen_ports[0],
|
||||
log.debug("listen port range set to %s-%s", listen_ports[0],
|
||||
listen_ports[1])
|
||||
self.session.listen_on(listen_ports[0], listen_ports[1])
|
||||
|
||||
|
||||
def _on_set_dht(self, key, value):
|
||||
log.debug("dht value set to %s", value)
|
||||
if value:
|
||||
@ -758,14 +763,14 @@ class Core(
|
||||
self.session.add_dht_router("router.bitcomet.com", 6881)
|
||||
else:
|
||||
self.session.stop_dht()
|
||||
|
||||
|
||||
def _on_set_upnp(self, key, value):
|
||||
log.debug("upnp value set to %s", value)
|
||||
if value:
|
||||
self.session.start_upnp()
|
||||
else:
|
||||
self.session.stop_upnp()
|
||||
|
||||
|
||||
def _on_set_natpmp(self, key, value):
|
||||
log.debug("natpmp value set to %s", value)
|
||||
if value:
|
||||
@ -779,7 +784,7 @@ class Core(
|
||||
self.session.start_lsd()
|
||||
else:
|
||||
self.session.stop_lsd()
|
||||
|
||||
|
||||
def _on_set_utpex(self, key, value):
|
||||
log.debug("utpex value set to %s", value)
|
||||
if value:
|
||||
@ -796,7 +801,7 @@ class Core(
|
||||
self.session.set_pe_settings(pe_settings)
|
||||
set = self.session.get_pe_settings()
|
||||
log.debug("encryption settings:\n\t\t\tout_policy: %s\n\t\t\
|
||||
in_policy: %s\n\t\t\tlevel: %s\n\t\t\tprefer_rc4: %s",
|
||||
in_policy: %s\n\t\t\tlevel: %s\n\t\t\tprefer_rc4: %s",
|
||||
set.out_enc_policy,
|
||||
set.in_enc_policy,
|
||||
set.allowed_enc_level,
|
||||
@ -804,8 +809,12 @@ class Core(
|
||||
|
||||
def _on_set_max_connections_global(self, key, value):
|
||||
log.debug("max_connections_global set to %s..", value)
|
||||
self.session.set_max_connections(value)
|
||||
|
||||
# Add this in to overwrite bad float values in the config, to prevent
|
||||
# future issues with 1.1
|
||||
if type(value) is not int:
|
||||
self.config[key] = int(value)
|
||||
self.session.set_max_connections(int(value))
|
||||
|
||||
def _on_set_max_upload_speed(self, key, value):
|
||||
log.debug("max_upload_speed set to %s..", value)
|
||||
# We need to convert Kb/s to B/s
|
||||
@ -815,22 +824,22 @@ class Core(
|
||||
log.debug("max_download_speed set to %s..", value)
|
||||
# We need to convert Kb/s to B/s
|
||||
self.session.set_download_rate_limit(int(value * 1024))
|
||||
|
||||
|
||||
def _on_set_max_upload_slots_global(self, key, value):
|
||||
log.debug("max_upload_slots_global set to %s..", value)
|
||||
self.session.set_max_uploads(value)
|
||||
|
||||
def _on_set_max_half_open_connections(self, key, value):
|
||||
self.session.set_max_half_open_connections(value)
|
||||
|
||||
|
||||
def _on_set_max_connections_per_second(self, key, value):
|
||||
self.settings.connection_speed = value
|
||||
self.session.set_settings(self.settings)
|
||||
|
||||
|
||||
def _on_ignore_limits_on_local_network(self, key, value):
|
||||
self.settings.ignore_limits_on_local_network = value
|
||||
self.session.set_settings(self.settings)
|
||||
|
||||
|
||||
def _on_set_share_ratio_limit(self, key, value):
|
||||
log.debug("%s set to %s..", key, value)
|
||||
self.settings.share_ratio_limit = value
|
||||
@ -864,7 +873,7 @@ class Core(
|
||||
log.debug("active_limit: %s", self.settings.active_limit)
|
||||
self.settings.active_limit = value
|
||||
self.session.set_settings(self.settings)
|
||||
|
||||
|
||||
def _on_set_dont_count_slow_torrents(self, key, value):
|
||||
log.debug("%s set to %s..", key, value)
|
||||
self.settings.dont_count_slow_torrents = value
|
||||
@ -910,7 +919,7 @@ class Core(
|
||||
log.debug("Unable to get release info from website: %s", e)
|
||||
return
|
||||
self.check_new_release()
|
||||
|
||||
|
||||
def check_new_release(self):
|
||||
if self.new_release:
|
||||
log.debug("new_release: %s", self.new_release)
|
||||
@ -918,7 +927,7 @@ class Core(
|
||||
self.signals.emit("new_version_available", self.new_release)
|
||||
return self.new_release
|
||||
return False
|
||||
|
||||
|
||||
def _on_new_release_check(self, key, value):
|
||||
if value:
|
||||
log.debug("Checking for new release..")
|
||||
@ -931,3 +940,8 @@ class Core(
|
||||
else:
|
||||
if self.new_release_timer:
|
||||
gobject.source.remove(self.new_release_timer)
|
||||
|
||||
def _on_rate_limit_ip_overhead(self, key, value):
|
||||
log.debug("%s: %s", key, value)
|
||||
self.settings.rate_limit_ip_overhead = value
|
||||
self.session.set_settings(self.settings)
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# daemon.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import deluge.configmanager
|
||||
import deluge.common
|
||||
@ -39,8 +31,8 @@ class Daemon:
|
||||
def __init__(self, options, args):
|
||||
version = deluge.common.get_version()
|
||||
if deluge.common.get_revision() != "":
|
||||
version = version + "r" + deluge.common.get_revision()
|
||||
|
||||
version = version + "r" + deluge.common.get_revision()
|
||||
|
||||
log.info("Deluge daemon %s", version)
|
||||
log.debug("options: %s", options)
|
||||
log.debug("args: %s", args)
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# oldstateupgrader.py
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import os
|
||||
import os.path
|
||||
@ -37,7 +29,10 @@ import pickle
|
||||
import cPickle
|
||||
import shutil
|
||||
|
||||
import deluge.libtorrent as lt
|
||||
try:
|
||||
import libtorrent as lt
|
||||
except ImportError:
|
||||
import deluge.libtorrent as lt
|
||||
from deluge.configmanager import ConfigManager
|
||||
import deluge.core.torrentmanager
|
||||
from deluge.log import LOG as log
|
||||
@ -70,14 +65,14 @@ class OldStateUpgrader:
|
||||
if os.path.exists(self.state05_location) and not os.path.exists(self.state10_location):
|
||||
# If the 0.5 state file exists and the 1.0 doesn't, then let's upgrade it
|
||||
self.upgrade05()
|
||||
|
||||
|
||||
def upgrade05(self):
|
||||
try:
|
||||
state = PickleUpgrader(open(self.state05_location, "rb")).load()
|
||||
except Exception, e:
|
||||
log.debug("Unable to open 0.5 state file: %s", e)
|
||||
return
|
||||
|
||||
|
||||
new_state = deluge.core.torrentmanager.TorrentManagerState()
|
||||
for ti, uid in state.torrents.items():
|
||||
torrent_path = os.path.join(self.config["config_location"], "torrentfiles", ti.filename)
|
||||
@ -89,7 +84,7 @@ class OldStateUpgrader:
|
||||
_file.close()
|
||||
except (IOError, RuntimeError), e:
|
||||
log.warning("Unable to open %s: %s", filepath, e)
|
||||
|
||||
|
||||
# Copy the torrent file to the new location
|
||||
import shutil
|
||||
shutil.copyfile(torrent_path, os.path.join(self.config["state_location"], str(torrent_info.info_hash()) + ".torrent"))
|
||||
@ -113,7 +108,7 @@ class OldStateUpgrader:
|
||||
)
|
||||
# Append the object to the state list
|
||||
new_state.torrents.append(new_torrent)
|
||||
|
||||
|
||||
# Now we need to write out the new state file
|
||||
try:
|
||||
log.debug("Saving torrent state file.")
|
||||
@ -124,7 +119,7 @@ class OldStateUpgrader:
|
||||
except IOError, e:
|
||||
log.warning("Unable to save state file: %s", e)
|
||||
return
|
||||
|
||||
|
||||
# Rename the persistent.state file
|
||||
try:
|
||||
os.rename(self.state05_location, self.state05_location + ".old")
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# pluginmanager.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
"""PluginManager for Core"""
|
||||
|
||||
@ -39,11 +31,11 @@ import deluge.pluginmanagerbase
|
||||
import deluge.component as component
|
||||
from deluge.log import LOG as log
|
||||
|
||||
class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
||||
class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
||||
component.Component):
|
||||
"""PluginManager handles the loading of plugins and provides plugins with
|
||||
functions to access parts of the core."""
|
||||
|
||||
|
||||
def __init__(self, core):
|
||||
component.Component.__init__(self, "PluginManager")
|
||||
self.core = core
|
||||
@ -53,7 +45,7 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
||||
"post_torrent_remove": [],
|
||||
"post_session_load": []
|
||||
}
|
||||
|
||||
|
||||
self.status_fields = {}
|
||||
|
||||
# Call the PluginManagerBase constructor
|
||||
@ -63,19 +55,19 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
||||
def start(self):
|
||||
# Enable plugins that are enabled in the config
|
||||
self.enable_plugins()
|
||||
|
||||
|
||||
# Set update timer to call update() in plugins every second
|
||||
self.update_timer = gobject.timeout_add(1000, self.update_plugins)
|
||||
|
||||
def stop(self):
|
||||
# Disable all enabled plugins
|
||||
self.disable_plugins()
|
||||
self.disable_plugins()
|
||||
# Stop the update timer
|
||||
gobject.source_remove(self.update_timer)
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
self.stop()
|
||||
|
||||
|
||||
def update_plugins(self):
|
||||
for plugin in self.plugins.keys():
|
||||
try:
|
||||
@ -87,13 +79,13 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
||||
def get_core(self):
|
||||
"""Returns a reference to the core"""
|
||||
return self.core
|
||||
|
||||
|
||||
def register_status_field(self, field, function):
|
||||
"""Register a new status field. This can be used in the same way the
|
||||
client requests other status information from core."""
|
||||
log.debug("Registering status field %s with PluginManager", field)
|
||||
self.status_fields[field] = function
|
||||
|
||||
|
||||
def deregister_status_field(self, field):
|
||||
"""Deregisters a status field"""
|
||||
log.debug("Deregistering status field %s with PluginManager", field)
|
||||
@ -101,7 +93,7 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
||||
del self.status_fields[field]
|
||||
except:
|
||||
log.warning("Unable to deregister status field %s", field)
|
||||
|
||||
|
||||
def get_status(self, torrent_id, fields):
|
||||
"""Return the value of status fields for the selected torrent_id."""
|
||||
status = {}
|
||||
@ -112,27 +104,27 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
||||
log.warning("Status field %s is not registered with the\
|
||||
PluginManager.", field)
|
||||
return status
|
||||
|
||||
|
||||
def register_hook(self, hook, function):
|
||||
"""Register a hook function with the plugin manager"""
|
||||
try:
|
||||
self.hooks[hook].append(function)
|
||||
except KeyError:
|
||||
log.warning("Plugin attempting to register invalid hook.")
|
||||
|
||||
|
||||
def deregister_hook(self, hook, function):
|
||||
"""Deregisters a hook function"""
|
||||
try:
|
||||
self.hooks[hook].remove(function)
|
||||
except:
|
||||
log.warning("Unable to deregister hook %s", hook)
|
||||
|
||||
|
||||
def run_post_torrent_add(self, torrent_id):
|
||||
"""This hook is run after a torrent has been added to the session."""
|
||||
log.debug("run_post_torrent_add")
|
||||
for function in self.hooks["post_torrent_add"]:
|
||||
function(torrent_id)
|
||||
|
||||
|
||||
def run_post_torrent_remove(self, torrent_id):
|
||||
"""This hook is run after a torrent has been removed from the session.
|
||||
"""
|
||||
@ -147,16 +139,16 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
||||
log.debug("run_post_session_load")
|
||||
for function in self.hooks["post_session_load"]:
|
||||
function()
|
||||
|
||||
|
||||
def get_torrent_list(self):
|
||||
"""Returns a list of torrent_id's in the current session."""
|
||||
return component.get("TorrentManager").get_torrent_list()
|
||||
|
||||
|
||||
def block_ip_range(self, range):
|
||||
"""Blocks the ip range in the core"""
|
||||
return self.core.export_block_ip_range(range)
|
||||
|
||||
|
||||
def reset_ip_filter(self):
|
||||
"""Resets the ip filter"""
|
||||
return self.core.export_reset_ip_filter()
|
||||
|
||||
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# signalmanager.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import deluge.xmlrpclib as xmlrpclib
|
||||
import socket
|
||||
|
@ -1,41 +1,36 @@
|
||||
#
|
||||
# torrent.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
"""Internal Torrent class"""
|
||||
|
||||
import os
|
||||
|
||||
import deluge.libtorrent as lt
|
||||
try:
|
||||
import libtorrent as lt
|
||||
except ImportError:
|
||||
import deluge.libtorrent as lt
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
from deluge.configmanager import ConfigManager
|
||||
@ -61,7 +56,7 @@ class Torrent:
|
||||
|
||||
# We store the filename just in case we need to make a copy of the torrentfile
|
||||
self.filename = filename
|
||||
|
||||
|
||||
# Holds status info so that we don't need to keep getting it from lt
|
||||
self.status = self.handle.status()
|
||||
self.torrent_info = self.handle.get_torrent_info()
|
||||
@ -70,10 +65,10 @@ class Torrent:
|
||||
self.files = self.get_files()
|
||||
# Set the default file priorities to normal
|
||||
self.file_priorities = [1]* len(self.files)
|
||||
|
||||
|
||||
# Default total_uploaded to 0, this may be changed by the state
|
||||
self.total_uploaded = 0
|
||||
|
||||
|
||||
# Set default auto_managed value
|
||||
self.auto_managed = options["auto_managed"]
|
||||
if not handle.is_paused():
|
||||
@ -82,12 +77,12 @@ class Torrent:
|
||||
# We need to keep track if the torrent is finished in the state to prevent
|
||||
# some weird things on state load.
|
||||
self.is_finished = False
|
||||
|
||||
|
||||
# Queueing options
|
||||
self.stop_at_ratio = False
|
||||
self.stop_ratio = 2.00
|
||||
self.remove_at_ratio = False
|
||||
|
||||
|
||||
# Load values from state if we have it
|
||||
if state is not None:
|
||||
# This is for saving the total uploaded between sessions
|
||||
@ -101,7 +96,7 @@ class Torrent:
|
||||
self.set_stop_at_ratio(state.stop_at_ratio)
|
||||
self.set_stop_ratio(state.stop_ratio)
|
||||
self.set_remove_at_ratio(state.remove_at_ratio)
|
||||
else:
|
||||
else:
|
||||
# Tracker list
|
||||
self.trackers = []
|
||||
# Create a list of trackers
|
||||
@ -111,51 +106,52 @@ class Torrent:
|
||||
tracker["tier"] = value.tier
|
||||
self.trackers.append(tracker)
|
||||
|
||||
# Set the allocation mode
|
||||
self.compact = options["compact_allocation"]
|
||||
|
||||
# Various torrent options
|
||||
self.set_max_connections(options["max_connections_per_torrent"])
|
||||
self.set_max_upload_slots(options["max_upload_slots_per_torrent"])
|
||||
self.set_max_upload_speed(options["max_upload_speed_per_torrent"])
|
||||
self.set_max_download_speed(options["max_download_speed_per_torrent"])
|
||||
self.set_prioritize_first_last(options["prioritize_first_last_pieces"])
|
||||
self.handle.resolve_countries(True)
|
||||
self.handle.resolve_countries(True)
|
||||
if options.has_key("file_priorities"):
|
||||
self.set_file_priorities(options["file_priorities"])
|
||||
|
||||
# Set the allocation mode
|
||||
self.compact = options["compact_allocation"]
|
||||
|
||||
# Where the torrent is being saved to
|
||||
self.save_path = options["download_location"]
|
||||
# Status message holds error info about the torrent
|
||||
self.statusmsg = "OK"
|
||||
|
||||
|
||||
# The torrents state
|
||||
self.update_state()
|
||||
|
||||
|
||||
# The tracker status
|
||||
self.tracker_status = ""
|
||||
|
||||
|
||||
log.debug("Torrent object created.")
|
||||
|
||||
|
||||
def set_tracker_status(self, status):
|
||||
"""Sets the tracker status"""
|
||||
self.tracker_status = status
|
||||
|
||||
|
||||
def set_max_connections(self, max_connections):
|
||||
self.max_connections = int(max_connections)
|
||||
self.handle.set_max_connections(self.max_connections)
|
||||
|
||||
|
||||
def set_max_upload_slots(self, max_slots):
|
||||
self.max_upload_slots = int(max_slots)
|
||||
self.handle.set_max_uploads(self.max_upload_slots)
|
||||
|
||||
|
||||
def set_max_upload_speed(self, m_up_speed):
|
||||
self.max_upload_speed = m_up_speed
|
||||
self.handle.set_upload_limit(int(m_up_speed * 1024))
|
||||
|
||||
|
||||
def set_max_download_speed(self, m_down_speed):
|
||||
self.max_download_speed = m_down_speed
|
||||
self.handle.set_download_limit(int(m_down_speed * 1024))
|
||||
|
||||
|
||||
def set_prioritize_first_last(self, prioritize):
|
||||
self.prioritize_first_last = prioritize
|
||||
if self.prioritize_first_last:
|
||||
@ -165,30 +161,37 @@ class Torrent:
|
||||
priorities[0] = 7
|
||||
priorities[-1] = 7
|
||||
self.handle.prioritize_pieces(priorities)
|
||||
|
||||
|
||||
def set_save_path(self, save_path):
|
||||
self.save_path = save_path
|
||||
|
||||
|
||||
def set_auto_managed(self, auto_managed):
|
||||
self.auto_managed = auto_managed
|
||||
self.handle.auto_managed(auto_managed)
|
||||
self.update_state()
|
||||
|
||||
|
||||
def set_stop_ratio(self, stop_ratio):
|
||||
self.stop_ratio = stop_ratio
|
||||
|
||||
|
||||
def set_stop_at_ratio(self, stop_at_ratio):
|
||||
self.stop_at_ratio = stop_at_ratio
|
||||
|
||||
|
||||
def set_remove_at_ratio(self, remove_at_ratio):
|
||||
self.remove_at_ratio = remove_at_ratio
|
||||
|
||||
|
||||
def set_file_priorities(self, file_priorities):
|
||||
log.debug("setting %s's file priorities: %s", self.torrent_id, file_priorities)
|
||||
if len(file_priorities) != len(self.files):
|
||||
log.debug("file_priorities len != num_files")
|
||||
self.options["file_priorities"] = self.handle.file_priorities()
|
||||
return
|
||||
|
||||
|
||||
if self.compact:
|
||||
log.debug("setting file priority with compact allocation does not work!")
|
||||
self.file_priorities = self.handle.file_priorities()
|
||||
return
|
||||
|
||||
log.debug("setting %s's file priorities: %s", self.torrent_id, file_priorities)
|
||||
|
||||
self.handle.prioritize_files(file_priorities)
|
||||
|
||||
if 0 in self.file_priorities:
|
||||
@ -200,7 +203,7 @@ class Torrent:
|
||||
self.is_finished = False
|
||||
self.update_state()
|
||||
break
|
||||
|
||||
|
||||
self.file_priorities = file_priorities
|
||||
|
||||
# Set the first/last priorities if needed
|
||||
@ -217,7 +220,7 @@ class Torrent:
|
||||
trackers.append(tracker)
|
||||
self.trackers = trackers
|
||||
return
|
||||
|
||||
|
||||
log.debug("Setting trackers for %s: %s", self.torrent_id, trackers)
|
||||
tracker_list = []
|
||||
|
||||
@ -225,9 +228,9 @@ class Torrent:
|
||||
new_entry = lt.announce_entry(tracker["url"])
|
||||
new_entry.tier = tracker["tier"]
|
||||
tracker_list.append(new_entry)
|
||||
|
||||
|
||||
self.handle.replace_trackers(tracker_list)
|
||||
|
||||
|
||||
# Print out the trackers
|
||||
for t in self.handle.trackers():
|
||||
log.debug("tier: %s tracker: %s", t.tier, t.url)
|
||||
@ -236,15 +239,15 @@ class Torrent:
|
||||
if len(trackers) > 0:
|
||||
# Force a reannounce if there is at least 1 tracker
|
||||
self.force_reannounce()
|
||||
|
||||
|
||||
def update_state(self):
|
||||
"""Updates the state based on what libtorrent's state for the torrent is"""
|
||||
# Set the initial state based on the lt state
|
||||
LTSTATE = deluge.common.LT_TORRENT_STATE
|
||||
ltstate = int(self.handle.status().state)
|
||||
|
||||
|
||||
log.debug("set_state_based_on_ltstate: %s", ltstate)
|
||||
|
||||
|
||||
if ltstate == LTSTATE["Queued"] or ltstate == LTSTATE["Checking"]:
|
||||
self.state = "Checking"
|
||||
return
|
||||
@ -254,7 +257,7 @@ class Torrent:
|
||||
self.state = "Seeding"
|
||||
elif ltstate == LTSTATE["Allocating"]:
|
||||
self.state = "Allocating"
|
||||
|
||||
|
||||
if self.handle.is_paused() and len(self.handle.status().error) > 0:
|
||||
# This is an error'd torrent
|
||||
self.state = "Error"
|
||||
@ -264,7 +267,7 @@ class Torrent:
|
||||
self.state = "Queued"
|
||||
elif self.handle.is_paused() and not self.handle.is_auto_managed():
|
||||
self.state = "Paused"
|
||||
|
||||
|
||||
def set_state(self, state):
|
||||
"""Accepts state strings, ie, "Paused", "Seeding", etc."""
|
||||
if state not in TORRENT_STATE:
|
||||
@ -283,17 +286,17 @@ class Torrent:
|
||||
status = self.handle.status()
|
||||
else:
|
||||
status = self.status
|
||||
|
||||
|
||||
left = status.total_wanted - status.total_done
|
||||
|
||||
|
||||
if left <= 0 or status.download_payload_rate == 0:
|
||||
return 0
|
||||
|
||||
|
||||
try:
|
||||
eta = left / status.download_payload_rate
|
||||
except ZeroDivisionError:
|
||||
eta = 0
|
||||
|
||||
|
||||
return eta
|
||||
|
||||
def get_ratio(self):
|
||||
@ -302,20 +305,12 @@ class Torrent:
|
||||
status = self.handle.status()
|
||||
else:
|
||||
status = self.status
|
||||
|
||||
up = self.total_uploaded + status.total_payload_upload
|
||||
down = status.total_done
|
||||
|
||||
# Convert 'up' and 'down' to floats for proper calculation
|
||||
up = float(up)
|
||||
down = float(down)
|
||||
|
||||
try:
|
||||
ratio = up / down
|
||||
except ZeroDivisionError:
|
||||
return 0.0
|
||||
|
||||
return ratio
|
||||
# Return -1.0 if the downloaded bytes is 0, this is to represent infinity
|
||||
if status.all_time_download == 0:
|
||||
return -1.0
|
||||
|
||||
return float(status.all_time_upload) / float(status.all_time_download)
|
||||
|
||||
def get_files(self):
|
||||
"""Returns a list of files this torrent contains"""
|
||||
@ -323,23 +318,23 @@ class Torrent:
|
||||
torrent_info = self.handle.get_torrent_info()
|
||||
else:
|
||||
torrent_info = self.torrent_info
|
||||
|
||||
|
||||
ret = []
|
||||
files = torrent_info.files()
|
||||
for index, file in enumerate(files):
|
||||
ret.append({
|
||||
'index': index,
|
||||
'path': file.path,
|
||||
'path': file.path.decode("utf8", "ignore"),
|
||||
'size': file.size,
|
||||
'offset': file.offset
|
||||
})
|
||||
return ret
|
||||
|
||||
|
||||
def get_peers(self):
|
||||
"""Returns a list of peers and various information about them"""
|
||||
ret = []
|
||||
peers = self.handle.get_peer_info()
|
||||
|
||||
|
||||
for peer in peers:
|
||||
# We do not want to report peers that are half-connected
|
||||
if peer.flags & peer.connecting or peer.flags & peer.handshake:
|
||||
@ -348,7 +343,7 @@ class Torrent:
|
||||
client = str(peer.client).decode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
client = str(peer.client).decode("latin-1")
|
||||
|
||||
|
||||
# Make country a proper string
|
||||
country = str()
|
||||
for c in peer.country:
|
||||
@ -356,7 +351,7 @@ class Torrent:
|
||||
country += " "
|
||||
else:
|
||||
country += c
|
||||
|
||||
|
||||
ret.append({
|
||||
"ip": "%s:%s" % (peer.ip[0], peer.ip[1]),
|
||||
"up_speed": peer.up_speed,
|
||||
@ -367,11 +362,11 @@ class Torrent:
|
||||
})
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def get_queue_position(self):
|
||||
"""Returns the torrents queue position"""
|
||||
return self.handle.queue_position()
|
||||
|
||||
|
||||
def get_file_progress(self):
|
||||
"""Returns the file progress as a list of floats.. 0.0 -> 1.0"""
|
||||
file_progress = self.handle.file_progress()
|
||||
@ -383,25 +378,26 @@ class Torrent:
|
||||
ret.append(0.0)
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def get_status(self, keys):
|
||||
"""Returns the status of the torrent based on the keys provided"""
|
||||
# Create the full dictionary
|
||||
self.status = self.handle.status()
|
||||
self.torrent_info = self.handle.get_torrent_info()
|
||||
|
||||
|
||||
# Adjust progress to be 0-100 value
|
||||
progress = self.status.progress * 100
|
||||
|
||||
|
||||
# Adjust status.distributed_copies to return a non-negative value
|
||||
distributed_copies = self.status.distributed_copies
|
||||
if distributed_copies < 0:
|
||||
distributed_copies = 0.0
|
||||
|
||||
|
||||
full_status = {
|
||||
"distributed_copies": distributed_copies,
|
||||
"total_done": self.status.total_done,
|
||||
"total_uploaded": self.total_uploaded + self.status.total_payload_upload,
|
||||
"total_uploaded": self.status.all_time_upload,
|
||||
"all_time_download": self.status.all_time_download,
|
||||
"state": self.state,
|
||||
"paused": self.status.paused,
|
||||
"progress": progress,
|
||||
@ -437,9 +433,16 @@ class Torrent:
|
||||
"stop_at_ratio": self.stop_at_ratio,
|
||||
"remove_at_ratio": self.remove_at_ratio
|
||||
}
|
||||
|
||||
def ti_name():
|
||||
if self.handle.has_metadata():
|
||||
try:
|
||||
return self.torrent_info.name().decode("utf8", "ignore")
|
||||
except UnicodeDecodeError:
|
||||
return self.torrent_info.name()
|
||||
|
||||
return self.torrent_id
|
||||
fns = {
|
||||
"name": self.torrent_info.name,
|
||||
"name": ti_name,
|
||||
"private": self.torrent_info.priv,
|
||||
"total_size": self.torrent_info.total_size,
|
||||
"num_files": self.torrent_info.num_files,
|
||||
@ -453,12 +456,9 @@ class Torrent:
|
||||
"peers": self.get_peers,
|
||||
}
|
||||
|
||||
self.status = None
|
||||
self.torrent_info = None
|
||||
|
||||
# Create the desired status dictionary and return it
|
||||
status_dict = {}
|
||||
|
||||
|
||||
if len(keys) == 0:
|
||||
status_dict = full_status
|
||||
for key in fns:
|
||||
@ -470,8 +470,11 @@ class Torrent:
|
||||
elif key in fns:
|
||||
status_dict[key] = fns[key]()
|
||||
|
||||
self.status = None
|
||||
self.torrent_info = None
|
||||
|
||||
return status_dict
|
||||
|
||||
|
||||
def apply_options(self):
|
||||
"""Applies the per-torrent options that are set."""
|
||||
self.handle.set_max_connections(self.max_connections)
|
||||
@ -480,7 +483,7 @@ class Torrent:
|
||||
self.handle.set_download_limit(int(self.max_download_speed * 1024))
|
||||
self.handle.prioritize_files(self.file_priorities)
|
||||
self.handle.resolve_countries(True)
|
||||
|
||||
|
||||
def pause(self):
|
||||
"""Pause this torrent"""
|
||||
# Turn off auto-management so the torrent will not be unpaused by lt queueing
|
||||
@ -498,19 +501,19 @@ class Torrent:
|
||||
except Exception, e:
|
||||
log.debug("Unable to pause torrent: %s", e)
|
||||
return False
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def resume(self):
|
||||
"""Resumes this torrent"""
|
||||
|
||||
|
||||
if self.handle.is_paused() and self.handle.is_auto_managed():
|
||||
log.debug("Torrent is being auto-managed, cannot resume!")
|
||||
return
|
||||
else:
|
||||
# Reset the status message just in case of resuming an Error'd torrent
|
||||
self.set_status_message("OK")
|
||||
|
||||
|
||||
if self.handle.is_finished():
|
||||
# If the torrent has already reached it's 'stop_seed_ratio' then do not do anything
|
||||
if self.config["stop_seed_at_ratio"] or self.stop_at_ratio:
|
||||
@ -518,7 +521,7 @@ class Torrent:
|
||||
ratio = self.stop_ratio
|
||||
else:
|
||||
ratio = self.config["stop_seed_ratio"]
|
||||
|
||||
|
||||
if self.get_ratio() >= ratio:
|
||||
self.signals.emit("torrent_resume_at_stop_ratio")
|
||||
return
|
||||
@ -526,14 +529,14 @@ class Torrent:
|
||||
if self.auto_managed:
|
||||
# This torrent is to be auto-managed by lt queueing
|
||||
self.handle.auto_managed(True)
|
||||
|
||||
|
||||
try:
|
||||
self.handle.resume()
|
||||
except:
|
||||
pass
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def move_storage(self, dest):
|
||||
"""Move a torrent's storage location"""
|
||||
try:
|
||||
@ -556,7 +559,7 @@ class Torrent:
|
||||
fastresume.write(resume_data)
|
||||
fastresume.close()
|
||||
except IOError:
|
||||
log.warning("Error trying to save fastresume file")
|
||||
log.warning("Error trying to save fastresume file")
|
||||
|
||||
def delete_fastresume(self):
|
||||
"""Deletes the .fastresume file"""
|
||||
@ -579,7 +582,7 @@ class Torrent:
|
||||
os.remove(path)
|
||||
except Exception, e:
|
||||
log.warning("Unable to delete the torrent file: %s", e)
|
||||
|
||||
|
||||
def force_reannounce(self):
|
||||
"""Force a tracker reannounce"""
|
||||
try:
|
||||
@ -587,9 +590,9 @@ class Torrent:
|
||||
except Exception, e:
|
||||
log.debug("Unable to force reannounce: %s", e)
|
||||
return False
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def scrape_tracker(self):
|
||||
"""Scrape the tracker"""
|
||||
try:
|
||||
@ -597,9 +600,9 @@ class Torrent:
|
||||
except Exception, e:
|
||||
log.debug("Unable to scrape tracker: %s", e)
|
||||
return False
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def force_recheck(self):
|
||||
"""Forces a recheck of the torrents pieces"""
|
||||
try:
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# torrentmanager.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
"""TorrentManager handles Torrent objects"""
|
||||
|
||||
@ -40,7 +32,10 @@ import time
|
||||
|
||||
import gobject
|
||||
|
||||
import deluge.libtorrent as lt
|
||||
try:
|
||||
import libtorrent as lt
|
||||
except ImportError:
|
||||
import deluge.libtorrent as lt
|
||||
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
@ -57,7 +52,7 @@ class TorrentState:
|
||||
total_uploaded=0,
|
||||
trackers=None,
|
||||
compact=False,
|
||||
paused=False,
|
||||
paused=False,
|
||||
save_path=None,
|
||||
max_connections=-1,
|
||||
max_upload_slots=-1,
|
||||
@ -102,7 +97,7 @@ class TorrentManager(component.Component):
|
||||
"""TorrentManager contains a list of torrents in the current libtorrent
|
||||
session. This object is also responsible for saving the state of the
|
||||
session for use on restart."""
|
||||
|
||||
|
||||
def __init__(self, session, alerts):
|
||||
component.Component.__init__(self, "TorrentManager", interval=5000, depend=["PluginManager"])
|
||||
log.debug("TorrentManager init..")
|
||||
@ -115,12 +110,12 @@ class TorrentManager(component.Component):
|
||||
|
||||
# Create the torrents dict { torrent_id: Torrent }
|
||||
self.torrents = {}
|
||||
|
||||
|
||||
# This is a list of torrent_id when we shutdown the torrentmanager.
|
||||
# We use this list to determine if all active torrents have been paused
|
||||
# and that their resume data has been written.
|
||||
self.shutdown_torrent_pause_list = []
|
||||
|
||||
|
||||
# Register set functions
|
||||
self.config.register_set_function("max_connections_per_torrent",
|
||||
self.on_set_max_connections_per_torrent)
|
||||
@ -130,9 +125,9 @@ class TorrentManager(component.Component):
|
||||
self.on_set_max_upload_speed_per_torrent)
|
||||
self.config.register_set_function("max_download_speed_per_torrent",
|
||||
self.on_set_max_download_speed_per_torrent)
|
||||
|
||||
|
||||
# Register alert functions
|
||||
self.alerts.register_handler("torrent_finished_alert",
|
||||
self.alerts.register_handler("torrent_finished_alert",
|
||||
self.on_alert_torrent_finished)
|
||||
self.alerts.register_handler("torrent_paused_alert",
|
||||
self.on_alert_torrent_paused)
|
||||
@ -149,15 +144,15 @@ class TorrentManager(component.Component):
|
||||
self.on_alert_tracker_error)
|
||||
self.alerts.register_handler("storage_moved_alert",
|
||||
self.on_alert_storage_moved)
|
||||
self.alerts.register_handler("torrent_resumed_alert",
|
||||
self.alerts.register_handler("torrent_resumed_alert",
|
||||
self.on_alert_torrent_resumed)
|
||||
self.alerts.register_handler("state_changed_alert",
|
||||
self.on_alert_state_changed)
|
||||
|
||||
|
||||
def start(self):
|
||||
# Get the pluginmanager reference
|
||||
self.plugins = component.get("PluginManager")
|
||||
|
||||
|
||||
self.signals = component.get("SignalManager")
|
||||
|
||||
# Run the old state upgrader before loading state
|
||||
@ -169,11 +164,11 @@ class TorrentManager(component.Component):
|
||||
# Save the state every 5 minutes
|
||||
self.save_state_timer = gobject.timeout_add(300000, self.save_state)
|
||||
self.save_resume_data_timer = gobject.timeout_add(290000, self.save_resume_data)
|
||||
|
||||
|
||||
def stop(self):
|
||||
# Save state on shutdown
|
||||
self.save_state()
|
||||
|
||||
|
||||
component.pause("AlertManager")
|
||||
for key in self.torrents.keys():
|
||||
if not self.torrents[key].handle.is_paused():
|
||||
@ -181,11 +176,11 @@ class TorrentManager(component.Component):
|
||||
self.torrents[key].handle.auto_managed(False)
|
||||
self.torrents[key].handle.pause()
|
||||
self.shutdown_torrent_pause_list.append(key)
|
||||
while self.shutdown_torrent_pause_list:
|
||||
while self.shutdown_torrent_pause_list:
|
||||
time.sleep(0.1)
|
||||
# Wait for all alerts
|
||||
self.alerts.handle_alerts(True)
|
||||
|
||||
|
||||
def update(self):
|
||||
for torrent_id, torrent in self.torrents.items():
|
||||
if self.config["stop_seed_at_ratio"] or torrent.stop_at_ratio:
|
||||
@ -202,11 +197,11 @@ class TorrentManager(component.Component):
|
||||
def __getitem__(self, torrent_id):
|
||||
"""Return the Torrent with torrent_id"""
|
||||
return self.torrents[torrent_id]
|
||||
|
||||
|
||||
def get_torrent_list(self):
|
||||
"""Returns a list of torrent_ids"""
|
||||
return self.torrents.keys()
|
||||
|
||||
|
||||
def get_torrent_info_from_file(self, filepath):
|
||||
"""Returns a torrent_info for the file specified or None"""
|
||||
torrent_info = None
|
||||
@ -218,16 +213,16 @@ class TorrentManager(component.Component):
|
||||
_file.close()
|
||||
except (IOError, RuntimeError), e:
|
||||
log.warning("Unable to open %s: %s", filepath, e)
|
||||
|
||||
|
||||
return torrent_info
|
||||
|
||||
|
||||
def get_resume_data_from_file(self, torrent_id):
|
||||
"""Returns an entry with the resume data or None"""
|
||||
fastresume = ""
|
||||
try:
|
||||
_file = open(
|
||||
os.path.join(
|
||||
self.config["state_location"],
|
||||
self.config["state_location"],
|
||||
torrent_id + ".fastresume"),
|
||||
"rb")
|
||||
fastresume = _file.read()
|
||||
@ -236,24 +231,24 @@ class TorrentManager(component.Component):
|
||||
log.debug("Unable to load .fastresume: %s", e)
|
||||
|
||||
return str(fastresume)
|
||||
|
||||
|
||||
def add(self, torrent_info=None, state=None, options=None, save_state=True,
|
||||
filedump=None, filename=None):
|
||||
"""Add a torrent to the manager and returns it's torrent_id"""
|
||||
|
||||
|
||||
if torrent_info is None and state is None and filedump is None:
|
||||
log.debug("You must specify a valid torrent_info or a torrent state object!")
|
||||
return
|
||||
|
||||
log.debug("torrentmanager.add")
|
||||
add_torrent_params = {}
|
||||
|
||||
|
||||
if filedump is not None:
|
||||
try:
|
||||
torrent_info = lt.torrent_info(lt.bdecode(filedump))
|
||||
except Exception, e:
|
||||
log.error("Unable to decode torrent file!: %s", e)
|
||||
|
||||
|
||||
if torrent_info is None:
|
||||
# We have no torrent_info so we need to add the torrent with information
|
||||
# from the state object.
|
||||
@ -270,14 +265,14 @@ class TorrentManager(component.Component):
|
||||
options["download_location"] = state.save_path
|
||||
options["auto_managed"] = state.auto_managed
|
||||
options["add_paused"] = state.paused
|
||||
|
||||
|
||||
add_torrent_params["ti"] =\
|
||||
self.get_torrent_info_from_file(
|
||||
os.path.join(self.config["state_location"], state.torrent_id + ".torrent"))
|
||||
if not add_torrent_params["ti"]:
|
||||
log.error("Unable to add torrent!")
|
||||
return
|
||||
|
||||
|
||||
add_torrent_params["resume_data"] = self.get_resume_data_from_file(state.torrent_id)
|
||||
else:
|
||||
# We have a torrent_info object so we're not loading from state.
|
||||
@ -301,44 +296,50 @@ class TorrentManager(component.Component):
|
||||
else:
|
||||
for key in options_keys:
|
||||
if not options.has_key(key):
|
||||
options[key] = self.config[key]
|
||||
options[key] = self.config[key]
|
||||
|
||||
add_torrent_params["ti"] = torrent_info
|
||||
add_torrent_params["resume_data"] = ""
|
||||
|
||||
|
||||
#log.info("Adding torrent: %s", filename)
|
||||
log.debug("options: %s", options)
|
||||
|
||||
|
||||
# Set the right storage_mode
|
||||
if options["compact_allocation"]:
|
||||
storage_mode = lt.storage_mode_t(2)
|
||||
else:
|
||||
storage_mode = lt.storage_mode_t(1)
|
||||
|
||||
|
||||
try:
|
||||
# Try to encode this as utf8 if needed
|
||||
options["download_location"] = options["download_location"].encode("utf8")
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
|
||||
# Fill in the rest of the add_torrent_params dictionary
|
||||
add_torrent_params["save_path"] = options["download_location"].encode("utf8")
|
||||
add_torrent_params["save_path"] = options["download_location"]
|
||||
|
||||
add_torrent_params["storage_mode"] = storage_mode
|
||||
add_torrent_params["paused"] = True
|
||||
add_torrent_params["auto_managed"] = False
|
||||
add_torrent_params["duplicate_is_error"] = True
|
||||
|
||||
|
||||
# We need to pause the AlertManager momentarily to prevent alerts
|
||||
# for this torrent being generated before a Torrent object is created.
|
||||
component.pause("AlertManager")
|
||||
|
||||
|
||||
handle = None
|
||||
try:
|
||||
handle = self.session.add_torrent(add_torrent_params)
|
||||
except RuntimeError, e:
|
||||
log.warning("Error adding torrent: %s", e)
|
||||
|
||||
|
||||
if not handle or not handle.is_valid():
|
||||
log.debug("torrent handle is invalid!")
|
||||
# The torrent was not added to the session
|
||||
component.resume("AlertManager")
|
||||
return
|
||||
|
||||
|
||||
log.debug("handle id: %s", str(handle.info_hash()))
|
||||
# Create a Torrent object
|
||||
torrent = Torrent(handle, options, state, filename)
|
||||
@ -346,7 +347,7 @@ class TorrentManager(component.Component):
|
||||
self.torrents[torrent.torrent_id] = torrent
|
||||
if self.config["queue_new_to_top"]:
|
||||
handle.queue_position_top()
|
||||
|
||||
|
||||
component.resume("AlertManager")
|
||||
|
||||
# Resume the torrent if needed
|
||||
@ -357,7 +358,7 @@ class TorrentManager(component.Component):
|
||||
# Write the .torrent file to the state directory
|
||||
if filedump:
|
||||
try:
|
||||
save_file = open(os.path.join(self.config["state_location"],
|
||||
save_file = open(os.path.join(self.config["state_location"],
|
||||
torrent.torrent_id + ".torrent"),
|
||||
"wb")
|
||||
save_file.write(filedump)
|
||||
@ -380,10 +381,10 @@ class TorrentManager(component.Component):
|
||||
if save_state:
|
||||
# Save the session state
|
||||
self.save_state()
|
||||
|
||||
|
||||
# Emit the torrent_added signal
|
||||
self.signals.emit("torrent_added", torrent.torrent_id)
|
||||
|
||||
|
||||
return torrent.torrent_id
|
||||
|
||||
def load_torrent(self, torrent_id):
|
||||
@ -394,16 +395,16 @@ class TorrentManager(component.Component):
|
||||
log.debug("Attempting to open %s for add.", torrent_id)
|
||||
_file = open(
|
||||
os.path.join(
|
||||
self.config["state_location"], torrent_id + ".torrent"),
|
||||
self.config["state_location"], torrent_id + ".torrent"),
|
||||
"rb")
|
||||
filedump = lt.bdecode(_file.read())
|
||||
_file.close()
|
||||
except (IOError, RuntimeError), e:
|
||||
log.warning("Unable to open %s: %s", torrent_id, e)
|
||||
return False
|
||||
|
||||
|
||||
return filedump
|
||||
|
||||
|
||||
def remove(self, torrent_id, remove_torrent=False, remove_data=False):
|
||||
"""Remove a torrent from the manager"""
|
||||
try:
|
||||
@ -412,17 +413,17 @@ class TorrentManager(component.Component):
|
||||
# Remove data if set
|
||||
if remove_data:
|
||||
option = 1
|
||||
self.session.remove_torrent(self.torrents[torrent_id].handle,
|
||||
self.session.remove_torrent(self.torrents[torrent_id].handle,
|
||||
option)
|
||||
except (RuntimeError, KeyError), e:
|
||||
log.warning("Error removing torrent: %s", e)
|
||||
return False
|
||||
|
||||
|
||||
# Remove the .torrent file if requested
|
||||
if remove_torrent:
|
||||
try:
|
||||
torrent_file = os.path.join(
|
||||
self.config["torrentfiles_location"],
|
||||
self.config["torrentfiles_location"],
|
||||
self.torrents[torrent_id].filename)
|
||||
os.remove(torrent_file)
|
||||
except Exception, e:
|
||||
@ -430,24 +431,24 @@ class TorrentManager(component.Component):
|
||||
|
||||
# Remove the .fastresume if it exists
|
||||
self.torrents[torrent_id].delete_fastresume()
|
||||
|
||||
|
||||
# Remove the .torrent file in the state
|
||||
self.torrents[torrent_id].delete_torrentfile()
|
||||
|
||||
|
||||
# Remove the torrent from deluge's session
|
||||
try:
|
||||
del self.torrents[torrent_id]
|
||||
except KeyError, ValueError:
|
||||
return False
|
||||
|
||||
|
||||
# Save the session state
|
||||
self.save_state()
|
||||
|
||||
|
||||
# Emit the signal to the clients
|
||||
self.signals.emit("torrent_removed", torrent_id)
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def pause_all(self):
|
||||
"""Pauses all torrents.. Returns a list of torrents paused."""
|
||||
torrent_was_paused = False
|
||||
@ -457,7 +458,7 @@ class TorrentManager(component.Component):
|
||||
torrent_was_paused = True
|
||||
except:
|
||||
log.warning("Unable to pause torrent %s", key)
|
||||
|
||||
|
||||
return torrent_was_paused
|
||||
|
||||
def resume_all(self):
|
||||
@ -470,7 +471,7 @@ class TorrentManager(component.Component):
|
||||
log.warning("Unable to resume torrent %s", key)
|
||||
|
||||
return torrent_was_resumed
|
||||
|
||||
|
||||
def load_state(self):
|
||||
"""Load the state of the TorrentManager from the torrents.state file"""
|
||||
state = TorrentManagerState()
|
||||
@ -483,7 +484,7 @@ class TorrentManager(component.Component):
|
||||
state_file.close()
|
||||
except (EOFError, IOError, Exception), e:
|
||||
log.warning("Unable to load state file: %s", e)
|
||||
|
||||
|
||||
# Try to use an old state
|
||||
try:
|
||||
if dir(state.torrents[0]) != dir(TorrentState()):
|
||||
@ -492,7 +493,7 @@ class TorrentManager(component.Component):
|
||||
setattr(s, attr, getattr(TorrentState(), attr, None))
|
||||
except Exception, e:
|
||||
log.warning("Unable to update state file to a compatible version: %s", e)
|
||||
|
||||
|
||||
# Reorder the state.torrents list to add torrents in the correct queue
|
||||
# order.
|
||||
ordered_state = []
|
||||
@ -503,14 +504,14 @@ class TorrentManager(component.Component):
|
||||
break
|
||||
if torrent_state not in ordered_state:
|
||||
ordered_state.append(torrent_state)
|
||||
|
||||
|
||||
for torrent_state in ordered_state:
|
||||
try:
|
||||
self.add(state=torrent_state, save_state=False)
|
||||
except AttributeError, e:
|
||||
log.error("Torrent state file is either corrupt or incompatible!")
|
||||
break
|
||||
|
||||
|
||||
# Run the post_session_load plugin hooks
|
||||
self.plugins.run_post_session_load()
|
||||
|
||||
@ -522,14 +523,14 @@ class TorrentManager(component.Component):
|
||||
paused = False
|
||||
if torrent.state == "Paused":
|
||||
paused = True
|
||||
|
||||
|
||||
torrent_state = TorrentState(
|
||||
torrent.torrent_id,
|
||||
torrent.filename,
|
||||
torrent.get_status(["total_uploaded"])["total_uploaded"],
|
||||
torrent.get_status(["total_uploaded"])["total_uploaded"],
|
||||
torrent.trackers,
|
||||
torrent.compact,
|
||||
paused,
|
||||
torrent.compact,
|
||||
paused,
|
||||
torrent.save_path,
|
||||
torrent.max_connections,
|
||||
torrent.max_upload_slots,
|
||||
@ -545,18 +546,18 @@ class TorrentManager(component.Component):
|
||||
torrent.remove_at_ratio
|
||||
)
|
||||
state.torrents.append(torrent_state)
|
||||
|
||||
|
||||
# Pickle the TorrentManagerState object
|
||||
try:
|
||||
log.debug("Saving torrent state file.")
|
||||
state_file = open(
|
||||
os.path.join(self.config["state_location"], "torrents.state"),
|
||||
os.path.join(self.config["state_location"], "torrents.state"),
|
||||
"wb")
|
||||
cPickle.dump(state, state_file)
|
||||
state_file.close()
|
||||
except IOError:
|
||||
log.warning("Unable to save state file.")
|
||||
|
||||
|
||||
# We return True so that the timer thread will continue
|
||||
return True
|
||||
|
||||
@ -564,7 +565,7 @@ class TorrentManager(component.Component):
|
||||
"""Saves resume data for all the torrents"""
|
||||
for torrent in self.torrents.values():
|
||||
torrent.write_fastresume()
|
||||
|
||||
|
||||
def queue_top(self, torrent_id):
|
||||
"""Queue torrent to top"""
|
||||
if self.torrents[torrent_id].get_queue_position() == 0:
|
||||
@ -585,7 +586,7 @@ class TorrentManager(component.Component):
|
||||
"""Queue torrent down one position"""
|
||||
if self.torrents[torrent_id].get_queue_position() == (len(self.torrents) - 1):
|
||||
return False
|
||||
|
||||
|
||||
self.torrents[torrent_id].handle.queue_position_down()
|
||||
return True
|
||||
|
||||
@ -596,13 +597,13 @@ class TorrentManager(component.Component):
|
||||
|
||||
self.torrents[torrent_id].handle.queue_position_bottom()
|
||||
return True
|
||||
|
||||
|
||||
def on_set_max_connections_per_torrent(self, key, value):
|
||||
"""Sets the per-torrent connection limit"""
|
||||
log.debug("max_connections_per_torrent set to %s..", value)
|
||||
for key in self.torrents.keys():
|
||||
self.torrents[key].set_max_connections(value)
|
||||
|
||||
|
||||
def on_set_max_upload_slots_per_torrent(self, key, value):
|
||||
"""Sets the per-torrent upload slot limit"""
|
||||
log.debug("max_upload_slots_per_torrent set to %s..", value)
|
||||
@ -613,7 +614,7 @@ class TorrentManager(component.Component):
|
||||
log.debug("max_upload_speed_per_torrent set to %s..", value)
|
||||
for key in self.torrents.keys():
|
||||
self.torrents[key].set_max_upload_speed(value)
|
||||
|
||||
|
||||
def on_set_max_download_speed_per_torrent(self, key, value):
|
||||
log.debug("max_download_speed_per_torrent set to %s..", value)
|
||||
for key in self.torrents.keys():
|
||||
@ -635,7 +636,7 @@ class TorrentManager(component.Component):
|
||||
torrent.update_state()
|
||||
torrent.write_fastresume()
|
||||
component.get("SignalManager").emit("torrent_finished", torrent_id)
|
||||
|
||||
|
||||
def on_alert_torrent_paused(self, alert):
|
||||
log.debug("on_alert_torrent_paused")
|
||||
# Get the torrent_id
|
||||
@ -643,20 +644,20 @@ class TorrentManager(component.Component):
|
||||
# Set the torrent state
|
||||
self.torrents[torrent_id].update_state()
|
||||
component.get("SignalManager").emit("torrent_paused", torrent_id)
|
||||
|
||||
|
||||
# Write the fastresume file
|
||||
self.torrents[torrent_id].write_fastresume()
|
||||
|
||||
|
||||
if torrent_id in self.shutdown_torrent_pause_list:
|
||||
self.shutdown_torrent_pause_list.remove(torrent_id)
|
||||
|
||||
|
||||
def on_alert_torrent_checked(self, alert):
|
||||
log.debug("on_alert_torrent_checked")
|
||||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
# Set the torrent state
|
||||
self.torrents[torrent_id].update_state()
|
||||
|
||||
|
||||
def on_alert_tracker_reply(self, alert):
|
||||
log.debug("on_alert_tracker_reply")
|
||||
# Get the torrent_id
|
||||
@ -667,7 +668,7 @@ class TorrentManager(component.Component):
|
||||
self.torrents[torrent_id].set_tracker_status(_("Announce OK"))
|
||||
except KeyError:
|
||||
log.debug("torrent_id doesn't exist.")
|
||||
|
||||
|
||||
# Check to see if we got any peer information from the tracker
|
||||
if alert.handle.status().num_complete == -1 or \
|
||||
alert.handle.status().num_incomplete == -1:
|
||||
@ -682,7 +683,7 @@ class TorrentManager(component.Component):
|
||||
except RuntimeError:
|
||||
log.debug("Invalid torrent handle.")
|
||||
return
|
||||
|
||||
|
||||
# Set the tracker status for the torrent
|
||||
try:
|
||||
self.torrents[torrent_id].set_tracker_status(_("Announce Sent"))
|
||||
@ -700,7 +701,7 @@ class TorrentManager(component.Component):
|
||||
self.torrents[torrent_id].set_tracker_status(tracker_status)
|
||||
except KeyError:
|
||||
log.debug("torrent_id doesn't exist.")
|
||||
|
||||
|
||||
def on_alert_tracker_warning(self, alert):
|
||||
log.debug("on_alert_tracker_warning")
|
||||
# Get the torrent_id
|
||||
@ -715,13 +716,12 @@ class TorrentManager(component.Component):
|
||||
def on_alert_tracker_error(self, alert):
|
||||
log.debug("on_alert_tracker_error")
|
||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
||||
error_msg = " ".join(alert.message().split()[3:]).split(":")[0]
|
||||
tracker_status = "%s: %s" % (_("Error"), error_msg)
|
||||
tracker_status = "%s: %s" % (_("Error"), alert.msg)
|
||||
try:
|
||||
torrent.set_tracker_status(tracker_status)
|
||||
except KeyError:
|
||||
log.debug("torrent_id doesn't exist.")
|
||||
|
||||
|
||||
def on_alert_storage_moved(self, alert):
|
||||
log.debug("on_alert_storage_moved")
|
||||
log.debug("save_path: %s", alert.handle.save_path())
|
||||
@ -738,10 +738,9 @@ class TorrentManager(component.Component):
|
||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
||||
torrent.is_finished = torrent.handle.is_seed()
|
||||
torrent.update_state()
|
||||
|
||||
|
||||
def on_alert_state_changed(self, alert):
|
||||
log.debug("on_alert_state_changed")
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
self.torrents[torrent_id].update_state()
|
||||
component.get("SignalManager").emit("torrent_state_changed", torrent_id)
|
||||
|
||||
|
39
deluge/data/GEOIP_LICENSE.txt
Normal file
39
deluge/data/GEOIP_LICENSE.txt
Normal file
@ -0,0 +1,39 @@
|
||||
There are two licenses, one for the C library software, and one for
|
||||
the database.
|
||||
|
||||
SOFTWARE LICENSE (C library)
|
||||
|
||||
The GeoIP C Library is licensed under the LGPL. For details see
|
||||
the COPYING file.
|
||||
|
||||
OPEN DATA LICENSE (GeoLite Country and GeoLite City databases)
|
||||
|
||||
Copyright (c) 2008 MaxMind, Inc. All Rights Reserved.
|
||||
|
||||
All advertising materials and documentation mentioning features or use of
|
||||
this database must display the following acknowledgment:
|
||||
"This product includes GeoLite data created by MaxMind, available from
|
||||
http://maxmind.com/"
|
||||
|
||||
Redistribution and use with or without modification, are permitted provided
|
||||
that the following conditions are met:
|
||||
1. Redistributions must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
2. All advertising materials and documentation mentioning features or use of
|
||||
this database must display the following acknowledgement:
|
||||
"This product includes GeoLite data created by MaxMind, available from
|
||||
http://maxmind.com/"
|
||||
3. "MaxMind" may not be used to endorse or promote products derived from this
|
||||
database without specific prior written permission.
|
||||
|
||||
THIS DATABASE IS PROVIDED BY MAXMIND, INC ``AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL MAXMIND BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
DATABASE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
433
deluge/data/pixmaps/deluge.xpm
Normal file
433
deluge/data/pixmaps/deluge.xpm
Normal file
@ -0,0 +1,433 @@
|
||||
/* XPM */
|
||||
static char * deluge_xpm[] = {
|
||||
"32 32 398 2",
|
||||
" c None",
|
||||
". c #7B869E",
|
||||
"+ c #7B869D",
|
||||
"@ c #A5ADBE",
|
||||
"# c #A7AFBE",
|
||||
"$ c #8894A9",
|
||||
"% c #A4ADBD",
|
||||
"& c #A7AFBF",
|
||||
"* c #95A0B4",
|
||||
"= c #6F7E99",
|
||||
"- c #A0AABD",
|
||||
"; c #8594AD",
|
||||
"> c #8A98B1",
|
||||
", c #A7B3C6",
|
||||
"' c #8496AF",
|
||||
") c #5B6F90",
|
||||
"! c #8F9EB6",
|
||||
"~ c #8194AF",
|
||||
"{ c #7C91AF",
|
||||
"] c #8096B3",
|
||||
"^ c #859BB8",
|
||||
"/ c #A0B1C8",
|
||||
"( c #728CAD",
|
||||
"_ c #758BAA",
|
||||
": c #849AB7",
|
||||
"< c #6F8AAE",
|
||||
"[ c #7591B3",
|
||||
"} c #7995B8",
|
||||
"| c #7A97B9",
|
||||
"1 c #86A0C0",
|
||||
"2 c #93ABC7",
|
||||
"3 c #6585AE",
|
||||
"4 c #5A78A0",
|
||||
"5 c #879FBE",
|
||||
"6 c #6485AF",
|
||||
"7 c #698CB5",
|
||||
"8 c #6E91BA",
|
||||
"9 c #7295BD",
|
||||
"0 c #7497BF",
|
||||
"a c #7296BF",
|
||||
"b c #89A6C8",
|
||||
"c c #809FC4",
|
||||
"d c #436B9C",
|
||||
"e c #7B99BE",
|
||||
"f c #5378A6",
|
||||
"g c #446A9A",
|
||||
"h c #4B6F9C",
|
||||
"i c #5577A2",
|
||||
"j c #6183AE",
|
||||
"k c #6D92BD",
|
||||
"l c #7097C3",
|
||||
"m c #6E96C1",
|
||||
"n c #8DACCF",
|
||||
"o c #6C93BF",
|
||||
"p c #587DA9",
|
||||
"q c #446592",
|
||||
"r c #1B4075",
|
||||
"s c #204478",
|
||||
"t c #2F5081",
|
||||
"u c #496791",
|
||||
"v c #4F6B94",
|
||||
"w c #5879A4",
|
||||
"x c #6B93BE",
|
||||
"y c #6E97C2",
|
||||
"z c #8EADCF",
|
||||
"A c #5E89BA",
|
||||
"B c #3E669A",
|
||||
"C c #567198",
|
||||
"D c #24477A",
|
||||
"E c #315281",
|
||||
"F c #365685",
|
||||
"G c #3A5A86",
|
||||
"H c #405E8A",
|
||||
"I c #567197",
|
||||
"J c #577298",
|
||||
"K c #516E97",
|
||||
"L c #6187B3",
|
||||
"M c #7098C4",
|
||||
"N c #85A7CC",
|
||||
"O c #5280B6",
|
||||
"P c #305C92",
|
||||
"Q c #5A759B",
|
||||
"R c #2B4D7E",
|
||||
"S c #3B5A88",
|
||||
"T c #4C6991",
|
||||
"U c #597397",
|
||||
"V c #60799D",
|
||||
"W c #5C769A",
|
||||
"X c #587298",
|
||||
"Y c #637C9E",
|
||||
"Z c #5D769B",
|
||||
"` c #526F96",
|
||||
" . c #5B84B0",
|
||||
".. c #759BC6",
|
||||
"+. c #7398C4",
|
||||
"@. c #325D95",
|
||||
"#. c #4C6A94",
|
||||
"$. c #3B5B87",
|
||||
"%. c #44628C",
|
||||
"&. c #5B7599",
|
||||
"*. c #6D84A5",
|
||||
"=. c #647D9F",
|
||||
"-. c #6784A8",
|
||||
";. c #7194BD",
|
||||
">. c #769EC9",
|
||||
",. c #709AC4",
|
||||
"'. c #7293B8",
|
||||
"). c #6D86A9",
|
||||
"!. c #526E96",
|
||||
"~. c #5782B1",
|
||||
"{. c #7A9EC8",
|
||||
"]. c #5D8ABC",
|
||||
"^. c #325485",
|
||||
"/. c #4F6C94",
|
||||
"(. c #3D5C88",
|
||||
"_. c #5E779B",
|
||||
":. c #7489A8",
|
||||
"<. c #667FA1",
|
||||
"[. c #8BA3C1",
|
||||
"}. c #8BAED4",
|
||||
"|. c #83A9D3",
|
||||
"1. c #82A8D2",
|
||||
"2. c #7FA6D1",
|
||||
"3. c #7CA4CE",
|
||||
"4. c #7AA0CC",
|
||||
"5. c #708EB4",
|
||||
"6. c #5F789C",
|
||||
"7. c #4E6C96",
|
||||
"8. c #5986B9",
|
||||
"9. c #7FA2CA",
|
||||
"0. c #4B7CB2",
|
||||
"a. c #2B5387",
|
||||
"b. c #567199",
|
||||
"c. c #305282",
|
||||
"d. c #506B93",
|
||||
"e. c #7187A5",
|
||||
"f. c #6F85A3",
|
||||
"g. c #8EA4BF",
|
||||
"h. c #9DBBDC",
|
||||
"i. c #8EB2D9",
|
||||
"j. c #8DB1D8",
|
||||
"k. c #8AAED6",
|
||||
"l. c #84AAD3",
|
||||
"m. c #7EA5D0",
|
||||
"n. c #779FCC",
|
||||
"o. c #6C8BB0",
|
||||
"p. c #5E779A",
|
||||
"q. c #5178A6",
|
||||
"r. c #5C89BC",
|
||||
"s. c #7198C4",
|
||||
"t. c #325486",
|
||||
"u. c #4C6993",
|
||||
"v. c #5E789B",
|
||||
"w. c #778CA8",
|
||||
"x. c #7389A7",
|
||||
"y. c #B6CADF",
|
||||
"z. c #9ABBDF",
|
||||
"A. c #9BBCE0",
|
||||
"B. c #9ABCDF",
|
||||
"C. c #97B9DE",
|
||||
"D. c #93B6DB",
|
||||
"E. c #8CB1D8",
|
||||
"F. c #85ABD4",
|
||||
"G. c #7CA4CF",
|
||||
"H. c #749BC9",
|
||||
"I. c #6783A6",
|
||||
"J. c #56739C",
|
||||
"K. c #5283B8",
|
||||
"L. c #6F96C3",
|
||||
"M. c #4E7BAE",
|
||||
"N. c #42618D",
|
||||
"O. c #3E5C88",
|
||||
"P. c #667E9F",
|
||||
"Q. c #7288A7",
|
||||
"R. c #8EA1BA",
|
||||
"S. c #B9CFE7",
|
||||
"T. c #A6C5E6",
|
||||
"U. c #A7C6E6",
|
||||
"V. c #A5C4E6",
|
||||
"W. c #A1C1E3",
|
||||
"X. c #93B6DC",
|
||||
"Y. c #8AAFD7",
|
||||
"Z. c #80A7D1",
|
||||
"`. c #769FCC",
|
||||
" + c #6992BF",
|
||||
".+ c #5D789D",
|
||||
"++ c #5483B9",
|
||||
"@+ c #5281B7",
|
||||
"#+ c #688FBB",
|
||||
"$+ c #557198",
|
||||
"%+ c #1E4277",
|
||||
"&+ c #3F5E88",
|
||||
"*+ c #687FA0",
|
||||
"=+ c #6F85A5",
|
||||
"-+ c #A0B2C8",
|
||||
";+ c #BFD5ED",
|
||||
">+ c #B3CFED",
|
||||
",+ c #B2CFED",
|
||||
"'+ c #AFCCEB",
|
||||
")+ c #A9C8E8",
|
||||
"!+ c #A2C2E4",
|
||||
"~+ c #99BADF",
|
||||
"{+ c #78A1CD",
|
||||
"]+ c #6C97C6",
|
||||
"^+ c #5D88B7",
|
||||
"/+ c #4779B2",
|
||||
"(+ c #7295BE",
|
||||
"_+ c #3C6699",
|
||||
":+ c #2B4F83",
|
||||
"<+ c #59749A",
|
||||
"[+ c #657D9E",
|
||||
"}+ c #6C83A3",
|
||||
"|+ c #A3B4CA",
|
||||
"1+ c #C7DDF2",
|
||||
"2+ c #BFD9F4",
|
||||
"3+ c #BDD7F2",
|
||||
"4+ c #B8D3F0",
|
||||
"5+ c #B0CDEC",
|
||||
"6+ c #9CBDE0",
|
||||
"7+ c #91B4DA",
|
||||
"8+ c #79A1CD",
|
||||
"9+ c #5F8DBF",
|
||||
"0+ c #4578B1",
|
||||
"a+ c #6B90BA",
|
||||
"b+ c #446A9B",
|
||||
"c+ c #2D5184",
|
||||
"d+ c #577299",
|
||||
"e+ c #305181",
|
||||
"f+ c #5B749A",
|
||||
"g+ c #6C82A2",
|
||||
"h+ c #98AAC3",
|
||||
"i+ c #D2E5F6",
|
||||
"j+ c #CAE2FA",
|
||||
"k+ c #C6DEF8",
|
||||
"l+ c #BED8F3",
|
||||
"m+ c #B4D0EE",
|
||||
"n+ c #9EBEE1",
|
||||
"o+ c #92B5DB",
|
||||
"p+ c #78A0CD",
|
||||
"q+ c #6B96C5",
|
||||
"r+ c #5D8BBE",
|
||||
"s+ c #5081B7",
|
||||
"t+ c #4276AF",
|
||||
"u+ c #6489B4",
|
||||
"v+ c #4B6E9B",
|
||||
"w+ c #2C5284",
|
||||
"x+ c #234679",
|
||||
"y+ c #4C6990",
|
||||
"z+ c #6C82A3",
|
||||
"A+ c #738AA9",
|
||||
"B+ c #D9E9F9",
|
||||
"C+ c #D3E9FF",
|
||||
"D+ c #CCE3FB",
|
||||
"E+ c #C2DBF5",
|
||||
"F+ c #B6D2EF",
|
||||
"G+ c #AAC8E8",
|
||||
"H+ c #9DBEE1",
|
||||
"I+ c #90B3DA",
|
||||
"J+ c #759ECB",
|
||||
"K+ c #6893C4",
|
||||
"L+ c #5A89BC",
|
||||
"M+ c #4D7EB5",
|
||||
"N+ c #3F73AD",
|
||||
"O+ c #6386B1",
|
||||
"P+ c #486A96",
|
||||
"Q+ c #2A5082",
|
||||
"R+ c #58739A",
|
||||
"S+ c #375685",
|
||||
"T+ c #5F789B",
|
||||
"U+ c #ADBED3",
|
||||
"V+ c #D4E9FE",
|
||||
"W+ c #CFE6FD",
|
||||
"X+ c #C2DCF6",
|
||||
"Y+ c #A8C7E7",
|
||||
"Z+ c #719BC9",
|
||||
"`+ c #6490C1",
|
||||
" @ c #5685BA",
|
||||
".@ c #487AB2",
|
||||
"+@ c #3F70A8",
|
||||
"@@ c #6B8BB2",
|
||||
"#@ c #3F608D",
|
||||
"$@ c #536F97",
|
||||
"%@ c #1F4377",
|
||||
"&@ c #224679",
|
||||
"*@ c #46638D",
|
||||
"=@ c #6880A0",
|
||||
"-@ c #6F86A5",
|
||||
";@ c #BBCDE0",
|
||||
">@ c #CEE4FC",
|
||||
",@ c #C0DAF4",
|
||||
"'@ c #A5C4E5",
|
||||
")@ c #96B9DD",
|
||||
"!@ c #88AED6",
|
||||
"~@ c #7CA3CE",
|
||||
"{@ c #719BC8",
|
||||
"]@ c #6692C2",
|
||||
"^@ c #5987BA",
|
||||
"/@ c #4C7CB3",
|
||||
"(@ c #4672A5",
|
||||
"_@ c #728DB1",
|
||||
":@ c #385884",
|
||||
"<@ c #3C5C89",
|
||||
"[@ c #385886",
|
||||
"}@ c #26497B",
|
||||
"|@ c #4B6790",
|
||||
"1@ c #6980A1",
|
||||
"2@ c #768BA9",
|
||||
"3@ c #9CB1CA",
|
||||
"4@ c #B9D3EE",
|
||||
"5@ c #ADCAEA",
|
||||
"6@ c #9EBFE2",
|
||||
"7@ c #90B4DA",
|
||||
"8@ c #87ACD5",
|
||||
"9@ c #7EA4CE",
|
||||
"0@ c #749CC8",
|
||||
"a@ c #6993C1",
|
||||
"b@ c #5C89BB",
|
||||
"c@ c #4F7DB1",
|
||||
"d@ c #5D80AC",
|
||||
"e@ c #617EA4",
|
||||
"f@ c #3A547B",
|
||||
"g@ c #2A4C7E",
|
||||
"h@ c #1C4176",
|
||||
"i@ c #27497B",
|
||||
"j@ c #45628D",
|
||||
"k@ c #60799C",
|
||||
"l@ c #7288A6",
|
||||
"m@ c #7D91AD",
|
||||
"n@ c #859FBE",
|
||||
"o@ c #93B4D7",
|
||||
"p@ c #8FB2D8",
|
||||
"q@ c #86ABD2",
|
||||
"r@ c #7EA4CD",
|
||||
"s@ c #759CC8",
|
||||
"t@ c #6A94C2",
|
||||
"u@ c #5C89BA",
|
||||
"v@ c #547EAE",
|
||||
"w@ c #7994B6",
|
||||
"x@ c #44628A",
|
||||
"y@ c #375786",
|
||||
"z@ c #476590",
|
||||
"A@ c #4C6890",
|
||||
"B@ c #5B7498",
|
||||
"C@ c #667EA0",
|
||||
"D@ c #6F86A7",
|
||||
"E@ c #738CAD",
|
||||
"F@ c #7592B7",
|
||||
"G@ c #779AC1",
|
||||
"H@ c #779DC7",
|
||||
"I@ c #6993C0",
|
||||
"J@ c #5B86B6",
|
||||
"K@ c #7B97BB",
|
||||
"L@ c #5A769E",
|
||||
"M@ c #394E6E",
|
||||
"N@ c #21426C",
|
||||
"O@ c #45638E",
|
||||
"P@ c #496691",
|
||||
"Q@ c #1D4176",
|
||||
"R@ c #41608B",
|
||||
"S@ c #4C6891",
|
||||
"T@ c #506D95",
|
||||
"U@ c #4E6B94",
|
||||
"V@ c #4B6A95",
|
||||
"W@ c #5176A3",
|
||||
"X@ c #7C99BC",
|
||||
"Y@ c #6280A8",
|
||||
"Z@ c #3E567A",
|
||||
"`@ c #25446F",
|
||||
" # c #395987",
|
||||
".# c #214579",
|
||||
"+# c #294C7E",
|
||||
"@# c #315383",
|
||||
"## c #3D5C8A",
|
||||
"$# c #43618D",
|
||||
"%# c #5C769C",
|
||||
"&# c #6D84A6",
|
||||
"*# c #405E8B",
|
||||
"=# c #375179",
|
||||
"-# c #1B304F",
|
||||
";# c #2E5181",
|
||||
"># c #415F8C",
|
||||
",# c #547098",
|
||||
"'# c #486590",
|
||||
")# c #43618E",
|
||||
"!# c #476690",
|
||||
"~# c #6981A4",
|
||||
"{# c #677FA3",
|
||||
"]# c #496690",
|
||||
"^# c #2E5283",
|
||||
"/# c #294467",
|
||||
"(# c #32507C",
|
||||
"_# c #325684",
|
||||
":# c #335484",
|
||||
"<# c #3F5E8B",
|
||||
"[# c #3E5F8D",
|
||||
"}# c #345887",
|
||||
"|# c #305383",
|
||||
"1# c #2A4466",
|
||||
" ",
|
||||
" . + ",
|
||||
" @ # ",
|
||||
" $ % & * ",
|
||||
" = - ; > , ' ",
|
||||
" ) ! ~ { ] ^ / ( ",
|
||||
" _ : < [ } | 1 2 3 ",
|
||||
" 4 5 6 7 8 9 0 a b c ",
|
||||
" d e f g h i j k l m n o ",
|
||||
" p q r r s t u v w x y z A ",
|
||||
" B C r D E F G H I J K L M N O ",
|
||||
" P Q R S T U V W I X Y Z ` ...+. ",
|
||||
" @.#.$.%.&.*.=.-.;.>.,.'.).V !.~.{.]. ",
|
||||
" ^./.(._.:.<.[.}.|.1.2.3.4.5.6.7.8.9.0. ",
|
||||
" a.b.c.d.e.f.g.h.i.i.j.k.l.m.n.o.p.q.r.s. ",
|
||||
" t.u.F v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M. ",
|
||||
" N.c.O.P.Q.R.S.T.U.V.W.A.X.Y.Z.`. +.+++@+#+ ",
|
||||
" $+%+&+*+=+-+;+>+,+'+)+!+~+i.|.{+]+^+++/+(+_+ ",
|
||||
" :+<+r G [+}+|+1+2+3+4+5+T.6+7+F.8+]+9+K.0+a+b+ ",
|
||||
" c+d+r e+f+g+h+i+j+k+l+m+)+n+o+l.p+q+r+s+t+u+v+ ",
|
||||
" w+Q r x+y+z+A+B+C+D+E+F+G+H+I+|.J+K+L+M+N+O+P+ ",
|
||||
" Q+R+r r S+T+*+U+V+W+X+F+Y+A.j.2.Z+`+ @.@+@@@#@ ",
|
||||
" $@%@r &@*@=@-@;@>@,@,+'@)@!@~@{@]@^@/@(@_@:@ ",
|
||||
" <@[@r r }@|@1@2@3@4@5@6@7@8@9@0@a@b@c@d@e@f@ ",
|
||||
" g@b.h@r r i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@ ",
|
||||
" y@z@r r r %@y@A@B@C@D@E@F@G@H@I@J@K@L@M@ ",
|
||||
" N@O@P@Q@r r r s e+R@S@T@` U@V@W@X@Y@Z@ ",
|
||||
" `@ #Q y@Q@r r .#+#@#[@##$#%#&#*#=# ",
|
||||
" -#;#>#d+,#'#)#!#u.Q ~#{#]#^#/# ",
|
||||
" (#_#:# #<#$#[#}#|#1# ",
|
||||
" ",
|
||||
" "};
|
@ -1,2 +1,2 @@
|
||||
Flag images found at http://www.hahn-hotel.com/flags/
|
||||
"All sets provided by us are free to use to anyone, for commercial or non-commercial websites."
|
||||
From: http://famfamfam.com/lab/icons/flags/
|
||||
"These flag icons are available for free use for any purpose with no requirement for attribution."
|
||||
|
45
deluge/docs/man/deluge.1
Normal file
45
deluge/docs/man/deluge.1
Normal file
@ -0,0 +1,45 @@
|
||||
.TH DELUGE 1 "November 2008" "1.0.6"
|
||||
|
||||
.SH NAME
|
||||
deluge - a bittorrent client
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B deluge [options] [torrent]
|
||||
|
||||
.SH DESCRIPTION
|
||||
.br
|
||||
.P
|
||||
Deluge utilizes a client/server model, with 'deluged' being the daemon process and 'deluge' being used to launch a user-interface.
|
||||
.br
|
||||
.P
|
||||
By default, Deluge will run in 'Classic' mode where the daemon functionality will be hidden and the GtkUI will automatically launch a 'deluged' process. You can turn this off in the Preferences dialog.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.I [torrent]
|
||||
List of ".torrent" files to add to the download queue.
|
||||
.TP
|
||||
.I --version
|
||||
Show program's version number and exit.
|
||||
.TP
|
||||
.I -h, --help
|
||||
Show this help message and exit.
|
||||
.TP
|
||||
.I -c CONFIG, --config=CONFIG
|
||||
Sets the configuration path.
|
||||
.TP
|
||||
.I -u UI, --ui=UI
|
||||
The UI that you wish to launch, current options include: gtk, web or null
|
||||
.TP
|
||||
.I -l LOGFILE, --logfile=LOGFILE
|
||||
Output to designated logfile instead of stdout
|
||||
|
||||
.SH SEE ALSO
|
||||
.B Homepage:
|
||||
http://www.deluge-torrent.org/
|
||||
|
||||
.SH AUTHOR
|
||||
This manual page was written by Andrew Resch <andrew.resch@gmail.com>.
|
||||
.br
|
||||
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation
|
||||
.br
|
45
deluge/docs/man/deluged.1
Normal file
45
deluge/docs/man/deluged.1
Normal file
@ -0,0 +1,45 @@
|
||||
.TH DELUGED 1 "November 2008" "1.0.6"
|
||||
|
||||
.SH NAME
|
||||
deluged - a bittorrent client daemon
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B deluged [options]
|
||||
|
||||
.SH DESCRIPTION
|
||||
.br
|
||||
.P
|
||||
Deluge utilizes a client/server model, with 'deluged' being the daemon process and 'deluge' being used to launch a user-interface.
|
||||
.br
|
||||
.P
|
||||
By default, 'deluged' will run as a daemon, to prevent this you can run deluged with the \-d option. This option is useful for running deluged with the start-stop-daemon.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.I --version
|
||||
Show program's version number and exit.
|
||||
.TP
|
||||
.I -h, --help
|
||||
Show this help message and exit.
|
||||
.TP
|
||||
.I -p PORT, --port=PORT
|
||||
Port daemon will listen on, default is 58846
|
||||
.TP
|
||||
.I -d, --do-not-daemonize
|
||||
Do not daemonize
|
||||
.TP
|
||||
.I -c CONFIG, --config=CONFIG
|
||||
Sets the configuration path.
|
||||
.TP
|
||||
.I -l LOGFILE, --logfile=LOGFILE
|
||||
Output to designated logfile instead of stdout
|
||||
|
||||
.SH SEE ALSO
|
||||
.B Homepage:
|
||||
http://www.deluge-torrent.org/
|
||||
|
||||
.SH AUTHOR
|
||||
This manual page was written by Andrew Resch <andrew.resch@gmail.com>.
|
||||
.br
|
||||
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation
|
||||
.br
|
@ -1,42 +1,34 @@
|
||||
#
|
||||
# error.py
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
class DelugeError(Exception):
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
def __str__(self):
|
||||
return repr(self.value)
|
||||
|
||||
|
||||
class NoCoreError(DelugeError):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -1,150 +1,150 @@
|
||||
deluge/scripts/wiki_docgen.py
|
||||
deluge/scripts/state_upgrade.py
|
||||
deluge/core/daemon.py
|
||||
deluge/core/signalmanager.py
|
||||
deluge/core/torrent.py
|
||||
deluge/core/core.py
|
||||
deluge/core/__init__.py
|
||||
deluge/core/torrentmanager.py
|
||||
deluge/core/pluginmanager.py
|
||||
deluge/core/autoadd.py
|
||||
deluge/core/signalmanager.py
|
||||
deluge/core/torrentmanager.py
|
||||
deluge/core/daemon.py
|
||||
deluge/core/torrent.py
|
||||
deluge/core/pluginmanager.py
|
||||
deluge/core/oldstateupgrader.py
|
||||
deluge/core/__init__.py
|
||||
deluge/core/core.py
|
||||
deluge/core/alertmanager.py
|
||||
deluge/main.py
|
||||
deluge/xmlrpclib.py
|
||||
deluge/SimpleXMLRPCServer.py
|
||||
deluge/component.py
|
||||
deluge/pluginmanagerbase.py
|
||||
deluge/error.py
|
||||
deluge/configmanager.py
|
||||
deluge/log.py
|
||||
deluge/config.py
|
||||
deluge/__init__.py
|
||||
deluge/ui/ui.py
|
||||
deluge/ui/webui/scripts/extract_template_strings.py
|
||||
deluge/ui/webui/scripts/template_strings.py
|
||||
deluge/ui/webui/tests/multicall_notepad.py
|
||||
deluge/ui/webui/tests/test_all.py
|
||||
deluge/ui/webui/json_api.py
|
||||
deluge/ui/webui/pages.py
|
||||
deluge/ui/webui/torrent_add.py
|
||||
deluge/ui/webui/config_tabs_deluge.py
|
||||
deluge/ui/webui/webserver_common.py
|
||||
deluge/ui/webui/config_tabs_webui.py
|
||||
deluge/ui/webui/torrent_move.py
|
||||
deluge/ui/webui/config_forms.py
|
||||
deluge/ui/webui/webui.py
|
||||
deluge/ui/webui/page_decorators.py
|
||||
deluge/ui/webui/components.py
|
||||
deluge/ui/webui/deluge_webserver.py
|
||||
deluge/ui/webui/utils.py
|
||||
deluge/ui/webui/apache.py
|
||||
deluge/ui/webui/debugerror.py
|
||||
deluge/ui/webui/torrent_options.py
|
||||
deluge/ui/webui/lib/newforms_portable/widgets.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/core/exceptions.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/core/__init__.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/safestring.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/translation.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/functional.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/html.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/encoding.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/http.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/__init__.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/datastructures.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/__init__.py
|
||||
deluge/ui/webui/lib/newforms_portable/util.py
|
||||
deluge/ui/webui/lib/newforms_portable/forms.py
|
||||
deluge/ui/webui/lib/newforms_portable/models.py
|
||||
deluge/ui/webui/lib/newforms_portable/fields.py
|
||||
deluge/ui/webui/lib/newforms_portable/__init__.py
|
||||
deluge/ui/webui/lib/webpy022/request.py
|
||||
deluge/ui/webui/lib/webpy022/webapi.py
|
||||
deluge/ui/webui/lib/webpy022/wsgi.py
|
||||
deluge/ui/webui/lib/webpy022/utils.py
|
||||
deluge/ui/webui/lib/webpy022/debugerror.py
|
||||
deluge/ui/webui/lib/webpy022/cheetah.py
|
||||
deluge/ui/webui/lib/webpy022/net.py
|
||||
deluge/ui/webui/lib/webpy022/http.py
|
||||
deluge/ui/webui/lib/webpy022/__init__.py
|
||||
deluge/ui/webui/lib/webpy022/wsgiserver/__init__.py
|
||||
deluge/ui/webui/lib/webpy022/template.py
|
||||
deluge/ui/webui/lib/webpy022/httpserver.py
|
||||
deluge/ui/webui/lib/webpy022/form.py
|
||||
deluge/ui/webui/lib/webpy022/db.py
|
||||
deluge/ui/webui/lib/web.py
|
||||
deluge/ui/webui/lib/__init__.py
|
||||
deluge/ui/webui/lib/json.py
|
||||
deluge/ui/webui/lib/static_handler.py
|
||||
deluge/ui/webui/lib/pythonize.py
|
||||
deluge/ui/webui/lib/newforms_plus.py
|
||||
deluge/ui/webui/render.py
|
||||
deluge/ui/webui/web.py
|
||||
deluge/ui/webui/__init__.py
|
||||
deluge/ui/webui/register_menu.py
|
||||
deluge/ui/null/deluge_shell.py
|
||||
deluge/ui/null/__init__.py
|
||||
deluge/ui/signalreceiver.py
|
||||
deluge/ui/client.py
|
||||
deluge/ui/__init__.py
|
||||
deluge/ui/gtkui/connectionmanager.py
|
||||
deluge/ui/gtkui/ipcinterface.py
|
||||
deluge/ui/gtkui/options_tab.py
|
||||
deluge/ui/gtkui/preferences.py
|
||||
deluge/ui/gtkui/addtorrentdialog.py
|
||||
deluge/ui/gtkui/torrentdetails.py
|
||||
deluge/ui/gtkui/peers_tab.py
|
||||
deluge/ui/gtkui/mainwindow.py
|
||||
deluge/ui/gtkui/coreconfig.py
|
||||
deluge/ui/gtkui/menubar.py
|
||||
deluge/ui/gtkui/statistics_tab.py
|
||||
deluge/ui/gtkui/gtkui.py
|
||||
deluge/ui/gtkui/sidebar.py
|
||||
deluge/ui/gtkui/systemtray.py
|
||||
deluge/ui/gtkui/toolbar.py
|
||||
deluge/ui/gtkui/torrentview.py
|
||||
deluge/ui/gtkui/files_tab.py
|
||||
deluge/ui/gtkui/signals.py
|
||||
deluge/ui/gtkui/queuedtorrents.py
|
||||
deluge/ui/gtkui/__init__.py
|
||||
deluge/ui/gtkui/removetorrentdialog.py
|
||||
deluge/ui/gtkui/details_tab.py
|
||||
deluge/ui/gtkui/pluginmanager.py
|
||||
deluge/ui/gtkui/dbusinterface.py
|
||||
deluge/ui/gtkui/listview.py
|
||||
deluge/ui/gtkui/aboutdialog.py
|
||||
deluge/ui/gtkui/statusbar.py
|
||||
deluge/ui/gtkui/edittrackersdialog.py
|
||||
deluge/common.py
|
||||
deluge/plugins/init.py
|
||||
deluge/plugins/label/label/ui.py
|
||||
deluge/plugins/label/label/gtk_sidebar.py
|
||||
deluge/plugins/label/label/test.py
|
||||
deluge/plugins/label/label/webui.py
|
||||
deluge/pluginmanagerbase.py
|
||||
deluge/SimpleXMLRPCServer.py
|
||||
deluge/plugins/label/label/webui_config.py
|
||||
deluge/plugins/label/label/webui.py
|
||||
deluge/plugins/label/label/gtk_sidebar.py
|
||||
deluge/plugins/label/label/gtkui.py
|
||||
deluge/plugins/label/label/test.py
|
||||
deluge/plugins/label/label/ui.py
|
||||
deluge/plugins/label/label/webui_pages.py
|
||||
deluge/plugins/label/label/core.py
|
||||
deluge/plugins/label/label/__init__.py
|
||||
deluge/plugins/label/label/core.py
|
||||
deluge/plugins/label/setup.py
|
||||
deluge/plugins/__init__.py
|
||||
deluge/plugins/corepluginbase.py
|
||||
deluge/plugins/init.py
|
||||
deluge/plugins/blocklist/setup.py
|
||||
deluge/plugins/blocklist/blocklist/ui.py
|
||||
deluge/plugins/blocklist/blocklist/peerguardian.py
|
||||
deluge/plugins/blocklist/blocklist/webui.py
|
||||
deluge/plugins/blocklist/blocklist/gtkui.py
|
||||
deluge/plugins/blocklist/blocklist/core.py
|
||||
deluge/plugins/blocklist/blocklist/ui.py
|
||||
deluge/plugins/blocklist/blocklist/text.py
|
||||
deluge/plugins/blocklist/blocklist/peerguardian.py
|
||||
deluge/plugins/blocklist/blocklist/__init__.py
|
||||
deluge/ui/gtkui/glade/connection_manager.glade
|
||||
deluge/ui/gtkui/glade/preferences_dialog.glade
|
||||
deluge/ui/gtkui/glade/queuedtorrents.glade
|
||||
deluge/ui/gtkui/glade/dgtkpopups.glade
|
||||
deluge/ui/gtkui/glade/remove_torrent_dialog.glade
|
||||
deluge/ui/gtkui/glade/edit_trackers.glade
|
||||
deluge/ui/gtkui/glade/move_storage_dialog.glade
|
||||
deluge/plugins/blocklist/blocklist/core.py
|
||||
deluge/plugins/__init__.py
|
||||
deluge/configmanager.py
|
||||
deluge/ui/client.py
|
||||
deluge/ui/ui.py
|
||||
deluge/ui/gtkui/listview.py
|
||||
deluge/ui/gtkui/options_tab.py
|
||||
deluge/ui/gtkui/statusbar.py
|
||||
deluge/ui/gtkui/statistics_tab.py
|
||||
deluge/ui/gtkui/addtorrentdialog.py
|
||||
deluge/ui/gtkui/coreconfig.py
|
||||
deluge/ui/gtkui/sidebar.py
|
||||
deluge/ui/gtkui/gtkui.py
|
||||
deluge/ui/gtkui/aboutdialog.py
|
||||
deluge/ui/gtkui/systemtray.py
|
||||
deluge/ui/gtkui/dbusinterface.py
|
||||
deluge/ui/gtkui/files_tab.py
|
||||
deluge/ui/gtkui/menubar.py
|
||||
deluge/ui/gtkui/peers_tab.py
|
||||
deluge/ui/gtkui/toolbar.py
|
||||
deluge/ui/gtkui/ipcinterface.py
|
||||
deluge/ui/gtkui/queuedtorrents.py
|
||||
deluge/ui/gtkui/pluginmanager.py
|
||||
deluge/ui/gtkui/mainwindow.py
|
||||
deluge/ui/gtkui/removetorrentdialog.py
|
||||
deluge/ui/gtkui/signals.py
|
||||
deluge/ui/gtkui/torrentdetails.py
|
||||
deluge/ui/gtkui/__init__.py
|
||||
deluge/ui/gtkui/edittrackersdialog.py
|
||||
deluge/ui/gtkui/preferences.py
|
||||
deluge/ui/gtkui/torrentview.py
|
||||
deluge/ui/gtkui/new_release_dialog.py
|
||||
deluge/ui/gtkui/connectionmanager.py
|
||||
deluge/ui/gtkui/details_tab.py
|
||||
deluge/ui/signalreceiver.py
|
||||
deluge/ui/__init__.py
|
||||
deluge/ui/webui/components.py
|
||||
deluge/ui/webui/render.py
|
||||
deluge/ui/webui/page_decorators.py
|
||||
deluge/ui/webui/webui.py
|
||||
deluge/ui/webui/debugerror.py
|
||||
deluge/ui/webui/webserver_common.py
|
||||
deluge/ui/webui/config_forms.py
|
||||
deluge/ui/webui/deluge_webserver.py
|
||||
deluge/ui/webui/json_api.py
|
||||
deluge/ui/webui/register_menu.py
|
||||
deluge/ui/webui/config_tabs_deluge.py
|
||||
deluge/ui/webui/lib/webpy022/request.py
|
||||
deluge/ui/webui/lib/webpy022/wsgiserver/__init__.py
|
||||
deluge/ui/webui/lib/webpy022/db.py
|
||||
deluge/ui/webui/lib/webpy022/template.py
|
||||
deluge/ui/webui/lib/webpy022/cheetah.py
|
||||
deluge/ui/webui/lib/webpy022/debugerror.py
|
||||
deluge/ui/webui/lib/webpy022/http.py
|
||||
deluge/ui/webui/lib/webpy022/httpserver.py
|
||||
deluge/ui/webui/lib/webpy022/utils.py
|
||||
deluge/ui/webui/lib/webpy022/__init__.py
|
||||
deluge/ui/webui/lib/webpy022/net.py
|
||||
deluge/ui/webui/lib/webpy022/wsgi.py
|
||||
deluge/ui/webui/lib/webpy022/webapi.py
|
||||
deluge/ui/webui/lib/webpy022/form.py
|
||||
deluge/ui/webui/lib/json.py
|
||||
deluge/ui/webui/lib/newforms_plus.py
|
||||
deluge/ui/webui/lib/static_handler.py
|
||||
deluge/ui/webui/lib/__init__.py
|
||||
deluge/ui/webui/lib/web.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/core/__init__.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/core/exceptions.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/html.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/http.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/encoding.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/translation.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/safestring.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/__init__.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/datastructures.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/utils/functional.py
|
||||
deluge/ui/webui/lib/newforms_portable/django/__init__.py
|
||||
deluge/ui/webui/lib/newforms_portable/forms.py
|
||||
deluge/ui/webui/lib/newforms_portable/models.py
|
||||
deluge/ui/webui/lib/newforms_portable/widgets.py
|
||||
deluge/ui/webui/lib/newforms_portable/fields.py
|
||||
deluge/ui/webui/lib/newforms_portable/__init__.py
|
||||
deluge/ui/webui/lib/newforms_portable/util.py
|
||||
deluge/ui/webui/utils.py
|
||||
deluge/ui/webui/pages.py
|
||||
deluge/ui/webui/__init__.py
|
||||
deluge/ui/webui/tests/test_all.py
|
||||
deluge/ui/webui/apache.py
|
||||
deluge/ui/webui/web.py
|
||||
deluge/ui/webui/torrent_move.py
|
||||
deluge/ui/webui/config_tabs_webui.py
|
||||
deluge/ui/webui/torrent_options.py
|
||||
deluge/ui/webui/torrent_add.py
|
||||
deluge/ui/webui/scripts/template_strings.py
|
||||
deluge/ui/webui/scripts/extract_template_strings.py
|
||||
deluge/ui/null/deluge_shell.py
|
||||
deluge/ui/null/__init__.py
|
||||
deluge/common.py
|
||||
deluge/component.py
|
||||
deluge/main.py
|
||||
deluge/error.py
|
||||
deluge/__init__.py
|
||||
deluge/log.py
|
||||
deluge/xmlrpclib.py
|
||||
deluge/scripts/wiki_docgen.py
|
||||
deluge/scripts/state_upgrade.py
|
||||
deluge/plugins/blocklist/blocklist/data/blocklist_pref.glade
|
||||
deluge/ui/gtkui/glade/add_torrent_dialog.glade
|
||||
deluge/ui/gtkui/glade/torrent_menu.glade
|
||||
deluge/ui/gtkui/glade/remove_torrent_dialog.glade
|
||||
deluge/ui/gtkui/glade/preferences_dialog.glade
|
||||
deluge/ui/gtkui/glade/edit_trackers.glade
|
||||
deluge/ui/gtkui/glade/queuedtorrents.glade
|
||||
deluge/ui/gtkui/glade/move_storage_dialog.glade
|
||||
deluge/ui/gtkui/glade/connection_manager.glade
|
||||
deluge/ui/gtkui/glade/dgtkpopups.glade
|
||||
deluge/ui/gtkui/glade/tray_menu.glade
|
||||
deluge/ui/gtkui/glade/main_window.glade
|
||||
deluge/plugins/blocklist/blocklist/data/blocklist_pref.glade
|
||||
|
3547
deluge/i18n/ar.po
3547
deluge/i18n/ar.po
File diff suppressed because it is too large
Load Diff
3728
deluge/i18n/bg.po
3728
deluge/i18n/bg.po
File diff suppressed because it is too large
Load Diff
3555
deluge/i18n/ca.po
3555
deluge/i18n/ca.po
File diff suppressed because it is too large
Load Diff
3594
deluge/i18n/cs.po
3594
deluge/i18n/cs.po
File diff suppressed because it is too large
Load Diff
3738
deluge/i18n/da.po
3738
deluge/i18n/da.po
File diff suppressed because it is too large
Load Diff
3693
deluge/i18n/de.po
3693
deluge/i18n/de.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
4179
deluge/i18n/el.po
4179
deluge/i18n/el.po
File diff suppressed because it is too large
Load Diff
3517
deluge/i18n/en_AU.po
3517
deluge/i18n/en_AU.po
File diff suppressed because it is too large
Load Diff
4097
deluge/i18n/en_CA.po
4097
deluge/i18n/en_CA.po
File diff suppressed because it is too large
Load Diff
4033
deluge/i18n/en_GB.po
4033
deluge/i18n/en_GB.po
File diff suppressed because it is too large
Load Diff
3640
deluge/i18n/es.po
3640
deluge/i18n/es.po
File diff suppressed because it is too large
Load Diff
3866
deluge/i18n/et.po
3866
deluge/i18n/et.po
File diff suppressed because it is too large
Load Diff
3314
deluge/i18n/eu.po
3314
deluge/i18n/eu.po
File diff suppressed because it is too large
Load Diff
3780
deluge/i18n/fi.po
3780
deluge/i18n/fi.po
File diff suppressed because it is too large
Load Diff
3759
deluge/i18n/fr.po
3759
deluge/i18n/fr.po
File diff suppressed because it is too large
Load Diff
3485
deluge/i18n/gl.po
3485
deluge/i18n/gl.po
File diff suppressed because it is too large
Load Diff
3563
deluge/i18n/he.po
3563
deluge/i18n/he.po
File diff suppressed because it is too large
Load Diff
3631
deluge/i18n/hu.po
3631
deluge/i18n/hu.po
File diff suppressed because it is too large
Load Diff
3598
deluge/i18n/id.po
3598
deluge/i18n/id.po
File diff suppressed because it is too large
Load Diff
4194
deluge/i18n/is.po
4194
deluge/i18n/is.po
File diff suppressed because it is too large
Load Diff
2683
deluge/i18n/it.po
2683
deluge/i18n/it.po
File diff suppressed because it is too large
Load Diff
3735
deluge/i18n/ja.po
3735
deluge/i18n/ja.po
File diff suppressed because it is too large
Load Diff
2327
deluge/i18n/kk.po
Normal file
2327
deluge/i18n/kk.po
Normal file
File diff suppressed because it is too large
Load Diff
4671
deluge/i18n/ko.po
4671
deluge/i18n/ko.po
File diff suppressed because it is too large
Load Diff
4276
deluge/i18n/lt.po
4276
deluge/i18n/lt.po
File diff suppressed because it is too large
Load Diff
3625
deluge/i18n/ms.po
3625
deluge/i18n/ms.po
File diff suppressed because it is too large
Load Diff
3695
deluge/i18n/nb.po
3695
deluge/i18n/nb.po
File diff suppressed because it is too large
Load Diff
4071
deluge/i18n/nl.po
4071
deluge/i18n/nl.po
File diff suppressed because it is too large
Load Diff
3717
deluge/i18n/pl.po
3717
deluge/i18n/pl.po
File diff suppressed because it is too large
Load Diff
2487
deluge/i18n/pt.po
2487
deluge/i18n/pt.po
File diff suppressed because it is too large
Load Diff
3646
deluge/i18n/pt_BR.po
3646
deluge/i18n/pt_BR.po
File diff suppressed because it is too large
Load Diff
4137
deluge/i18n/ro.po
4137
deluge/i18n/ro.po
File diff suppressed because it is too large
Load Diff
2862
deluge/i18n/ru.po
2862
deluge/i18n/ru.po
File diff suppressed because it is too large
Load Diff
4520
deluge/i18n/sk.po
4520
deluge/i18n/sk.po
File diff suppressed because it is too large
Load Diff
4274
deluge/i18n/sl.po
4274
deluge/i18n/sl.po
File diff suppressed because it is too large
Load Diff
3597
deluge/i18n/sr.po
3597
deluge/i18n/sr.po
File diff suppressed because it is too large
Load Diff
3740
deluge/i18n/sv.po
3740
deluge/i18n/sv.po
File diff suppressed because it is too large
Load Diff
3364
deluge/i18n/th.po
3364
deluge/i18n/th.po
File diff suppressed because it is too large
Load Diff
3485
deluge/i18n/tr.po
3485
deluge/i18n/tr.po
File diff suppressed because it is too large
Load Diff
3876
deluge/i18n/uk.po
3876
deluge/i18n/uk.po
File diff suppressed because it is too large
Load Diff
2465
deluge/i18n/zh_CN.po
2465
deluge/i18n/zh_CN.po
File diff suppressed because it is too large
Load Diff
4704
deluge/i18n/zh_TW.po
4704
deluge/i18n/zh_TW.po
File diff suppressed because it is too large
Load Diff
@ -1,35 +1,27 @@
|
||||
#
|
||||
# log.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
"""Logging functions"""
|
||||
|
||||
|
@ -1,37 +1,29 @@
|
||||
#
|
||||
# main.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
# The main starting point for the program. This function is called when the
|
||||
|
||||
# The main starting point for the program. This function is called when the
|
||||
# user runs the command 'deluge'.
|
||||
|
||||
"""Main starting point for Deluge. Contains the main() entry point."""
|
||||
@ -46,7 +38,7 @@ import deluge.common
|
||||
def start_ui():
|
||||
"""Entry point for ui script"""
|
||||
# Setup the argument parser
|
||||
parser = OptionParser(usage="%prog [options] [actions]",
|
||||
parser = OptionParser(usage="%prog [options] [actions]",
|
||||
version=deluge.common.get_version())
|
||||
|
||||
parser.add_option("-u", "--ui", dest="ui",
|
||||
@ -55,7 +47,7 @@ def start_ui():
|
||||
help="Set the config location", action="store", type="str")
|
||||
parser.add_option("-l", "--logfile", dest="logfile",
|
||||
help="Output to designated logfile instead of stdout", action="store", type="str")
|
||||
|
||||
|
||||
# Get the options and args from the OptionParser
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
@ -69,11 +61,11 @@ def start_ui():
|
||||
else:
|
||||
if not os.path.exists(deluge.common.get_default_config_dir()):
|
||||
os.makedirs(deluge.common.get_default_config_dir())
|
||||
|
||||
|
||||
# Always log to a file in Windows
|
||||
if deluge.common.windows_check() and not options.logfile:
|
||||
options.logfile = "deluge.log"
|
||||
|
||||
|
||||
if options.logfile:
|
||||
if options.config:
|
||||
logfile = os.path.join(options.config, options.logfile)
|
||||
@ -83,13 +75,13 @@ def start_ui():
|
||||
sys.stdout = open(logfile, "wb")
|
||||
sys.stderr = sys.stdout
|
||||
sys.stdin = None
|
||||
|
||||
|
||||
from deluge.log import LOG as log
|
||||
|
||||
version = deluge.common.get_version()
|
||||
if deluge.common.get_revision() != "":
|
||||
version = version + "r" + deluge.common.get_revision()
|
||||
|
||||
|
||||
log.info("Deluge ui %s", version)
|
||||
log.debug("options: %s", options)
|
||||
log.debug("args: %s", args)
|
||||
@ -97,15 +89,15 @@ def start_ui():
|
||||
from deluge.ui.ui import UI
|
||||
log.info("Starting ui..")
|
||||
UI(options, args)
|
||||
|
||||
|
||||
def start_daemon():
|
||||
"""Entry point for daemon script"""
|
||||
import deluge.common
|
||||
|
||||
|
||||
# Setup the argument parser
|
||||
parser = OptionParser(usage="%prog [options] [actions]",
|
||||
parser = OptionParser(usage="%prog [options] [actions]",
|
||||
version=deluge.common.get_version())
|
||||
parser.add_option("-p", "--port", dest="port",
|
||||
parser.add_option("-p", "--port", dest="port",
|
||||
help="Port daemon will listen on", action="store", type="int")
|
||||
parser.add_option("-d", "--do-not-daemonize", dest="donot",
|
||||
help="Do not daemonize", action="store_true", default=False)
|
||||
@ -113,7 +105,7 @@ def start_daemon():
|
||||
help="Set the config location", action="store", type="str")
|
||||
parser.add_option("-l", "--logfile", dest="logfile",
|
||||
help="Set the logfile location", action="store", type="str")
|
||||
|
||||
|
||||
# Get the options and args from the OptionParser
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
@ -127,7 +119,7 @@ def start_daemon():
|
||||
else:
|
||||
if not os.path.exists(deluge.common.get_default_config_dir()):
|
||||
os.makedirs(deluge.common.get_default_config_dir())
|
||||
|
||||
|
||||
# If the donot daemonize is set, then we just skip the forking
|
||||
if not options.donot and not deluge.common.windows_check():
|
||||
if os.fork() == 0:
|
||||
@ -141,7 +133,7 @@ def start_daemon():
|
||||
else:
|
||||
config_dir = deluge.common.get_default_config_dir()
|
||||
logfile = os.path.join(config_dir, "deluged.log")
|
||||
|
||||
|
||||
sys.stdout = open(logfile, "wb")
|
||||
sys.stderr = sys.stdout
|
||||
sys.stdin = None
|
||||
@ -160,11 +152,11 @@ def start_daemon():
|
||||
else:
|
||||
config_dir = deluge.common.get_default_config_dir()
|
||||
logfile = os.path.join(config_dir, "deluged.log")
|
||||
|
||||
|
||||
sys.stdout = open(logfile, "wb")
|
||||
sys.stderr = sys.stdout
|
||||
sys.stdin = None
|
||||
|
||||
|
||||
from deluge.core.daemon import Daemon
|
||||
Daemon(options, args)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# pluginmanagerbase.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
@ -21,15 +21,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
"""PluginManagerBase"""
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# blocklist/__init__.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2008 Mark Stahler ('kramed') <markstahler@gmail.com>
|
||||
#
|
||||
#
|
||||
@ -23,15 +23,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
from deluge.log import LOG as log
|
||||
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# core.py
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import threading
|
||||
import urllib
|
||||
@ -66,17 +58,17 @@ FORMATS = {
|
||||
'p2bgz': ["PeerGuardian P2B (GZip)", PGReader]
|
||||
}
|
||||
|
||||
class Core(CorePluginBase):
|
||||
class Core(CorePluginBase):
|
||||
def enable(self):
|
||||
log.debug('Blocklist: Plugin enabled..')
|
||||
|
||||
|
||||
self.is_downloading = False
|
||||
self.is_importing = False
|
||||
self.num_blocked = 0
|
||||
self.file_progress = 0.0
|
||||
|
||||
|
||||
self.core = component.get("Core")
|
||||
|
||||
|
||||
self.config = deluge.configmanager.ConfigManager("blocklist.conf", DEFAULT_PREFS)
|
||||
if self.config["load_on_start"]:
|
||||
self.export_import(self.need_new_blocklist())
|
||||
@ -86,13 +78,13 @@ class Core(CorePluginBase):
|
||||
self.update_timer = gobject.timeout_add(
|
||||
self.config["check_after_days"] * 24 * 60 * 60 * 1000,
|
||||
self.download_blocklist, True)
|
||||
|
||||
|
||||
def disable(self):
|
||||
log.debug("Reset IP Filter..")
|
||||
component.get("Core").export_reset_ip_filter()
|
||||
self.config.save()
|
||||
log.debug('Blocklist: Plugin disabled')
|
||||
|
||||
|
||||
def update(self):
|
||||
pass
|
||||
|
||||
@ -100,7 +92,7 @@ class Core(CorePluginBase):
|
||||
def export_download(self, _import=False):
|
||||
"""Download the blocklist specified in the config as url"""
|
||||
self.download_blocklist(_import)
|
||||
|
||||
|
||||
def export_import(self, download=False, force=False):
|
||||
"""Import the blocklist from the blocklist.cache, if load is True, then
|
||||
it will download the blocklist file if needed."""
|
||||
@ -109,12 +101,12 @@ class Core(CorePluginBase):
|
||||
def export_get_config(self):
|
||||
"""Returns the config dictionary"""
|
||||
return self.config.get_config()
|
||||
|
||||
|
||||
def export_set_config(self, config):
|
||||
"""Sets the config based on values in 'config'"""
|
||||
for key in config.keys():
|
||||
self.config[key] = config[key]
|
||||
|
||||
|
||||
def export_get_status(self):
|
||||
"""Returns the status of the plugin."""
|
||||
status = {}
|
||||
@ -124,40 +116,40 @@ class Core(CorePluginBase):
|
||||
status["state"] = "Importing"
|
||||
else:
|
||||
status["state"] = "Idle"
|
||||
|
||||
|
||||
status["num_blocked"] = self.num_blocked
|
||||
status["file_progress"] = self.file_progress
|
||||
status["file_type"] = self.config["file_type"]
|
||||
status["file_url"] = self.config["file_url"]
|
||||
status["file_size"] = self.config["file_size"]
|
||||
status["file_date"] = self.config["file_date"]
|
||||
|
||||
|
||||
return status
|
||||
|
||||
|
||||
####
|
||||
|
||||
|
||||
|
||||
|
||||
def on_download_blocklist(self, load):
|
||||
self.is_downloading = False
|
||||
if load:
|
||||
self.export_import()
|
||||
|
||||
|
||||
def import_blocklist(self, download=False, force=False):
|
||||
"""Imports the downloaded blocklist into the session"""
|
||||
if self.is_downloading:
|
||||
return
|
||||
|
||||
|
||||
if download:
|
||||
if force or self.need_new_blocklist():
|
||||
self.download_blocklist(True)
|
||||
return
|
||||
|
||||
self.is_importing = True
|
||||
|
||||
self.is_importing = True
|
||||
log.debug("Reset IP Filter..")
|
||||
component.get("Core").export_reset_ip_filter()
|
||||
|
||||
|
||||
self.num_blocked = 0
|
||||
|
||||
|
||||
# Open the file for reading
|
||||
try:
|
||||
read_list = FORMATS[self.config["listtype"]][1](
|
||||
@ -177,21 +169,21 @@ class Core(CorePluginBase):
|
||||
log.debug("Exception during import: %s", e)
|
||||
else:
|
||||
log.debug("Blocklist import complete!")
|
||||
|
||||
|
||||
self.is_importing = False
|
||||
|
||||
|
||||
def download_blocklist(self, load=False):
|
||||
"""Runs download_blocklist_thread() in a thread and calls on_download_blocklist
|
||||
when finished. If load is True, then we will import the blocklist
|
||||
upon download completion."""
|
||||
if self.is_importing:
|
||||
return
|
||||
|
||||
|
||||
self.is_downloading = True
|
||||
threading.Thread(
|
||||
target=self.download_blocklist_thread,
|
||||
target=self.download_blocklist_thread,
|
||||
args=(self.on_download_blocklist, load)).start()
|
||||
|
||||
|
||||
def download_blocklist_thread(self, callback, load):
|
||||
"""Downloads the blocklist specified by 'url' in the config"""
|
||||
def _call_callback(callback, load):
|
||||
@ -203,10 +195,10 @@ class Core(CorePluginBase):
|
||||
if fp > 1.0:
|
||||
fp = 1.0
|
||||
self.file_progress = fp
|
||||
|
||||
|
||||
import socket
|
||||
socket.setdefaulttimeout(self.config["timeout"])
|
||||
|
||||
|
||||
for i in xrange(self.config["try_times"]):
|
||||
log.debug("Attempting to download blocklist %s", self.config["url"])
|
||||
try:
|
||||
@ -225,10 +217,10 @@ class Core(CorePluginBase):
|
||||
list_stats = os.stat(deluge.configmanager.get_config_dir("blocklist.cache"))
|
||||
self.config["file_date"] = datetime.datetime.fromtimestamp(list_stats.st_mtime).ctime()
|
||||
self.config["file_size"] = list_size = list_stats.st_size
|
||||
|
||||
|
||||
gobject.idle_add(_call_callback, callback, load)
|
||||
return
|
||||
|
||||
|
||||
def need_new_blocklist(self):
|
||||
"""Returns True if a new blocklist file should be downloaded"""
|
||||
try:
|
||||
@ -247,5 +239,5 @@ class Core(CorePluginBase):
|
||||
|
||||
if current_time >= (list_time + datetime.timedelta(days=self.config["check_after_days"])):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
return False
|
||||
|
340
deluge/plugins/blocklist/blocklist/data/COPYING
Normal file
340
deluge/plugins/blocklist/blocklist/data/COPYING
Normal file
@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
3
deluge/plugins/blocklist/blocklist/data/LICENSE
Normal file
3
deluge/plugins/blocklist/blocklist/data/LICENSE
Normal file
@ -0,0 +1,3 @@
|
||||
Icons (*.png) are from: http://ftp.acc.umu.se/pub/GNOME/sources/gnome-icon-theme
|
||||
|
||||
Licensed under the GPLv2, see COPYING
|
@ -1,35 +1,26 @@
|
||||
#
|
||||
# gtkui.py
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here
|
||||
|
||||
import gtk
|
||||
|
||||
@ -44,59 +35,59 @@ from core import FORMATS
|
||||
class GtkUI(ui.UI):
|
||||
def enable(self):
|
||||
log.debug("Blocklist GtkUI enable..")
|
||||
|
||||
|
||||
self.load_preferences_page()
|
||||
|
||||
|
||||
self.status_item = component.get("StatusBar").add_item(
|
||||
image=self.get_resource("blocklist16.png"),
|
||||
text="",
|
||||
callback=self._on_status_item_clicked,
|
||||
tooltip="Blocked IP Ranges")
|
||||
|
||||
|
||||
# Register some hooks
|
||||
self.plugin.register_hook("on_apply_prefs", self._on_apply_prefs)
|
||||
self.plugin.register_hook("on_show_prefs", self._on_show_prefs)
|
||||
|
||||
|
||||
def disable(self):
|
||||
log.debug("Blocklist GtkUI disable..")
|
||||
|
||||
|
||||
# Remove the preferences page
|
||||
self.plugin.remove_preferences_page("Blocklist")
|
||||
|
||||
|
||||
# Remove status item
|
||||
component.get("StatusBar").remove_item(self.status_item)
|
||||
del self.status_item
|
||||
|
||||
|
||||
# Deregister the hooks
|
||||
self.plugin.deregister_hook("on_apply_prefs", self._on_apply_prefs)
|
||||
self.plugin.deregister_hook("on_show_prefs", self._on_show_prefs)
|
||||
|
||||
|
||||
del self.glade
|
||||
|
||||
|
||||
def update(self):
|
||||
def _on_get_status(status):
|
||||
if status["state"] == "Downloading":
|
||||
self.table_info.hide()
|
||||
self.glade.get_widget("button_check_download").set_sensitive(False)
|
||||
self.glade.get_widget("button_force_download").set_sensitive(False)
|
||||
|
||||
|
||||
self.status_item.set_text(
|
||||
"Downloading %.2f%%" % (status["file_progress"] * 100))
|
||||
self.progress_bar.set_text("Downloading %.2f%%" % (status["file_progress"] * 100))
|
||||
self.progress_bar.set_fraction(status["file_progress"])
|
||||
self.progress_bar.show()
|
||||
|
||||
|
||||
elif status["state"] == "Importing":
|
||||
self.table_info.hide()
|
||||
self.glade.get_widget("button_check_download").set_sensitive(False)
|
||||
self.glade.get_widget("button_force_download").set_sensitive(False)
|
||||
|
||||
|
||||
self.status_item.set_text(
|
||||
"Importing " + str(status["num_blocked"]))
|
||||
self.progress_bar.set_text("Importing %s" % (status["num_blocked"]))
|
||||
self.progress_bar.pulse()
|
||||
self.progress_bar.show()
|
||||
|
||||
|
||||
elif status["state"] == "Idle":
|
||||
self.progress_bar.hide()
|
||||
self.glade.get_widget("button_check_download").set_sensitive(True)
|
||||
@ -113,30 +104,30 @@ class GtkUI(ui.UI):
|
||||
FORMATS[status["file_type"]][0])
|
||||
except KeyError:
|
||||
self.glade.get_widget("label_type").set_text("")
|
||||
|
||||
|
||||
self.glade.get_widget("label_url").set_text(
|
||||
status["file_url"])
|
||||
|
||||
client.blocklist_get_status(_on_get_status)
|
||||
|
||||
|
||||
def _on_show_prefs(self):
|
||||
def _on_get_config(config):
|
||||
# Update the combo box. It's ugly, get over it.
|
||||
self.glade.get_widget("combobox_types").set_active_iter(
|
||||
self.glade.get_widget("combobox_types").get_model().\
|
||||
get_iter(FORMATS[config["listtype"]][1]))
|
||||
|
||||
|
||||
self.glade.get_widget("entry_url").set_text(
|
||||
config["url"])
|
||||
|
||||
|
||||
self.glade.get_widget("spin_check_days").set_value(
|
||||
config["check_after_days"])
|
||||
|
||||
|
||||
self.glade.get_widget("chk_import_on_start").set_active(
|
||||
config["load_on_start"])
|
||||
|
||||
|
||||
client.blocklist_get_config(_on_get_config)
|
||||
|
||||
|
||||
def _on_apply_prefs(self):
|
||||
config = {}
|
||||
config["listtype"] = self.glade.get_widget("combobox_types").\
|
||||
@ -145,33 +136,33 @@ class GtkUI(ui.UI):
|
||||
config["check_after_days"] = self.glade.get_widget("spin_check_days").get_value_as_int()
|
||||
config["load_on_start"] = self.glade.get_widget("chk_import_on_start").get_active()
|
||||
client.blocklist_set_config(None, config)
|
||||
|
||||
|
||||
def _on_button_check_download_clicked(self, widget):
|
||||
client.blocklist_import(None, True, False)
|
||||
|
||||
|
||||
def _on_button_force_download_clicked(self, widget):
|
||||
client.blocklist_import(None, True, True)
|
||||
|
||||
|
||||
def _on_status_item_clicked(self, widget, event):
|
||||
component.get("Preferences").show("Blocklist")
|
||||
|
||||
|
||||
def load_preferences_page(self):
|
||||
"""Initializes the preferences page and adds it to the preferences dialog"""
|
||||
# Load the preferences page
|
||||
self.glade = gtk.glade.XML(self.get_resource("blocklist_pref.glade"))
|
||||
|
||||
|
||||
self.progress_bar = self.glade.get_widget("progressbar")
|
||||
self.table_info = self.glade.get_widget("table_info")
|
||||
|
||||
|
||||
# Hide the progress bar initially
|
||||
self.progress_bar.hide()
|
||||
self.table_info.show()
|
||||
|
||||
|
||||
self.glade.signal_autoconnect({
|
||||
"on_button_check_download_clicked": self._on_button_check_download_clicked,
|
||||
"on_button_force_download_clicked": self._on_button_force_download_clicked
|
||||
})
|
||||
|
||||
|
||||
# Setup types combobox
|
||||
combo = self.glade.get_widget("combobox_types")
|
||||
combo_list = gtk.ListStore(str, str)
|
||||
@ -182,21 +173,21 @@ class GtkUI(ui.UI):
|
||||
|
||||
for k in FORMATS.keys():
|
||||
i = combo_list.append([FORMATS[k][0], k])
|
||||
FORMATS[k][1] = combo_list.get_path(i)
|
||||
FORMATS[k][1] = combo_list.get_path(i)
|
||||
|
||||
combo.set_active(0)
|
||||
|
||||
|
||||
# Set button icons
|
||||
self.glade.get_widget("image_download").set_from_file(
|
||||
self.get_resource("blocklist_download24.png"))
|
||||
|
||||
|
||||
self.glade.get_widget("image_import").set_from_file(
|
||||
self.get_resource("blocklist_import24.png"))
|
||||
|
||||
|
||||
# Update the preferences page with config values from the core
|
||||
self._on_show_prefs()
|
||||
|
||||
|
||||
# Add the page to the preferences dialog
|
||||
self.plugin.add_preferences_page(
|
||||
"Blocklist",
|
||||
self.glade.get_widget("blocklist_prefs_box"))
|
||||
"Blocklist",
|
||||
self.glade.get_widget("blocklist_prefs_box"))
|
||||
|
@ -19,7 +19,7 @@ class FormatException(TextException):
|
||||
pass
|
||||
|
||||
class TextBase:
|
||||
|
||||
|
||||
def __init__(self, fd, regexp):
|
||||
log.debug("TextBase loading")
|
||||
self.count = 0
|
||||
@ -28,7 +28,7 @@ class TextBase:
|
||||
|
||||
def next(self):
|
||||
self.count += 1
|
||||
|
||||
|
||||
txt = self.fd.readline()
|
||||
if txt == "":
|
||||
return False
|
||||
@ -89,7 +89,7 @@ class GZMuleReader(MuleReader):
|
||||
log.debug("Wrong file type or corrupted blocklist file.")
|
||||
|
||||
|
||||
# Reads zip files from SafePeer style files
|
||||
# Reads zip files from SafePeer style files
|
||||
class PGZip(TextBase):
|
||||
|
||||
def __init__(self, filename):
|
||||
@ -113,7 +113,7 @@ class PGZip(TextBase):
|
||||
def next(self):
|
||||
try:
|
||||
ret = self.reader.next()
|
||||
if ret == False:
|
||||
if not ret:
|
||||
# This bit is repeated below and could be moved into a
|
||||
# new procedure. However I'm not clear on how this
|
||||
# would effect tail recursion, so it remains
|
||||
@ -125,7 +125,7 @@ class PGZip(TextBase):
|
||||
# End of zip
|
||||
return False
|
||||
return ret
|
||||
|
||||
|
||||
except FormatException, e:
|
||||
log.debug("Blocklist: PGZip: Got format exception for zipfile")
|
||||
# Just skip
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# ui.py
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import pkg_resources
|
||||
import os.path
|
||||
@ -40,9 +32,9 @@ class UI:
|
||||
|
||||
def enable(self):
|
||||
pass
|
||||
|
||||
|
||||
def disable(self):
|
||||
pass
|
||||
|
||||
|
||||
def get_resource(self, filename):
|
||||
return pkg_resources.resource_filename("blocklist", os.path.join("data", filename))
|
||||
|
@ -22,15 +22,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import os
|
||||
from deluge.log import LOG as log
|
||||
|
@ -1,6 +1,6 @@
|
||||
# setup.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2008 Mark Stahler ('kramed') <markstahler@gmail.com>
|
||||
|
||||
#
|
||||
@ -20,15 +20,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
"""
|
||||
Download and import IP Blocklists
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# core.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
from deluge.log import LOG as log
|
||||
|
||||
@ -39,7 +31,7 @@ class CorePluginBase:
|
||||
# Register all export_* functions
|
||||
for func in dir(self):
|
||||
if func.startswith("export_"):
|
||||
log.debug("Registering export function %s as %s", func,
|
||||
log.debug("Registering export function %s as %s", func,
|
||||
plugin_name.lower() + "_" + func[7:])
|
||||
self.plugin.get_core().register_function(
|
||||
getattr(self, "%s" % func), plugin_name.lower()\
|
||||
|
@ -1,42 +1,34 @@
|
||||
#
|
||||
# init.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
from deluge.log import LOG as log
|
||||
|
||||
class PluginBase:
|
||||
def __init__(self):
|
||||
self.plugin = None
|
||||
|
||||
|
||||
def enable(self):
|
||||
try:
|
||||
self.plugin.enable()
|
||||
@ -45,7 +37,7 @@ class PluginBase:
|
||||
else:
|
||||
# If plugin was enabled, call it's update() right away
|
||||
self.update()
|
||||
|
||||
|
||||
def disable(self):
|
||||
try:
|
||||
self.plugin.disable()
|
||||
@ -55,4 +47,4 @@ class PluginBase:
|
||||
def update(self):
|
||||
if hasattr(self.plugin, "update"):
|
||||
self.plugin.update()
|
||||
|
||||
|
||||
|
@ -21,15 +21,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
from deluge.log import LOG as log
|
||||
from deluge.plugins.init import PluginBase
|
||||
|
@ -19,15 +19,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
"""
|
||||
torrent-label core plugin.
|
||||
|
@ -2,7 +2,7 @@
|
||||
# gtk_sidebar.py
|
||||
#
|
||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
@ -22,15 +22,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import gtk
|
||||
import gtk.glade
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# blocklist/gtkui.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2008 Mark Stahler ('kramed') <markstahler@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
@ -22,15 +22,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import os
|
||||
import pkg_resources # access plugin egg
|
||||
|
@ -1,3 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) Martijn Voncken 2008 <mvoncken@gmail.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
|
||||
from deluge.ui.client import sclient
|
||||
|
||||
sclient.set_core_uri()
|
||||
|
@ -1,37 +1,29 @@
|
||||
#
|
||||
# blocklist/ui.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2008 Mark Stahler ('kramed') <markstahler@gmail.com>
|
||||
|
||||
#
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import gettext
|
||||
import locale
|
||||
@ -46,8 +38,7 @@ class UI:
|
||||
|
||||
def enable(self):
|
||||
pass
|
||||
|
||||
|
||||
def disable(self):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
@ -22,15 +22,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import os
|
||||
from deluge.log import LOG as log
|
||||
|
@ -19,15 +19,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import os
|
||||
from deluge.log import LOG as log
|
||||
|
@ -20,15 +20,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import os
|
||||
from deluge.log import LOG as log
|
||||
|
@ -18,15 +18,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
"""
|
||||
Label plugin.
|
||||
|
@ -19,15 +19,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import sys, pickle , shutil , os
|
||||
from deluge.ui.client import sclient
|
||||
|
@ -1,4 +1,27 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) Martijn Voncken 2008 <mvoncken@gmail.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
#generate docs for deluge-wiki
|
||||
#client doc's For core.
|
||||
#
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# client.py
|
||||
#
|
||||
# Copyright (C) 2007/2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
# Copyright (C) 2007/2008 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
@ -22,15 +22,7 @@
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import os.path
|
||||
import socket
|
||||
@ -96,6 +88,7 @@ class CoreProxy(gobject.GObject):
|
||||
except:
|
||||
pass
|
||||
except (socket.error, xmlrpclib.ProtocolError), e:
|
||||
log.error("Socket or XMLRPC error: %s", e)
|
||||
self.set_core_uri(None)
|
||||
except (deluge.xmlrpclib.Fault, Exception), e:
|
||||
#self.set_core_uri(None) , disabled : there are many reasons for an exception ; not just an invalid core.
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,35 +1,27 @@
|
||||
#
|
||||
# addtorrentdialog.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import pygtk
|
||||
pygtk.require('2.0')
|
||||
@ -52,7 +44,7 @@ class AddTorrentDialog(component.Component):
|
||||
self.glade = gtk.glade.XML(
|
||||
pkg_resources.resource_filename(
|
||||
"deluge.ui.gtkui", "glade/add_torrent_dialog.glade"))
|
||||
|
||||
|
||||
self.dialog = self.glade.get_widget("dialog_add_torrent")
|
||||
|
||||
self.dialog.connect("delete-event", self._on_delete_event)
|
||||
@ -81,8 +73,8 @@ class AddTorrentDialog(component.Component):
|
||||
self.core_config = {}
|
||||
self.options = {}
|
||||
self.previous_selected_torrent = None
|
||||
|
||||
|
||||
|
||||
|
||||
self.listview_torrents = self.glade.get_widget("listview_torrents")
|
||||
self.listview_files = self.glade.get_widget("listview_files")
|
||||
|
||||
@ -110,12 +102,12 @@ class AddTorrentDialog(component.Component):
|
||||
column.pack_start(render)
|
||||
column.set_cell_data_func(render, listview.cell_data_size, 2)
|
||||
self.listview_files.append_column(column)
|
||||
|
||||
|
||||
self.listview_torrents.set_model(self.torrent_liststore)
|
||||
self.listview_files.set_model(self.files_treestore)
|
||||
|
||||
self.listview_files.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
|
||||
self.listview_torrents.get_selection().connect("changed",
|
||||
self.listview_torrents.get_selection().connect("changed",
|
||||
self._on_torrent_changed)
|
||||
|
||||
# Get default config values from the core
|
||||
@ -130,10 +122,10 @@ class AddTorrentDialog(component.Component):
|
||||
"add_paused"
|
||||
]
|
||||
self.core_config = {}
|
||||
|
||||
|
||||
def start(self):
|
||||
self.update_core_config()
|
||||
|
||||
|
||||
def show(self, focus=False):
|
||||
self.update_core_config()
|
||||
|
||||
@ -142,15 +134,15 @@ class AddTorrentDialog(component.Component):
|
||||
self.glade.get_widget("entry_download_path").hide()
|
||||
else:
|
||||
self.glade.get_widget("button_location").hide()
|
||||
self.glade.get_widget("entry_download_path").show()
|
||||
|
||||
self.dialog.set_transient_for(component.get("MainWindow").window)
|
||||
self.glade.get_widget("entry_download_path").show()
|
||||
|
||||
self.dialog.set_transient_for(component.get("MainWindow").window)
|
||||
self.dialog.present()
|
||||
if focus:
|
||||
self.dialog.window.focus()
|
||||
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def hide(self):
|
||||
self.dialog.hide()
|
||||
self.files = {}
|
||||
@ -159,9 +151,9 @@ class AddTorrentDialog(component.Component):
|
||||
self.previous_selected_torrent = None
|
||||
self.torrent_liststore.clear()
|
||||
self.files_treestore.clear()
|
||||
self.dialog.set_transient_for(component.get("MainWindow").window)
|
||||
self.dialog.set_transient_for(component.get("MainWindow").window)
|
||||
return None
|
||||
|
||||
|
||||
def update_core_config(self):
|
||||
self.core_config = {}
|
||||
# Send requests to the core for these config values
|
||||
@ -171,18 +163,21 @@ class AddTorrentDialog(component.Component):
|
||||
# Force a call to the core because we need this data now
|
||||
client.force_call()
|
||||
self.set_default_options()
|
||||
|
||||
|
||||
def _on_config_value(self, value):
|
||||
for key in self.core_keys:
|
||||
if not self.core_config.has_key(key):
|
||||
self.core_config[key] = value
|
||||
break
|
||||
|
||||
|
||||
def add_from_files(self, filenames):
|
||||
import deluge.libtorrent as lt
|
||||
try:
|
||||
import libtorrent as lt
|
||||
except ImportError:
|
||||
import deluge.libtorrent as lt
|
||||
import os.path
|
||||
new_row = None
|
||||
|
||||
|
||||
for filename in filenames:
|
||||
# Get the torrent data from the torrent file
|
||||
try:
|
||||
@ -195,7 +190,7 @@ class AddTorrentDialog(component.Component):
|
||||
filedump = lt.bdecode(filedump)
|
||||
_file.close()
|
||||
except Exception, e:
|
||||
log.warning("Unable to open %s: e", filename, e)
|
||||
log.warning("Unable to open %s: %s", filename, e)
|
||||
continue
|
||||
|
||||
try:
|
||||
@ -207,7 +202,7 @@ class AddTorrentDialog(component.Component):
|
||||
if str(info.info_hash()) in self.infos:
|
||||
log.debug("Torrent already in list!")
|
||||
continue
|
||||
|
||||
|
||||
# Get list of files from torrent info
|
||||
files = []
|
||||
for f in info.files():
|
||||
@ -226,22 +221,22 @@ class AddTorrentDialog(component.Component):
|
||||
(model, row) = self.listview_torrents.get_selection().get_selected()
|
||||
if not row and new_row:
|
||||
self.listview_torrents.get_selection().select_iter(new_row)
|
||||
|
||||
|
||||
def _on_torrent_changed(self, treeselection):
|
||||
(model, row) = treeselection.get_selected()
|
||||
self.files_treestore.clear()
|
||||
|
||||
|
||||
if row is None:
|
||||
return
|
||||
|
||||
# Update files list
|
||||
|
||||
# Update files list
|
||||
files_list = self.files[model.get_value(row, 0)]
|
||||
|
||||
self.prepare_file_store(files_list)
|
||||
|
||||
if self.core_config == {}:
|
||||
self.update_core_config()
|
||||
|
||||
|
||||
# Save the previous torrents options
|
||||
self.save_torrent_options()
|
||||
# Update the options frame
|
||||
@ -287,16 +282,16 @@ class AddTorrentDialog(component.Component):
|
||||
if torrent_id not in self.options:
|
||||
self.set_default_options()
|
||||
return
|
||||
|
||||
|
||||
options = self.options[torrent_id]
|
||||
|
||||
|
||||
if client.is_localhost():
|
||||
self.glade.get_widget("button_location").set_current_folder(
|
||||
options["download_location"])
|
||||
else:
|
||||
self.glade.get_widget("entry_download_path").set_text(
|
||||
options["download_location"])
|
||||
|
||||
|
||||
self.glade.get_widget("radio_compact").set_active(
|
||||
options["compact_allocation"])
|
||||
self.glade.get_widget("spin_maxdown").set_value(
|
||||
@ -311,7 +306,7 @@ class AddTorrentDialog(component.Component):
|
||||
options["add_paused"])
|
||||
self.glade.get_widget("chk_prioritize").set_active(
|
||||
options["prioritize_first_last_pieces"])
|
||||
|
||||
|
||||
def save_torrent_options(self, row=None):
|
||||
# Keeps the torrent options dictionary up-to-date with what the user has
|
||||
# selected.
|
||||
@ -319,10 +314,10 @@ class AddTorrentDialog(component.Component):
|
||||
row = self.previous_selected_torrent
|
||||
if row is None or not self.torrent_liststore.iter_is_valid(row):
|
||||
return
|
||||
|
||||
|
||||
torrent_id = self.torrent_liststore.get_value(row, 0)
|
||||
|
||||
options = {}
|
||||
|
||||
options = {}
|
||||
if client.is_localhost():
|
||||
options["download_location"] = \
|
||||
self.glade.get_widget("button_location").get_current_folder()
|
||||
@ -345,16 +340,16 @@ class AddTorrentDialog(component.Component):
|
||||
self.glade.get_widget("chk_prioritize").get_active()
|
||||
options["default_private"] = \
|
||||
self.glade.get_widget("chk_private").get_active()
|
||||
|
||||
|
||||
self.options[torrent_id] = options
|
||||
|
||||
|
||||
# Save the file priorities
|
||||
files_priorities = self.build_priorities(
|
||||
self.files_treestore.get_iter_first(), {})
|
||||
|
||||
|
||||
for i, file_dict in enumerate(self.files[torrent_id]):
|
||||
file_dict["download"] = files_priorities[i]
|
||||
|
||||
|
||||
def build_priorities(self, iter, priorities):
|
||||
while iter is not None:
|
||||
if self.files_treestore.iter_has_child(iter):
|
||||
@ -372,7 +367,7 @@ class AddTorrentDialog(component.Component):
|
||||
else:
|
||||
self.glade.get_widget("entry_download_path").set_text(
|
||||
self.core_config["download_location"])
|
||||
|
||||
|
||||
self.glade.get_widget("radio_compact").set_active(
|
||||
self.core_config["compact_allocation"])
|
||||
self.glade.get_widget("spin_maxdown").set_value(
|
||||
@ -387,19 +382,19 @@ class AddTorrentDialog(component.Component):
|
||||
self.core_config["add_paused"])
|
||||
self.glade.get_widget("chk_prioritize").set_active(
|
||||
self.core_config["prioritize_first_last_pieces"])
|
||||
|
||||
|
||||
def get_file_priorities(self, torrent_id):
|
||||
# A list of priorities
|
||||
files_list = []
|
||||
|
||||
for file_dict in self.files[torrent_id]:
|
||||
if file_dict["download"] == False:
|
||||
if not file_dict["download"]:
|
||||
files_list.append(0)
|
||||
else:
|
||||
files_list.append(1)
|
||||
|
||||
|
||||
return files_list
|
||||
|
||||
|
||||
def _on_file_toggled(self, render, path):
|
||||
(model, paths) = self.listview_files.get_selection().get_selected_rows()
|
||||
if len(paths) > 1:
|
||||
@ -449,13 +444,13 @@ class AddTorrentDialog(component.Component):
|
||||
chooser = gtk.FileChooserDialog(_("Choose a .torrent file"),
|
||||
None,
|
||||
gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN,
|
||||
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN,
|
||||
gtk.RESPONSE_OK))
|
||||
|
||||
chooser.set_transient_for(self.dialog)
|
||||
chooser.set_select_multiple(True)
|
||||
chooser.set_property("skip-taskbar-hint", True)
|
||||
|
||||
|
||||
# Add .torrent and * file filters
|
||||
file_filter = gtk.FileFilter()
|
||||
file_filter.set_name(_("Torrent files"))
|
||||
@ -483,7 +478,7 @@ class AddTorrentDialog(component.Component):
|
||||
|
||||
chooser.destroy()
|
||||
self.add_from_files(result)
|
||||
|
||||
|
||||
def _on_button_url_clicked(self, widget):
|
||||
log.debug("_on_button_url_clicked")
|
||||
dialog = self.glade.get_widget("url_dialog")
|
||||
@ -492,13 +487,13 @@ class AddTorrentDialog(component.Component):
|
||||
dialog.set_default_response(gtk.RESPONSE_OK)
|
||||
dialog.set_transient_for(self.dialog)
|
||||
entry.grab_focus()
|
||||
|
||||
|
||||
if deluge.common.windows_check():
|
||||
import win32clipboard as clip
|
||||
import win32clipboard as clip
|
||||
import win32con
|
||||
clip.OpenClipboard()
|
||||
text = clip.GetClipboardData(win32con.CF_UNICODETEXT)
|
||||
clip.CloseClipboard()
|
||||
clip.OpenClipboard()
|
||||
text = clip.GetClipboardData(win32con.CF_UNICODETEXT)
|
||||
clip.CloseClipboard()
|
||||
else:
|
||||
clip = gtk.clipboard_get(selection='PRIMARY')
|
||||
text = clip.wait_for_text()
|
||||
@ -520,7 +515,7 @@ class AddTorrentDialog(component.Component):
|
||||
log.debug("url: %s", url)
|
||||
if url != None:
|
||||
self.add_from_url(url)
|
||||
|
||||
|
||||
entry.set_text("")
|
||||
dialog.hide()
|
||||
|
||||
@ -535,7 +530,7 @@ class AddTorrentDialog(component.Component):
|
||||
filename, headers = urllib.urlretrieve(url, tmp_file)
|
||||
log.debug("filename: %s", filename)
|
||||
self.add_from_files([filename])
|
||||
|
||||
|
||||
def _on_button_hash_clicked(self, widget):
|
||||
log.debug("_on_button_hash_clicked")
|
||||
|
||||
@ -544,9 +539,9 @@ class AddTorrentDialog(component.Component):
|
||||
(model, row) = self.listview_torrents.get_selection().get_selected()
|
||||
if row is None:
|
||||
return
|
||||
|
||||
|
||||
torrent_id = model.get_value(row, 0)
|
||||
|
||||
|
||||
model.remove(row)
|
||||
del self.files[torrent_id]
|
||||
del self.infos[torrent_id]
|
||||
@ -567,7 +562,7 @@ class AddTorrentDialog(component.Component):
|
||||
|
||||
torrent_filenames = []
|
||||
torrent_options = []
|
||||
|
||||
|
||||
row = self.torrent_liststore.get_iter_first()
|
||||
while row != None:
|
||||
torrent_id = self.torrent_liststore.get_value(row, 0)
|
||||
@ -576,16 +571,16 @@ class AddTorrentDialog(component.Component):
|
||||
options = self.options[torrent_id]
|
||||
except:
|
||||
options = None
|
||||
|
||||
|
||||
file_priorities = self.get_file_priorities(torrent_id)
|
||||
if options != None:
|
||||
options["file_priorities"] = file_priorities
|
||||
|
||||
|
||||
torrent_filenames.append(filename)
|
||||
torrent_options.append(options)
|
||||
|
||||
|
||||
row = self.torrent_liststore.iter_next(row)
|
||||
|
||||
|
||||
client.add_torrent_file(torrent_filenames, torrent_options)
|
||||
client.force_call()
|
||||
self.hide()
|
||||
@ -595,25 +590,25 @@ class AddTorrentDialog(component.Component):
|
||||
(model, row) = self.listview_torrents.get_selection().get_selected()
|
||||
if row is None:
|
||||
return
|
||||
|
||||
|
||||
self.save_torrent_options(row)
|
||||
|
||||
|
||||
# The options we want all the torrents to have
|
||||
options = self.options[model.get_value(row, 0)]
|
||||
|
||||
|
||||
# Set all the torrent options
|
||||
row = model.get_iter_first()
|
||||
while row != None:
|
||||
torrent_id = model.get_value(row, 0)
|
||||
self.options[torrent_id] = options
|
||||
row = model.iter_next(row)
|
||||
|
||||
|
||||
def _on_button_revert_clicked(self, widget):
|
||||
log.debug("_on_button_revert_clicked")
|
||||
(model, row) = self.listview_torrents.get_selection().get_selected()
|
||||
if row is None:
|
||||
return
|
||||
|
||||
|
||||
del self.options[model.get_value(row, 0)]
|
||||
self.set_default_options()
|
||||
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# connectionmanager.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import gtk, gtk.glade
|
||||
import pkg_resources
|
||||
@ -69,9 +61,9 @@ class ConnectionManager(component.Component):
|
||||
component.Component.__init__(self, "ConnectionManager")
|
||||
# Get the glade file for the connection manager
|
||||
self.glade = gtk.glade.XML(
|
||||
pkg_resources.resource_filename("deluge.ui.gtkui",
|
||||
pkg_resources.resource_filename("deluge.ui.gtkui",
|
||||
"glade/connection_manager.glade"))
|
||||
|
||||
|
||||
self.window = component.get("MainWindow")
|
||||
self.config = ConfigManager("hostlist.conf", DEFAULT_CONFIG)
|
||||
self.gtkui_config = ConfigManager("gtkui.conf")
|
||||
@ -80,20 +72,20 @@ class ConnectionManager(component.Component):
|
||||
self.connection_manager.set_transient_for(self.window.window)
|
||||
self.hostlist = self.glade.get_widget("hostlist")
|
||||
self.connection_manager.set_icon(deluge.common.get_logo(32))
|
||||
|
||||
|
||||
self.glade.get_widget("image1").set_from_pixbuf(
|
||||
deluge.common.get_logo(32))
|
||||
|
||||
|
||||
self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, int)
|
||||
|
||||
# Holds the online status of hosts
|
||||
self.online_status = {}
|
||||
|
||||
|
||||
# Fill in hosts from config file
|
||||
for host in self.config["hosts"]:
|
||||
row = self.liststore.append()
|
||||
self.liststore.set_value(row, HOSTLIST_COL_URI, host)
|
||||
|
||||
|
||||
# Setup host list treeview
|
||||
self.hostlist.set_model(self.liststore)
|
||||
render = gtk.CellRendererPixbuf()
|
||||
@ -103,7 +95,7 @@ class ConnectionManager(component.Component):
|
||||
render = gtk.CellRendererText()
|
||||
column = gtk.TreeViewColumn("Host", render, text=HOSTLIST_COL_URI)
|
||||
self.hostlist.append_column(column)
|
||||
|
||||
|
||||
self.glade.signal_autoconnect({
|
||||
"on_button_addhost_clicked": self.on_button_addhost_clicked,
|
||||
"on_button_removehost_clicked": self.on_button_removehost_clicked,
|
||||
@ -115,23 +107,19 @@ class ConnectionManager(component.Component):
|
||||
"on_chk_autostart_toggled": self.on_chk_autostart_toggled,
|
||||
"on_chk_donotshow_toggled": self.on_chk_donotshow_toggled
|
||||
})
|
||||
|
||||
|
||||
self.connection_manager.connect("delete-event", self.on_delete_event)
|
||||
# Connect to the 'changed' event of TreeViewSelection to get selection
|
||||
# changes.
|
||||
self.hostlist.get_selection().connect("changed",
|
||||
self.hostlist.get_selection().connect("changed",
|
||||
self.on_selection_changed)
|
||||
|
||||
self.hostlist.connect("row-activated", self._on_row_activated)
|
||||
|
||||
|
||||
# If classic mode is set, we just start up a localhost daemon and connect to it
|
||||
if self.gtkui_config["classic_mode"]:
|
||||
uri = "http://localhost:58846"
|
||||
if deluge.common.windows_check():
|
||||
win32api.WinExec("deluged -p 58846")
|
||||
else:
|
||||
subprocess.Popen(["deluged", "-p 58846"])
|
||||
time.sleep(0.1)
|
||||
self.start_localhost(58846)
|
||||
# We need to wait for the host to start before connecting
|
||||
while not self.test_online_status(uri):
|
||||
time.sleep(0.01)
|
||||
@ -142,7 +130,7 @@ class ConnectionManager(component.Component):
|
||||
# This controls the timer, if it's set to false the update timer will stop.
|
||||
self._do_update = True
|
||||
self._update_list()
|
||||
|
||||
|
||||
# Auto connect to a host if applicable
|
||||
if self.gtkui_config["autoconnect"] and \
|
||||
self.gtkui_config["autoconnect_host_uri"] != None:
|
||||
@ -162,22 +150,19 @@ class ConnectionManager(component.Component):
|
||||
port = uri[7:].split(":")[1]
|
||||
# First add it to the list
|
||||
self.add_host("localhost", port)
|
||||
if deluge.common.windows_check():
|
||||
win32api.WinExec("deluged -p %s" % port)
|
||||
else:
|
||||
subprocess.Popen(["deluged", "-p %s" % port])
|
||||
self.start_localhost(port)
|
||||
# We need to wait for the host to start before connecting
|
||||
while not self.test_online_status(uri):
|
||||
time.sleep(0.01)
|
||||
client.set_core_uri(uri)
|
||||
self.hide()
|
||||
|
||||
|
||||
def start(self):
|
||||
if self.gtkui_config["autoconnect"]:
|
||||
# We need to update the autoconnect_host_uri on connection to host
|
||||
# start() gets called whenever we get a new connection to a host
|
||||
self.gtkui_config["autoconnect_host_uri"] = client.get_core_uri()
|
||||
|
||||
|
||||
def show(self):
|
||||
# Set the checkbuttons according to config
|
||||
self.glade.get_widget("chk_autoconnect").set_active(
|
||||
@ -186,13 +171,13 @@ class ConnectionManager(component.Component):
|
||||
self.gtkui_config["autostart_localhost"])
|
||||
self.glade.get_widget("chk_donotshow").set_active(
|
||||
not self.gtkui_config["show_connection_manager_on_start"])
|
||||
|
||||
|
||||
# Setup timer to update host status
|
||||
self._update_timer = gobject.timeout_add(1000, self._update_list)
|
||||
self._update_list()
|
||||
self._update_list()
|
||||
self.connection_manager.show_all()
|
||||
|
||||
|
||||
def hide(self):
|
||||
self.connection_manager.hide()
|
||||
self._do_update = False
|
||||
@ -213,31 +198,31 @@ class ConnectionManager(component.Component):
|
||||
online = self.online_status[uri]
|
||||
except:
|
||||
online = False
|
||||
|
||||
|
||||
if online:
|
||||
image = gtk.STOCK_YES
|
||||
online = HOSTLIST_STATUS.index("Online")
|
||||
else:
|
||||
image = gtk.STOCK_NO
|
||||
online = HOSTLIST_STATUS.index("Offline")
|
||||
|
||||
|
||||
if uri == current_uri:
|
||||
# We are connected to this host, so lets display the connected
|
||||
# icon.
|
||||
image = gtk.STOCK_CONNECT
|
||||
online = HOSTLIST_STATUS.index("Connected")
|
||||
|
||||
|
||||
pixbuf = self.connection_manager.render_icon(
|
||||
image, gtk.ICON_SIZE_MENU)
|
||||
|
||||
|
||||
model.set_value(row, HOSTLIST_COL_PIXBUF, pixbuf)
|
||||
model.set_value(row, HOSTLIST_COL_STATUS, online)
|
||||
|
||||
|
||||
current_uri = client.get_core_uri()
|
||||
self.liststore.foreach(update_row)
|
||||
# Update the buttons
|
||||
self.update_buttons()
|
||||
|
||||
|
||||
# See if there is any row selected
|
||||
paths = self.hostlist.get_selection().get_selected_rows()[1]
|
||||
if len(paths) < 1:
|
||||
@ -246,7 +231,7 @@ class ConnectionManager(component.Component):
|
||||
# Then select the first row
|
||||
self.hostlist.get_selection().select_iter(self.liststore.get_iter_first())
|
||||
return self._do_update
|
||||
|
||||
|
||||
def update_buttons(self):
|
||||
"""Updates the buttons based on selection"""
|
||||
if self.liststore.iter_n_children(None) < 1:
|
||||
@ -260,7 +245,7 @@ class ConnectionManager(component.Component):
|
||||
"_Start Daemon")
|
||||
self.glade.get_widget("label_startdaemon").set_use_underline(
|
||||
True)
|
||||
|
||||
|
||||
# Get the selected row's URI
|
||||
paths = self.hostlist.get_selection().get_selected_rows()[1]
|
||||
# If nothing is selected, just return
|
||||
@ -269,12 +254,12 @@ class ConnectionManager(component.Component):
|
||||
row = self.liststore.get_iter(paths[0])
|
||||
uri = self.liststore.get_value(row, HOSTLIST_COL_URI)
|
||||
status = self.liststore.get_value(row, HOSTLIST_COL_STATUS)
|
||||
|
||||
|
||||
# Check to see if a localhost is selected
|
||||
localhost = False
|
||||
if uri.split(":")[0] == "localhost" or uri.split(":")[0] == "127.0.0.1":
|
||||
localhost = True
|
||||
|
||||
|
||||
# Make actual URI string
|
||||
uri = "http://" + uri
|
||||
|
||||
@ -282,7 +267,7 @@ class ConnectionManager(component.Component):
|
||||
self.glade.get_widget("button_startdaemon").set_sensitive(True)
|
||||
self.glade.get_widget("button_connect").set_sensitive(True)
|
||||
self.glade.get_widget("button_removehost").set_sensitive(True)
|
||||
|
||||
|
||||
# See if this is the currently connected URI
|
||||
if status == HOSTLIST_STATUS.index("Connected"):
|
||||
# Display a disconnect button if we're connected to this host
|
||||
@ -300,7 +285,7 @@ class ConnectionManager(component.Component):
|
||||
gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)
|
||||
self.glade.get_widget("label_startdaemon").set_text(
|
||||
"_Stop Daemon")
|
||||
|
||||
|
||||
# Update the start daemon button if the selected host is localhost
|
||||
if localhost and status == HOSTLIST_STATUS.index("Offline"):
|
||||
# The localhost is not online
|
||||
@ -308,32 +293,32 @@ class ConnectionManager(component.Component):
|
||||
gtk.STOCK_EXECUTE, gtk.ICON_SIZE_MENU)
|
||||
self.glade.get_widget("label_startdaemon").set_text(
|
||||
"_Start Daemon")
|
||||
|
||||
|
||||
if not localhost:
|
||||
# An offline host
|
||||
self.glade.get_widget("button_startdaemon").set_sensitive(False)
|
||||
|
||||
# Make sure label is displayed correctly using mnemonics
|
||||
# Make sure label is displayed correctly using mnemonics
|
||||
self.glade.get_widget("label_startdaemon").set_use_underline(
|
||||
True)
|
||||
|
||||
|
||||
def save(self):
|
||||
"""Save the current host list to file"""
|
||||
def append_row(model=None, path=None, row=None, columns=None):
|
||||
hostlist.append(model.get_value(row, HOSTLIST_COL_URI))
|
||||
|
||||
|
||||
hostlist = []
|
||||
self.liststore.foreach(append_row, hostlist)
|
||||
self.config["hosts"] = hostlist
|
||||
self.config.save()
|
||||
|
||||
|
||||
def test_online_status(self, uri):
|
||||
"""Tests the status of URI.. Returns True or False depending on status.
|
||||
"""
|
||||
online = True
|
||||
host = None
|
||||
try:
|
||||
host = xmlrpclib.ServerProxy(uri)
|
||||
host = xmlrpclib.ServerProxy(uri.replace("localhost", "127.0.0.1"))
|
||||
host.ping()
|
||||
except socket.error:
|
||||
online = False
|
||||
@ -341,12 +326,12 @@ class ConnectionManager(component.Component):
|
||||
del host
|
||||
self.online_status[uri] = online
|
||||
return online
|
||||
|
||||
|
||||
## Callbacks
|
||||
def on_delete_event(self, widget, event):
|
||||
self.hide()
|
||||
return True
|
||||
|
||||
|
||||
def on_button_addhost_clicked(self, widget):
|
||||
log.debug("on_button_addhost_clicked")
|
||||
dialog = self.glade.get_widget("addhost_dialog")
|
||||
@ -356,11 +341,11 @@ class ConnectionManager(component.Component):
|
||||
response = dialog.run()
|
||||
if response == 1:
|
||||
# We add the host
|
||||
self.add_host(hostname_entry.get_text(),
|
||||
self.add_host(hostname_entry.get_text(),
|
||||
port_spinbutton.get_value_as_int())
|
||||
|
||||
dialog.hide()
|
||||
|
||||
dialog.hide()
|
||||
|
||||
def add_host(self, hostname, port):
|
||||
"""Adds the host to the list"""
|
||||
if hostname.startswith("http://"):
|
||||
@ -369,8 +354,8 @@ class ConnectionManager(component.Component):
|
||||
# Check to make sure the hostname is at least 1 character long
|
||||
if len(hostname) < 1:
|
||||
return
|
||||
|
||||
# Get the port and concatenate the hostname string
|
||||
|
||||
# Get the port and concatenate the hostname string
|
||||
hostname = hostname + ":" + str(port)
|
||||
|
||||
# Check to see if there is already an entry for this host and return
|
||||
@ -382,7 +367,7 @@ class ConnectionManager(component.Component):
|
||||
self.liststore.foreach(each_row, None)
|
||||
if hostname in self.hosts_liststore:
|
||||
return
|
||||
|
||||
|
||||
# Host isn't in the list, so lets add it
|
||||
row = self.liststore.append()
|
||||
self.liststore.set_value(row, HOSTLIST_COL_URI, hostname)
|
||||
@ -390,20 +375,20 @@ class ConnectionManager(component.Component):
|
||||
self.save()
|
||||
# Update the status of the hosts
|
||||
self._update_list()
|
||||
|
||||
|
||||
def on_button_removehost_clicked(self, widget):
|
||||
log.debug("on_button_removehost_clicked")
|
||||
# Get the selected rows
|
||||
paths = self.hostlist.get_selection().get_selected_rows()[1]
|
||||
for path in paths:
|
||||
self.liststore.remove(self.liststore.get_iter(path))
|
||||
|
||||
|
||||
# Update the hostlist
|
||||
self._update_list()
|
||||
|
||||
|
||||
# Save the host list
|
||||
self.save()
|
||||
|
||||
|
||||
def on_button_startdaemon_clicked(self, widget):
|
||||
log.debug("on_button_startdaemon_clicked")
|
||||
if self.liststore.iter_n_children(None) < 1:
|
||||
@ -412,7 +397,7 @@ class ConnectionManager(component.Component):
|
||||
# ..and start the daemon.
|
||||
self.start_localhost(58846)
|
||||
return
|
||||
|
||||
|
||||
paths = self.hostlist.get_selection().get_selected_rows()[1]
|
||||
if len(paths) < 1:
|
||||
return
|
||||
@ -431,7 +416,7 @@ class ConnectionManager(component.Component):
|
||||
self.update()
|
||||
elif HOSTLIST_STATUS[status] == "Offline":
|
||||
self.start_localhost(port)
|
||||
|
||||
|
||||
def start_localhost(self, port):
|
||||
"""Starts a localhost daemon"""
|
||||
port = str(port)
|
||||
@ -440,7 +425,7 @@ class ConnectionManager(component.Component):
|
||||
if deluge.common.windows_check():
|
||||
win32api.WinExec("deluged -p %s" % port)
|
||||
else:
|
||||
subprocess.Popen(["deluged", "-p %s" % port])
|
||||
subprocess.call(["deluged", "-p %s" % port])
|
||||
|
||||
def on_button_close_clicked(self, widget):
|
||||
log.debug("on_button_close_clicked")
|
||||
@ -448,6 +433,7 @@ class ConnectionManager(component.Component):
|
||||
|
||||
def on_button_connect_clicked(self, widget):
|
||||
log.debug("on_button_connect_clicked")
|
||||
component.stop()
|
||||
paths = self.hostlist.get_selection().get_selected_rows()[1]
|
||||
row = self.liststore.get_iter(paths[0])
|
||||
status = self.liststore.get_value(row, HOSTLIST_COL_STATUS)
|
||||
@ -457,7 +443,7 @@ class ConnectionManager(component.Component):
|
||||
port = uri.split(":")[1]
|
||||
if uri.split(":")[0] == "localhost":
|
||||
localhost = True
|
||||
|
||||
|
||||
uri = "http://" + uri
|
||||
if status == HOSTLIST_STATUS.index("Connected"):
|
||||
# Stop all the components first.
|
||||
@ -466,7 +452,7 @@ class ConnectionManager(component.Component):
|
||||
client.set_core_uri(None)
|
||||
self._update_list()
|
||||
return
|
||||
|
||||
|
||||
# Test the host to see if it is online or not. We don't use the status
|
||||
# column information because it can be up to 5 seconds out of sync.
|
||||
if not self.test_online_status(uri):
|
||||
@ -476,14 +462,14 @@ class ConnectionManager(component.Component):
|
||||
self.start_localhost(port)
|
||||
# We need to wait for the host to start before connecting
|
||||
while not self.test_online_status(uri):
|
||||
time.sleep(0.01)
|
||||
time.sleep(0.01)
|
||||
client.set_core_uri(uri)
|
||||
self._update_list()
|
||||
self.hide()
|
||||
|
||||
|
||||
# Update the list to show proper status
|
||||
self._update_list()
|
||||
|
||||
|
||||
return
|
||||
|
||||
# Status is OK, so lets change to this host
|
||||
@ -508,10 +494,10 @@ class ConnectionManager(component.Component):
|
||||
log.debug("on_chk_donotshow_toggled")
|
||||
value = widget.get_active()
|
||||
self.gtkui_config["show_connection_manager_on_start"] = not value
|
||||
|
||||
|
||||
def on_selection_changed(self, treeselection):
|
||||
log.debug("on_selection_changed")
|
||||
self.update_buttons()
|
||||
|
||||
def _on_row_activated(self, tree, path, view_column):
|
||||
|
||||
def _on_row_activated(self, tree, path, view_column):
|
||||
self.on_button_connect_clicked(self.glade.get_widget("button_connect"))
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# coreconfig.py
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import deluge.component as component
|
||||
from deluge.ui.client import aclient as client
|
||||
@ -42,22 +34,22 @@ class CoreConfig(component.Component):
|
||||
self.config = {}
|
||||
component.get("Signals").connect_to_signal("config_value_changed",
|
||||
self._on_config_value_changed)
|
||||
|
||||
|
||||
def start(self):
|
||||
client.get_config(self._on_get_config)
|
||||
|
||||
|
||||
def stop(self):
|
||||
self.config = {}
|
||||
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.config[key]
|
||||
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
client.set_config({key: value})
|
||||
|
||||
|
||||
def _on_get_config(self, config):
|
||||
self.config = config
|
||||
|
||||
|
||||
def _on_config_value_changed(self, key, value):
|
||||
self.config[key] = value
|
||||
|
||||
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# dbusinterface.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import sys
|
||||
import os
|
||||
@ -46,7 +38,7 @@ elif dbus.version >= (0,80,0):
|
||||
import deluge.component as component
|
||||
import deluge.common
|
||||
from deluge.log import LOG as log
|
||||
|
||||
|
||||
class DbusInterface(dbus.service.Object, component.Component):
|
||||
def __init__(self, args, path="/org/deluge_torrent/Deluge"):
|
||||
component.Component.__init__(self, "DbusInterface")
|
||||
@ -64,11 +56,11 @@ class DbusInterface(dbus.service.Object, component.Component):
|
||||
if not deluge.common.is_url(arg):
|
||||
new_args.append(os.path.abspath(arg))
|
||||
args = new_args
|
||||
|
||||
|
||||
# Send the args to the running session
|
||||
if args != [] and args != None:
|
||||
bus = dbus.SessionBus()
|
||||
proxy = bus.get_object("org.deluge_torrent.Deluge",
|
||||
proxy = bus.get_object("org.deluge_torrent.Deluge",
|
||||
"/org/deluge_torrent/Deluge")
|
||||
ui = dbus.Interface(proxy, "org.deluge_torrent.Deluge")
|
||||
ui.process_args(args)
|
||||
@ -80,7 +72,7 @@ class DbusInterface(dbus.service.Object, component.Component):
|
||||
self.process_args(args)
|
||||
# Register Deluge with Dbus
|
||||
log.info("Registering with DBUS..")
|
||||
bus_name = dbus.service.BusName("org.deluge_torrent.Deluge",
|
||||
bus_name = dbus.service.BusName("org.deluge_torrent.Deluge",
|
||||
bus=dbus.SessionBus())
|
||||
dbus.service.Object.__init__(self, bus_name, path)
|
||||
|
||||
@ -89,4 +81,4 @@ class DbusInterface(dbus.service.Object, component.Component):
|
||||
"""Process arguments sent to already running Deluge"""
|
||||
from ipcinterface import process_args
|
||||
process_args(args)
|
||||
|
||||
|
||||
|
@ -1,35 +1,27 @@
|
||||
#
|
||||
# details_tab.py
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
|
||||
import gtk, gtk.glade
|
||||
|
||||
@ -46,11 +38,11 @@ class DetailsTab(Tab):
|
||||
# Get the labels we need to update.
|
||||
# widgetname, modifier function, status keys
|
||||
glade = component.get("MainWindow").main_glade
|
||||
|
||||
|
||||
self._name = "Details"
|
||||
self._child_widget = glade.get_widget("details_tab")
|
||||
self._tab_label = glade.get_widget("details_tab_label")
|
||||
|
||||
|
||||
self.label_widgets = [
|
||||
(glade.get_widget("summary_name"), None, ("name",)),
|
||||
(glade.get_widget("summary_total_size"), deluge.common.fsize, ("total_size",)),
|
||||
@ -60,11 +52,11 @@ class DetailsTab(Tab):
|
||||
(glade.get_widget("summary_message"), str, ("message",)),
|
||||
(glade.get_widget("summary_hash"), str, ("hash",))
|
||||
]
|
||||
|
||||
|
||||
def update(self):
|
||||
# Get the first selected torrent
|
||||
selected = component.get("TorrentView").get_selected_torrents()
|
||||
|
||||
|
||||
# Only use the first torrent in the list or return if None selected
|
||||
if len(selected) != 0:
|
||||
selected = selected[0]
|
||||
@ -72,20 +64,20 @@ class DetailsTab(Tab):
|
||||
# No torrent is selected in the torrentview
|
||||
self.clear()
|
||||
return
|
||||
|
||||
|
||||
# Get the torrent status
|
||||
status_keys = ["name", "total_size", "num_files",
|
||||
"tracker", "save_path", "message", "hash"]
|
||||
|
||||
|
||||
client.get_torrent_status(
|
||||
self._on_get_torrent_status, selected, status_keys)
|
||||
|
||||
|
||||
def _on_get_torrent_status(self, status):
|
||||
# Check to see if we got valid data from the core
|
||||
if status is None:
|
||||
return
|
||||
|
||||
# Update all the label widgets
|
||||
|
||||
# Update all the label widgets
|
||||
for widget in self.label_widgets:
|
||||
if widget[1] != None:
|
||||
args = []
|
||||
@ -95,14 +87,14 @@ class DetailsTab(Tab):
|
||||
except Exception, e:
|
||||
log.debug("Unable to get status value: %s", e)
|
||||
continue
|
||||
|
||||
|
||||
txt = widget[1](*args)
|
||||
else:
|
||||
txt = status[widget[2][0]]
|
||||
|
||||
if widget[0].get_text() != txt:
|
||||
widget[0].set_text(txt)
|
||||
|
||||
|
||||
def clear(self):
|
||||
for widget in self.label_widgets:
|
||||
widget[0].set_text("")
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user