Compare commits
277 Commits
develop
...
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 | |||
bbd862e086 | |||
f7f00de52c | |||
baaafefb89 | |||
262279b27f | |||
3c33018079 | |||
fb23f229fb | |||
2e3a9ce28c | |||
a0f90acfc8 | |||
34d34b785c | |||
90053270d5 | |||
a1df9626e5 | |||
84e58626a9 | |||
761586b2a8 | |||
57f1409a55 | |||
14bfebdb98 | |||
95e40aa64b | |||
b246457b91 | |||
0c39331295 | |||
66c986c305 | |||
ccfead4e6c | |||
88e5c07564 | |||
40633277d8 | |||
d60c595599 | |||
fc6edca315 | |||
bd8dcbce91 | |||
7adf503bb6 | |||
67c0069c7a | |||
4094601f6e | |||
3178582312 | |||
2f6d98693d | |||
1e4f53b716 | |||
4731d4814f | |||
584226db96 | |||
135a0ca7e9 | |||
892e642502 | |||
6f7e814e76 | |||
39e8fd772b | |||
2a5e346313 | |||
4fb8fe54c9 | |||
acf59dd287 | |||
f2d80343c7 | |||
f15971bdeb | |||
6afe33d584 | |||
53853f043e | |||
bc0612d951 | |||
edb60072f5 | |||
b1dbca37c3 | |||
7bde1e549a | |||
9e04988422 | |||
cccd1b8436 | |||
5f20e2139d | |||
ab9842e4c1 | |||
240c60aa74 | |||
d8bdaff0cc | |||
4a4ffdab63 | |||
d83a748401 | |||
dac94c5038 | |||
ed5e080b6d | |||
cbab9cd823 | |||
971308416b | |||
8564f45e59 | |||
6948c81d01 | |||
7665f5394a | |||
7b31434287 | |||
bba9c1a54f | |||
73b3ff8a0f | |||
67b85a9f89 | |||
165b97751d | |||
26fc7cf13f | |||
c0cced9747 | |||
cd391ca749 | |||
8ecc336152 | |||
9280a9609e | |||
a118d3e7d5 | |||
61b9e4ae0e | |||
1a9376b7ea | |||
2edaeae60e | |||
01ed7d6012 | |||
3152dd1a9a | |||
560604ade9 | |||
766a055d65 | |||
073f8ff544 | |||
43982adc3a | |||
922e34f025 | |||
bf69584b99 | |||
470deeb8ed | |||
d880015eae | |||
f6b6a44d4c | |||
4332627a33 | |||
6182d5f14b | |||
40ab319f64 | |||
a2e0eae18a | |||
f5b398aaea | |||
9402ab1781 | |||
e10a02b4e2 | |||
26eb9e9658 | |||
4d1ff54c03 | |||
c861110047 | |||
1170675310 | |||
7e56c5568c | |||
8eb7eb7dae | |||
f23520664a | |||
ce638455fd | |||
21050caaa6 | |||
325746bfa0 | |||
f853ac209b | |||
da309c66c3 | |||
897ef1135d | |||
ab89338dac | |||
537c596e21 | |||
d03d1f1483 | |||
af25aee9e2 | |||
ad6f16f69d | |||
78eabc66a8 | |||
feb54cd785 | |||
c873360ca6 | |||
10ad76b2f4 | |||
63ede39505 | |||
f26f9c6331 | |||
2102c0b910 | |||
d71b4a132e | |||
e3a55b8923 | |||
a5178a875c | |||
9d416efbd2 | |||
e481be0ccd | |||
4abb436e34 | |||
753f624805 | |||
063564655e | |||
54a3e04e26 | |||
bbee37f54f | |||
ca7ad6daf3 | |||
f4ccc4bd79 | |||
fc717fbc0e | |||
0e6f48d1de |
202
ChangeLog
202
ChangeLog
@ -1,10 +1,202 @@
|
||||
Deluge 0.9.03 - "1.0.0_RC3" (In-Development)
|
||||
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
|
||||
|
||||
Deluge 0.9.09 - "1.0.0_RC9" (15 September 2008)
|
||||
Core:
|
||||
* Bug fixes in libtorrent including a crash when the tracker doesn't
|
||||
have 'announce' in it's url.
|
||||
* 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
|
||||
* Fix setting file priorities on folders
|
||||
|
||||
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
|
||||
* Fix UPnP
|
||||
* Fix to prevent Deluge from segfaulting when trying to autoadd an incomplete torrent file
|
||||
* Fix #407 possible negative ETA
|
||||
|
||||
GtkUI:
|
||||
* Add 'edit' to edit trackers dialog
|
||||
* Improve performance of initial torrent list load
|
||||
* Fix hiding the bottom pane when disabling all the tabs
|
||||
* Fix not showing new torrents if you don't use the All label first
|
||||
* Fix size units to be more accurate
|
||||
* Fix torrentview sorting to be persistent
|
||||
* Fix not displaying file list when state changes
|
||||
* Expand root folder in files tab by default
|
||||
|
||||
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
|
||||
* Fix do not create torrentfiles folder unless 'copy_torrent_file' is True
|
||||
|
||||
GtkUI:
|
||||
* Add drag n' drop support for adding .torrent files
|
||||
* Double-clicking on host in ConnectionManager now will connect to that host
|
||||
* Fix selecting torrents when right-clicking on them in torrentview and filestab
|
||||
* Fix new release check
|
||||
* Display 'total_wanted' instead of 'total_size' in Size column
|
||||
* 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.
|
||||
|
||||
@ -14,13 +206,13 @@ Deluge 0.9.03 - "1.0.0_RC3" (In-Development)
|
||||
|
||||
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
|
||||
|
621
LICENSE
Normal file
621
LICENSE
Normal file
@ -0,0 +1,621 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. 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
|
||||
them 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 prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. 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.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey 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;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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 that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
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.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
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.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
92
README
Normal file
92
README
Normal file
@ -0,0 +1,92 @@
|
||||
==========================
|
||||
Deluge BitTorrent Client
|
||||
==========================
|
||||
|
||||
Authors:
|
||||
Andrew Resch
|
||||
Marcos Pinto
|
||||
Martijn Voncken
|
||||
Sadrul Habib Chowdhury
|
||||
|
||||
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:
|
||||
==========================
|
||||
|
||||
We have two options available for support:
|
||||
|
||||
Our Forum, at http://forum.deluge-torrent.org
|
||||
or
|
||||
Our IRC Channel, at #deluge on Freenode
|
||||
|
||||
==========================
|
||||
Installation Instructions:
|
||||
==========================
|
||||
|
||||
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 \
|
||||
python-gtk2 python-notify librsvg2-common python-xdg python-support \
|
||||
subversion libboost-dev libboost-python-dev libboost-iostreams-dev \
|
||||
libboost-thread-dev libboost-date-time-dev libboost-filesystem-dev \
|
||||
libboost-serialization-dev libssl-dev zlib1g-dev python-setuptools
|
||||
|
||||
The names of the packages may vary depending on your OS / distro.
|
||||
|
||||
Once you have the needed libraries installed, build and install by running:
|
||||
|
||||
$ python setup.py build
|
||||
$ sudo python setup.py install
|
||||
|
||||
|
||||
==========================
|
||||
FAQ
|
||||
==========================
|
||||
|
||||
How to start the various user-interfaces
|
||||
|
||||
Gtk:
|
||||
deluge --ui gtk
|
||||
Console:
|
||||
deluge --ui null
|
||||
Web:
|
||||
deluge --ui web
|
||||
Go to http://localhost:8112/ default-password = "deluge"
|
||||
|
||||
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 ?
|
||||
|
||||
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 ?
|
||||
|
||||
deluged
|
||||
|
||||
How do I start the daemon with logging to console ?
|
||||
|
||||
deluged -d
|
||||
|
||||
I can't connect to the daemon from another machine
|
||||
|
||||
* Configure the daemon to allow remote connections
|
||||
* Restart the daemon.
|
||||
|
||||
Note: do not do this on a public ip , use the webui for unsecure networks.
|
||||
|
||||
I upgraded from 0.5 and plugin x is missing
|
||||
|
||||
1.0 is a rewrite, all old 0.5 plugins have to be rewritten.
|
23
TODO
23
TODO
@ -1,23 +0,0 @@
|
||||
For 0.6 release:
|
||||
* Translations
|
||||
* Add progress bars for downloading and importing lists instead of hanging (blocklist)
|
||||
|
||||
After 0.6 release:
|
||||
* Address issue where torrents will redownload if the storage is moved outside
|
||||
of deluge.
|
||||
* Implement add by hash
|
||||
* Figure out easy way for user-made plugins to add i18n support.
|
||||
* Restart daemon function
|
||||
* Docstrings!
|
||||
* Add wizard
|
||||
* Advanced (pieces) progress bar
|
||||
* Add method for plugins to add labels
|
||||
* Add context menus for labels.. ie. setting options for all torrents in label
|
||||
* Implement caching in core
|
||||
* Use the batch torrent status info as a cache for other torrent status requests
|
||||
* Add number of torrents to labels
|
||||
* Proxy stuff
|
||||
* Webseed
|
||||
* Enable/disable webui from within gtkui
|
||||
* Notifications
|
||||
* create a clamav plugin to scan files
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,5 +1,5 @@
|
||||
deluge-torrent (0.9.02-1) unstable; urgency=low
|
||||
deluge-torrent (1.0.6-1) unstable; urgency=low
|
||||
|
||||
* RC2 release
|
||||
* 1.0.6
|
||||
|
||||
-- Andrew Resch (andar) <andrewresch@gmail.com> Tue, 17 Jul 2008 16:31:14 -0800
|
||||
-- Andrew Resch (andar) <andrewresch@gmail.com> Mon, 01 Dec 2008 02:10:00 -0000
|
||||
|
120
debian/copyright
vendored
120
debian/copyright
vendored
@ -1,20 +1,19 @@
|
||||
This package was debianized by Adam Cécile (Le_Vert) <gandalf@le-vert.net> on
|
||||
Wed, 15 Nov 2006 22:03:13 +0100.
|
||||
This package was debianized by Marcos Pinto (markybob) <markybob@gmail.com> on
|
||||
Fri, 31 Jul 2008 22:03:13 +0100.
|
||||
|
||||
It was downloaded from http://www.deluge-torrent.org/
|
||||
|
||||
Upstream Author: Zach Tibbitts <zach@collegegeek.org>
|
||||
Alon Zakai <kripkensteiner@gmail.com>
|
||||
Marcos Pinto
|
||||
|
||||
Copyright: (C) 2006, Zach Tibbitts <zach@collegegeek.org>
|
||||
(C) 2006, Alon Zakai <kripkensteiner@gmail.com>
|
||||
Upstream Authors & Copyright:
|
||||
Andrew Resch
|
||||
Marcos Pinto
|
||||
Sadrul Habib Chowdhury
|
||||
Martijn Voncken
|
||||
|
||||
License:
|
||||
|
||||
This package 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
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This package is distributed in the hope that it will be useful,
|
||||
@ -39,65 +38,62 @@ License:
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License can be found in `/usr/share/common-licenses/GPL'.
|
||||
|
||||
libtorrent/* are (C) 2006, A. Zakai ('Kripken') <kripkensteiner@gmail.com>
|
||||
and distributed unders term of GNU General Public License.
|
||||
libtorrent is (C) 2003-2008 Arvid Norberg arvid@cs.umu.se and its
|
||||
python bindings were initially written by Daniel Wallin in 2006.
|
||||
It is distributed unders terms of the BSD License below:
|
||||
|
||||
This code is baded on libtorrent which is (C) 2003 Arvid Norberg and
|
||||
distributed under terms of the license below :
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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 SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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 SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
"libtorrent/include/libtorrent/asio*" are (C) 2003-2008 Christopher
|
||||
M. Kohlhoff <chris@kohlhoff.com> and distributed under terms of the Boost
|
||||
Software License, Version 1.0 :
|
||||
|
||||
"libtorrent/include/libtorrent/asio*" are (C) 2003-2006 Christopher
|
||||
M. Kohlhoff <chris@kohlhoff.com> and distributed under terms of the Boost
|
||||
Software License, Version 1.0 :
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
"po/*" are (C) 2006 Rosetta Contributors and Canonical Ltd 2006 and distributed
|
||||
"deluge/i18n/*" are (C) 2006 Rosetta Contributors and Canonical Ltd 2006 and distributed
|
||||
under the same license as the deluge software.
|
||||
|
||||
The Debian packaging is (C) 2006-2007, Adam Cécile (Le_Vert)
|
||||
<gandalf@le-vert.net> and is licensed under the GPL, see above.
|
||||
The Debian packaging is (C) 2006-2008, Marcos Pinto (markybob)
|
||||
<markybob@gmail.com> and is licensed under GPL3, see above.
|
||||
|
3
debian/manpages
vendored
3
debian/manpages
vendored
@ -1 +1,2 @@
|
||||
debian/deluge.1
|
||||
deluge/docs/man/deluge.1
|
||||
deluge/docs/man/deluged.1
|
||||
|
111
deluge/common.py
111
deluge/common.py
@ -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 2 of the License, or (at your option)
|
||||
# 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
|
||||
@ -42,22 +35,18 @@ import xdg, xdg.BaseDirectory
|
||||
LT_TORRENT_STATE = {
|
||||
"Queued": 0,
|
||||
"Checking": 1,
|
||||
"Connecting": 2,
|
||||
"Downloading Metadata": 3,
|
||||
"Downloading": 4,
|
||||
"Finished": 5,
|
||||
"Seeding": 6,
|
||||
"Allocating": 7,
|
||||
"Paused": 8,
|
||||
"Downloading Metadata": 2,
|
||||
"Downloading": 3,
|
||||
"Finished": 4,
|
||||
"Seeding": 5,
|
||||
"Allocating": 6,
|
||||
0: "Queued",
|
||||
1: "Checking",
|
||||
2: "Connecting",
|
||||
3: "Downloading Metadata",
|
||||
4: "Downloading",
|
||||
5: "Finished",
|
||||
6: "Seeding",
|
||||
7: "Allocating",
|
||||
8: "Paused"
|
||||
2: "Downloading Metadata",
|
||||
3: "Downloading",
|
||||
4: "Finished",
|
||||
5: "Seeding",
|
||||
6: "Allocating",
|
||||
}
|
||||
|
||||
TORRENT_STATE = [
|
||||
@ -93,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
|
||||
@ -121,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"""
|
||||
@ -135,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:
|
||||
@ -145,7 +136,7 @@ def get_logo(size):
|
||||
def open_file(path):
|
||||
"""Opens a file or folder."""
|
||||
if windows_check():
|
||||
os.startfile("'%s'" % path)
|
||||
os.startfile("%s" % path)
|
||||
else:
|
||||
subprocess.Popen(["xdg-open", "%s" % path])
|
||||
|
||||
@ -162,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:
|
||||
@ -186,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:
|
||||
@ -207,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:
|
||||
@ -220,21 +211,23 @@ def build_menu_radio_list(value_list, callback, pref_value=None,
|
||||
|
||||
if show_notset:
|
||||
menuitem = gtk.RadioMenuItem(group, notset_label)
|
||||
menuitem.set_name(notset_label)
|
||||
if pref_value < notset_lessthan and pref_value != None:
|
||||
menuitem.set_active(True)
|
||||
if show_activated and pref_value == 1:
|
||||
menuitem.set_active(True)
|
||||
menuitem.connect("toggled", callback)
|
||||
menu.append(menuitem)
|
||||
|
||||
|
||||
# Add the Other... menuitem
|
||||
if show_other is True:
|
||||
menuitem = gtk.SeparatorMenuItem()
|
||||
menu.append(menuitem)
|
||||
menuitem = gtk.MenuItem(_("Other..."))
|
||||
menuitem.set_name(_("Other..."))
|
||||
menuitem.connect("activate", callback)
|
||||
menu.append(menuitem)
|
||||
|
||||
|
||||
return menu
|
||||
|
||||
def show_other_dialog(string, default=None):
|
||||
@ -242,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")
|
||||
@ -257,22 +250,22 @@ 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):
|
||||
"""Returns formatted string describing filesize
|
||||
fsize_b should be in bytes
|
||||
Returned value will be in either KB, MB, or GB
|
||||
"""
|
||||
Returned value will be in either KiB, MiB, or GiB
|
||||
"""
|
||||
fsize_kb = fsize_b / 1024.0
|
||||
if fsize_kb < 1000:
|
||||
if fsize_kb < 1024:
|
||||
return "%.1f KiB" % fsize_kb
|
||||
fsize_mb = fsize_kb / 1024.0
|
||||
if fsize_mb < 1000:
|
||||
if fsize_mb < 1024:
|
||||
return "%.1f MiB" % fsize_mb
|
||||
fsize_gb = fsize_mb / 1024.0
|
||||
return "%.1f GiB" % fsize_gb
|
||||
@ -291,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:
|
||||
@ -319,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
|
||||
@ -337,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 2 of the License, or (at your option)
|
||||
# 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 2 of the License, or (at your option)
|
||||
# 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 2 of the License, or (at your option)
|
||||
# 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 2 of the License, or (at your option)
|
||||
# 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,9 +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
|
||||
log.debug("%s: %s", alert_type, 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]:
|
||||
@ -102,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 2 of the License, or (at your option)
|
||||
# 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
|
||||
@ -42,10 +37,10 @@ MAX_NUM_ATTEMPTS = 10
|
||||
|
||||
class AutoAdd(component.Component):
|
||||
def __init__(self):
|
||||
component.Component.__init__(self, "AutoAdd", depend=["TorrentManager"], interval=3000)
|
||||
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,29 +80,31 @@ 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)
|
||||
_file = open(filename, "rb")
|
||||
filedump = _file.read()
|
||||
if not filedump:
|
||||
raise RuntimeError, "Torrent is 0 bytes!"
|
||||
_file.close()
|
||||
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 2 of the License, or (at your option)
|
||||
# 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,
|
||||
@ -67,7 +63,7 @@ DEFAULT_PREFS = {
|
||||
"download_location": deluge.common.get_default_download_dir(),
|
||||
"listen_ports": [6881, 6891],
|
||||
"copy_torrent_file": False,
|
||||
"torrentfiles_location": os.path.join(deluge.common.get_default_download_dir(), "torrentfiles"),
|
||||
"torrentfiles_location": deluge.common.get_default_download_dir(),
|
||||
"plugins_location": os.path.join(deluge.configmanager.get_config_dir(), "plugins"),
|
||||
"state_location": os.path.join(deluge.configmanager.get_config_dir(), "state"),
|
||||
"prioritize_first_last_pieces": 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,49 +141,37 @@ 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.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.bindtextdomain("deluge", pkg_resources.resource_filename("deluge", "i18n"))
|
||||
gettext.textdomain("deluge")
|
||||
gettext.install("deluge",
|
||||
pkg_resources.resource_filename(
|
||||
"deluge", "i18n"))
|
||||
# Setup signals
|
||||
try:
|
||||
import gnome.ui
|
||||
self.gnome_client = gnome.ui.Client()
|
||||
self.gnome_client.connect("die", self._shutdown)
|
||||
except:
|
||||
pass
|
||||
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
|
||||
from win32con import CTRL_CLOSE_EVENT
|
||||
from win32con import CTRL_SHUTDOWN_EVENT
|
||||
result = 0
|
||||
def win_handler(ctrl_type):
|
||||
if ctrl_type == CTRL_CLOSE_EVENT:
|
||||
log.debug("ctrl_type: %s", ctrl_type)
|
||||
if ctrl_type == CTRL_CLOSE_EVENT or ctrl_type == CTRL_SHUTDOWN_EVENT:
|
||||
self._shutdown()
|
||||
result = 1
|
||||
return result
|
||||
@ -198,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"""
|
||||
|
||||
@ -209,19 +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()
|
||||
|
||||
# Set lazy bitfield
|
||||
|
||||
# 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:
|
||||
@ -520,16 +524,18 @@ class Core(
|
||||
config = deluge.common.pythonize(config)
|
||||
# Load all the values into the configuration
|
||||
for key in config.keys():
|
||||
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
|
||||
@ -541,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()
|
||||
@ -553,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
|
||||
@ -674,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")
|
||||
@ -704,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):
|
||||
# First try to create the new directory
|
||||
try:
|
||||
os.makedirs(value)
|
||||
except Exception, e:
|
||||
log.debug("Unable to make directory: %s", e)
|
||||
|
||||
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
|
||||
@ -741,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:
|
||||
@ -756,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:
|
||||
@ -777,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:
|
||||
@ -794,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,
|
||||
@ -802,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
|
||||
@ -813,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
|
||||
@ -862,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
|
||||
@ -903,12 +914,12 @@ class Core(
|
||||
from urllib2 import urlopen
|
||||
try:
|
||||
self.new_release = urlopen(
|
||||
"http://download.deluge-torrent.org/version-1.0").read().strip()
|
||||
"http://download.deluge-torrent.org/version").read().strip()
|
||||
except Exception, e:
|
||||
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)
|
||||
@ -916,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..")
|
||||
@ -929,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 2 of the License, or (at your option)
|
||||
# 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)
|
||||
|
127
deluge/core/oldstateupgrader.py
Normal file
127
deluge/core/oldstateupgrader.py
Normal file
@ -0,0 +1,127 @@
|
||||
#
|
||||
# oldstateupgrader.py
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import pickle
|
||||
import cPickle
|
||||
import shutil
|
||||
|
||||
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
|
||||
|
||||
#start : http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286203
|
||||
def makeFakeClass(module, name):
|
||||
class FakeThing(object):
|
||||
pass
|
||||
FakeThing.__name__ = name
|
||||
FakeThing.__module__ = '(fake)' + module
|
||||
return FakeThing
|
||||
|
||||
class PickleUpgrader(pickle.Unpickler):
|
||||
def find_class(self, module, cname):
|
||||
# Pickle tries to load a couple things like copy_reg and
|
||||
# __builtin__.object even though a pickle file doesn't
|
||||
# explicitly reference them (afaict): allow them to be loaded
|
||||
# normally.
|
||||
if module in ('copy_reg', '__builtin__'):
|
||||
thing = pickle.Unpickler.find_class(self, module, cname)
|
||||
return thing
|
||||
return makeFakeClass(module, cname)
|
||||
# end: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286203
|
||||
|
||||
class OldStateUpgrader:
|
||||
def __init__(self):
|
||||
self.config = ConfigManager("core.conf")
|
||||
self.state05_location = os.path.join(self.config["config_location"], "persistent.state")
|
||||
self.state10_location = os.path.join(self.config["state_location"], "torrents.state")
|
||||
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)
|
||||
try:
|
||||
torrent_info = None
|
||||
log.debug("Attempting to create torrent_info from %s", torrent_path)
|
||||
_file = open(torrent_path, "rb")
|
||||
torrent_info = lt.torrent_info(lt.bdecode(_file.read()))
|
||||
_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"))
|
||||
|
||||
# Set the file prioritiy property if not already there
|
||||
if not hasattr(ti, "priorities"):
|
||||
ti.priorities = [1] * torrent_info.num_files()
|
||||
|
||||
# Create the new TorrentState object
|
||||
new_torrent = deluge.core.torrentmanager.TorrentState(
|
||||
torrent_id=str(torrent_info.info_hash()),
|
||||
filename=ti.filename,
|
||||
save_path=ti.save_dir,
|
||||
compact=ti.compact,
|
||||
paused=ti.user_paused,
|
||||
total_uploaded=ti.uploaded_memory,
|
||||
max_upload_speed=ti.upload_rate_limit,
|
||||
max_download_speed=ti.download_rate_limit,
|
||||
file_priorities=ti.priorities,
|
||||
queue=state.queue.index(ti)
|
||||
)
|
||||
# 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.")
|
||||
state_file = open(
|
||||
os.path.join(self.config["state_location"], "torrents.state"), "wb")
|
||||
cPickle.dump(new_state, state_file)
|
||||
state_file.close()
|
||||
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")
|
||||
except Exception, e:
|
||||
log.debug("Unable to rename old persistent.state file! %s", e)
|
@ -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 2 of the License, or (at your option)
|
||||
# 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 2 of the License, or (at your option)
|
||||
# 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 2 of the License, or (at your option)
|
||||
# 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
|
||||
@ -210,7 +213,14 @@ class Torrent:
|
||||
"""Sets trackers"""
|
||||
if trackers == None:
|
||||
trackers = []
|
||||
|
||||
for value in self.handle.trackers():
|
||||
tracker = {}
|
||||
tracker["url"] = value.url
|
||||
tracker["tier"] = value.tier
|
||||
trackers.append(tracker)
|
||||
self.trackers = trackers
|
||||
return
|
||||
|
||||
log.debug("Setting trackers for %s: %s", self.torrent_id, trackers)
|
||||
tracker_list = []
|
||||
|
||||
@ -218,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)
|
||||
@ -229,26 +239,25 @@ 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
|
||||
elif ltstate == LTSTATE["Connecting"] or ltstate == LTSTATE["Downloading"] or\
|
||||
ltstate == LTSTATE["Downloading Metadata"]:
|
||||
elif ltstate == LTSTATE["Downloading"] or ltstate == LTSTATE["Downloading Metadata"]:
|
||||
self.state = "Downloading"
|
||||
elif ltstate == LTSTATE["Finished"] or ltstate == LTSTATE["Seeding"]:
|
||||
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"
|
||||
@ -258,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:
|
||||
@ -277,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:
|
||||
|
||||
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):
|
||||
@ -296,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"""
|
||||
@ -317,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:
|
||||
@ -342,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:
|
||||
@ -350,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,
|
||||
@ -361,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()
|
||||
@ -377,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,
|
||||
@ -431,28 +433,32 @@ class Torrent:
|
||||
"stop_at_ratio": self.stop_at_ratio,
|
||||
"remove_at_ratio": self.remove_at_ratio
|
||||
}
|
||||
|
||||
fns = {
|
||||
"name": self.torrent_info.name,
|
||||
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": ti_name,
|
||||
"private": self.torrent_info.priv,
|
||||
"total_size": self.torrent_info.total_size,
|
||||
"num_files": self.torrent_info.num_files,
|
||||
"num_pieces": self.torrent_info.num_pieces,
|
||||
"piece_length": self.torrent_info.piece_length,
|
||||
"eta": self.get_eta,
|
||||
"ratio": self.get_ratio,
|
||||
"total_size": self.torrent_info.total_size,
|
||||
"num_files": self.torrent_info.num_files,
|
||||
"num_pieces": self.torrent_info.num_pieces,
|
||||
"piece_length": self.torrent_info.piece_length,
|
||||
"eta": self.get_eta,
|
||||
"ratio": self.get_ratio,
|
||||
"file_progress": self.get_file_progress,
|
||||
"queue": self.handle.queue_position,
|
||||
"is_seed": self.handle.is_seed,
|
||||
"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:
|
||||
@ -461,11 +467,14 @@ class Torrent:
|
||||
for key in keys:
|
||||
if key in full_status:
|
||||
status_dict[key] = full_status[key]
|
||||
elif key in fns:
|
||||
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)
|
||||
@ -474,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
|
||||
@ -492,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:
|
||||
@ -512,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
|
||||
@ -520,18 +529,18 @@ 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:
|
||||
self.handle.move_storage(dest)
|
||||
self.handle.move_storage(dest.encode("utf8"))
|
||||
except:
|
||||
return False
|
||||
|
||||
@ -545,11 +554,12 @@ class Torrent:
|
||||
self.torrent_id)
|
||||
log.debug("Saving fastresume file: %s", path)
|
||||
try:
|
||||
self.delete_fastresume()
|
||||
fastresume = open(path, "wb")
|
||||
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"""
|
||||
@ -572,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:
|
||||
@ -580,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:
|
||||
@ -590,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 2 of the License, or (at your option)
|
||||
# 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,12 +32,16 @@ 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
|
||||
from deluge.configmanager import ConfigManager
|
||||
from deluge.core.torrent import Torrent
|
||||
import deluge.core.oldstateupgrader
|
||||
|
||||
from deluge.log import LOG as log
|
||||
|
||||
@ -53,23 +49,23 @@ class TorrentState:
|
||||
def __init__(self,
|
||||
torrent_id=None,
|
||||
filename=None,
|
||||
total_uploaded=None,
|
||||
total_uploaded=0,
|
||||
trackers=None,
|
||||
compact=None,
|
||||
paused=None,
|
||||
compact=False,
|
||||
paused=False,
|
||||
save_path=None,
|
||||
max_connections=None,
|
||||
max_upload_slots=None,
|
||||
max_upload_speed=None,
|
||||
max_download_speed=None,
|
||||
prioritize_first_last=None,
|
||||
max_connections=-1,
|
||||
max_upload_slots=-1,
|
||||
max_upload_speed=-1.0,
|
||||
max_download_speed=-1.0,
|
||||
prioritize_first_last=False,
|
||||
file_priorities=None,
|
||||
queue=None,
|
||||
auto_managed=None,
|
||||
auto_managed=True,
|
||||
is_finished=False,
|
||||
stop_ratio=2.00,
|
||||
stop_at_ratio=False,
|
||||
remove_at_ratio=True
|
||||
remove_at_ratio=False
|
||||
):
|
||||
self.torrent_id = torrent_id
|
||||
self.filename = filename
|
||||
@ -101,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..")
|
||||
@ -114,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)
|
||||
@ -129,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)
|
||||
@ -144,29 +140,35 @@ class TorrentManager(component.Component):
|
||||
self.alerts.register_handler("tracker_alert", self.on_alert_tracker)
|
||||
self.alerts.register_handler("tracker_warning_alert",
|
||||
self.on_alert_tracker_warning)
|
||||
self.alerts.register_handler("tracker_error_alert",
|
||||
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
|
||||
deluge.core.oldstateupgrader.OldStateUpgrader()
|
||||
|
||||
# Try to load the state from file
|
||||
self.load_state()
|
||||
|
||||
# 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():
|
||||
@ -174,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:
|
||||
@ -195,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
|
||||
@ -211,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 = None
|
||||
fastresume = ""
|
||||
try:
|
||||
_file = open(
|
||||
os.path.join(
|
||||
self.config["state_location"],
|
||||
self.config["state_location"],
|
||||
torrent_id + ".fastresume"),
|
||||
"rb")
|
||||
fastresume = _file.read()
|
||||
@ -229,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.
|
||||
@ -263,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.
|
||||
@ -294,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"] = str(options["download_location"])
|
||||
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)
|
||||
@ -339,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
|
||||
@ -350,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)
|
||||
@ -373,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):
|
||||
@ -387,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:
|
||||
@ -405,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:
|
||||
@ -423,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
|
||||
@ -450,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):
|
||||
@ -463,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()
|
||||
@ -476,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()):
|
||||
@ -485,24 +493,25 @@ 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 = []
|
||||
for torrent_state in state.torrents:
|
||||
for t in ordered_state:
|
||||
if torrent_state.queue < t.queue:
|
||||
ordered_state.insert(0, torrent_state)
|
||||
ordered_state.insert(ordered_state.index(t), torrent_state)
|
||||
break
|
||||
ordered_state.append(torrent_state)
|
||||
|
||||
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()
|
||||
|
||||
@ -514,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,
|
||||
@ -537,21 +546,26 @@ 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
|
||||
|
||||
def save_resume_data(self):
|
||||
"""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:
|
||||
@ -572,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
|
||||
|
||||
@ -583,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)
|
||||
@ -600,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():
|
||||
@ -622,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
|
||||
@ -630,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
|
||||
@ -654,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:
|
||||
@ -669,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"))
|
||||
@ -687,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
|
||||
@ -698,7 +712,16 @@ 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_error(self, alert):
|
||||
log.debug("on_alert_tracker_error")
|
||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
||||
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())
|
||||
@ -715,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.
|
BIN
deluge/data/GeoIP.dat
Normal file
BIN
deluge/data/GeoIP.dat
Normal file
Binary file not shown.
BIN
deluge/data/pixmaps/deluge.ico
Normal file
BIN
deluge/data/pixmaps/deluge.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
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 2 of the License, or (at your option)
|
||||
# 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,172 +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/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/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/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/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/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/addtorrenturl.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/testp/testp/ui.py
|
||||
deluge/plugins/testp/testp/gtkui.py
|
||||
deluge/plugins/testp/testp/core.py
|
||||
deluge/plugins/testp/testp/__init__.py
|
||||
deluge/plugins/testp/setup.py
|
||||
deluge/plugins/testp/build/lib/testp/ui.py
|
||||
deluge/plugins/testp/build/lib/testp/gtkui.py
|
||||
deluge/plugins/testp/build/lib/testp/core.py
|
||||
deluge/plugins/testp/build/lib/testp/__init__.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/label/build/lib/label/ui.py
|
||||
deluge/plugins/label/build/lib/label/gtk_sidebar.py
|
||||
deluge/plugins/label/build/lib/label/test.py
|
||||
deluge/plugins/label/build/lib/label/webui.py
|
||||
deluge/plugins/label/build/lib/label/webui_config.py
|
||||
deluge/plugins/label/build/lib/label/gtkui.py
|
||||
deluge/plugins/label/build/lib/label/sidebar.py
|
||||
deluge/plugins/label/build/lib/label/webui_pages.py
|
||||
deluge/plugins/label/build/lib/label/core.py
|
||||
deluge/plugins/label/build/lib/label/__init__.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/plugins/blocklist/build/lib/blocklist/ui.py
|
||||
deluge/plugins/blocklist/build/lib/blocklist/peerguardian.py
|
||||
deluge/plugins/blocklist/build/lib/blocklist/webui.py
|
||||
deluge/plugins/blocklist/build/lib/blocklist/gtkui.py
|
||||
deluge/plugins/blocklist/build/lib/blocklist/core.py
|
||||
deluge/plugins/blocklist/build/lib/blocklist/text.py
|
||||
deluge/plugins/blocklist/build/lib/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/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/file_tab_menu.glade
|
||||
deluge/ui/gtkui/glade/main_window.glade
|
||||
deluge/plugins/blocklist/blocklist/data/blocklist_pref.glade
|
||||
deluge/plugins/blocklist/build/lib/blocklist/data/blocklist_pref.glade
|
||||
|
2327
deluge/i18n/ar.po
Normal file
2327
deluge/i18n/ar.po
Normal file
File diff suppressed because it is too large
Load Diff
2816
deluge/i18n/ast.po
Normal file
2816
deluge/i18n/ast.po
Normal file
File diff suppressed because it is too large
Load Diff
2335
deluge/i18n/bg.po
Normal file
2335
deluge/i18n/bg.po
Normal file
File diff suppressed because it is too large
Load Diff
2745
deluge/i18n/bs.po
Normal file
2745
deluge/i18n/bs.po
Normal file
File diff suppressed because it is too large
Load Diff
2327
deluge/i18n/ca.po
Normal file
2327
deluge/i18n/ca.po
Normal file
File diff suppressed because it is too large
Load Diff
2327
deluge/i18n/cs.po
Normal file
2327
deluge/i18n/cs.po
Normal file
File diff suppressed because it is too large
Load Diff
2751
deluge/i18n/cy.po
Normal file
2751
deluge/i18n/cy.po
Normal file
File diff suppressed because it is too large
Load Diff
2327
deluge/i18n/da.po
Normal file
2327
deluge/i18n/da.po
Normal file
File diff suppressed because it is too large
Load Diff
2380
deluge/i18n/de.po
Normal file
2380
deluge/i18n/de.po
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2386
deluge/i18n/el.po
Normal file
2386
deluge/i18n/el.po
Normal file
File diff suppressed because it is too large
Load Diff
2364
deluge/i18n/en_AU.po
Normal file
2364
deluge/i18n/en_AU.po
Normal file
File diff suppressed because it is too large
Load Diff
2364
deluge/i18n/en_CA.po
Normal file
2364
deluge/i18n/en_CA.po
Normal file
File diff suppressed because it is too large
Load Diff
2346
deluge/i18n/en_GB.po
Normal file
2346
deluge/i18n/en_GB.po
Normal file
File diff suppressed because it is too large
Load Diff
2747
deluge/i18n/eo.po
Normal file
2747
deluge/i18n/eo.po
Normal file
File diff suppressed because it is too large
Load Diff
2378
deluge/i18n/es.po
Normal file
2378
deluge/i18n/es.po
Normal file
File diff suppressed because it is too large
Load Diff
2327
deluge/i18n/et.po
Normal file
2327
deluge/i18n/et.po
Normal file
File diff suppressed because it is too large
Load Diff
2327
deluge/i18n/eu.po
Normal file
2327
deluge/i18n/eu.po
Normal file
File diff suppressed because it is too large
Load Diff
2751
deluge/i18n/fa.po
Normal file
2751
deluge/i18n/fa.po
Normal file
File diff suppressed because it is too large
Load Diff
2373
deluge/i18n/fi.po
Normal file
2373
deluge/i18n/fi.po
Normal file
File diff suppressed because it is too large
Load Diff
2392
deluge/i18n/fr.po
Normal file
2392
deluge/i18n/fr.po
Normal file
File diff suppressed because it is too large
Load Diff
2745
deluge/i18n/fy.po
Normal file
2745
deluge/i18n/fy.po
Normal file
File diff suppressed because it is too large
Load Diff
2336
deluge/i18n/gl.po
Normal file
2336
deluge/i18n/gl.po
Normal file
File diff suppressed because it is too large
Load Diff
2349
deluge/i18n/he.po
Normal file
2349
deluge/i18n/he.po
Normal file
File diff suppressed because it is too large
Load Diff
2745
deluge/i18n/hi.po
Normal file
2745
deluge/i18n/hi.po
Normal file
File diff suppressed because it is too large
Load Diff
2762
deluge/i18n/hr.po
Normal file
2762
deluge/i18n/hr.po
Normal file
File diff suppressed because it is too large
Load Diff
2364
deluge/i18n/hu.po
Normal file
2364
deluge/i18n/hu.po
Normal file
File diff suppressed because it is too large
Load Diff
2329
deluge/i18n/id.po
Normal file
2329
deluge/i18n/id.po
Normal file
File diff suppressed because it is too large
Load Diff
2353
deluge/i18n/is.po
Normal file
2353
deluge/i18n/is.po
Normal file
File diff suppressed because it is too large
Load Diff
2378
deluge/i18n/it.po
Normal file
2378
deluge/i18n/it.po
Normal file
File diff suppressed because it is too large
Load Diff
2745
deluge/i18n/iu.po
Normal file
2745
deluge/i18n/iu.po
Normal file
File diff suppressed because it is too large
Load Diff
2347
deluge/i18n/ja.po
Normal file
2347
deluge/i18n/ja.po
Normal file
File diff suppressed because it is too large
Load Diff
2769
deluge/i18n/ka.po
Normal file
2769
deluge/i18n/ka.po
Normal file
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
2745
deluge/i18n/kn.po
Normal file
2745
deluge/i18n/kn.po
Normal file
File diff suppressed because it is too large
Load Diff
2344
deluge/i18n/ko.po
Normal file
2344
deluge/i18n/ko.po
Normal file
File diff suppressed because it is too large
Load Diff
2745
deluge/i18n/ku.po
Normal file
2745
deluge/i18n/ku.po
Normal file
File diff suppressed because it is too large
Load Diff
2745
deluge/i18n/la.po
Normal file
2745
deluge/i18n/la.po
Normal file
File diff suppressed because it is too large
Load Diff
2366
deluge/i18n/lt.po
Normal file
2366
deluge/i18n/lt.po
Normal file
File diff suppressed because it is too large
Load Diff
2766
deluge/i18n/lv.po
Normal file
2766
deluge/i18n/lv.po
Normal file
File diff suppressed because it is too large
Load Diff
2757
deluge/i18n/mk.po
Normal file
2757
deluge/i18n/mk.po
Normal file
File diff suppressed because it is too large
Load Diff
2327
deluge/i18n/ms.po
Normal file
2327
deluge/i18n/ms.po
Normal file
File diff suppressed because it is too large
Load Diff
2360
deluge/i18n/nb.po
Normal file
2360
deluge/i18n/nb.po
Normal file
File diff suppressed because it is too large
Load Diff
2745
deluge/i18n/nds.po
Normal file
2745
deluge/i18n/nds.po
Normal file
File diff suppressed because it is too large
Load Diff
2379
deluge/i18n/nl.po
Normal file
2379
deluge/i18n/nl.po
Normal file
File diff suppressed because it is too large
Load Diff
2341
deluge/i18n/pl.po
Normal file
2341
deluge/i18n/pl.po
Normal file
File diff suppressed because it is too large
Load Diff
2745
deluge/i18n/pms.po
Normal file
2745
deluge/i18n/pms.po
Normal file
File diff suppressed because it is too large
Load Diff
2369
deluge/i18n/pt.po
Normal file
2369
deluge/i18n/pt.po
Normal file
File diff suppressed because it is too large
Load Diff
2378
deluge/i18n/pt_BR.po
Normal file
2378
deluge/i18n/pt_BR.po
Normal file
File diff suppressed because it is too large
Load Diff
2371
deluge/i18n/ro.po
Normal file
2371
deluge/i18n/ro.po
Normal file
File diff suppressed because it is too large
Load Diff
2377
deluge/i18n/ru.po
Normal file
2377
deluge/i18n/ru.po
Normal file
File diff suppressed because it is too large
Load Diff
2745
deluge/i18n/si.po
Normal file
2745
deluge/i18n/si.po
Normal file
File diff suppressed because it is too large
Load Diff
2371
deluge/i18n/sk.po
Normal file
2371
deluge/i18n/sk.po
Normal file
File diff suppressed because it is too large
Load Diff
2337
deluge/i18n/sl.po
Normal file
2337
deluge/i18n/sl.po
Normal file
File diff suppressed because it is too large
Load Diff
2327
deluge/i18n/sr.po
Normal file
2327
deluge/i18n/sr.po
Normal file
File diff suppressed because it is too large
Load Diff
2375
deluge/i18n/sv.po
Normal file
2375
deluge/i18n/sv.po
Normal file
File diff suppressed because it is too large
Load Diff
2745
deluge/i18n/ta.po
Normal file
2745
deluge/i18n/ta.po
Normal file
File diff suppressed because it is too large
Load Diff
2327
deluge/i18n/th.po
Normal file
2327
deluge/i18n/th.po
Normal file
File diff suppressed because it is too large
Load Diff
2745
deluge/i18n/tl.po
Normal file
2745
deluge/i18n/tl.po
Normal file
File diff suppressed because it is too large
Load Diff
2745
deluge/i18n/tlh.po
Normal file
2745
deluge/i18n/tlh.po
Normal file
File diff suppressed because it is too large
Load Diff
2361
deluge/i18n/tr.po
Normal file
2361
deluge/i18n/tr.po
Normal file
File diff suppressed because it is too large
Load Diff
2327
deluge/i18n/uk.po
Normal file
2327
deluge/i18n/uk.po
Normal file
File diff suppressed because it is too large
Load Diff
2753
deluge/i18n/vi.po
Normal file
2753
deluge/i18n/vi.po
Normal file
File diff suppressed because it is too large
Load Diff
2340
deluge/i18n/zh_CN.po
Normal file
2340
deluge/i18n/zh_CN.po
Normal file
File diff suppressed because it is too large
Load Diff
2327
deluge/i18n/zh_TW.po
Normal file
2327
deluge/i18n/zh_TW.po
Normal file
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 2 of the License, or (at your option)
|
||||
# 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 2 of the License, or (at your option)
|
||||
# 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,16 +47,25 @@ 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()
|
||||
|
||||
if options.config:
|
||||
if not os.path.exists(options.config):
|
||||
os.makedirs(options.config)
|
||||
# Try to create the config folder if it doesn't exist
|
||||
try:
|
||||
os.makedirs(options.config)
|
||||
except Exception, e:
|
||||
pass
|
||||
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)
|
||||
@ -74,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)
|
||||
@ -88,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)
|
||||
@ -104,10 +105,21 @@ 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()
|
||||
|
||||
if options.config:
|
||||
if not os.path.exists(options.config):
|
||||
# Try to create the config folder if it doesn't exist
|
||||
try:
|
||||
os.makedirs(options.config)
|
||||
except Exception, e:
|
||||
pass
|
||||
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:
|
||||
@ -121,15 +133,30 @@ def start_daemon():
|
||||
else:
|
||||
config_dir = deluge.common.get_default_config_dir()
|
||||
logfile = os.path.join(config_dir, "deluged.log")
|
||||
|
||||
sys.stdout = open(logfile, "w")
|
||||
|
||||
sys.stdout = open(logfile, "wb")
|
||||
sys.stderr = sys.stdout
|
||||
sys.stdin = None
|
||||
else:
|
||||
os._exit(0)
|
||||
else:
|
||||
os._exit(0)
|
||||
|
||||
|
||||
# Windows check, we log to the config folder by default
|
||||
if not options.donot and deluge.common.windows_check():
|
||||
if options.logfile:
|
||||
logfile = options.logfile
|
||||
else:
|
||||
if options.config:
|
||||
logfile = os.path.join(options.config, "deluged.log")
|
||||
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,13 +1,13 @@
|
||||
#
|
||||
# pluginmanagerbase.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 2 of the License, or (at your option)
|
||||
# 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,
|
||||
@ -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,15 +1,15 @@
|
||||
#
|
||||
# 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>
|
||||
|
||||
#
|
||||
#
|
||||
# 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 2 of the License, or (at your option)
|
||||
# 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,
|
||||
@ -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 2 of the License, or (at your option)
|
||||
# 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
|
||||
@ -52,7 +44,11 @@ DEFAULT_PREFS = {
|
||||
"check_after_days": 2,
|
||||
"listtype": "gzmule",
|
||||
"timeout": 180,
|
||||
"try_times": 3
|
||||
"try_times": 3,
|
||||
"file_type": "",
|
||||
"file_url": "",
|
||||
"file_date": "",
|
||||
"file_size": 0,
|
||||
}
|
||||
|
||||
FORMATS = {
|
||||
@ -62,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())
|
||||
@ -82,35 +78,35 @@ 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
|
||||
|
||||
## Exported RPC methods ###
|
||||
def export_download(self):
|
||||
def export_download(self, _import=False):
|
||||
"""Download the blocklist specified in the config as url"""
|
||||
self.download_blocklist()
|
||||
|
||||
def export_import(self, download=False):
|
||||
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."""
|
||||
threading.Thread(target=self.import_blocklist, kwargs={"download": download}).start()
|
||||
threading.Thread(target=self.import_blocklist, kwargs={"download": download, "force": force}).start()
|
||||
|
||||
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 = {}
|
||||
@ -120,36 +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):
|
||||
|
||||
def import_blocklist(self, download=False, force=False):
|
||||
"""Imports the downloaded blocklist into the session"""
|
||||
if self.is_downloading:
|
||||
return
|
||||
|
||||
|
||||
if download:
|
||||
if self.need_new_blocklist():
|
||||
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](
|
||||
@ -169,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):
|
||||
@ -191,11 +191,14 @@ class Core(CorePluginBase):
|
||||
return False
|
||||
|
||||
def on_retrieve_data(count, block_size, total_blocks):
|
||||
self.file_progress = float(count * block_size) / total_blocks
|
||||
|
||||
fp = float(count * block_size) / total_blocks
|
||||
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:
|
||||
@ -208,9 +211,16 @@ class Core(CorePluginBase):
|
||||
continue
|
||||
else:
|
||||
log.debug("Blocklist successfully downloaded..")
|
||||
# Set information about the file
|
||||
self.config["file_type"] = self.config["listtype"]
|
||||
self.config["file_url"] = self.config["url"]
|
||||
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:
|
||||
@ -227,7 +237,7 @@ class Core(CorePluginBase):
|
||||
if list_size == 0:
|
||||
return True
|
||||
|
||||
if current_time >= (list_time + datetime.timedelta(self.config["check_after_days"] * 24 * 60 * 60)):
|
||||
if current_time >= (list_time + datetime.timedelta(days=self.config["check_after_days"])):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
return False
|
||||
|
@ -278,7 +278,7 @@ 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
|
||||
@ -338,13 +338,3 @@ 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.
|
||||
|
||||
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.
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user