Compare commits
1 Commits
archive/1.
...
deluge-0.5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5f3c5d78b6 |
9
.gitattributes
vendored
@@ -1,9 +0,0 @@
|
|||||||
/libtorrent export-ignore
|
|
||||||
/win32 export-ignore
|
|
||||||
docs/build export-ignore
|
|
||||||
docs/source export-ignore
|
|
||||||
/tests export-ignore
|
|
||||||
deluge/scripts export-ignore
|
|
||||||
.gitattributes export-ignore
|
|
||||||
.gitmodules export-ignore
|
|
||||||
.gitignore export-ignore
|
|
8
.gitignore
vendored
@@ -1,8 +0,0 @@
|
|||||||
*~
|
|
||||||
build
|
|
||||||
dist
|
|
||||||
*egg-info
|
|
||||||
*.egg
|
|
||||||
*.log
|
|
||||||
*.pyc
|
|
||||||
*.tar.*
|
|
697
ChangeLog
@@ -1,451 +1,246 @@
|
|||||||
=== Deluge 1.2.3 (27 March 2010) ===
|
Deluge 0.5.8.4 (14 February 2008)
|
||||||
==== Core ====
|
* Randomize encryption pad size to evade throttling
|
||||||
* Fix libtorrent version compare to use a proper numerical compare instead
|
* https support
|
||||||
of string. This fixes a problem where using lt 0.14.10 wouldn't allow
|
* Add "seed time" to preferences
|
||||||
Deluge to start.
|
* Add switch torrent source to "Move Torrent" plugin
|
||||||
* Fix libtorrent 0.15 compatibility
|
* Fix alignment of torrent info
|
||||||
* Fix hang on quit
|
* Fix possible hang with torrents with many pieces
|
||||||
|
* Don't resave fast-resume for seeding torrents
|
||||||
=== Deluge 1.2.2 (19 March 2010) ===
|
* Add logout to WebUI
|
||||||
==== Core ====
|
* Only draw the advanced progress bar if 'num_pieces' is greater than 0 - prevents crash
|
||||||
* Fix #1109 auto add halting when a torrent with invalid filename encoding
|
|
||||||
is in the directory
|
Deluge 0.5.8.3 (28 January 2008)
|
||||||
|
* Fix remote exploit which could crash Deluge
|
||||||
==== GtkUI ====
|
* Fix high cpu spikes
|
||||||
* Fix #1162 problem with the queued torrents dialog from not properly adding
|
* Fix torrent order between sessions
|
||||||
to the add torrent dialog if set to auto add
|
* Fix loading of BlocklistImport plugin
|
||||||
* Fix #1172 notify startup complete when adding torrents externally
|
|
||||||
* Fix issue where the gtkui sometimes won't start if there is a stale lock
|
Deluge 0.5.8.2 (24 January 2008)
|
||||||
file or socket in the ipc/ directory.
|
* Fix column width saving
|
||||||
|
* Option to download new blocklist after certain number of days - Patch from Mark Stahler
|
||||||
==== Console ====
|
* Fix ui-locking when tracker responded in non-utf8 encoding
|
||||||
* Fix #1143 deluge-console crashes when tab-completing not-existent directory
|
* Remove Extra Stats plugin
|
||||||
|
* Prevent Scheduler plugin from setting an invalid 'max_active_torrents'
|
||||||
=== Deluge 1.2.1 (20 February 2010) ===
|
|
||||||
==== Core ====
|
Deluge 0.5.8.1 (18 January 2008)
|
||||||
* Make Deluge dependent upon libtorrent 0.14.9 or greater. This is due to
|
* Catch various exceptions from possibly corrupted persistent.state
|
||||||
an over-downloading bug in previous versions of libtorrent.
|
* Use pieces wanted instead of total pieces to draw adv progress bar
|
||||||
|
* Properly catch 'address already in use' error when trying to use a port that is in use
|
||||||
==== GtkUI ====
|
* Attempt to fix issue where all the columns start very small
|
||||||
* Fix #1128 Show an error dialog when unable to start a 'deluged' process
|
* Change how we handle fastresume - should prevent rechecking
|
||||||
* Increased max enterable download / upload limit to 60000 KiB/s
|
* New theme for windows
|
||||||
|
* Performance enhancements by removing needless casts
|
||||||
==== Console ====
|
* Search is now a plugin
|
||||||
* Fix hanging when using commands from the command-line
|
* Browser removed
|
||||||
|
|
||||||
==== Web ====
|
Deluge 0.5.8 (29 December 2007)
|
||||||
* Fix #1147: Cannot upload a torrent in a multi-user system via the web interface
|
* Fix handling of corrupt torrent files
|
||||||
* Fix #1148: Unable to save execute command in execute plugin
|
* Fix having two instances of Deluge running on Ubuntu
|
||||||
|
|
||||||
=== Deluge 1.2.0 - "Bursting like an infected kidney" (10 January 2010) ===
|
Deluge 0.5.8RC2 (25 December 2007)
|
||||||
==== Core ====
|
* Change add torrent to ctrl+n
|
||||||
* Fix file renaming
|
* Change notification plugin to not show the file list, but only the torrent
|
||||||
* Fix tracker host filtering (Closes #1106)
|
name
|
||||||
* Fix exceptions when gettext/locale cannot be initialized properly
|
* Allow removal of browser icon from toolbar
|
||||||
* Change share ratio calculation to use the total done instead of the all time
|
* Add buttons to browser to launch the main and footer frames into an
|
||||||
downloaded value. This change will make the share ratio calculation not
|
external browser
|
||||||
use data downloaded in failed hash checks.
|
* Fix removing torrents from deluge template of webui - vonck7
|
||||||
* Fix torrent info name not being utf-8 decoded when root file/folder name
|
* Set the advanced webui template as default
|
||||||
is blank
|
* Cut down significantly on the memory usage of the blocklist plugin
|
||||||
|
* Fix some UPnP bugs
|
||||||
==== GtkUI ====
|
* Fix "New version" alert from freezing sometimes
|
||||||
* Fix #1104, #735 use path.utf-8 if available
|
* Prioritizes local peers over non-local ones when finding connect
|
||||||
* Fix #1114 test active port not working in classic mode
|
* Wish everyone a happy holiday :)
|
||||||
|
|
||||||
==== Console ====
|
|
||||||
* Fix #1115 not showing usage for the 'debug' command
|
Deluge 0.5.8RC1 (22 December 2007)
|
||||||
* Fix #1116 not being able to use command aliases when not connected to a daemon
|
* Key bindings:
|
||||||
* Fix #1117 can't use the '3' key
|
ctrl+a adds a torrent
|
||||||
|
ctrl+l adds a torrent via URL
|
||||||
==== Windows ====
|
ctrl+p pauses torrent(s)
|
||||||
* Fix displaying folders in the add torrent dialog
|
ctrl+r resumes torrent(s)
|
||||||
* Fix displaying the new release dialog
|
delete removes torrent(s)
|
||||||
|
* Fix total uploaded display bug
|
||||||
==== Blocklist ====
|
* Fix seeding ratio stop on finished torrents
|
||||||
* Fix blocklist status icon not opening the blocklist preference
|
* Fix zombie processes from occurring
|
||||||
page in certain locales
|
* Fix saying goodbye to trackers
|
||||||
* Fix blocklist not recognising comments that begin with whitespace
|
* Increase auto remove ratio to 100
|
||||||
* Minor speedup in parsing blocklists
|
* Fix problem on Windows with filenames that have special characters
|
||||||
* Blocklist now attempts to download the URL multiple times before giving
|
* Fix saving of which columns to show
|
||||||
up
|
* Fix init script error on exotic systems
|
||||||
* Fix blocklist not being able to open zipped blocklists with python 2.5
|
* Add web seed to Torrent Creator plugin
|
||||||
|
* TorrentSearch is now built-in
|
||||||
==== Web ====
|
* Add internal anonymizing browser - Key bindings for that are as follows:
|
||||||
* Put the default password in the manpage.
|
ctrl+l focus on location bar
|
||||||
|
ctrl+k focus on search bar
|
||||||
=== Deluge 1.2.0_rc5 (17 December 2009) ===
|
ctrl+r refreshes current page
|
||||||
==== Web ====
|
ctrl+enter adds 'www.' and '.com' to url string
|
||||||
* Swap order of buttons in Remove window (Closes #1083)
|
shift+enter adds 'www.' and '.net' to url string
|
||||||
* Change the compressed js script to deluge-all.js to avoid naming
|
|
||||||
conflicts on case-sensitive filesystems.
|
Deluge 0.5.7.1 (01 December 2007)
|
||||||
* Apply patch from adios fixing the cookie date
|
* Tweak full hd warning so that it only displays itself once per torrent that
|
||||||
* Add tooltips to the statusbar items
|
it has to pause.
|
||||||
* Add disk usage to the statusbar
|
* Fixed crash and corruption of persistent.state while adding a duplicate
|
||||||
* Add a ToggleField widget and use this on the Downloads preferences
|
torrent. Also caused yet another invalid handle error.
|
||||||
page allowing the movecom/copytorrent/autoadd boxes to be enabled.
|
* Increase tracker timeout
|
||||||
* Fix enabling plugins.
|
|
||||||
* Implement installing plugins.
|
Deluge 0.5.7 (26 November 2007)
|
||||||
* Update some icons
|
* Scrape support
|
||||||
* Fixed #1075 (changing priority on a whole folder doesn't work)
|
* Manual force-recheck
|
||||||
|
* Add local peer discovery (aka local service discovery)
|
||||||
==== GtkUI ====
|
* Blocklist plugin will now display errors, instead of just crashing on a bad
|
||||||
* Attempt to register as the default magnet uri handler in GNOME on startup
|
list or wrong type
|
||||||
* Properly show 100.00% and reduce number of progress bar updates during a
|
* Add torrent in paused state option
|
||||||
torrent creation
|
* Add advanced progress bar
|
||||||
* Fix crash in Windows when creating a torrent
|
* Fix bug in merging trackers
|
||||||
* Add button to Other preferences to associate magnet links with Deluge
|
* Various updates to WebUI, including https support and advanced template by vonck7
|
||||||
* Fix uploading plugins when the daemon is not localhost
|
* Add maximum connection attempts per second preference
|
||||||
* Fix #692 no longer require tray password when quitting from the tray icon
|
* Fix bug where loaded plugins were forgotten if Deluge crashed
|
||||||
while the window is visible.
|
* Fix ratio bugs (hopefully for the last time)
|
||||||
* Fix #782 do not ask for tray password when window is not minimized to tray
|
* Add preference to only show file selection popup if torrent has multiple files
|
||||||
* Fix #1036 autoconnecting to localhost daemon on start-up
|
* Fix pause all and resume all bugs
|
||||||
* Fix issue where hosts will show up erroneously as Offline
|
* Fix client not loading if our website goes down (new version check failing)
|
||||||
* Add #891 remove torrents by pressing the Delete key
|
* Allow torrent creation with no trackers
|
||||||
* Fix issue where stoping a daemon that you aren't connected to causes the
|
* Scheduler plugin revamp by Ben Klein
|
||||||
gtkui to shutdown the currently connected daemon.
|
* Fix ETA from going backwards
|
||||||
* Fix #594 tray password dialog freeze in Windows
|
* UI warning on full HD - no longer just silently pauses torrents
|
||||||
* Made the password dialog prettier
|
* Replace SimpleRSS with FlexRSS
|
||||||
* Fix #1086 deprecated gtk.Tooltips usage
|
* Add preference for the location of torrent files
|
||||||
* Fix #768 save tracker list for create torrent dialog
|
* Add autoload folder
|
||||||
* Fix #1095 incorrect piece size used when using some non-English languages
|
* Copy translator credits from Launchpad to our about->credits
|
||||||
|
* Differentiate between queued and paused torrents. Able to pause queued
|
||||||
==== Console ====
|
torrents - patch by yobbobandana
|
||||||
* Fix using the console in Windows, but only in command-line mode
|
* Show error when writing/permission problems occur
|
||||||
* Fix #823 setting config values to -1.0
|
|
||||||
|
Deluge 0.5.6.2 (31 October 2007)
|
||||||
==== Label ====
|
* Set default piece size to 256-KiB in TorrentCreator plugin and add 2048KiB
|
||||||
* Fix #1085 only use ints for specific options to prevent unhandled exception
|
as a size option.
|
||||||
|
* Fix a bug in Debian package that caused the UI to completely freeze when a
|
||||||
==== Execute ====
|
torrent finished
|
||||||
* Use the move_completed path if it is different to the save path
|
* Find and fix another shutdown bug that mostly Gutsy users were encountering
|
||||||
in the completed event.
|
* Fix a couple of WebUI bugs, including the "index" page erroring out
|
||||||
|
|
||||||
==== Core ====
|
Deluge 0.5.6.1 (28 October 2007)
|
||||||
* Fix the upload_plugin rpc method (was still using XML-RPC stuff)
|
* Fix invalid handle error
|
||||||
* Fix possible exception when upgrading from a 0.5 state file
|
* Fix shutdown hang
|
||||||
* Use metavar to modify the help output by optparse.
|
|
||||||
* Partial fix for #1103 if the per-torrent option for stopping at a ratio has
|
Deluge 0.5.6 (24 October 2007)
|
||||||
been unchecked, then do not stop it at the global setting.
|
* Web Interface Plugin
|
||||||
|
* Hopefully fix "losing data" and having to re-download parts (for real this time :p)
|
||||||
==== Blocklist ====
|
* Use new full allocation method which does not create files until one of its
|
||||||
* Fix blocklist not working for all locales
|
pieces is downloaded
|
||||||
* Fix blocklist checking for updates when it shouldn't
|
* Tray lock password is no longer stored in plain text
|
||||||
|
* Update the Scheduler plugin and fix a bunch of bugs on it
|
||||||
=== Deluge 1.2.0_rc4 (24 November 2009) ===
|
* Double-clicking on a torrent opens up its containing folder
|
||||||
==== Core ====
|
* Fix SpeedLimiter plugin when setting upload limits
|
||||||
* Fix deleting old .fastresume files with fresh configs
|
* Fix MoveTorrent plugin when moving actively downloading torrents
|
||||||
* Fix files list when using magnet uris
|
* Pause torrents while importing blocklist and resume them when finished
|
||||||
* Fix loading the saved metadata when loading state with magnet uris
|
* Remove TorrentPieces and disable its use
|
||||||
|
* A whole bunch of stuff for Win32
|
||||||
==== GtkUI ====
|
* Add private flag to TorrentCreator plugin
|
||||||
* Fix showing the 'Other' speed dialogs in Windows
|
* Use SVG for internal logo usage (except on Win32)
|
||||||
* Fix adding torrents from the Queued Torrents dialog
|
* Use theme for tray icon instead of hard-coded
|
||||||
* Fix disabling/enabling plugins after switching daemons
|
* Properly release port on shutdown
|
||||||
* Reduce height of Add Torrent Dialog by ~80 pixels
|
* TorrentFiles plugin now has progress bars
|
||||||
* Fix #1071 issue where Deluge will fail to start if there is a stale ipc lockfile
|
* Removing torrent files no longer deletes files that weren't part of the torrent
|
||||||
* Fix autoconnecting to the next host in the list if the selected one isn't available
|
* New max half-open connections setting to deal with cheap/broken routers
|
||||||
* Fix endless loop when trying to autoconnect to an offline daemon
|
* Inherit UPnP fixes from libtorrent
|
||||||
* Fix exception on startup when the system tray icon is not enabled
|
* Use threading for everything, instead of spawning
|
||||||
* Fix issue where some torrents with special characters could not be added
|
|
||||||
* Fix issues adding magnet uris
|
Deluge 0.5.5 (09 September 2007)
|
||||||
|
* Editing a torrent's tracker list is now persistent between sessions
|
||||||
==== Web ====
|
* Persistence between sessions for Speed Limiter, Web Seed and Desired Ratio
|
||||||
* Fix installing the deluge-web manpage
|
plugins
|
||||||
* Escape hyphens in the manpage
|
* New wizard to aid first-time users with configuration
|
||||||
|
* Reorderable tabs and remember order (with exception of details tab)
|
||||||
==== Console ====
|
* Fix losing data and having to re-download parts
|
||||||
* Escape hyphens in the manpage
|
* Fix password lock showing when main window is not hidden
|
||||||
* Make the delete key work
|
* Get rid of the plugin manager and integrate it into preferences
|
||||||
* Allow ~ to be used in the path in the add command
|
* New Move torrent plugin - takes over for "move completed downloads" feature
|
||||||
* Allow commands that are .pyc files to be used
|
and provides a "Move Torrent" option when right-clicking on a torrent
|
||||||
* Fix printing info, help, etc.. on the command line
|
* Save column widths
|
||||||
|
* Queue order after restart fixes.
|
||||||
==== Blocklist ====
|
* Use payload instead of including protocol overhead to ease user confusion
|
||||||
* Force blocklist to auto-detect format when a download / import is forced
|
of seeding torrents "downloading"
|
||||||
* Fix blocklist failing on certain PeerGuardian/SafePeer lists
|
* New Web Seed plugin for adding URLs to torrents for http seeding
|
||||||
|
* Add FAST-extension (http://www.bittorrent.org/fast_extensions.html)
|
||||||
=== Deluge 1.2.0_rc3 (01 November 2009) ===
|
|
||||||
==== Core ====
|
Deluge 0.5.4.1 (10 August 2007)
|
||||||
* Fix #1047 move completed does not work if saving to non default path
|
* Add "Open containing folder" and "Open File" to the torrent and file
|
||||||
* Fix renamed files not being utf-8 encoded
|
menu, respectively
|
||||||
* Fix torrent name being blank when renaming root folder to /
|
* Load Blocklist plugin last and have it not lock up the interface during
|
||||||
* Do not include an 'announce-list' key in torrents when there is only one tracker
|
import
|
||||||
|
* Add full allocation to preferences for clarification
|
||||||
==== GtkUI ====
|
* Catch SIGINT, SIGHUP, SIGTERM and Gnome logoff to quit properly
|
||||||
* Replace & with & in the details tab to ensure there are no markup errors
|
* Add send local info to developers
|
||||||
* Consider 0 unlimited when displaying limits in the statusbar
|
* Fix up pieces, peers and files plugins
|
||||||
* Fix adding torrents when not showing the add torrent dialog in Windows
|
* UPnP fixes
|
||||||
* Fix crash when removing multiple torrents
|
* Add ExtraStats plugin
|
||||||
|
* FreeBSD full allocation fix
|
||||||
==== Web ====
|
* Added per torrent max upload slots and max connections preferences
|
||||||
* Fix #1046 changing auto managed via the details tab
|
* A lot of other less visible improvements
|
||||||
* Fix setting torrent options when adding
|
|
||||||
* Fix setting file priorities when adding
|
Deluge 0.5.4 (06 August 2007)
|
||||||
* HTML escape the field values on the details tab
|
|
||||||
* Fix #215, make infinite eta values display in the correct order
|
* Tray message includes session totals
|
||||||
* Fix displaying the protocol upload speed
|
* Ticket #198 - Display peers countries in the Peers tab.
|
||||||
* Fix #990, showing 0 as a limit when it means unlimited in the statusbar
|
* Ticket #474 - Multiple password prompts displayed
|
||||||
|
* Pause all/resume all in tray menu
|
||||||
==== Console ====
|
* Peers and Files tabs are now plugins
|
||||||
* Fix displaying non-ascii strings
|
* New Location plugin
|
||||||
* Fix #1052 crash when issuing commands while not connected to a daemon
|
* Option to use a random port every time
|
||||||
* Fix crash when string length makes line longer than terminal width
|
* Proxy system redone - you can now specify different information for each
|
||||||
* Improve 'info' command draw speed
|
type of proxy (DHT, peer, tracker, web-seed)
|
||||||
|
* TorrentPieces plugin to view piece updates and show pieces table per file
|
||||||
=== Deluge 1.2.0_rc2 (25 October 2009) ===
|
* EventLogger plugin to view/log every activity
|
||||||
==== GtkUI ====
|
* SpeedLimiter plugin, which allows you to set speed limits on a per-torrent
|
||||||
* Fix path errors when adding torrents externally in Windows
|
basis
|
||||||
* Fix localclient authentication by stripping the lines read from the auth file
|
* New release alerts - Client will inform user if their version of deluge is
|
||||||
* Do not try to call doIteration() on the reactor if it has already stopped
|
outdated
|
||||||
* Fix 'autostart localhost if needed' option
|
|
||||||
* Fix starting plugins when the pluginmanager is started
|
Deluge 0.5.3 (25 July 2007)
|
||||||
* Fix #799 translate connection status
|
|
||||||
* Fix #215 ETA sort order
|
* Added ChangeLog
|
||||||
|
* Ticket #53 - Added files priorities within torrent
|
||||||
==== Core ====
|
* Ticket #111 - Remember directory of last added torrent
|
||||||
* Fix saving torrent state on fresh configs
|
* Ticket #232 - Added Move completed downloads to feature
|
||||||
|
* Ticket #245 - Added ability to select torrent files before starting
|
||||||
==== Web ====
|
* Ticked #368 - Added ability to prioritize first and last pieces of files
|
||||||
* Fix changing of the allocation in the preferences.
|
in torrents
|
||||||
* Fix updating the Connection Manager when a host is added.
|
* Ticket #371 - Proper full storage allocation of files on reiser4 and
|
||||||
* Add a `--fork` option to allow forking the webui to the background
|
ntfs-3g filesystems
|
||||||
* Fix the statusbar menu limits
|
* Ticket #420 - Show size of torrent minus size of unselected files as Total
|
||||||
* Fix setting the torrent options via the options tab
|
Size
|
||||||
* Fix the private flag in the options tab
|
* Ticket #405 - Properly start in tray when run deluge --tray
|
||||||
|
* Ticket #437 - Gracefully upgrade from old versions
|
||||||
==== Console ====
|
* Picking a file to not download now checks for compact_mode status to prevent
|
||||||
* Fix exception when using the 'halt' command
|
all sorts of problems such as downloading pieces into the wrong file
|
||||||
|
* RSS plugin inclusion
|
||||||
==== Misc ====
|
* Added ability to queue new torrents above completed ones when
|
||||||
* Add man pages for deluge-console, deluge-gtk and deluge-web
|
seeds are set to queue at the bottom
|
||||||
|
* Added availability and piece size display in details, availability
|
||||||
==== Extractor ====
|
column
|
||||||
* Fix issue where the plugin would not stop extracting files after being disabled
|
* Added ability to automatically remove torrents when max share ratio is set
|
||||||
* Add option to create torrent name sub-folders in extract folder
|
* Show text from clipboard in Add URL dialog only if it looks like an URL
|
||||||
|
* Added Torrent Notification plugin
|
||||||
=== Deluge 1.2.0_rc1 (07 October 2009) ===
|
* Added event handling callbacks for plugins
|
||||||
==== Core ====
|
* Added ability to designate a torrent as private (in file selection dialog)
|
||||||
* Implement new RPC protocol DelugeRPC replacing XMLRPC
|
* Added merging trackers of duplicate torrents
|
||||||
* Move to a twisted framework
|
* Details, Peers and Files tabs more responsible and their performance
|
||||||
* Add an 'Error' filter for Trackers to show trackers that currently have a tracker error
|
greatly improved especially on torrents with many files and peers
|
||||||
* Use system GeoIP database if available, this is now an optional dependency
|
* A lot of other less visible improvements
|
||||||
|
|
||||||
==== GtkUI ====
|
Deluge 0.5.2 (05 July 2007)
|
||||||
* Remove SignalReceiver
|
* ticket #6 - Torrent creation built into main client
|
||||||
* Implemented a cross-platform IPC method thus removing the DBUS dependency
|
* ticket #315 - Plugins implemented as modules
|
||||||
* Implement a "True" Classic Mode where there is no longer a separate daemon process
|
* ticket #310 - Configuration options for PEX and UPnP
|
||||||
* Add preferences option "Add torrent in paused state"
|
* ticket #390 - Individual file progress shown in File tab
|
||||||
* Add tracker icons to the Tracker column
|
* The usual slew of improvements
|
||||||
* Implement #259 show tooltip with country name in the peers tab
|
|
||||||
* Add an error category to the tracker sidebar list
|
Deluge 0.5.1 (11 June 2007)
|
||||||
* Add Find More Plugins button to Plugins preference page
|
* Peer Exchange
|
||||||
* Fix #518 remove header in add torrent dialog to save vertical space
|
* ticket #254 - Encryption
|
||||||
* Add a Cache preferences page to adjust cache settings and examine cache status
|
* ticket #142 - UPnP + NATPMP
|
||||||
* Add ability to rename files prior to adding them
|
* Improved user interface
|
||||||
* Fix shutdown handler with GNOME session manager
|
* Redesigned preferences dialog
|
||||||
* Allow 4 MiB piece sizes when creating a torrent
|
* Proper startup and shutdown
|
||||||
|
|
||||||
==== ConsoleUI ====
|
|
||||||
* Changed to use curses for a more interactive client
|
|
||||||
|
|
||||||
==== WebUI ====
|
|
||||||
* Move over to using Twisted-Web for the webserver.
|
|
||||||
* Move to only AJAX interface built upon Ext-JS.
|
|
||||||
|
|
||||||
==== Plugins ====
|
|
||||||
* Add Scheduler plugin
|
|
||||||
* Add Extractor plugin
|
|
||||||
|
|
||||||
==== Misc ====
|
|
||||||
* PyGTK dependency bumped to => 2.12 to use new tooltip system
|
|
||||||
* Add new scripts for invoking UIs: deluge-gtk, deluge-web, deluge-console
|
|
||||||
* Remove GeoIP database from the source tree
|
|
||||||
|
|
||||||
=== Deluge 1.1.9 - (15 June 2009) ===
|
|
||||||
==== Core ====
|
|
||||||
* Only move a torrent due to 'move on complete' when some data has been downloaded
|
|
||||||
* Update libtorrent for CVE-2009-1760
|
|
||||||
|
|
||||||
==== GtkUI ====
|
|
||||||
* Fix #950 renaming a parent folder into multiple folders
|
|
||||||
|
|
||||||
==== WebUI ====
|
|
||||||
* Fix remote torrent add
|
|
||||||
|
|
||||||
=== Deluge 1.1.8 - (21 May 2009) ===
|
|
||||||
==== Core ====
|
|
||||||
* Fix pause all/resume all
|
|
||||||
* Torrent name is now changed when the root folder or file is renamed
|
|
||||||
|
|
||||||
==== GtkUI ====
|
|
||||||
* Fix high cpu usage when displaying speeds in titlebar
|
|
||||||
* Fix showing non-utf8 encoded torrents in add torrent dialog -- this adds
|
|
||||||
an additional dependency on chardet.
|
|
||||||
* Fix exception when timing out trying to send notification email
|
|
||||||
* Set some sane defaults for peers/file tabs column widths
|
|
||||||
|
|
||||||
==== WebUI ====
|
|
||||||
* Fix starting when -l option is used
|
|
||||||
|
|
||||||
=== Deluge 1.1.7 - (25 April 2009) ===
|
|
||||||
==== Core ====
|
|
||||||
* Fix issue where cannot resume torrent after doing a 'Pause All'
|
|
||||||
* Add workaround for 'address_v4 from unsigned long' bug experienced by users
|
|
||||||
with 64-bit machines. This bug is fixed in libtorrent 0.14.3.
|
|
||||||
|
|
||||||
==== GtkUI ====
|
|
||||||
* Fix #883 segfault if locale is not using UTF-8 encoding
|
|
||||||
* Fix for adding torrents with invalid filename encodings
|
|
||||||
* Fix displaying IPv6 peers in the Peers tab
|
|
||||||
* Fix starting the daemon in OS X
|
|
||||||
* Fix loading improperly created torrents with mismatched encodings
|
|
||||||
* Fix displaying improper progress when creating torrent
|
|
||||||
|
|
||||||
==== Windows ====
|
|
||||||
* Fix freezing in create torrent dialog
|
|
||||||
* Fix creating torrents in Windows
|
|
||||||
* Fix free space check
|
|
||||||
|
|
||||||
=== Deluge 1.1.6 - (06 April 2009) ===
|
|
||||||
==== Core ====
|
|
||||||
* Fix udp trackers being classified as DHT source
|
|
||||||
* Fix #855 force a resume on a torrent if a 'Force Recheck' is initiated
|
|
||||||
* Fix #862 deluged crash when access http://localhost:58846
|
|
||||||
|
|
||||||
==== GtkUI ====
|
|
||||||
* Fix displaying torrents with non-utf8 encodings in add torrent dialog
|
|
||||||
|
|
||||||
==== WebUI ====
|
|
||||||
* Fix #870 use proper config location for loading ssl cert
|
|
||||||
|
|
||||||
==== Misc ====
|
|
||||||
* Add OpenSSL exception to license
|
|
||||||
|
|
||||||
=== Deluge 1.1.5 - (16 March 2009) ===
|
|
||||||
==== Core ====
|
|
||||||
* Fix config file saving when no current config file exists
|
|
||||||
|
|
||||||
==== GtkUI ====
|
|
||||||
* Add 'Comments' field to the Details tab
|
|
||||||
* Fix #841 maximum upload slots tooltip
|
|
||||||
|
|
||||||
=== Deluge 1.1.4 - (08 March 2009) ===
|
|
||||||
==== Core ====
|
|
||||||
* Fix displaying file errors when the torrent isn't paused
|
|
||||||
* Fix issue where torrents being check would get removed due to "stop at ratio" rules
|
|
||||||
* Fix #790 tracker hosts not correct for some .uk trackers
|
|
||||||
* Make sure config files, resume data and state are fsync'd when saved. This should help prevent data losses on crashes/improper shutdowns.
|
|
||||||
|
|
||||||
==== GtkUI ====
|
|
||||||
* Fix hiding bottom pane when no tabs are enabled upon restart
|
|
||||||
* Fix saving file priorities when switching torrents in the addtorrentdialog
|
|
||||||
* Fix the allocate mode not being preserved when selecting different torrents in addtorrentdialog
|
|
||||||
* Fix #655 issue where default torrent options wouldn't be set for new torrents added to the addtorrentdialog
|
|
||||||
* Fix #817 email notifications fail to substitute format strings
|
|
||||||
|
|
||||||
==== Plugins ====
|
|
||||||
* Label: Fix setting 'Move on completed' folder when connected to a remote daemon
|
|
||||||
|
|
||||||
=== Deluge 1.1.3 - (15 February 2009) ===
|
|
||||||
==== Core ====
|
|
||||||
* Fix issue where checking queue would stop
|
|
||||||
* Fix announcing to SSL trackers
|
|
||||||
|
|
||||||
==== Misc ====
|
|
||||||
* Fix issue when initializing gettext that would prevent deluge from starting
|
|
||||||
* Fix logging exceptions when starting the daemon
|
|
||||||
* Fix displaying errors when a torrent is Checking
|
|
||||||
* Fix #790 tracker hosts not correct for some 3rd-level domain names
|
|
||||||
|
|
||||||
=== Deluge 1.1.2 - (31 January 2009) ===
|
|
||||||
==== Core ====
|
|
||||||
* Fix issue where torrents get stuck Checking
|
|
||||||
|
|
||||||
==== GtkUI ====
|
|
||||||
* Fix #761 use proper theme colours in sidebar
|
|
||||||
* Fix saving files/peers tab state when no column is sorted
|
|
||||||
|
|
||||||
=== Deluge 1.1.1 - (24 January 2009) ===
|
|
||||||
==== Core ====
|
|
||||||
* Fix oldstateupgrader for those upgrading from 0.5.x
|
|
||||||
* Fix setting Peer TOS byte
|
|
||||||
* Fix setting outgoing ports
|
|
||||||
|
|
||||||
==== GtkUI ====
|
|
||||||
* Fix opening links from Help menu and others
|
|
||||||
* Fix remembering sorted column in the torrent list
|
|
||||||
* Fix saving Files tab and Peers tab state
|
|
||||||
* Disable popup notification in preferences on Windows
|
|
||||||
* Fix crashing in Add Torrent Dialog when removing torrents from the list
|
|
||||||
* Do not allow duplicate torrents in the Add Torrent Dialog
|
|
||||||
* Fix translating speed units in status tab when a per-torrent limit is set
|
|
||||||
* Fix torrents not displaying properly after disconnecting and reconnecting to the daemon
|
|
||||||
* Fix when sorting # column, downloads should be on top
|
|
||||||
|
|
||||||
==== Misc ====
|
|
||||||
* Fix bdecoding some torrent files
|
|
||||||
* Fix the -l, --logfile option
|
|
||||||
* Fix #729 tracker icons not being saved in the correct location
|
|
||||||
* Add support for more tracker icons
|
|
||||||
* Fix being able to connect to a local daemon from another user account
|
|
||||||
|
|
||||||
=== Deluge 1.1.0 - "Time gas!" (10 January 2009) ===
|
|
||||||
==== Core ====
|
|
||||||
* Implement #79 ability to change outgoing port range
|
|
||||||
* Implement #296 ability to change peer TOS byte
|
|
||||||
* Add per-torrent move on completed settings
|
|
||||||
* Implement #414 use async save_resume_data method
|
|
||||||
* Filter Manager with torrent filtering in get_torrents_status , for sidebar and plugins.
|
|
||||||
* Implement #368 add torrents by infohash/magnet uri (trackerless torrents)
|
|
||||||
* Remove remaining gtk functions in common
|
|
||||||
* Tracker icons.
|
|
||||||
* Add ETA for torrents with stop at seed ratio set
|
|
||||||
* Fix #47 the state and config files are no longer invalidated when there is no diskspace
|
|
||||||
* Fix #619 return "" instead of "Infinity" if seconds == 0 in ftime
|
|
||||||
* Add -P, --pidfile option to deluged
|
|
||||||
|
|
||||||
==== GtkUI ====
|
|
||||||
* Add peer progress to the peers tab
|
|
||||||
* Add ability to manually add peers
|
|
||||||
* Sorting # column will place downloaders above seeds
|
|
||||||
* Remove dependency on libtorrent for add torrent dialog
|
|
||||||
* Allow adding multiple trackers at once in the edit tracker dialog
|
|
||||||
* Implement #28 Create Torrent Dialog
|
|
||||||
* Redesiged sidebar with filters for Active and Tracker (see Filter Manager)
|
|
||||||
* Implement #428 the ability to rename files and directories
|
|
||||||
* Implement #229 add date added column
|
|
||||||
* Implement #596 show speeds in title
|
|
||||||
* Fix #636 not setting the daemon's config directory when using --config= with the UI in classic mode.
|
|
||||||
* Fix #624 do not allow changing file priorities when using compact allocation
|
|
||||||
* Fix #602 re-did files/peers tab state saving/loading
|
|
||||||
* Fix gtk warnings
|
|
||||||
* Add protocol traffic statusbar item
|
|
||||||
* Rework the Remove Torrent Dialog to only have 2 options, remove data and remove from session.
|
|
||||||
* Add "Install Plugin" and "Rescan Plugins" buttons to the Plugins preferences
|
|
||||||
* Make active port test use internal graphic instead of launching browser
|
|
||||||
|
|
||||||
==== WebUI ====
|
|
||||||
* Lots of smaller tweaks.
|
|
||||||
* All details tabs have the same features as in gtk-ui 1.0.x
|
|
||||||
* Persistent sessions #486
|
|
||||||
* Plugin improvements for easy use of templates and images in eggs. #497
|
|
||||||
* Classic template takes over some style elements from white template.
|
|
||||||
* https (for users that know how to create certificates)
|
|
||||||
* Easier apache mod_proxy use.
|
|
||||||
* Redesigned sidebar
|
|
||||||
|
|
||||||
==== AjaxUI ====
|
|
||||||
* Hosted in a webui template.
|
|
||||||
|
|
||||||
==== ConsoleUI ====
|
|
||||||
* New ConsoleUI written by Idoa01
|
|
||||||
* Callable from command-line for scripts.
|
|
||||||
|
|
||||||
==== Plugins ====
|
|
||||||
* Stats plugin for graphs.
|
|
||||||
* Label plugin for grouping torrents and per torrent settings.
|
|
||||||
|
|
||||||
==== Misc ====
|
|
||||||
* Implement #478 display UI options in usage help
|
|
||||||
* Fix #547 add description to name field per HIG entry 2.1.1.1
|
|
||||||
* Fix #531 set default log level to ERROR and add 2 command-line options, "-L, --loglevel" and "-q, --quiet".
|
|
||||||
|
24
DEPENDS
@@ -1,24 +0,0 @@
|
|||||||
=== Core ===
|
|
||||||
* python >= 2.5
|
|
||||||
* twisted >= 8.1
|
|
||||||
* twisted-web >= 8.1
|
|
||||||
* pyopenssl
|
|
||||||
* simplejson (if python < 2.6)
|
|
||||||
* setuptools
|
|
||||||
* gettext
|
|
||||||
* pyxdg
|
|
||||||
* geoip-database (optional)
|
|
||||||
* libtorrent >= 0.14.9
|
|
||||||
|
|
||||||
=== UIs ===
|
|
||||||
* chardet
|
|
||||||
|
|
||||||
=== Gtk ===
|
|
||||||
* python-notify (libnotify python wrapper)
|
|
||||||
* pygame
|
|
||||||
* pygtk >= 2.12
|
|
||||||
* librsvg
|
|
||||||
* xdg-utils
|
|
||||||
|
|
||||||
=== Web ===
|
|
||||||
* mako
|
|
40
HACKING
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# Copyright (c) 2006 Marcos Pinto ('markybob') <markybob@gmail.com>
|
||||||
|
|
||||||
|
This is pretty much taken straight out of PEP 8, the "Style Guide for Python
|
||||||
|
Code" (http://www.python.org/dev/peps/pep-0008/)
|
||||||
|
More or less, if you try to submit a patch that doesn't follow this guide, odds
|
||||||
|
are your patch will be denied...unless it does some incredibly magnificient
|
||||||
|
things, in which case I *might* edit it. Don't bet on it, though.
|
||||||
|
|
||||||
|
Here are the highlights:
|
||||||
|
Indents are FOUR (4) spaces. Not 8, not 5 or 2 and definitely NOT tab.
|
||||||
|
Limit all lines to a maximum of 80 characters.
|
||||||
|
Use UTF-8 encoding
|
||||||
|
Every single import should be on its own line
|
||||||
|
Avoid extraneous whitespace in the following situations:
|
||||||
|
Yes: spam(ham[1], {eggs: 2})
|
||||||
|
No: spam( ham[ 1 ], { eggs: 2 } )
|
||||||
|
Yes: spam(1)
|
||||||
|
No: spam (1)
|
||||||
|
Yes: if x == 4: print x, y; x, y = y, x
|
||||||
|
No: if x == 4 : print x , y ; x , y = y , x
|
||||||
|
Yes: dict['key'] = list[index]
|
||||||
|
No: dict ['key'] = list [index]
|
||||||
|
Yes:
|
||||||
|
x = 1
|
||||||
|
y = 2
|
||||||
|
long_variable = 3
|
||||||
|
No:
|
||||||
|
x = 1
|
||||||
|
y = 2
|
||||||
|
long_variable = 3
|
||||||
|
|
||||||
|
Some more recommendations:
|
||||||
|
* "Don't repeat yourself (DRY). Every distinct concept and/or piece of
|
||||||
|
data should live in one, and only one, place. Redundancy is bad.
|
||||||
|
Normalization is good." (taken straight from django's Design philosophies)
|
||||||
|
* Try to use iterators/generators where applicable. The simplest change from
|
||||||
|
range to xrange is also good.
|
||||||
|
* In UI and deluge code for consistency we use notion of speed not rate.
|
||||||
|
Libtorrent mixes this usage and so do we on deluge-libtorrent boundary,
|
||||||
|
but all deluge only code should use speed.
|
908
LICENSE
@@ -1,634 +1,350 @@
|
|||||||
Deluge is licensed under the GNU General Public License version 3 with the
|
GNU GENERAL PUBLIC LICENSE
|
||||||
addition of the following special exception:
|
Version 2, June 1991
|
||||||
|
|
||||||
In addition, as a special exception, the copyright holders give
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
permission to link the code of portions of this program with the OpenSSL
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
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.
|
|
||||||
|
|
||||||
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
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
The licenses for most software are designed to take away your
|
||||||
software and other kinds of works.
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
The licenses for most software and other practical works are designed
|
software--to make sure the software is free for all its users. This
|
||||||
to take away your freedom to share and change the works. By contrast,
|
General Public License applies to most of the Free Software
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
Foundation's software and to any other program whose authors commit to
|
||||||
share and change all versions of a program--to make sure it remains free
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
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.
|
your programs, too.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
When we speak of free software, we are referring to freedom, not
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
have the freedom to distribute copies of free software (and charge for
|
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
|
this service if you wish), that you receive source code or can get it
|
||||||
want it, that you can change the software or use pieces of it in new
|
if you want it, that you can change the software or use pieces of it
|
||||||
free programs, and that you know you can do these things.
|
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
|
To protect your rights, we need to make restrictions that forbid
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
These restrictions translate to certain responsibilities for you if you
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
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
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
you have. You must make sure that they, too, receive or can get the
|
||||||
or can get the source code. And you must show them these terms so they
|
source code. And you must show them these terms so they know their
|
||||||
know their rights.
|
rights.
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
distribute and/or modify the software.
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
Also, for each author's protection and ours, we want to make certain
|
||||||
that there is no warranty for this free software. For both users' and
|
that everyone understands that there is no warranty for this free
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
software. If the software is modified by someone else and passed on, we
|
||||||
changed, so that their problems will not be attributed erroneously to
|
want its recipients to know that what they have is not the original, so
|
||||||
authors of previous versions.
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
Finally, any free program is threatened constantly by software
|
||||||
modified versions of the software inside them, although the manufacturer
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
program will individually obtain patent licenses, in effect making the
|
||||||
protecting users' freedom to change the software. The systematic
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
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
|
The precise terms and conditions for copying, distribution and
|
||||||
modification follow.
|
modification follow.
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
0. Definitions.
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
refers to any such program or work, and a "work based on the Program"
|
||||||
works, such as semiconductor masks.
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
either verbatim or with modifications and/or translated into another
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
language. (Hereinafter, translation is included without limitation in
|
||||||
"recipients" may be individuals or organizations.
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
Activities other than copying, distribution and modification are not
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
covered by this License; they are outside its scope. The act of
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
running the Program is not restricted, and the output from the Program
|
||||||
earlier work or a work "based on" the earlier work.
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
A "covered work" means either the unmodified Program or a work based
|
Whether that is true depends on what the Program does.
|
||||||
on the Program.
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
To "propagate" a work means to do anything with it that, without
|
source code as you receive it, in any medium, provided that you
|
||||||
permission, would make you directly or secondarily liable for
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
infringement under applicable copyright law, except executing it on a
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
notices that refer to this License and to the absence of any warranty;
|
||||||
distribution (with or without modification), making available to the
|
and give any other recipients of the Program a copy of this License
|
||||||
public, and in some countries other activities as well.
|
along with the Program.
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
of it, thus forming a work based on the Program, and copy and
|
||||||
to the extent that it includes a convenient and prominently visible
|
distribute such modifications or work under the terms of Section 1
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
above, provided that you also meet all of these conditions:
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
a) You must cause the modified files to carry prominent notices
|
||||||
work under this License, and how to view a copy of this License. If
|
stating that you changed the files and the date of any change.
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
1. Source Code.
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
c) If the modified program normally reads commands interactively
|
||||||
form of a work.
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
A "Standard Interface" means an interface that either is an official
|
announcement including an appropriate copyright notice and a
|
||||||
standard defined by a recognized standards body, or, in the case of
|
notice that there is no warranty (or else, saying that you provide
|
||||||
interfaces specified for a particular programming language, one that
|
a warranty) and that users may redistribute the program under
|
||||||
is widely used among developers working in that language.
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
The "System Libraries" of an executable work include anything, other
|
does not normally print such an announcement, your work based on
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
the Program is not required to print an announcement.)
|
||||||
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
|
These requirements apply to the modified work as a whole. If
|
||||||
Major Component, or to implement a Standard Interface for which an
|
identifiable sections of that work are not derived from the Program,
|
||||||
implementation is available to the public in source code form. A
|
and can be reasonably considered independent and separate works in
|
||||||
"Major Component", in this context, means a major essential component
|
themselves, then this License, and its terms, do not apply to those
|
||||||
(kernel, window system, and so on) of the specific operating system
|
sections when you distribute them as separate works. But when you
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
distribute the same sections as part of a whole which is a work based
|
||||||
produce the work, or an object code interpreter used to run it.
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
The "Corresponding Source" for a work in object code form means all
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
control those activities. However, it does not include the work's
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
System Libraries, or general-purpose tools or generally available free
|
exercise the right to control the distribution of derivative or
|
||||||
programs which are used unmodified in performing those activities but
|
collective works based on the Program.
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
In addition, mere aggregation of another work not based on the Program
|
||||||
the work, and the source code for shared libraries and dynamically
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
linked subprograms that the work is specifically designed to require,
|
a storage or distribution medium does not bring the other work under
|
||||||
such as by intimate data communication or control flow between those
|
the scope of this License.
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
The Corresponding Source need not include anything that users
|
under Section 2) in object code or executable form under the terms of
|
||||||
can regenerate automatically from other parts of the Corresponding
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
Source.
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
The Corresponding Source for a work in source code form is that
|
source code, which must be distributed under the terms of Sections
|
||||||
same work.
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
2. Basic Permissions.
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
All rights granted under this License are granted for the term of
|
cost of physically performing source distribution, a complete
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
machine-readable copy of the corresponding source code, to be
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
permission to run the unmodified Program. The output from running a
|
customarily used for software interchange; or,
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
c) Accompany it with the information you received as to the offer
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
You may make, run and propagate covered works that you do not
|
received the program in object code or executable form with such
|
||||||
convey, without conditions so long as your license otherwise remains
|
an offer, in accord with Subsection b above.)
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
The source code for a work means the preferred form of the work for
|
||||||
with facilities for running those works, provided that you comply with
|
making modifications to it. For an executable work, complete source
|
||||||
the terms of this License in conveying all material for which you do
|
code means all the source code for all modules it contains, plus any
|
||||||
not control copyright. Those thus making or running the covered works
|
associated interface definition files, plus the scripts used to
|
||||||
for you must do so exclusively on your behalf, under your direction
|
control compilation and installation of the executable. However, as a
|
||||||
and control, on terms that prohibit them from making any copies of
|
special exception, the source code distributed need not include
|
||||||
your copyrighted material outside their relationship with you.
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
Conveying under any other circumstances is permitted solely under
|
operating system on which the executable runs, unless that component
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
itself accompanies the executable.
|
||||||
makes it unnecessary.
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
No covered work shall be deemed part of an effective technological
|
distribution of the source code, even though third parties are not
|
||||||
measure under any applicable law fulfilling obligations under article
|
compelled to copy the source along with the object code.
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
measures.
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
void, and will automatically terminate your rights under this License.
|
||||||
circumvention of technological measures to the extent such circumvention
|
However, parties who have received copies, or rights, from you under
|
||||||
is effected by exercising rights under this License with respect to
|
this License will not have their licenses terminated so long as such
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
parties remain in full compliance.
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
5. You are not required to accept this License, since you have not
|
||||||
technological measures.
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
4. Conveying Verbatim Copies.
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
You may convey verbatim copies of the Program's source code as you
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
receive it, in any medium, provided that you conspicuously and
|
all its terms and conditions for copying, distributing or modifying
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
the Program or works based on it.
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
Program), the recipient automatically receives a license from the
|
||||||
recipients a copy of this License along with the Program.
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
You may charge any price or no price for each copy that you convey,
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
and you may offer support or warranty protection for a fee.
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
|
||||||
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.
|
this License.
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
patent license under the contributor's essential patent claims, to
|
infringement or for any other reason (not limited to patent issues),
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
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
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
excuse you from the conditions of this License. If you cannot
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
License and any other pertinent obligations, then as a consequence you
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
may not distribute the Program at all. For example, if a patent
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
license would not permit royalty-free redistribution of the Program by
|
||||||
the Program, the only way you could satisfy both those terms and this
|
all those who receive copies directly or indirectly through you, then
|
||||||
License would be to refrain entirely from conveying the Program.
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
It is not the purpose of this section to induce you to infringe any
|
||||||
permission to link or combine any covered work with a work licensed
|
patents or other property right claims or to contest validity of any
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
such claims; this section has the sole purpose of protecting the
|
||||||
combined work, and to convey the resulting work. The terms of this
|
integrity of the free software distribution system, which is
|
||||||
License will continue to apply to the part which is the covered work,
|
implemented by public license practices. Many people have made
|
||||||
but the special requirements of the GNU Affero General Public License,
|
generous contributions to the wide range of software distributed
|
||||||
section 13, concerning interaction through a network will apply to the
|
through that system in reliance on consistent application of that
|
||||||
combination as such.
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
the GNU General Public License from time to time. Such new versions will
|
of the General Public License from time to time. Such new versions will
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
address new problems or concerns.
|
address new problems or concerns.
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
Each version is given a distinguishing version number. If the Program
|
||||||
Program specifies that a certain numbered version of the GNU General
|
specifies a version number of this License which applies to it and "any
|
||||||
Public License "or any later version" applies to it, you have the
|
later version", you have the option of following the terms and conditions
|
||||||
option of following the terms and conditions either of that numbered
|
either of that version or of any later version published by the Free
|
||||||
version or of any later version published by the Free Software
|
Software Foundation. If the Program does not specify a version number of
|
||||||
Foundation. If the Program does not specify a version number of the
|
this License, you may choose any version ever published by the Free Software
|
||||||
GNU General Public License, you may choose any version ever published
|
Foundation.
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
programs whose distribution conditions are different, write to the author
|
||||||
public statement of acceptance of a version permanently authorizes you
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
to choose that version for the Program.
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
NO WARRANTY
|
||||||
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.
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
16. Limitation of Liability.
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
How to Apply These Terms to Your New Programs
|
||||||
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 you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
To do so, attach the following notices to the program. It is safest
|
||||||
above cannot be given local legal effect according to their terms,
|
to attach them to the start of each source file to most effectively
|
||||||
reviewing courts shall apply local law that most closely approximates
|
convey the exclusion of warranty; and each file should have at least
|
||||||
an absolute waiver of all civil liability in connection with the
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
||||||
|
|
||||||
|
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.
|
||||||
|
12
MANIFEST.in
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
include LICENSE
|
||||||
|
include README
|
||||||
|
include README.Packagers
|
||||||
|
include Makefile
|
||||||
|
include deluge.desktop
|
||||||
|
include deluge.png
|
||||||
|
include msgfmt.py
|
||||||
|
recursive-include libtorrent/ *
|
||||||
|
recursive-include glade/ *.glade
|
||||||
|
recursive-include pixmaps/ *.png *.svg
|
||||||
|
recursive-include plugins/ *
|
||||||
|
recursive-include po/ *
|
31
Makefile
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#
|
||||||
|
# Makefile for Deluge
|
||||||
|
#
|
||||||
|
PYVER=`python -c "import sys; print sys.version[:3]"`
|
||||||
|
PREFIX ?= /usr
|
||||||
|
DESTDIR ?= ./
|
||||||
|
|
||||||
|
all:
|
||||||
|
python setup.py build
|
||||||
|
|
||||||
|
tarball:
|
||||||
|
python setup.py sdist
|
||||||
|
mv dist/deluge-*.tar.gz $(DESTDIR)
|
||||||
|
|
||||||
|
install:
|
||||||
|
python setup.py install --prefix=$(PREFIX) && /usr/bin/update-desktop-database;
|
||||||
|
|
||||||
|
clean:
|
||||||
|
python setup.py clean
|
||||||
|
rm -rf ./build
|
||||||
|
rm msgfmt.pyc
|
||||||
|
find . -name *.pyc -exec rm {} \;
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
-rm $(PREFIX)/bin/deluge
|
||||||
|
-rm -r $(PREFIX)/lib/python${PYVER}/site-packages/deluge
|
||||||
|
-rm -r $(PREFIX)/lib/python${PYVER}/site-packages/deluge-*.egg-info
|
||||||
|
-rm -r $(PREFIX)/share/deluge
|
||||||
|
-find ${PREFIX}/share/locale -name deluge.mo -exec rm {} \;
|
||||||
|
-rm $(PREFIX)/share/applications/deluge.desktop
|
||||||
|
-rm $(PREFIX)/share/pixmaps/deluge.png
|
10
PKG-INFO
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Metadata-Version: 1.0
|
||||||
|
Name: deluge
|
||||||
|
Version: 0.5.2
|
||||||
|
Summary: A bittorrent client written in PyGTK
|
||||||
|
Home-page: http://deluge-torrent.org
|
||||||
|
Author: Zach Tibbitts, Alon Zakai, Marcos Pinto, Alex Dedul, Andrew Resch
|
||||||
|
Author-email: zach@collegegeek.org, kripkensteiner@gmail.com, marcospinto@dipconsultants.com, rotmer@gmail.com, alonzakai@gmail.com
|
||||||
|
License: GPLv2
|
||||||
|
Description: UNKNOWN
|
||||||
|
Platform: UNKNOWN
|
129
README
@@ -1,24 +1,15 @@
|
|||||||
|
|
||||||
==========================
|
==========================
|
||||||
Deluge BitTorrent Client
|
Deluge BitTorrent Client
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
Homepage: http://deluge-torrent.org
|
|
||||||
|
|
||||||
Authors:
|
Authors:
|
||||||
Andrew Resch
|
Zach Tibbitts, aka zachtib
|
||||||
Damien Churchill
|
Alon Zakai, aka kripkenstein
|
||||||
|
Marcos Pinto, aka markybob
|
||||||
|
Andrew Resch, aka andar
|
||||||
|
Alex Dedul, aka plisk
|
||||||
|
|
||||||
For past developers and contributers see: http://dev.deluge-torrent.org/wiki/About
|
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:
|
Contact/Support:
|
||||||
@@ -26,69 +17,87 @@ Contact/Support:
|
|||||||
|
|
||||||
We have two options available for support:
|
We have two options available for support:
|
||||||
|
|
||||||
Our Forum, at: http://forum.deluge-torrent.org
|
Our Forum, at http://forum.deluge-torrent.org
|
||||||
or
|
or
|
||||||
Our IRC Channel, at #deluge on Freenode: http://freenode.net
|
Our IRC Channel, at #deluge on Freenode
|
||||||
|
|
||||||
==========================
|
==========================
|
||||||
Installation Instructions:
|
Installation Instructions:
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
For more detailed instructions see: http://dev.deluge-torrent.org/wiki/Installing/Source
|
First, make sure you have the proper build dependencies installed. On a normal
|
||||||
|
Debian or Ubuntu system, those dependencies are:
|
||||||
|
|
||||||
See: DEPENDS for a full list of dependencies.
|
g++
|
||||||
|
make
|
||||||
|
python-all-dev
|
||||||
|
python-all version >= 2.4
|
||||||
|
python-dbus
|
||||||
|
python-gnome2-extras
|
||||||
|
python-gtk2 version >= 2.9
|
||||||
|
python-notify
|
||||||
|
python-pyopenssl
|
||||||
|
librsvg2-common
|
||||||
|
python-xdg
|
||||||
|
python-support
|
||||||
|
libboost-dev >= 1.33.1
|
||||||
|
libboost-thread-dev
|
||||||
|
libboost-date-time-dev
|
||||||
|
libboost-filesystem-dev
|
||||||
|
libboost-serialization-dev
|
||||||
|
libssl-dev
|
||||||
|
zlib1g-dev
|
||||||
|
|
||||||
First, make sure you have the proper build dependencies installed. On a normal
|
But the names of the packages may vary depending on your OS / distro.
|
||||||
Debian or Ubuntu system:
|
|
||||||
|
|
||||||
sudo apt-get install g++ make python-all-dev python-all python-dbus \
|
Once you have the needed libraries installed, build Deluge by running:
|
||||||
python-gtk2 python-notify librsvg2-common python-xdg python-support \
|
|
||||||
subversion libboost-dev libboost-python-dev \
|
|
||||||
libboost-thread-dev libboost-date-time-dev libboost-filesystem-dev \
|
|
||||||
libssl-dev zlib1g-dev python-setuptools \
|
|
||||||
python-mako python-twisted-web python-chardet python-simplejson
|
|
||||||
|
|
||||||
The names of the packages may vary depending on your OS / distro.
|
$ make
|
||||||
|
|
||||||
Once you have the needed libraries installed, build and install by running:
|
You shouldn't get any errors. Then run, as root (or by using sudo):
|
||||||
|
|
||||||
$ python setup.py build
|
$ make install
|
||||||
$ sudo python setup.py install
|
|
||||||
|
and Deluge will be installed. By default, Deluge will be installed to the
|
||||||
|
prefix /usr. If you wish, you can install Deluge to a different prefix by
|
||||||
|
specifying it when you install it:
|
||||||
|
|
||||||
|
$ PREFIX=yourprefixhere make install
|
||||||
|
|
||||||
|
So, to install to /usr/local, run:
|
||||||
|
|
||||||
|
$ PREFIX=/usr/local make install
|
||||||
|
|
||||||
|
You can then run Deluge by executing:
|
||||||
|
|
||||||
|
$ deluge
|
||||||
|
|
||||||
==========================
|
==========================
|
||||||
FAQ
|
Uninstallation/Upgrading:
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
How to start the various user-interfaces
|
If you wish to upgrade from the older Deluge version please remove it first,
|
||||||
|
then install the latest version as per "Installation Instructions". If you
|
||||||
|
installed via the tarball, cd into the unpacked source tarball and then run,
|
||||||
|
as root (or by using sudo):
|
||||||
|
|
||||||
Gtk:
|
$ make uninstall
|
||||||
deluge-gtk
|
|
||||||
Console:
|
|
||||||
deluge-console
|
|
||||||
Web:
|
|
||||||
deluge-web
|
|
||||||
Go to http://localhost:8112/ default-password = "deluge"
|
|
||||||
|
|
||||||
Why is deluge still listed in my system tray even after I close it ?
|
If you installed via the deb package, run as root (or by using sudo:)
|
||||||
|
$ dpkg --purge remove deluge-torrent
|
||||||
|
|
||||||
You closed the gtk user-interface but you did not close the daemon. Choose "Quit & Shutdown Daemon" to close both Daemon and gtk-ui.
|
Now install the latest version (and check out the additional notes).
|
||||||
|
|
||||||
How do I start the daemon?
|
==========================
|
||||||
|
Additional Notes:
|
||||||
|
==========================
|
||||||
|
|
||||||
deluged
|
1) On some distributions, boost libraries are renamed to have "-mt" at the end
|
||||||
|
(boost_thread_mt instead of boost_thread, for example), the "mt" indicating
|
||||||
How do I start the daemon with logging to console?
|
"multithreaded". In some cases it appears the distros lack symlinks to connect
|
||||||
|
things. The solution is to either add symlinks from the short names to those
|
||||||
deluged -d -L <log level>
|
with "-mt", or to alter setup.py to look for the "-mt" versions.
|
||||||
|
|
||||||
I can't connect to the daemon from another machine
|
2) After upgrading your Deluge installation, it may fail to start. If this
|
||||||
|
happens to you, you need to remove your ~/.config/deluge directory to allow
|
||||||
* Configure the daemon to allow remote connections
|
Deluge to rebuild it's configuration file.
|
||||||
* Add a user to the auth file located in the config folder: ~/.config/deluge/auth
|
|
||||||
* Restart the daemon.
|
|
||||||
|
|
||||||
I upgraded from 0.5 and plugin x is missing
|
|
||||||
|
|
||||||
1.0 is a rewrite, all old 0.5 plugins have to be rewritten.
|
|
||||||
|
|
||||||
For the full FAQ see: http://dev.deluge-torrent.org/wiki/Faq
|
|
||||||
|
8
README.Packagers
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
NOTE: Deluge 0.5.1 and newer uses an svn build of libtorrent. This build
|
||||||
|
differs from a clean libtorrent source checkout and has been hacked in order
|
||||||
|
to get it to work properly with Deluge. As a result, Deluge will likely not
|
||||||
|
build properly against a vanilla libtorrent 0.12 installation or a nightly
|
||||||
|
build oflibtorrent 0.13. It is recommended that you build against our included
|
||||||
|
libtorrent, as our build will not conflict with any installed libtorrent.
|
||||||
|
|
||||||
|
- zachtib
|
@@ -1,23 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
# Paths to exclude
|
|
||||||
EXCLUSIONS = [
|
|
||||||
"deluge/scripts"
|
|
||||||
]
|
|
||||||
|
|
||||||
POTFILE_IN = "deluge/i18n/POTFILES.in"
|
|
||||||
|
|
||||||
print "Creating " + POTFILE_IN + " .."
|
|
||||||
to_translate = []
|
|
||||||
for (dirpath, dirnames, filenames) in os.walk("deluge"):
|
|
||||||
for filename in filenames:
|
|
||||||
if os.path.splitext(filename)[1] in (".py", ".glade") and dirpath not in EXCLUSIONS:
|
|
||||||
to_translate.append(os.path.join(dirpath, filename))
|
|
||||||
|
|
||||||
f = open(POTFILE_IN, "wb")
|
|
||||||
for line in to_translate:
|
|
||||||
f.write(line + "\n")
|
|
||||||
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
print "Done"
|
|
@@ -1,6 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
for size in 16 22 24 32 36 48 64 72 96 128 192 256; do mkdir -p deluge/data/\
|
for size in 16 22 24 32 36 48 64 72 96 128 192 256; do mkdir -p icons/hicolor/\
|
||||||
icons/hicolor/${size}x${size}/apps; rsvg-convert -w ${size} -h ${size} \
|
${size}x${size}/apps; rsvg-convert -w ${size} -h ${size} \
|
||||||
-o deluge/data/icons/hicolor/${size}x${size}/apps/deluge.png deluge/data/pixmaps\
|
-o icons/hicolor/${size}x${size}/apps/deluge.png pixmaps/deluge.svg; mkdir -p \
|
||||||
/deluge.svg; mkdir -p deluge/data/icons/scalable/apps/; cp deluge/data/pixmaps/\
|
icons/scalable/apps/; cp pixmaps/deluge.svg icons/scalable/apps/deluge.svg; done
|
||||||
deluge.svg deluge/data/icons/scalable/apps/deluge.svg; done
|
|
||||||
|
13
deluge.desktop
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Version=1.0
|
||||||
|
Encoding=UTF-8
|
||||||
|
Name=Deluge BitTorrent Client
|
||||||
|
GenericName=BitTorrent Client
|
||||||
|
Comment=A GTK BitTorrent client written in Python and C++
|
||||||
|
Exec=deluge
|
||||||
|
Icon=deluge.png
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
|
Categories=Network;
|
||||||
|
StartupNotify=true
|
||||||
|
MimeType=application/x-bittorrent;
|
BIN
deluge.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
@@ -1 +0,0 @@
|
|||||||
"""Deluge"""
|
|
@@ -1,20 +0,0 @@
|
|||||||
from new import classobj
|
|
||||||
from deluge.core.core import Core
|
|
||||||
from deluge.core.daemon import Daemon
|
|
||||||
|
|
||||||
class RpcApi:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def scan_for_methods(obj):
|
|
||||||
methods = {
|
|
||||||
'__doc__': 'Methods available in %s' % obj.__name__.lower()
|
|
||||||
}
|
|
||||||
for d in dir(obj):
|
|
||||||
if not hasattr(getattr(obj,d), '_rpcserver_export'):
|
|
||||||
continue
|
|
||||||
methods[d] = getattr(obj, d)
|
|
||||||
cobj = classobj(obj.__name__.lower(), (object,), methods)
|
|
||||||
setattr(RpcApi, obj.__name__.lower(), cobj)
|
|
||||||
|
|
||||||
scan_for_methods(Core)
|
|
||||||
scan_for_methods(Daemon)
|
|
@@ -1,60 +0,0 @@
|
|||||||
#
|
|
||||||
# _libtorrent.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
This module is used to handle the importing of libtorrent.
|
|
||||||
|
|
||||||
We use this module to control what versions of libtorrent this version of Deluge
|
|
||||||
supports.
|
|
||||||
|
|
||||||
** Usage **
|
|
||||||
|
|
||||||
>>> from deluge._libtorrent import lt
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
REQUIRED_VERSION = "0.14.9.0"
|
|
||||||
|
|
||||||
def check_version(LT):
|
|
||||||
from deluge.common import VersionSplit
|
|
||||||
if VersionSplit(lt.version) < VersionSplit(REQUIRED_VERSION):
|
|
||||||
raise ImportError("This version of Deluge requires libtorrent >=%s!" % REQUIRED_VERSION)
|
|
||||||
|
|
||||||
try:
|
|
||||||
import deluge.libtorrent as lt
|
|
||||||
check_version(lt)
|
|
||||||
except ImportError:
|
|
||||||
import libtorrent as lt
|
|
||||||
check_version(lt)
|
|
@@ -1,129 +0,0 @@
|
|||||||
# The contents of this file are subject to the Python Software Foundation
|
|
||||||
# License Version 2.3 (the License). You may not copy or use this file, in
|
|
||||||
# either source code or executable form, except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at http://www.python.org/license.
|
|
||||||
#
|
|
||||||
# Software distributed under the License is distributed on an AS IS basis,
|
|
||||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
# for the specific language governing rights and limitations under the
|
|
||||||
# License.
|
|
||||||
|
|
||||||
# Written by Petru Paler
|
|
||||||
|
|
||||||
# Minor modifications made by Andrew Resch to replace the BTFailure errors with Exceptions
|
|
||||||
|
|
||||||
def decode_int(x, f):
|
|
||||||
f += 1
|
|
||||||
newf = x.index('e', f)
|
|
||||||
n = int(x[f:newf])
|
|
||||||
if x[f] == '-':
|
|
||||||
if x[f + 1] == '0':
|
|
||||||
raise ValueError
|
|
||||||
elif x[f] == '0' and newf != f+1:
|
|
||||||
raise ValueError
|
|
||||||
return (n, newf+1)
|
|
||||||
|
|
||||||
def decode_string(x, f):
|
|
||||||
colon = x.index(':', f)
|
|
||||||
n = int(x[f:colon])
|
|
||||||
if x[f] == '0' and colon != f+1:
|
|
||||||
raise ValueError
|
|
||||||
colon += 1
|
|
||||||
return (x[colon:colon+n], colon+n)
|
|
||||||
|
|
||||||
def decode_list(x, f):
|
|
||||||
r, f = [], f+1
|
|
||||||
while x[f] != 'e':
|
|
||||||
v, f = decode_func[x[f]](x, f)
|
|
||||||
r.append(v)
|
|
||||||
return (r, f + 1)
|
|
||||||
|
|
||||||
def decode_dict(x, f):
|
|
||||||
r, f = {}, f+1
|
|
||||||
while x[f] != 'e':
|
|
||||||
k, f = decode_string(x, f)
|
|
||||||
r[k], f = decode_func[x[f]](x, f)
|
|
||||||
return (r, f + 1)
|
|
||||||
|
|
||||||
decode_func = {}
|
|
||||||
decode_func['l'] = decode_list
|
|
||||||
decode_func['d'] = decode_dict
|
|
||||||
decode_func['i'] = decode_int
|
|
||||||
decode_func['0'] = decode_string
|
|
||||||
decode_func['1'] = decode_string
|
|
||||||
decode_func['2'] = decode_string
|
|
||||||
decode_func['3'] = decode_string
|
|
||||||
decode_func['4'] = decode_string
|
|
||||||
decode_func['5'] = decode_string
|
|
||||||
decode_func['6'] = decode_string
|
|
||||||
decode_func['7'] = decode_string
|
|
||||||
decode_func['8'] = decode_string
|
|
||||||
decode_func['9'] = decode_string
|
|
||||||
|
|
||||||
def bdecode(x):
|
|
||||||
try:
|
|
||||||
r, l = decode_func[x[0]](x, 0)
|
|
||||||
except (IndexError, KeyError, ValueError):
|
|
||||||
raise Exception("not a valid bencoded string")
|
|
||||||
|
|
||||||
return r
|
|
||||||
|
|
||||||
from types import StringType, IntType, LongType, DictType, ListType, TupleType
|
|
||||||
|
|
||||||
|
|
||||||
class Bencached(object):
|
|
||||||
|
|
||||||
__slots__ = ['bencoded']
|
|
||||||
|
|
||||||
def __init__(self, s):
|
|
||||||
self.bencoded = s
|
|
||||||
|
|
||||||
def encode_bencached(x,r):
|
|
||||||
r.append(x.bencoded)
|
|
||||||
|
|
||||||
def encode_int(x, r):
|
|
||||||
r.extend(('i', str(x), 'e'))
|
|
||||||
|
|
||||||
def encode_bool(x, r):
|
|
||||||
if x:
|
|
||||||
encode_int(1, r)
|
|
||||||
else:
|
|
||||||
encode_int(0, r)
|
|
||||||
|
|
||||||
def encode_string(x, r):
|
|
||||||
r.extend((str(len(x)), ':', x))
|
|
||||||
|
|
||||||
def encode_list(x, r):
|
|
||||||
r.append('l')
|
|
||||||
for i in x:
|
|
||||||
encode_func[type(i)](i, r)
|
|
||||||
r.append('e')
|
|
||||||
|
|
||||||
def encode_dict(x,r):
|
|
||||||
r.append('d')
|
|
||||||
ilist = x.items()
|
|
||||||
ilist.sort()
|
|
||||||
for k, v in ilist:
|
|
||||||
r.extend((str(len(k)), ':', k))
|
|
||||||
encode_func[type(v)](v, r)
|
|
||||||
r.append('e')
|
|
||||||
|
|
||||||
encode_func = {}
|
|
||||||
encode_func[Bencached] = encode_bencached
|
|
||||||
encode_func[IntType] = encode_int
|
|
||||||
encode_func[LongType] = encode_int
|
|
||||||
encode_func[StringType] = encode_string
|
|
||||||
encode_func[ListType] = encode_list
|
|
||||||
encode_func[TupleType] = encode_list
|
|
||||||
encode_func[DictType] = encode_dict
|
|
||||||
|
|
||||||
try:
|
|
||||||
from types import BooleanType
|
|
||||||
encode_func[BooleanType] = encode_bool
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def bencode(x):
|
|
||||||
r = []
|
|
||||||
encode_func[type(x)](x, r)
|
|
||||||
return ''.join(r)
|
|
560
deluge/common.py
@@ -1,560 +0,0 @@
|
|||||||
#
|
|
||||||
# common.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
"""Common functions for various parts of Deluge to use."""
|
|
||||||
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
import subprocess
|
|
||||||
import platform
|
|
||||||
import sys
|
|
||||||
|
|
||||||
try:
|
|
||||||
import json
|
|
||||||
except ImportError:
|
|
||||||
import simplejson as json
|
|
||||||
|
|
||||||
# Do a little hack here just in case the user has json-py installed since it
|
|
||||||
# has a different api
|
|
||||||
if not hasattr(json, "dumps"):
|
|
||||||
json.dumps = json.write
|
|
||||||
json.loads = json.read
|
|
||||||
|
|
||||||
def dump(obj, fp, **kw):
|
|
||||||
fp.write(json.dumps(obj))
|
|
||||||
|
|
||||||
def load(fp, **kw):
|
|
||||||
return json.loads(fp.read())
|
|
||||||
|
|
||||||
json.dump = dump
|
|
||||||
json.load = load
|
|
||||||
|
|
||||||
import pkg_resources
|
|
||||||
import xdg, xdg.BaseDirectory
|
|
||||||
|
|
||||||
from deluge.error import *
|
|
||||||
|
|
||||||
LT_TORRENT_STATE = {
|
|
||||||
"Queued": 0,
|
|
||||||
"Checking": 1,
|
|
||||||
"Downloading Metadata": 2,
|
|
||||||
"Downloading": 3,
|
|
||||||
"Finished": 4,
|
|
||||||
"Seeding": 5,
|
|
||||||
"Allocating": 6,
|
|
||||||
"Checking Resume Data": 7,
|
|
||||||
0: "Queued",
|
|
||||||
1: "Checking",
|
|
||||||
2: "Downloading Metadata",
|
|
||||||
3: "Downloading",
|
|
||||||
4: "Finished",
|
|
||||||
5: "Seeding",
|
|
||||||
6: "Allocating",
|
|
||||||
7: "Checking Resume Data"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TORRENT_STATE = [
|
|
||||||
"Allocating",
|
|
||||||
"Checking",
|
|
||||||
"Downloading",
|
|
||||||
"Seeding",
|
|
||||||
"Paused",
|
|
||||||
"Error",
|
|
||||||
"Queued"
|
|
||||||
]
|
|
||||||
|
|
||||||
FILE_PRIORITY = {
|
|
||||||
0: "Do Not Download",
|
|
||||||
1: "Normal Priority",
|
|
||||||
2: "High Priority",
|
|
||||||
5: "Highest Priority",
|
|
||||||
"Do Not Download": 0,
|
|
||||||
"Normal Priority": 1,
|
|
||||||
"High Priority": 2,
|
|
||||||
"Highest Priority": 5
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_version():
|
|
||||||
"""
|
|
||||||
Returns the program version from the egg metadata
|
|
||||||
|
|
||||||
:returns: the version of Deluge
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
return pkg_resources.require("Deluge")[0].version
|
|
||||||
|
|
||||||
def get_default_config_dir(filename=None):
|
|
||||||
"""
|
|
||||||
:param filename: if None, only the config path is returned, if provided, a path including the filename will be returned
|
|
||||||
:type filename: string
|
|
||||||
:returns: a file path to the config directory and optional filename
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
if windows_check():
|
|
||||||
if filename:
|
|
||||||
return os.path.join(os.environ.get("APPDATA"), "deluge", filename)
|
|
||||||
else:
|
|
||||||
return os.path.join(os.environ.get("APPDATA"), "deluge")
|
|
||||||
else:
|
|
||||||
if filename:
|
|
||||||
return os.path.join(xdg.BaseDirectory.save_config_path("deluge"), filename)
|
|
||||||
else:
|
|
||||||
return xdg.BaseDirectory.save_config_path("deluge")
|
|
||||||
|
|
||||||
def get_default_download_dir():
|
|
||||||
"""
|
|
||||||
:returns: the default download directory
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
if windows_check():
|
|
||||||
return os.path.expanduser("~")
|
|
||||||
else:
|
|
||||||
return os.environ.get("HOME")
|
|
||||||
|
|
||||||
def windows_check():
|
|
||||||
"""
|
|
||||||
Checks if the current platform is Windows
|
|
||||||
|
|
||||||
:returns: True or False
|
|
||||||
:rtype: bool
|
|
||||||
|
|
||||||
"""
|
|
||||||
return platform.system() in ('Windows', 'Microsoft')
|
|
||||||
|
|
||||||
def vista_check():
|
|
||||||
"""
|
|
||||||
Checks if the current platform is Windows Vista
|
|
||||||
|
|
||||||
:returns: True or False
|
|
||||||
:rtype: bool
|
|
||||||
|
|
||||||
"""
|
|
||||||
return platform.release() == "Vista"
|
|
||||||
|
|
||||||
def osx_check():
|
|
||||||
"""
|
|
||||||
Checks if the current platform is Mac OS X
|
|
||||||
|
|
||||||
:returns: True or False
|
|
||||||
:rtype: bool
|
|
||||||
|
|
||||||
"""
|
|
||||||
return platform.system() == "Darwin"
|
|
||||||
|
|
||||||
def get_pixmap(fname):
|
|
||||||
"""
|
|
||||||
Provides easy access to files in the deluge/data/pixmaps folder within the Deluge egg
|
|
||||||
|
|
||||||
:param fname: the filename to look for
|
|
||||||
:type fname: string
|
|
||||||
:returns: a path to a pixmap file included with Deluge
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
return pkg_resources.resource_filename("deluge", os.path.join("data", \
|
|
||||||
"pixmaps", fname))
|
|
||||||
|
|
||||||
def open_file(path):
|
|
||||||
"""
|
|
||||||
Opens a file or folder using the system configured program
|
|
||||||
|
|
||||||
:param path: the path to the file or folder to open
|
|
||||||
:type path: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
if windows_check():
|
|
||||||
os.startfile("%s" % path)
|
|
||||||
else:
|
|
||||||
subprocess.Popen(["xdg-open", "%s" % path])
|
|
||||||
|
|
||||||
def open_url_in_browser(url):
|
|
||||||
"""
|
|
||||||
Opens a url in the desktop's default browser
|
|
||||||
|
|
||||||
:param url: the url to open
|
|
||||||
:type url: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
import webbrowser
|
|
||||||
webbrowser.open(url)
|
|
||||||
|
|
||||||
## Formatting text functions
|
|
||||||
|
|
||||||
def fsize(fsize_b):
|
|
||||||
"""
|
|
||||||
Formats the bytes value into a string with KiB, MiB or GiB units
|
|
||||||
|
|
||||||
:param fsize_b: the filesize in bytes
|
|
||||||
:type fsize_b: int
|
|
||||||
:returns: formatted string in KiB, MiB or GiB units
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
**Usage**
|
|
||||||
|
|
||||||
>>> fsize(112245)
|
|
||||||
'109.6 KiB'
|
|
||||||
|
|
||||||
"""
|
|
||||||
fsize_kb = fsize_b / 1024.0
|
|
||||||
if fsize_kb < 1024:
|
|
||||||
return "%.1f KiB" % fsize_kb
|
|
||||||
fsize_mb = fsize_kb / 1024.0
|
|
||||||
if fsize_mb < 1024:
|
|
||||||
return "%.1f MiB" % fsize_mb
|
|
||||||
fsize_gb = fsize_mb / 1024.0
|
|
||||||
return "%.1f GiB" % fsize_gb
|
|
||||||
|
|
||||||
def fpcnt(dec):
|
|
||||||
"""
|
|
||||||
Formats a string to display a percentage with two decimal places
|
|
||||||
|
|
||||||
:param dec: the ratio in the range [0.0, 1.0]
|
|
||||||
:type dec: float
|
|
||||||
:returns: a formatted string representing a percentage
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
**Usage**
|
|
||||||
|
|
||||||
>>> fpcnt(0.9311)
|
|
||||||
'93.11%'
|
|
||||||
|
|
||||||
"""
|
|
||||||
return '%.2f%%' % (dec * 100)
|
|
||||||
|
|
||||||
def fspeed(bps):
|
|
||||||
"""
|
|
||||||
Formats a string to display a transfer speed utilizing :func:`fsize`
|
|
||||||
|
|
||||||
:param bps: bytes per second
|
|
||||||
:type bps: int
|
|
||||||
:returns: a formatted string representing transfer speed
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
**Usage**
|
|
||||||
|
|
||||||
>>> fspeed(43134)
|
|
||||||
'42.1 KiB/s'
|
|
||||||
|
|
||||||
"""
|
|
||||||
return '%s/s' % (fsize(bps))
|
|
||||||
|
|
||||||
def fpeer(num_peers, total_peers):
|
|
||||||
"""
|
|
||||||
Formats a string to show 'num_peers' ('total_peers')
|
|
||||||
|
|
||||||
:param num_peers: the number of connected peers
|
|
||||||
:type num_peers: int
|
|
||||||
:param total_peers: the total number of peers
|
|
||||||
:type total_peers: int
|
|
||||||
:returns: a formatted string: num_peers (total_peers), if total_peers < 0, then it will not be shown
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
**Usage**
|
|
||||||
|
|
||||||
>>> fpeer(10, 20)
|
|
||||||
'10 (20)'
|
|
||||||
>>> fpeer(10, -1)
|
|
||||||
'10'
|
|
||||||
|
|
||||||
"""
|
|
||||||
if total_peers > -1:
|
|
||||||
return "%d (%d)" % (num_peers, total_peers)
|
|
||||||
else:
|
|
||||||
return "%d" % num_peers
|
|
||||||
|
|
||||||
def ftime(seconds):
|
|
||||||
"""
|
|
||||||
Formats a string to show time in a human readable form
|
|
||||||
|
|
||||||
:param seconds: the number of seconds
|
|
||||||
:type seconds: int
|
|
||||||
:returns: a formatted time string, will return '' if seconds == 0
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
**Usage**
|
|
||||||
|
|
||||||
>>> ftime(23011)
|
|
||||||
'6h 23m'
|
|
||||||
|
|
||||||
"""
|
|
||||||
if seconds == 0:
|
|
||||||
return ""
|
|
||||||
if seconds < 60:
|
|
||||||
return '%ds' % (seconds)
|
|
||||||
minutes = seconds / 60
|
|
||||||
if minutes < 60:
|
|
||||||
seconds = seconds % 60
|
|
||||||
return '%dm %ds' % (minutes, seconds)
|
|
||||||
hours = minutes / 60
|
|
||||||
if hours < 24:
|
|
||||||
minutes = minutes % 60
|
|
||||||
return '%dh %dm' % (hours, minutes)
|
|
||||||
days = hours / 24
|
|
||||||
if days < 7:
|
|
||||||
hours = hours % 24
|
|
||||||
return '%dd %dh' % (days, hours)
|
|
||||||
weeks = days / 7
|
|
||||||
if weeks < 52:
|
|
||||||
days = days % 7
|
|
||||||
return '%dw %dd' % (weeks, days)
|
|
||||||
years = weeks / 52
|
|
||||||
weeks = weeks % 52
|
|
||||||
return '%dy %dw' % (years, weeks)
|
|
||||||
|
|
||||||
def fdate(seconds):
|
|
||||||
"""
|
|
||||||
Formats a date string in the locale's date representation based on the systems timezone
|
|
||||||
|
|
||||||
:param seconds: time in seconds since the Epoch
|
|
||||||
:type seconds: float
|
|
||||||
:returns: a string in the locale's date representation or "" if seconds < 0
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
if seconds < 0:
|
|
||||||
return ""
|
|
||||||
return time.strftime("%x", time.localtime(seconds))
|
|
||||||
|
|
||||||
def is_url(url):
|
|
||||||
"""
|
|
||||||
A simple regex test to check if the URL is valid
|
|
||||||
|
|
||||||
:param url: the url to test
|
|
||||||
:type url: string
|
|
||||||
:returns: True or False
|
|
||||||
:rtype: bool
|
|
||||||
|
|
||||||
**Usage**
|
|
||||||
|
|
||||||
>>> is_url("http://deluge-torrent.org")
|
|
||||||
True
|
|
||||||
|
|
||||||
"""
|
|
||||||
import re
|
|
||||||
return bool(re.search('^(https?|ftp|udp)://', url))
|
|
||||||
|
|
||||||
def is_magnet(uri):
|
|
||||||
"""
|
|
||||||
A check to determine if a uri is a valid bittorrent magnet uri
|
|
||||||
|
|
||||||
:param uri: the uri to check
|
|
||||||
:type uri: string
|
|
||||||
:returns: True or False
|
|
||||||
:rtype: bool
|
|
||||||
|
|
||||||
**Usage**
|
|
||||||
|
|
||||||
>>> is_magnet("magnet:?xt=urn:btih:SU5225URMTUEQLDXQWRB2EQWN6KLTYKN")
|
|
||||||
True
|
|
||||||
|
|
||||||
"""
|
|
||||||
if uri[:20] == "magnet:?xt=urn:btih:":
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def fetch_url(url):
|
|
||||||
"""
|
|
||||||
Downloads a torrent file from a given URL and checks the file's validity
|
|
||||||
|
|
||||||
:param url: the url of the .torrent file to fetch
|
|
||||||
:type url: string
|
|
||||||
:returns: the filepath to the downloaded file
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
import urllib
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
try:
|
|
||||||
filename, headers = urllib.urlretrieve(url)
|
|
||||||
except IOError:
|
|
||||||
log.debug("Network error while trying to fetch torrent from %s", url)
|
|
||||||
else:
|
|
||||||
if filename.endswith(".torrent") or headers["content-type"] ==\
|
|
||||||
"application/x-bittorrent":
|
|
||||||
return filename
|
|
||||||
else:
|
|
||||||
log.debug("URL doesn't appear to be a valid torrent file: %s", url)
|
|
||||||
return None
|
|
||||||
|
|
||||||
def create_magnet_uri(infohash, name=None, trackers=[]):
|
|
||||||
"""
|
|
||||||
Creates a magnet uri
|
|
||||||
|
|
||||||
:param infohash: the info-hash of the torrent
|
|
||||||
:type infohash: string
|
|
||||||
:param name: the name of the torrent (optional)
|
|
||||||
:type name: string
|
|
||||||
:param trackers: the trackers to announce to (optional)
|
|
||||||
:type trackers: list of strings
|
|
||||||
|
|
||||||
:returns: a magnet uri string
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
from base64 import b32encode
|
|
||||||
uri = "magnet:?xt=urn:btih:" + b32encode(infohash.decode("hex"))
|
|
||||||
if name:
|
|
||||||
uri = uri + "&dn=" + name
|
|
||||||
if trackers:
|
|
||||||
for t in trackers:
|
|
||||||
uri = uri + "&tr=" + t
|
|
||||||
|
|
||||||
return uri
|
|
||||||
|
|
||||||
def get_path_size(path):
|
|
||||||
"""
|
|
||||||
Gets the size in bytes of 'path'
|
|
||||||
|
|
||||||
:param path: the path to check for size
|
|
||||||
:type path: string
|
|
||||||
:returns: the size in bytes of the path or -1 if the path does not exist
|
|
||||||
:rtype: int
|
|
||||||
|
|
||||||
"""
|
|
||||||
if not os.path.exists(path):
|
|
||||||
return -1
|
|
||||||
|
|
||||||
if os.path.isfile(path):
|
|
||||||
return os.path.getsize(path)
|
|
||||||
|
|
||||||
dir_size = 0
|
|
||||||
for (p, dirs, files) in os.walk(path):
|
|
||||||
for file in files:
|
|
||||||
filename = os.path.join(p, file)
|
|
||||||
dir_size += os.path.getsize(filename)
|
|
||||||
return dir_size
|
|
||||||
|
|
||||||
def free_space(path):
|
|
||||||
"""
|
|
||||||
Gets the free space available at 'path'
|
|
||||||
|
|
||||||
:param path: the path to check
|
|
||||||
:type path: string
|
|
||||||
:returns: the free space at path in bytes
|
|
||||||
:rtype: int
|
|
||||||
|
|
||||||
:raises InvalidPathError: if the path is not valid
|
|
||||||
|
|
||||||
"""
|
|
||||||
if not os.path.exists(path):
|
|
||||||
raise InvalidPathError("%s is not a valid path" % path)
|
|
||||||
|
|
||||||
if windows_check():
|
|
||||||
import win32file
|
|
||||||
sectors, bytes, free, total = map(long, win32file.GetDiskFreeSpace(path))
|
|
||||||
return (free * sectors * bytes)
|
|
||||||
else:
|
|
||||||
disk_data = os.statvfs(path)
|
|
||||||
block_size = disk_data.f_bsize
|
|
||||||
return disk_data.f_bavail * block_size
|
|
||||||
|
|
||||||
def is_ip(ip):
|
|
||||||
"""
|
|
||||||
A simple test to see if 'ip' is valid
|
|
||||||
|
|
||||||
:param ip: the ip to check
|
|
||||||
:type ip: string
|
|
||||||
:returns: True or False
|
|
||||||
:rtype: bool
|
|
||||||
|
|
||||||
** Usage **
|
|
||||||
|
|
||||||
>>> is_ip("127.0.0.1")
|
|
||||||
True
|
|
||||||
|
|
||||||
"""
|
|
||||||
import socket
|
|
||||||
#first we test ipv4
|
|
||||||
try:
|
|
||||||
if socket.inet_pton(socket.AF_INET, "%s" % (ip)):
|
|
||||||
return True
|
|
||||||
except socket.error:
|
|
||||||
if not socket.has_ipv6:
|
|
||||||
return False
|
|
||||||
#now test ipv6
|
|
||||||
try:
|
|
||||||
if socket.inet_pton(socket.AF_INET6, "%s" % (ip)):
|
|
||||||
return True
|
|
||||||
except socket.error:
|
|
||||||
return False
|
|
||||||
|
|
||||||
class VersionSplit(object):
|
|
||||||
"""
|
|
||||||
Used for comparing version numbers.
|
|
||||||
|
|
||||||
:param ver: the version
|
|
||||||
:type ver: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
def __init__(self, ver):
|
|
||||||
ver = ver.lower()
|
|
||||||
vs = ver.split("_") if "_" in ver else ver.split("-")
|
|
||||||
self.version = [int(x) for x in vs[0].split(".")]
|
|
||||||
self.suffix = None
|
|
||||||
if len(vs) > 1:
|
|
||||||
for s in ("rc", "alpha", "beta", "dev"):
|
|
||||||
if s in vs[1][:len(s)]:
|
|
||||||
self.suffix = vs[1]
|
|
||||||
|
|
||||||
def __cmp__(self, ver):
|
|
||||||
"""
|
|
||||||
The comparison method.
|
|
||||||
|
|
||||||
:param ver: the version to compare with
|
|
||||||
:type ver: VersionSplit
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
if self.version > ver.version or (self.suffix and self.suffix[:3] == "dev"):
|
|
||||||
return 1
|
|
||||||
if self.version < ver.version:
|
|
||||||
return -1
|
|
||||||
|
|
||||||
if self.version == ver.version:
|
|
||||||
if self.suffix == ver.suffix:
|
|
||||||
return 0
|
|
||||||
if self.suffix is None:
|
|
||||||
return 1
|
|
||||||
if ver.suffix is None:
|
|
||||||
return -1
|
|
||||||
if self.suffix < ver.suffix:
|
|
||||||
return -1
|
|
||||||
if self.suffix > ver.suffix:
|
|
||||||
return 1
|
|
@@ -1,245 +0,0 @@
|
|||||||
#
|
|
||||||
# component.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
from twisted.internet.task import LoopingCall
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
|
|
||||||
COMPONENT_STATE = [
|
|
||||||
"Stopped",
|
|
||||||
"Started",
|
|
||||||
"Paused"
|
|
||||||
]
|
|
||||||
|
|
||||||
class Component(object):
|
|
||||||
def __init__(self, name, interval=1, depend=None):
|
|
||||||
# Register with the ComponentRegistry
|
|
||||||
register(name, self, depend)
|
|
||||||
self._interval = interval
|
|
||||||
self._timer = None
|
|
||||||
self._state = COMPONENT_STATE.index("Stopped")
|
|
||||||
self._name = name
|
|
||||||
|
|
||||||
def get_state(self):
|
|
||||||
return self._state
|
|
||||||
|
|
||||||
def get_component_name(self):
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
def start(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _start(self):
|
|
||||||
self._state = COMPONENT_STATE.index("Started")
|
|
||||||
if hasattr(self, "update"):
|
|
||||||
self._timer = LoopingCall(self.update)
|
|
||||||
self._timer.start(self._interval)
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _stop(self):
|
|
||||||
self._state = COMPONENT_STATE.index("Stopped")
|
|
||||||
try:
|
|
||||||
self._timer.stop()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _pause(self):
|
|
||||||
self._state = COMPONENT_STATE.index("Paused")
|
|
||||||
try:
|
|
||||||
self._timer.stop()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _resume(self):
|
|
||||||
self._start()
|
|
||||||
|
|
||||||
def shutdown(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
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 deregister(self, name):
|
|
||||||
"""Deregisters a component"""
|
|
||||||
if name in self.components:
|
|
||||||
log.debug("Deregistering Component: %s", name)
|
|
||||||
self.stop_component(name)
|
|
||||||
del self.components[name]
|
|
||||||
|
|
||||||
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
|
|
||||||
if self.depend.has_key(name):
|
|
||||||
for depend in self.depend[name]:
|
|
||||||
self.start_component(depend)
|
|
||||||
|
|
||||||
# Only start if the component is stopped.
|
|
||||||
if self.components[name].get_state() == \
|
|
||||||
COMPONENT_STATE.index("Stopped"):
|
|
||||||
log.debug("Starting component %s..", name)
|
|
||||||
self.components[name].start()
|
|
||||||
self.components[name]._start()
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
"""Stops all components"""
|
|
||||||
# We create a separate list of the keys and do an additional check to
|
|
||||||
# make sure the key still exists in the components dict.
|
|
||||||
# This is because components could be deregistered during a stop and
|
|
||||||
# the dictionary would get modified while iterating through it.
|
|
||||||
components = self.components.keys()
|
|
||||||
for component in components:
|
|
||||||
if component in self.components:
|
|
||||||
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")]:
|
|
||||||
log.debug("Pausing component %s..", component)
|
|
||||||
self.components[component]._pause()
|
|
||||||
|
|
||||||
def resume(self):
|
|
||||||
"""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()
|
|
||||||
|
|
||||||
def update(self):
|
|
||||||
"""Updates all components"""
|
|
||||||
for component in self.components.keys():
|
|
||||||
# Only update the component if it's started
|
|
||||||
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."""
|
|
||||||
# Stop all components first
|
|
||||||
self.stop()
|
|
||||||
for component in self.components.keys():
|
|
||||||
log.debug("Shutting down component %s..", component)
|
|
||||||
try:
|
|
||||||
self.components[component].shutdown()
|
|
||||||
except Exception, e:
|
|
||||||
log.debug("Unable to call shutdown()")
|
|
||||||
log.exception(e)
|
|
||||||
|
|
||||||
|
|
||||||
_ComponentRegistry = ComponentRegistry()
|
|
||||||
|
|
||||||
def register(name, obj, depend=None):
|
|
||||||
"""Registers a component with the registry"""
|
|
||||||
_ComponentRegistry.register(name, obj, depend)
|
|
||||||
|
|
||||||
def deregister(name):
|
|
||||||
"""Deregisters a component"""
|
|
||||||
_ComponentRegistry.deregister(name)
|
|
||||||
|
|
||||||
def start(component=None):
|
|
||||||
"""Starts all components"""
|
|
||||||
if component == None:
|
|
||||||
_ComponentRegistry.start()
|
|
||||||
else:
|
|
||||||
_ComponentRegistry.start_component(component)
|
|
||||||
|
|
||||||
def stop(component=None):
|
|
||||||
"""Stops all or specified components"""
|
|
||||||
if component == None:
|
|
||||||
_ComponentRegistry.stop()
|
|
||||||
else:
|
|
||||||
_ComponentRegistry.stop_component(component)
|
|
||||||
|
|
||||||
def pause(component=None):
|
|
||||||
"""Pauses all or specificed components"""
|
|
||||||
if component == None:
|
|
||||||
_ComponentRegistry.pause()
|
|
||||||
else:
|
|
||||||
_ComponentRegistry.pause_component(component)
|
|
||||||
|
|
||||||
def resume(component=None):
|
|
||||||
"""Resumes all or specificed components"""
|
|
||||||
if component == None:
|
|
||||||
_ComponentRegistry.resume()
|
|
||||||
else:
|
|
||||||
_ComponentRegistry.resume_component(component)
|
|
||||||
|
|
||||||
def update():
|
|
||||||
"""Updates all components"""
|
|
||||||
_ComponentRegistry.update()
|
|
||||||
|
|
||||||
def shutdown():
|
|
||||||
"""Shutdowns all components"""
|
|
||||||
_ComponentRegistry.shutdown()
|
|
||||||
|
|
||||||
def get(component):
|
|
||||||
"""Return a reference to the component"""
|
|
||||||
return _ComponentRegistry.get(component)
|
|
487
deluge/config.py
@@ -1,487 +0,0 @@
|
|||||||
#
|
|
||||||
# config.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.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
Deluge Config Module
|
|
||||||
|
|
||||||
This module is used for loading and saving of configuration files.. or anything
|
|
||||||
really.
|
|
||||||
|
|
||||||
The format of the config file is two json encoded dicts:
|
|
||||||
|
|
||||||
<version dict>
|
|
||||||
<content dict>
|
|
||||||
|
|
||||||
The version dict contains two keys: file and format. The format version is
|
|
||||||
controlled by the Config class. It should only be changed when anything below
|
|
||||||
it is changed directly by the Config class. An example of this would be if we
|
|
||||||
changed the serializer for the content to something different.
|
|
||||||
|
|
||||||
The config file version is changed by the 'owner' of the config file. This is
|
|
||||||
to signify that there is a change in the naming of some config keys or something
|
|
||||||
similar along those lines.
|
|
||||||
|
|
||||||
The content is simply the dict to be saved and will be serialized before being
|
|
||||||
written.
|
|
||||||
|
|
||||||
Converting
|
|
||||||
|
|
||||||
Since the format of the config could change, there needs to be a way to have
|
|
||||||
the Config object convert to newer formats. To do this, you will need to
|
|
||||||
register conversion functions for various versions of the config file. Note that
|
|
||||||
this can only be done for the 'config file version' and not for the 'format'
|
|
||||||
version as this will be done internally.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import cPickle as pickle
|
|
||||||
import shutil
|
|
||||||
import os
|
|
||||||
|
|
||||||
import deluge.common
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
|
|
||||||
json = deluge.common.json
|
|
||||||
|
|
||||||
def prop(func):
|
|
||||||
"""Function decorator for defining property attributes
|
|
||||||
|
|
||||||
The decorated function is expected to return a dictionary
|
|
||||||
containing one or more of the following pairs:
|
|
||||||
fget - function for getting attribute value
|
|
||||||
fset - function for setting attribute value
|
|
||||||
fdel - function for deleting attribute
|
|
||||||
This can be conveniently constructed by the locals() builtin
|
|
||||||
function; see:
|
|
||||||
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/205183
|
|
||||||
"""
|
|
||||||
return property(doc=func.__doc__, **func())
|
|
||||||
|
|
||||||
def find_json_objects(s):
|
|
||||||
"""
|
|
||||||
Find json objects in a string.
|
|
||||||
|
|
||||||
:param s: the string to find json objects in
|
|
||||||
:type s: string
|
|
||||||
|
|
||||||
:returns: a list of tuples containing start and end locations of json objects in the string `s`
|
|
||||||
:rtype: [(start, end), ...]
|
|
||||||
|
|
||||||
"""
|
|
||||||
objects = []
|
|
||||||
opens = 0
|
|
||||||
start = s.find("{")
|
|
||||||
offset = start
|
|
||||||
|
|
||||||
if start < 0:
|
|
||||||
return []
|
|
||||||
|
|
||||||
for index, c in enumerate(s[offset:]):
|
|
||||||
if c == "{":
|
|
||||||
opens += 1
|
|
||||||
elif c == "}":
|
|
||||||
opens -= 1
|
|
||||||
if opens == 0:
|
|
||||||
objects.append((start, index+offset+1))
|
|
||||||
start = index + offset + 1
|
|
||||||
|
|
||||||
return objects
|
|
||||||
|
|
||||||
|
|
||||||
class Config(object):
|
|
||||||
"""
|
|
||||||
This class is used to access/create/modify config files
|
|
||||||
|
|
||||||
:param filename: the name of the config file
|
|
||||||
:param defaults: dictionary of default values
|
|
||||||
:param config_dir: the path to the config directory
|
|
||||||
|
|
||||||
"""
|
|
||||||
def __init__(self, filename, defaults=None, config_dir=None):
|
|
||||||
self.__config = {}
|
|
||||||
self.__set_functions = {}
|
|
||||||
self.__change_callbacks = []
|
|
||||||
|
|
||||||
# These hold the version numbers and they will be set when loaded
|
|
||||||
self.__version = {
|
|
||||||
"format": 1,
|
|
||||||
"file": 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# This will get set with a reactor.callLater whenever a config option
|
|
||||||
# is set.
|
|
||||||
self._save_timer = None
|
|
||||||
|
|
||||||
if defaults:
|
|
||||||
self.__config = dict(defaults)
|
|
||||||
|
|
||||||
# Load the config from file in the config_dir
|
|
||||||
if config_dir:
|
|
||||||
self.__config_file = os.path.join(config_dir, filename)
|
|
||||||
else:
|
|
||||||
self.__config_file = deluge.common.get_default_config_dir(filename)
|
|
||||||
|
|
||||||
self.load()
|
|
||||||
|
|
||||||
def __contains__(self, item):
|
|
||||||
return item in self.__config
|
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
|
||||||
"""
|
|
||||||
See
|
|
||||||
:meth:`set_item`
|
|
||||||
"""
|
|
||||||
|
|
||||||
return self.set_item(key, value)
|
|
||||||
|
|
||||||
def set_item(self, key, value):
|
|
||||||
"""
|
|
||||||
Sets item 'key' to 'value' in the config dictionary, but does not allow
|
|
||||||
changing the item's type unless it is None. If the types do not match,
|
|
||||||
it will attempt to convert it to the set type before raising a ValueError.
|
|
||||||
|
|
||||||
:param key: string, item to change to change
|
|
||||||
:param value: the value to change item to, must be same type as what is currently in the config
|
|
||||||
|
|
||||||
:raises ValueError: raised when the type of value is not the same as\
|
|
||||||
what is currently in the config and it could not convert the value
|
|
||||||
|
|
||||||
**Usage**
|
|
||||||
|
|
||||||
>>> config = Config("test.conf")
|
|
||||||
>>> config["test"] = 5
|
|
||||||
>>> config["test"]
|
|
||||||
5
|
|
||||||
|
|
||||||
"""
|
|
||||||
if not self.__config.has_key(key):
|
|
||||||
self.__config[key] = value
|
|
||||||
log.debug("Setting '%s' to %s of %s", key, value, type(value))
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.__config[key] == value:
|
|
||||||
return
|
|
||||||
|
|
||||||
# Do not allow the type to change unless it is None
|
|
||||||
oldtype, newtype = type(self.__config[key]), type(value)
|
|
||||||
|
|
||||||
if value is not None and oldtype != type(None) and oldtype != newtype:
|
|
||||||
try:
|
|
||||||
value = oldtype(value)
|
|
||||||
except ValueError:
|
|
||||||
log.warning("Type '%s' invalid for '%s'", newtype, key)
|
|
||||||
raise
|
|
||||||
|
|
||||||
log.debug("Setting '%s' to %s of %s", key, value, type(value))
|
|
||||||
|
|
||||||
self.__config[key] = value
|
|
||||||
# Run the set_function for this key if any
|
|
||||||
from twisted.internet import reactor
|
|
||||||
try:
|
|
||||||
for func in self.__set_functions[key]:
|
|
||||||
reactor.callLater(0, func, key, value)
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
def do_change_callbacks(key, value):
|
|
||||||
for func in self.__change_callbacks:
|
|
||||||
func(key, value)
|
|
||||||
reactor.callLater(0, do_change_callbacks, key, value)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# We set the save_timer for 5 seconds if not already set
|
|
||||||
if not self._save_timer or not self._save_timer.active():
|
|
||||||
self._save_timer = reactor.callLater(5, self.save)
|
|
||||||
|
|
||||||
def __getitem__(self, key):
|
|
||||||
"""
|
|
||||||
See
|
|
||||||
:meth:`get_item`
|
|
||||||
"""
|
|
||||||
return self.get_item(key)
|
|
||||||
|
|
||||||
def get_item(self, key):
|
|
||||||
"""
|
|
||||||
Gets the value of item 'key'
|
|
||||||
|
|
||||||
:param key: the item for which you want it's value
|
|
||||||
:return: the value of item 'key'
|
|
||||||
|
|
||||||
:raises KeyError: if 'key' is not in the config dictionary
|
|
||||||
|
|
||||||
**Usage**
|
|
||||||
|
|
||||||
>>> config = Config("test.conf", defaults={"test": 5})
|
|
||||||
>>> config["test"]
|
|
||||||
5
|
|
||||||
|
|
||||||
"""
|
|
||||||
return self.__config[key]
|
|
||||||
|
|
||||||
def register_change_callback(self, callback):
|
|
||||||
"""
|
|
||||||
Registers a callback function that will be called when a value is changed in the config dictionary
|
|
||||||
|
|
||||||
:param callback: the function, callback(key, value)
|
|
||||||
|
|
||||||
**Usage**
|
|
||||||
|
|
||||||
>>> config = Config("test.conf", defaults={"test": 5})
|
|
||||||
>>> def cb(key, value):
|
|
||||||
... print key, value
|
|
||||||
...
|
|
||||||
>>> config.register_change_callback(cb)
|
|
||||||
|
|
||||||
"""
|
|
||||||
self.__change_callbacks.append(callback)
|
|
||||||
|
|
||||||
def register_set_function(self, key, function, apply_now=True):
|
|
||||||
"""
|
|
||||||
Register a function to be called when a config value changes
|
|
||||||
|
|
||||||
:param key: the item to monitor for change
|
|
||||||
:param function: the function to call when the value changes, f(key, value)
|
|
||||||
:keyword apply_now: if True, the function will be called after it's registered
|
|
||||||
|
|
||||||
**Usage**
|
|
||||||
|
|
||||||
>>> config = Config("test.conf", defaults={"test": 5})
|
|
||||||
>>> def cb(key, value):
|
|
||||||
... print key, value
|
|
||||||
...
|
|
||||||
>>> config.register_set_function("test", cb, apply_now=True)
|
|
||||||
test 5
|
|
||||||
|
|
||||||
"""
|
|
||||||
log.debug("Registering function for %s key..", key)
|
|
||||||
if key not in self.__set_functions:
|
|
||||||
self.__set_functions[key] = []
|
|
||||||
|
|
||||||
self.__set_functions[key].append(function)
|
|
||||||
|
|
||||||
# Run the function now if apply_now is set
|
|
||||||
if apply_now:
|
|
||||||
function(key, self.__config[key])
|
|
||||||
return
|
|
||||||
|
|
||||||
def apply_all(self):
|
|
||||||
"""
|
|
||||||
Calls all set functions
|
|
||||||
|
|
||||||
**Usage**
|
|
||||||
|
|
||||||
>>> config = Config("test.conf", defaults={"test": 5})
|
|
||||||
>>> def cb(key, value):
|
|
||||||
... print key, value
|
|
||||||
...
|
|
||||||
>>> config.register_set_function("test", cb, apply_now=False)
|
|
||||||
>>> config.apply_all()
|
|
||||||
test 5
|
|
||||||
|
|
||||||
"""
|
|
||||||
log.debug("Calling all set functions..")
|
|
||||||
for key, value in self.__set_functions.iteritems():
|
|
||||||
for func in value:
|
|
||||||
func(key, self.__config[key])
|
|
||||||
|
|
||||||
def apply_set_functions(self, key):
|
|
||||||
"""
|
|
||||||
Calls set functions for `:param:key`.
|
|
||||||
|
|
||||||
:param key: str, the config key
|
|
||||||
|
|
||||||
"""
|
|
||||||
log.debug("Calling set functions for key %s..", key)
|
|
||||||
if key in self.__set_functions:
|
|
||||||
for func in self.__set_functions[key]:
|
|
||||||
func(key, self.__config[key])
|
|
||||||
|
|
||||||
def load(self, filename=None):
|
|
||||||
"""
|
|
||||||
Load a config file
|
|
||||||
|
|
||||||
:param filename: if None, uses filename set in object initialization
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
if not filename:
|
|
||||||
filename = self.__config_file
|
|
||||||
|
|
||||||
try:
|
|
||||||
data = open(filename, "rb").read()
|
|
||||||
except IOError, e:
|
|
||||||
log.warning("Unable to open config file %s: %s", filename, e)
|
|
||||||
return
|
|
||||||
|
|
||||||
objects = find_json_objects(data)
|
|
||||||
|
|
||||||
if not len(objects):
|
|
||||||
# No json objects found, try depickling it
|
|
||||||
try:
|
|
||||||
self.__config.update(pickle.loads(data))
|
|
||||||
except Exception, e:
|
|
||||||
log.exception(e)
|
|
||||||
log.warning("Unable to load config file: %s", filename)
|
|
||||||
elif len(objects) == 1:
|
|
||||||
start, end = objects[0]
|
|
||||||
try:
|
|
||||||
self.__config.update(json.loads(data[start:end]))
|
|
||||||
except Exception, e:
|
|
||||||
log.exception(e)
|
|
||||||
log.warning("Unable to load config file: %s", filename)
|
|
||||||
elif len(objects) == 2:
|
|
||||||
try:
|
|
||||||
start, end = objects[0]
|
|
||||||
self.__version.update(json.loads(data[start:end]))
|
|
||||||
start, end = objects[1]
|
|
||||||
self.__config.update(json.loads(data[start:end]))
|
|
||||||
except Exception, e:
|
|
||||||
log.exception(e)
|
|
||||||
log.warning("Unable to load config file: %s", filename)
|
|
||||||
|
|
||||||
log.debug("Config %s version: %s.%s loaded: %s", filename,
|
|
||||||
self.__version["format"], self.__version["file"], self.__config)
|
|
||||||
|
|
||||||
def save(self, filename=None):
|
|
||||||
"""
|
|
||||||
Save configuration to disk
|
|
||||||
|
|
||||||
:param filename: if None, uses filename set in object initiliazation
|
|
||||||
:rtype bool:
|
|
||||||
:return: whether or not the save succeeded.
|
|
||||||
|
|
||||||
"""
|
|
||||||
if not filename:
|
|
||||||
filename = self.__config_file
|
|
||||||
# Check to see if the current config differs from the one on disk
|
|
||||||
# We will only write a new config file if there is a difference
|
|
||||||
try:
|
|
||||||
data = open(filename, "rb").read()
|
|
||||||
objects = find_json_objects(data)
|
|
||||||
start, end = objects[0]
|
|
||||||
version = json.loads(data[start:end])
|
|
||||||
start, end = objects[1]
|
|
||||||
loaded_data = json.loads(data[start:end])
|
|
||||||
|
|
||||||
if self.__config == loaded_data and self.__version == version:
|
|
||||||
# The config has not changed so lets just return
|
|
||||||
self._save_timer.cancel()
|
|
||||||
return
|
|
||||||
except Exception, e:
|
|
||||||
log.warning("Unable to open config file: %s", filename)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Save the new config and make sure it's written to disk
|
|
||||||
try:
|
|
||||||
log.debug("Saving new config file %s", filename + ".new")
|
|
||||||
f = open(filename + ".new", "wb")
|
|
||||||
json.dump(self.__version, f, indent=2)
|
|
||||||
json.dump(self.__config, f, indent=2)
|
|
||||||
f.flush()
|
|
||||||
os.fsync(f.fileno())
|
|
||||||
f.close()
|
|
||||||
except Exception, e:
|
|
||||||
log.error("Error writing new config file: %s", e)
|
|
||||||
return False
|
|
||||||
|
|
||||||
# Make a backup of the old config
|
|
||||||
try:
|
|
||||||
log.debug("Backing up old config file to %s~", filename)
|
|
||||||
shutil.move(filename, filename + "~")
|
|
||||||
except Exception, e:
|
|
||||||
log.error("Error backing up old config..")
|
|
||||||
|
|
||||||
# The new config file has been written successfully, so let's move it over
|
|
||||||
# the existing one.
|
|
||||||
try:
|
|
||||||
log.debug("Moving new config file %s to %s..", filename + ".new", filename)
|
|
||||||
shutil.move(filename + ".new", filename)
|
|
||||||
except Exception, e:
|
|
||||||
log.error("Error moving new config file: %s", e)
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
finally:
|
|
||||||
if self._save_timer and self._save_timer.active():
|
|
||||||
self._save_timer.cancel()
|
|
||||||
|
|
||||||
def run_converter(self, input_range, output_version, func):
|
|
||||||
"""
|
|
||||||
Runs a function that will convert file versions in the `:param:input_range`
|
|
||||||
to the `:param:output_version`.
|
|
||||||
|
|
||||||
:param input_range: tuple, (int, int) the range of input versions this
|
|
||||||
function will accept
|
|
||||||
:param output_version: int, the version this function will return
|
|
||||||
:param func: func, the function that will do the conversion, it will take
|
|
||||||
the config dict as an argument and return the augmented dict
|
|
||||||
|
|
||||||
:raises ValueError: if the output_version is less than the input_range
|
|
||||||
|
|
||||||
"""
|
|
||||||
if output_version in input_range or output_version <= max(input_range):
|
|
||||||
raise ValueError("output_version needs to be greater than input_range")
|
|
||||||
|
|
||||||
if self.__version["file"] not in input_range:
|
|
||||||
log.debug("File version %s is not in input_range %s, ignoring converter function..",
|
|
||||||
self.__version["file"], input_range)
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
self.__config = func(self.__config)
|
|
||||||
except Exception, e:
|
|
||||||
log.exception(e)
|
|
||||||
log.error("There was an exception try to convert config file %s %s to %s",
|
|
||||||
self.__config_file, self.__version["file"], output_version)
|
|
||||||
raise e
|
|
||||||
else:
|
|
||||||
self.__version["file"] = output_version
|
|
||||||
self.save()
|
|
||||||
|
|
||||||
@property
|
|
||||||
def config_file(self):
|
|
||||||
return self.__config_file
|
|
||||||
|
|
||||||
@prop
|
|
||||||
def config():
|
|
||||||
"""The config dictionary"""
|
|
||||||
def fget(self):
|
|
||||||
return self.__config
|
|
||||||
def fdel(self):
|
|
||||||
return self.save()
|
|
||||||
return locals()
|
|
@@ -1,135 +0,0 @@
|
|||||||
#
|
|
||||||
# configmanager.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
import deluge.common
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
from deluge.config import Config
|
|
||||||
|
|
||||||
class _ConfigManager:
|
|
||||||
def __init__(self):
|
|
||||||
log.debug("ConfigManager started..")
|
|
||||||
self.config_files = {}
|
|
||||||
self.__config_directory = None
|
|
||||||
|
|
||||||
@property
|
|
||||||
def config_directory(self):
|
|
||||||
if self.__config_directory is None:
|
|
||||||
self.__config_directory = deluge.common.get_default_config_dir()
|
|
||||||
return self.__config_directory
|
|
||||||
|
|
||||||
def __del__(self):
|
|
||||||
log.debug("ConfigManager stopping..")
|
|
||||||
del self.config_files
|
|
||||||
|
|
||||||
def set_config_dir(self, directory):
|
|
||||||
"""
|
|
||||||
Sets the config directory.
|
|
||||||
|
|
||||||
:param directory: str, the directory where the config info should be
|
|
||||||
|
|
||||||
:returns bool: True if successfully changed directory, False if not
|
|
||||||
"""
|
|
||||||
|
|
||||||
if not directory:
|
|
||||||
return False
|
|
||||||
|
|
||||||
log.info("Setting config directory to: %s", directory)
|
|
||||||
if not os.path.exists(directory):
|
|
||||||
# Try to create the config folder if it doesn't exist
|
|
||||||
try:
|
|
||||||
os.makedirs(directory)
|
|
||||||
except Exception, e:
|
|
||||||
log.error("Unable to make config directory: %s", e)
|
|
||||||
return False
|
|
||||||
elif not os.path.isdir(directory):
|
|
||||||
log.error("Config directory needs to be a directory!")
|
|
||||||
return False
|
|
||||||
|
|
||||||
self.__config_directory = directory
|
|
||||||
|
|
||||||
# Reset the config_files so we don't get config from old config folder
|
|
||||||
# XXX: Probably should have it go through the config_files dict and try
|
|
||||||
# to reload based on the new config directory
|
|
||||||
self.save()
|
|
||||||
self.config_files = {}
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def get_config_dir(self):
|
|
||||||
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 value in self.config_files.values():
|
|
||||||
value.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()
|
|
||||||
|
|
||||||
def ConfigManager(config, defaults=None):
|
|
||||||
return _configmanager.get_config(config, defaults)
|
|
||||||
|
|
||||||
def set_config_dir(directory):
|
|
||||||
"""Sets the config directory, else just uses default"""
|
|
||||||
return _configmanager.set_config_dir(directory)
|
|
||||||
|
|
||||||
def get_config_dir(filename=None):
|
|
||||||
if 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,124 +0,0 @@
|
|||||||
#
|
|
||||||
# alertmanager.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
The AlertManager handles all the libtorrent alerts.
|
|
||||||
|
|
||||||
This should typically only be used by the Core. Plugins should utilize the
|
|
||||||
`:mod:EventManager` for similar functionality.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
from twisted.internet import reactor
|
|
||||||
|
|
||||||
import deluge.component as component
|
|
||||||
from deluge._libtorrent import lt
|
|
||||||
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
|
|
||||||
class AlertManager(component.Component):
|
|
||||||
def __init__(self):
|
|
||||||
log.debug("AlertManager initialized..")
|
|
||||||
component.Component.__init__(self, "AlertManager", interval=0.05)
|
|
||||||
self.session = component.get("Core").session
|
|
||||||
|
|
||||||
self.session.set_alert_mask(
|
|
||||||
lt.alert.category_t.error_notification |
|
|
||||||
lt.alert.category_t.port_mapping_notification |
|
|
||||||
lt.alert.category_t.storage_notification |
|
|
||||||
lt.alert.category_t.tracker_notification |
|
|
||||||
lt.alert.category_t.status_notification |
|
|
||||||
lt.alert.category_t.ip_block_notification |
|
|
||||||
lt.alert.category_t.performance_warning)
|
|
||||||
|
|
||||||
# handlers is a dictionary of lists {"alert_type": [handler1,h2,..]}
|
|
||||||
self.handlers = {}
|
|
||||||
|
|
||||||
def update(self):
|
|
||||||
self.handle_alerts()
|
|
||||||
|
|
||||||
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: handler(alert)
|
|
||||||
Where 'alert' is the actual alert object from libtorrent.
|
|
||||||
|
|
||||||
:param alert_type: str, this is string representation of the alert name
|
|
||||||
:param handler: func(alert), the function to be called when the alert is raised
|
|
||||||
"""
|
|
||||||
if alert_type not in self.handlers:
|
|
||||||
# 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 `:param:handler` function from all alert types.
|
|
||||||
|
|
||||||
:param handler: func, the handler function to deregister
|
|
||||||
"""
|
|
||||||
# Iterate through all handlers and remove 'handler' where found
|
|
||||||
for (key, value) in self.handlers.items():
|
|
||||||
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.
|
|
||||||
|
|
||||||
:param wait: bool, if True then the handler functions will be run right
|
|
||||||
away and waited to return before processing the next alert
|
|
||||||
"""
|
|
||||||
alert = self.session.pop_alert()
|
|
||||||
# Loop through all alerts in the queue
|
|
||||||
while alert is not None:
|
|
||||||
alert_type = type(alert).__name__
|
|
||||||
# Display the alert message
|
|
||||||
log.debug("%s: %s", alert_type, alert.message())
|
|
||||||
# Call any handlers for this alert type
|
|
||||||
if alert_type in self.handlers:
|
|
||||||
for handler in self.handlers[alert_type]:
|
|
||||||
if not wait:
|
|
||||||
reactor.callLater(0, handler, alert)
|
|
||||||
else:
|
|
||||||
handler(alert)
|
|
||||||
|
|
||||||
alert = self.session.pop_alert()
|
|
@@ -1,146 +0,0 @@
|
|||||||
#
|
|
||||||
# authmanager.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
import os
|
|
||||||
import random
|
|
||||||
import stat
|
|
||||||
|
|
||||||
import deluge.component as component
|
|
||||||
import deluge.configmanager as configmanager
|
|
||||||
import deluge.error
|
|
||||||
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
|
|
||||||
AUTH_LEVEL_NONE = 0
|
|
||||||
AUTH_LEVEL_READONLY = 1
|
|
||||||
AUTH_LEVEL_NORMAL = 5
|
|
||||||
AUTH_LEVEL_ADMIN = 10
|
|
||||||
|
|
||||||
AUTH_LEVEL_DEFAULT = AUTH_LEVEL_NORMAL
|
|
||||||
|
|
||||||
class BadLoginError(deluge.error.DelugeError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class AuthManager(component.Component):
|
|
||||||
def __init__(self):
|
|
||||||
component.Component.__init__(self, "AuthManager")
|
|
||||||
self.__auth = {}
|
|
||||||
|
|
||||||
def start(self):
|
|
||||||
self.__load_auth_file()
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
self.__auth = {}
|
|
||||||
|
|
||||||
def shutdown(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def authorize(self, username, password):
|
|
||||||
"""
|
|
||||||
Authorizes users based on username and password
|
|
||||||
|
|
||||||
:param username: str, username
|
|
||||||
:param password: str, password
|
|
||||||
:returns: int, the auth level for this user
|
|
||||||
:rtype: int
|
|
||||||
|
|
||||||
:raises BadLoginError: if the username does not exist or password does not match
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
if username not in self.__auth:
|
|
||||||
# Let's try to re-load the file.. Maybe it's been updated
|
|
||||||
self.__load_auth_file()
|
|
||||||
if username not in self.__auth:
|
|
||||||
raise BadLoginError("Username does not exist")
|
|
||||||
|
|
||||||
if self.__auth[username][0] == password:
|
|
||||||
# Return the users auth level
|
|
||||||
return int(self.__auth[username][1])
|
|
||||||
else:
|
|
||||||
raise BadLoginError("Password does not match")
|
|
||||||
|
|
||||||
def __create_localclient_account(self):
|
|
||||||
"""
|
|
||||||
Returns the string.
|
|
||||||
"""
|
|
||||||
# We create a 'localclient' account with a random password
|
|
||||||
try:
|
|
||||||
from hashlib import sha1 as sha_hash
|
|
||||||
except ImportError:
|
|
||||||
from sha import new as sha_hash
|
|
||||||
return "localclient:" + sha_hash(str(random.random())).hexdigest() + ":" + str(AUTH_LEVEL_ADMIN) + "\n"
|
|
||||||
|
|
||||||
def __load_auth_file(self):
|
|
||||||
auth_file = configmanager.get_config_dir("auth")
|
|
||||||
# Check for auth file and create if necessary
|
|
||||||
if not os.path.exists(auth_file):
|
|
||||||
localclient = self.__create_localclient_account()
|
|
||||||
fd = open(auth_file, "w")
|
|
||||||
fd.write(localclient)
|
|
||||||
fd.flush()
|
|
||||||
os.fsync(fd.fileno())
|
|
||||||
fd.close()
|
|
||||||
# Change the permissions on the file so only this user can read/write it
|
|
||||||
os.chmod(auth_file, stat.S_IREAD | stat.S_IWRITE)
|
|
||||||
f = [localclient]
|
|
||||||
else:
|
|
||||||
# Load the auth file into a dictionary: {username: password, ...}
|
|
||||||
f = open(auth_file, "r").readlines()
|
|
||||||
|
|
||||||
for line in f:
|
|
||||||
if line.startswith("#"):
|
|
||||||
# This is a comment line
|
|
||||||
continue
|
|
||||||
line = line.strip()
|
|
||||||
try:
|
|
||||||
lsplit = line.split(":")
|
|
||||||
except Exception, e:
|
|
||||||
log.error("Your auth file is malformed: %s", e)
|
|
||||||
continue
|
|
||||||
if len(lsplit) == 2:
|
|
||||||
username, password = lsplit
|
|
||||||
log.warning("Your auth entry for %s contains no auth level, using AUTH_LEVEL_DEFAULT(%s)..", username, AUTH_LEVEL_DEFAULT)
|
|
||||||
level = AUTH_LEVEL_DEFAULT
|
|
||||||
elif len(lsplit) == 3:
|
|
||||||
username, password, level = lsplit
|
|
||||||
else:
|
|
||||||
log.error("Your auth file is malformed: Incorrect number of fields!")
|
|
||||||
continue
|
|
||||||
|
|
||||||
self.__auth[username.strip()] = (password.strip(), level)
|
|
||||||
|
|
||||||
if "localclient" not in self.__auth:
|
|
||||||
open(auth_file, "a").write(self.__create_localclient_account())
|
|
@@ -1,135 +0,0 @@
|
|||||||
#
|
|
||||||
# autoadd.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.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from deluge._libtorrent import lt
|
|
||||||
|
|
||||||
import deluge.component as component
|
|
||||||
from deluge.configmanager import ConfigManager
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
|
|
||||||
MAX_NUM_ATTEMPTS = 10
|
|
||||||
|
|
||||||
class AutoAdd(component.Component):
|
|
||||||
def __init__(self):
|
|
||||||
component.Component.__init__(self, "AutoAdd", depend=["TorrentManager"], interval=5)
|
|
||||||
# Get the core config
|
|
||||||
self.config = ConfigManager("core.conf")
|
|
||||||
|
|
||||||
# A list of filenames
|
|
||||||
self.invalid_torrents = []
|
|
||||||
# Filename:Attempts
|
|
||||||
self.attempts = {}
|
|
||||||
|
|
||||||
# Register set functions
|
|
||||||
self.config.register_set_function("autoadd_enable",
|
|
||||||
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.isdir(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":
|
|
||||||
try:
|
|
||||||
filepath = os.path.join(self.config["autoadd_location"], filename)
|
|
||||||
except UnicodeDecodeError, e:
|
|
||||||
log.error("Unable to auto add torrent due to inproper filename encoding: %s", e)
|
|
||||||
continue
|
|
||||||
try:
|
|
||||||
filedump = self.load_torrent(filepath)
|
|
||||||
except (RuntimeError, Exception), e:
|
|
||||||
# If the torrent is invalid, we keep track of it so that we
|
|
||||||
# can try again on the next pass. This is because some
|
|
||||||
# torrents may not be fully saved during the pass.
|
|
||||||
log.debug("Torrent is invalid: %s", e)
|
|
||||||
if filename in self.invalid_torrents:
|
|
||||||
self.attempts[filename] += 1
|
|
||||||
if self.attempts[filename] >= MAX_NUM_ATTEMPTS:
|
|
||||||
os.rename(filepath, filepath + ".invalid")
|
|
||||||
del self.attempts[filename]
|
|
||||||
self.invalid_torrents.remove(filename)
|
|
||||||
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):
|
|
||||||
log.debug("_on_autoadd_enable")
|
|
||||||
if value:
|
|
||||||
component.resume("AutoAdd")
|
|
||||||
else:
|
|
||||||
component.pause("AutoAdd")
|
|
||||||
|
|
||||||
def _on_autoadd_location(self, key, value):
|
|
||||||
log.debug("_on_autoadd_location")
|
|
||||||
# We need to resume the component just incase it was paused due to
|
|
||||||
# an invalid autoadd location.
|
|
||||||
if self.config["autoadd_enable"]:
|
|
||||||
component.resume("AutoAdd")
|
|
@@ -1,824 +0,0 @@
|
|||||||
#
|
|
||||||
# core.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
from deluge._libtorrent import lt
|
|
||||||
|
|
||||||
import os
|
|
||||||
import glob
|
|
||||||
import base64
|
|
||||||
import shutil
|
|
||||||
import threading
|
|
||||||
import pkg_resources
|
|
||||||
import warnings
|
|
||||||
|
|
||||||
|
|
||||||
from twisted.internet import reactor, defer
|
|
||||||
from twisted.internet.task import LoopingCall
|
|
||||||
import twisted.web.client
|
|
||||||
|
|
||||||
from deluge.httpdownloader import download_file
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import deluge.configmanager
|
|
||||||
import deluge.common
|
|
||||||
import deluge.component as component
|
|
||||||
from deluge.event import *
|
|
||||||
from deluge.error import *
|
|
||||||
from deluge.core.torrentmanager import TorrentManager
|
|
||||||
from deluge.core.pluginmanager import PluginManager
|
|
||||||
from deluge.core.alertmanager import AlertManager
|
|
||||||
from deluge.core.filtermanager import FilterManager
|
|
||||||
from deluge.core.preferencesmanager import PreferencesManager
|
|
||||||
from deluge.core.autoadd import AutoAdd
|
|
||||||
from deluge.core.authmanager import AuthManager
|
|
||||||
from deluge.core.eventmanager import EventManager
|
|
||||||
from deluge.core.rpcserver import export
|
|
||||||
|
|
||||||
class Core(component.Component):
|
|
||||||
def __init__(self, listen_interface=None):
|
|
||||||
log.debug("Core init..")
|
|
||||||
component.Component.__init__(self, "Core")
|
|
||||||
|
|
||||||
# Start the libtorrent session
|
|
||||||
log.info("Starting libtorrent %s session..", lt.version)
|
|
||||||
|
|
||||||
# Create the client fingerprint
|
|
||||||
version = [int(value.split("-")[0]) for value in deluge.common.get_version().split(".")]
|
|
||||||
while len(version) < 4:
|
|
||||||
version.append(0)
|
|
||||||
|
|
||||||
self.session = lt.session(lt.fingerprint("DE", *version), flags=0)
|
|
||||||
|
|
||||||
# Load the session state if available
|
|
||||||
self.__load_session_state()
|
|
||||||
|
|
||||||
# Set the user agent
|
|
||||||
self.settings = lt.session_settings()
|
|
||||||
self.settings.user_agent = "Deluge %s" % deluge.common.get_version()
|
|
||||||
|
|
||||||
# Set session settings
|
|
||||||
self.settings.send_redundant_have = True
|
|
||||||
self.session.set_settings(self.settings)
|
|
||||||
|
|
||||||
# Load metadata extension
|
|
||||||
self.session.add_extension(lt.create_metadata_plugin)
|
|
||||||
self.session.add_extension(lt.create_ut_metadata_plugin)
|
|
||||||
self.session.add_extension(lt.create_smart_ban_plugin)
|
|
||||||
|
|
||||||
# Create the components
|
|
||||||
self.eventmanager = EventManager()
|
|
||||||
self.preferencesmanager = PreferencesManager()
|
|
||||||
self.alertmanager = AlertManager()
|
|
||||||
self.pluginmanager = PluginManager(self)
|
|
||||||
self.torrentmanager = TorrentManager()
|
|
||||||
self.filtermanager = FilterManager(self)
|
|
||||||
self.autoadd = AutoAdd()
|
|
||||||
self.authmanager = AuthManager()
|
|
||||||
|
|
||||||
# New release check information
|
|
||||||
self.new_release = None
|
|
||||||
|
|
||||||
# Get the core config
|
|
||||||
self.config = deluge.configmanager.ConfigManager("core.conf")
|
|
||||||
|
|
||||||
# If there was an interface value from the command line, use it, but
|
|
||||||
# store the one in the config so we can restore it on shutdown
|
|
||||||
self.__old_interface = None
|
|
||||||
if listen_interface:
|
|
||||||
self.__old_interface = self.config["listen_interface"]
|
|
||||||
self.config["listen_interface"] = listen_interface
|
|
||||||
|
|
||||||
def start(self):
|
|
||||||
"""Starts the core"""
|
|
||||||
# New release check information
|
|
||||||
self.__new_release = None
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
# Save the DHT state if necessary
|
|
||||||
if self.config["dht"]:
|
|
||||||
self.save_dht_state()
|
|
||||||
# Save the libtorrent session state
|
|
||||||
self.__save_session_state()
|
|
||||||
|
|
||||||
# We stored a copy of the old interface value
|
|
||||||
if self.__old_interface:
|
|
||||||
self.config["listen_interface"] = self.__old_interface
|
|
||||||
|
|
||||||
# Make sure the config file has been saved
|
|
||||||
self.config.save()
|
|
||||||
|
|
||||||
def shutdown(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def __save_session_state(self):
|
|
||||||
"""Saves the libtorrent session state"""
|
|
||||||
try:
|
|
||||||
open(deluge.configmanager.get_config_dir("session.state"), "wb").write(
|
|
||||||
lt.bencode(self.session.state()))
|
|
||||||
except Exception, e:
|
|
||||||
log.warning("Failed to save lt state: %s", e)
|
|
||||||
|
|
||||||
def __load_session_state(self):
|
|
||||||
"""Loads the libtorrent session state"""
|
|
||||||
try:
|
|
||||||
self.session.load_state(lt.bdecode(
|
|
||||||
open(deluge.configmanager.get_config_dir("session.state"), "rb").read()))
|
|
||||||
except Exception, e:
|
|
||||||
log.warning("Failed to load lt state: %s", e)
|
|
||||||
|
|
||||||
def save_dht_state(self):
|
|
||||||
"""Saves the dht state to a file"""
|
|
||||||
try:
|
|
||||||
dht_data = open(deluge.configmanager.get_config_dir("dht.state"), "wb")
|
|
||||||
dht_data.write(lt.bencode(self.session.dht_state()))
|
|
||||||
dht_data.close()
|
|
||||||
except Exception, e:
|
|
||||||
log.warning("Failed to save dht state: %s", e)
|
|
||||||
|
|
||||||
def get_new_release(self):
|
|
||||||
log.debug("get_new_release")
|
|
||||||
from urllib2 import urlopen
|
|
||||||
try:
|
|
||||||
self.new_release = urlopen(
|
|
||||||
"http://download.deluge-torrent.org/version-1.0").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)
|
|
||||||
if deluge.common.VersionSplit(self.new_release) > deluge.common.VersionSplit(deluge.common.get_version()):
|
|
||||||
component.get("EventManager").emit(NewVersionAvailableEvent(self.new_release))
|
|
||||||
return self.new_release
|
|
||||||
return False
|
|
||||||
|
|
||||||
# Exported Methods
|
|
||||||
@export
|
|
||||||
def add_torrent_file(self, filename, filedump, options):
|
|
||||||
"""
|
|
||||||
Adds a torrent file to the session.
|
|
||||||
|
|
||||||
:param filename: the filename of the torrent
|
|
||||||
:type filename: string
|
|
||||||
:param filedump: a base64 encoded string of the torrent file contents
|
|
||||||
:type filedump: string
|
|
||||||
:param options: the options to apply to the torrent on add
|
|
||||||
:type options: dict
|
|
||||||
|
|
||||||
:returns: the torrent_id as a str or None
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
filedump = base64.decodestring(filedump)
|
|
||||||
except Exception, e:
|
|
||||||
log.error("There was an error decoding the filedump string!")
|
|
||||||
log.exception(e)
|
|
||||||
|
|
||||||
try:
|
|
||||||
torrent_id = self.torrentmanager.add(filedump=filedump, options=options, filename=filename)
|
|
||||||
except Exception, e:
|
|
||||||
log.error("There was an error adding the torrent file %s", filename)
|
|
||||||
log.exception(e)
|
|
||||||
torrent_id = None
|
|
||||||
|
|
||||||
return torrent_id
|
|
||||||
|
|
||||||
@export
|
|
||||||
def add_torrent_url(self, url, options, headers=None):
|
|
||||||
"""
|
|
||||||
Adds a torrent from a url. Deluge will attempt to fetch the torrent
|
|
||||||
from url prior to adding it to the session.
|
|
||||||
|
|
||||||
:param url: the url pointing to the torrent file
|
|
||||||
:type url: string
|
|
||||||
:param options: the options to apply to the torrent on add
|
|
||||||
:type options: dict
|
|
||||||
:param headers: any optional headers to send
|
|
||||||
:type headers: dict
|
|
||||||
|
|
||||||
:returns: a Deferred which returns the torrent_id as a str or None
|
|
||||||
"""
|
|
||||||
log.info("Attempting to add url %s", url)
|
|
||||||
def on_get_file(filename):
|
|
||||||
# We got the file, so add it to the session
|
|
||||||
data = open(filename, "rb").read()
|
|
||||||
return self.add_torrent_file(filename, base64.encodestring(data), options)
|
|
||||||
|
|
||||||
def on_get_file_error(failure):
|
|
||||||
# Log the error and pass the failure onto the client
|
|
||||||
log.error("Error occured downloading torrent from %s", url)
|
|
||||||
log.error("Reason: %s", failure.getErrorMessage())
|
|
||||||
return failure
|
|
||||||
|
|
||||||
d = download_file(url, url.split("/")[-1], headers=headers)
|
|
||||||
d.addCallback(on_get_file)
|
|
||||||
d.addErrback(on_get_file_error)
|
|
||||||
return d
|
|
||||||
|
|
||||||
@export
|
|
||||||
def add_torrent_magnet(self, uri, options):
|
|
||||||
"""
|
|
||||||
Adds a torrent from a magnet link.
|
|
||||||
|
|
||||||
:param uri: the magnet link
|
|
||||||
:type uri: string
|
|
||||||
:param options: the options to apply to the torrent on add
|
|
||||||
:type options: dict
|
|
||||||
|
|
||||||
:returns: the torrent_id
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
log.debug("Attempting to add by magnet uri: %s", uri)
|
|
||||||
|
|
||||||
return self.torrentmanager.add(magnet=uri, options=options)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def remove_torrent(self, torrent_id, remove_data):
|
|
||||||
"""
|
|
||||||
Removes a torrent from the session.
|
|
||||||
|
|
||||||
:param torrent_id: the torrent_id of the torrent to remove
|
|
||||||
:type torrent_id: string
|
|
||||||
:param remove_data: if True, remove the data associated with this torrent
|
|
||||||
:type remove_data: boolean
|
|
||||||
:returns: True if removed successfully
|
|
||||||
:rtype: bool
|
|
||||||
|
|
||||||
:raises InvalidTorrentError: if the torrent_id does not exist in the session
|
|
||||||
|
|
||||||
"""
|
|
||||||
log.debug("Removing torrent %s from the core.", torrent_id)
|
|
||||||
return self.torrentmanager.remove(torrent_id, remove_data)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_stats(self):
|
|
||||||
"""
|
|
||||||
Deprecated: please use get_session_status()
|
|
||||||
|
|
||||||
"""
|
|
||||||
warnings.warn("Use get_session_status() instead of get_stats()", DeprecationWarning)
|
|
||||||
stats = self.get_session_status(["payload_download_rate", "payload_upload_rate",
|
|
||||||
"dht_nodes", "has_incoming_connections", "download_rate", "upload_rate"])
|
|
||||||
|
|
||||||
stats.update({
|
|
||||||
#dynamic stats:
|
|
||||||
"num_connections":self.session.num_connections(),
|
|
||||||
"free_space":deluge.common.free_space(self.config["download_location"]),
|
|
||||||
#max config values:
|
|
||||||
"max_download":self.config["max_download_speed"],
|
|
||||||
"max_upload":self.config["max_upload_speed"],
|
|
||||||
"max_num_connections":self.config["max_connections_global"],
|
|
||||||
})
|
|
||||||
|
|
||||||
return stats
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_session_status(self, keys):
|
|
||||||
"""
|
|
||||||
Gets the session status values for 'keys', these keys are taking
|
|
||||||
from libtorrent's session status.
|
|
||||||
|
|
||||||
See: http://www.rasterbar.com/products/libtorrent/manual.html#status
|
|
||||||
|
|
||||||
:param keys: the keys for which we want values
|
|
||||||
:type keys: list
|
|
||||||
:returns: a dictionary of {key: value, ...}
|
|
||||||
:rtype: dict
|
|
||||||
|
|
||||||
"""
|
|
||||||
status = {}
|
|
||||||
session_status = self.session.status()
|
|
||||||
for key in keys:
|
|
||||||
status[key] = getattr(session_status, key)
|
|
||||||
|
|
||||||
return status
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_cache_status(self):
|
|
||||||
"""
|
|
||||||
Returns a dictionary of the session's cache status.
|
|
||||||
|
|
||||||
:returns: the cache status
|
|
||||||
:rtype: dict
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
status = self.session.get_cache_status()
|
|
||||||
cache = {}
|
|
||||||
for attr in dir(status):
|
|
||||||
if attr.startswith("_"):
|
|
||||||
continue
|
|
||||||
cache[attr] = getattr(status, attr)
|
|
||||||
|
|
||||||
# Add in a couple ratios
|
|
||||||
try:
|
|
||||||
cache["write_hit_ratio"] = float((cache["blocks_written"] - cache["writes"])) / float(cache["blocks_written"])
|
|
||||||
except ZeroDivisionError:
|
|
||||||
cache["write_hit_ratio"] = 0.0
|
|
||||||
|
|
||||||
try:
|
|
||||||
cache["read_hit_ratio"] = float(cache["blocks_read_hit"]) / float(cache["blocks_read"])
|
|
||||||
except ZeroDivisionError:
|
|
||||||
cache["read_hit_ratio"] = 0.0
|
|
||||||
|
|
||||||
return cache
|
|
||||||
|
|
||||||
@export
|
|
||||||
def force_reannounce(self, torrent_ids):
|
|
||||||
log.debug("Forcing reannouncment to: %s", torrent_ids)
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
self.torrentmanager[torrent_id].force_reannounce()
|
|
||||||
|
|
||||||
@export
|
|
||||||
def pause_torrent(self, torrent_ids):
|
|
||||||
log.debug("Pausing: %s", torrent_ids)
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
if not self.torrentmanager[torrent_id].pause():
|
|
||||||
log.warning("Error pausing torrent %s", torrent_id)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def connect_peer(self, torrent_id, ip, port):
|
|
||||||
log.debug("adding peer %s to %s", ip, torrent_id)
|
|
||||||
if not self.torrentmanager[torrent_id].connect_peer(ip, port):
|
|
||||||
log.warning("Error adding peer %s:%s to %s", ip, port, torrent_id)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def 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.torrentmanager[torrent_id].move_storage(dest):
|
|
||||||
log.warning("Error moving torrent %s to %s", torrent_id, dest)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def pause_all_torrents(self):
|
|
||||||
"""Pause all torrents in the session"""
|
|
||||||
for torrent in self.torrentmanager.torrents.values():
|
|
||||||
torrent.pause()
|
|
||||||
|
|
||||||
@export
|
|
||||||
def resume_all_torrents(self):
|
|
||||||
"""Resume all torrents in the session"""
|
|
||||||
for torrent in self.torrentmanager.torrents.values():
|
|
||||||
torrent.resume()
|
|
||||||
component.get("EventManager").emit(SessionResumedEvent())
|
|
||||||
|
|
||||||
@export
|
|
||||||
def resume_torrent(self, torrent_ids):
|
|
||||||
log.debug("Resuming: %s", torrent_ids)
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
self.torrentmanager[torrent_id].resume()
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_torrent_status(self, torrent_id, keys):
|
|
||||||
# Build the status dictionary
|
|
||||||
status = self.torrentmanager[torrent_id].get_status(keys)
|
|
||||||
|
|
||||||
# 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.pluginmanager.get_status(torrent_id, leftover_fields))
|
|
||||||
return status
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_torrents_status(self, filter_dict, keys):
|
|
||||||
"""
|
|
||||||
returns all torrents , optionally filtered by filter_dict.
|
|
||||||
"""
|
|
||||||
torrent_ids = self.filtermanager.filter_torrent_ids(filter_dict)
|
|
||||||
status_dict = {}.fromkeys(torrent_ids)
|
|
||||||
|
|
||||||
# Get the torrent status for each torrent_id
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
status_dict[torrent_id] = self.get_torrent_status(torrent_id, keys)
|
|
||||||
|
|
||||||
return status_dict
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_filter_tree(self , show_zero_hits=True, hide_cat=None):
|
|
||||||
"""
|
|
||||||
returns {field: [(value,count)] }
|
|
||||||
for use in sidebar(s)
|
|
||||||
"""
|
|
||||||
return self.filtermanager.get_filter_tree(show_zero_hits, hide_cat)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_session_state(self):
|
|
||||||
"""Returns a list of torrent_ids in the session."""
|
|
||||||
# Get the torrent list from the TorrentManager
|
|
||||||
return self.torrentmanager.get_torrent_list()
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_config(self):
|
|
||||||
"""Get all the preferences as a dictionary"""
|
|
||||||
return self.config.config
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_config_value(self, key):
|
|
||||||
"""Get the config value for key"""
|
|
||||||
try:
|
|
||||||
value = self.config[key]
|
|
||||||
except KeyError:
|
|
||||||
return None
|
|
||||||
|
|
||||||
return value
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_config_values(self, keys):
|
|
||||||
"""Get the config values for the entered keys"""
|
|
||||||
config = {}
|
|
||||||
for key in keys:
|
|
||||||
try:
|
|
||||||
config[key] = self.config[key]
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
return config
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_config(self, config):
|
|
||||||
"""Set the config with values from dictionary"""
|
|
||||||
# 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]
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_listen_port(self):
|
|
||||||
"""Returns the active listen port"""
|
|
||||||
return self.session.listen_port()
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_num_connections(self):
|
|
||||||
"""Returns the current number of connections"""
|
|
||||||
return self.session.num_connections()
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_dht_nodes(self):
|
|
||||||
"""Returns the number of dht nodes"""
|
|
||||||
warnings.warn("Use get_session_status().", DeprecationWarning)
|
|
||||||
return self.session.status().dht_nodes
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_download_rate(self):
|
|
||||||
"""Returns the payload download rate"""
|
|
||||||
warnings.warn("Use get_session_status().", DeprecationWarning)
|
|
||||||
return self.session.status().payload_download_rate
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_upload_rate(self):
|
|
||||||
"""Returns the payload upload rate"""
|
|
||||||
warnings.warn("Use get_session_status().", DeprecationWarning)
|
|
||||||
return self.session.status().payload_upload_rate
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_available_plugins(self):
|
|
||||||
"""Returns a list of plugins available in the core"""
|
|
||||||
return self.pluginmanager.get_available_plugins()
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_enabled_plugins(self):
|
|
||||||
"""Returns a list of enabled plugins in the core"""
|
|
||||||
return self.pluginmanager.get_enabled_plugins()
|
|
||||||
|
|
||||||
@export
|
|
||||||
def enable_plugin(self, plugin):
|
|
||||||
self.pluginmanager.enable_plugin(plugin)
|
|
||||||
return None
|
|
||||||
|
|
||||||
@export
|
|
||||||
def disable_plugin(self, plugin):
|
|
||||||
self.pluginmanager.disable_plugin(plugin)
|
|
||||||
return None
|
|
||||||
|
|
||||||
@export
|
|
||||||
def force_recheck(self, torrent_ids):
|
|
||||||
"""Forces a data recheck on torrent_ids"""
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
self.torrentmanager[torrent_id].force_recheck()
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_options(self, torrent_ids, options):
|
|
||||||
"""Sets the torrent options for torrent_ids"""
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
self.torrentmanager[torrent_id].set_options(options)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_trackers(self, torrent_id, trackers):
|
|
||||||
"""Sets a torrents tracker list. trackers will be [{"url", "tier"}]"""
|
|
||||||
return self.torrentmanager[torrent_id].set_trackers(trackers)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_max_connections(self, torrent_id, value):
|
|
||||||
"""Sets a torrents max number of connections"""
|
|
||||||
return self.torrentmanager[torrent_id].set_max_connections(value)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_max_upload_slots(self, torrent_id, value):
|
|
||||||
"""Sets a torrents max number of upload slots"""
|
|
||||||
return self.torrentmanager[torrent_id].set_max_upload_slots(value)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_max_upload_speed(self, torrent_id, value):
|
|
||||||
"""Sets a torrents max upload speed"""
|
|
||||||
return self.torrentmanager[torrent_id].set_max_upload_speed(value)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_max_download_speed(self, torrent_id, value):
|
|
||||||
"""Sets a torrents max download speed"""
|
|
||||||
return self.torrentmanager[torrent_id].set_max_download_speed(value)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_file_priorities(self, torrent_id, priorities):
|
|
||||||
"""Sets a torrents file priorities"""
|
|
||||||
return self.torrentmanager[torrent_id].set_file_priorities(priorities)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_prioritize_first_last(self, torrent_id, value):
|
|
||||||
"""Sets a higher priority to the first and last pieces"""
|
|
||||||
return self.torrentmanager[torrent_id].set_prioritize_first_last(value)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_auto_managed(self, torrent_id, value):
|
|
||||||
"""Sets the auto managed flag for queueing purposes"""
|
|
||||||
return self.torrentmanager[torrent_id].set_auto_managed(value)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_stop_at_ratio(self, torrent_id, value):
|
|
||||||
"""Sets the torrent to stop at 'stop_ratio'"""
|
|
||||||
return self.torrentmanager[torrent_id].set_stop_at_ratio(value)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_stop_ratio(self, torrent_id, value):
|
|
||||||
"""Sets the ratio when to stop a torrent if 'stop_at_ratio' is set"""
|
|
||||||
return self.torrentmanager[torrent_id].set_stop_ratio(value)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_remove_at_ratio(self, torrent_id, value):
|
|
||||||
"""Sets the torrent to be removed at 'stop_ratio'"""
|
|
||||||
return self.torrentmanager[torrent_id].set_remove_at_ratio(value)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_move_completed(self, torrent_id, value):
|
|
||||||
"""Sets the torrent to be moved when completed"""
|
|
||||||
return self.torrentmanager[torrent_id].set_move_completed(value)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def set_torrent_move_completed_path(self, torrent_id, value):
|
|
||||||
"""Sets the path for the torrent to be moved when completed"""
|
|
||||||
return self.torrentmanager[torrent_id].set_move_completed_path(value)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_health(self):
|
|
||||||
"""Returns True if we have established incoming connections"""
|
|
||||||
warnings.warn("Use get_session_status().", DeprecationWarning)
|
|
||||||
return self.session.status().has_incoming_connections
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_path_size(self, path):
|
|
||||||
"""Returns the size of the file or folder 'path' and -1 if the path is
|
|
||||||
unaccessible (non-existent or insufficient privs)"""
|
|
||||||
return deluge.common.get_path_size(path)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def create_torrent(self, path, tracker, piece_length, comment, target,
|
|
||||||
webseeds, private, created_by, trackers, add_to_session):
|
|
||||||
|
|
||||||
log.debug("creating torrent..")
|
|
||||||
threading.Thread(target=_create_torrent_thread,
|
|
||||||
args=(
|
|
||||||
path,
|
|
||||||
tracker,
|
|
||||||
piece_length,
|
|
||||||
comment,
|
|
||||||
target,
|
|
||||||
webseeds,
|
|
||||||
private,
|
|
||||||
created_by,
|
|
||||||
trackers,
|
|
||||||
add_to_session)).start()
|
|
||||||
|
|
||||||
def _create_torrent_thread(self, path, tracker, piece_length, comment, target,
|
|
||||||
webseeds, private, created_by, trackers, add_to_session):
|
|
||||||
import deluge.metafile
|
|
||||||
deluge.metafile.make_meta_file(
|
|
||||||
path,
|
|
||||||
tracker,
|
|
||||||
piece_length,
|
|
||||||
comment=comment,
|
|
||||||
target=target,
|
|
||||||
webseeds=webseeds,
|
|
||||||
private=private,
|
|
||||||
created_by=created_by,
|
|
||||||
trackers=trackers)
|
|
||||||
log.debug("torrent created!")
|
|
||||||
if add_to_session:
|
|
||||||
options = {}
|
|
||||||
options["download_location"] = os.path.split(path)[0]
|
|
||||||
self.add_torrent_file(os.path.split(target)[1], open(target, "rb").read(), options)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def upload_plugin(self, filename, filedump):
|
|
||||||
"""This method is used to upload new plugins to the daemon. It is used
|
|
||||||
when connecting to the daemon remotely and installing a new plugin on
|
|
||||||
the client side. 'plugin_data' is a xmlrpc.Binary object of the file data,
|
|
||||||
ie, plugin_file.read()"""
|
|
||||||
|
|
||||||
try:
|
|
||||||
filedump = base64.decodestring(filedump)
|
|
||||||
except Exception, e:
|
|
||||||
log.error("There was an error decoding the filedump string!")
|
|
||||||
log.exception(e)
|
|
||||||
return
|
|
||||||
|
|
||||||
f = open(os.path.join(deluge.configmanager.get_config_dir(), "plugins", filename), "wb")
|
|
||||||
f.write(filedump)
|
|
||||||
f.close()
|
|
||||||
component.get("CorePluginManager").scan_for_plugins()
|
|
||||||
|
|
||||||
@export
|
|
||||||
def rescan_plugins(self):
|
|
||||||
"""
|
|
||||||
Rescans the plugin folders for new plugins
|
|
||||||
"""
|
|
||||||
component.get("CorePluginManager").scan_for_plugins()
|
|
||||||
|
|
||||||
@export
|
|
||||||
def rename_files(self, torrent_id, filenames):
|
|
||||||
"""
|
|
||||||
Rename files in torrent_id. Since this is an asynchronous operation by
|
|
||||||
libtorrent, watch for the TorrentFileRenamedEvent to know when the
|
|
||||||
files have been renamed.
|
|
||||||
|
|
||||||
:param torrent_id: the torrent_id to rename files
|
|
||||||
:type torrent_id: string
|
|
||||||
:param filenames: a list of index, filename pairs
|
|
||||||
:type filenames: ((index, filename), ...)
|
|
||||||
|
|
||||||
:raises InvalidTorrentError: if torrent_id is invalid
|
|
||||||
|
|
||||||
"""
|
|
||||||
if torrent_id not in self.torrentmanager.torrents:
|
|
||||||
raise InvalidTorrentError("torrent_id is not in session")
|
|
||||||
|
|
||||||
self.torrentmanager[torrent_id].rename_files(filenames)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def rename_folder(self, torrent_id, folder, new_folder):
|
|
||||||
"""
|
|
||||||
Renames the 'folder' to 'new_folder' in 'torrent_id'. Watch for the
|
|
||||||
TorrentFolderRenamedEvent which is emitted when the folder has been
|
|
||||||
renamed successfully.
|
|
||||||
|
|
||||||
:param torrent_id: the torrent to rename folder in
|
|
||||||
:type torrent_id: string
|
|
||||||
:param folder: the folder to rename
|
|
||||||
:type folder: string
|
|
||||||
:param new_folder: the new folder name
|
|
||||||
:type new_folder: string
|
|
||||||
|
|
||||||
:raises InvalidTorrentError: if the torrent_id is invalid
|
|
||||||
|
|
||||||
"""
|
|
||||||
if torrent_id not in self.torrentmanager.torrents:
|
|
||||||
raise InvalidTorrentError("torrent_id is not in session")
|
|
||||||
|
|
||||||
self.torrentmanager[torrent_id].rename_folder(folder, new_folder)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def queue_top(self, torrent_ids):
|
|
||||||
log.debug("Attempting to queue %s to top", torrent_ids)
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
try:
|
|
||||||
# If the queue method returns True, then we should emit a signal
|
|
||||||
if self.torrentmanager.queue_top(torrent_id):
|
|
||||||
component.get("EventManager").emit(TorrentQueueChangedEvent())
|
|
||||||
except KeyError:
|
|
||||||
log.warning("torrent_id: %s does not exist in the queue", torrent_id)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def queue_up(self, torrent_ids):
|
|
||||||
log.debug("Attempting to queue %s to up", torrent_ids)
|
|
||||||
#torrent_ids must be sorted before moving.
|
|
||||||
torrent_ids = list(torrent_ids)
|
|
||||||
torrent_ids.sort(key = lambda id: self.torrentmanager.torrents[id].get_queue_position())
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
try:
|
|
||||||
# If the queue method returns True, then we should emit a signal
|
|
||||||
if self.torrentmanager.queue_up(torrent_id):
|
|
||||||
component.get("EventManager").emit(TorrentQueueChangedEvent())
|
|
||||||
except KeyError:
|
|
||||||
log.warning("torrent_id: %s does not exist in the queue", torrent_id)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def queue_down(self, torrent_ids):
|
|
||||||
log.debug("Attempting to queue %s to down", torrent_ids)
|
|
||||||
#torrent_ids must be sorted before moving.
|
|
||||||
torrent_ids = list(torrent_ids)
|
|
||||||
torrent_ids.sort(key = lambda id: -self.torrentmanager.torrents[id].get_queue_position())
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
try:
|
|
||||||
# If the queue method returns True, then we should emit a signal
|
|
||||||
if self.torrentmanager.queue_down(torrent_id):
|
|
||||||
component.get("EventManager").emit(TorrentQueueChangedEvent())
|
|
||||||
except KeyError:
|
|
||||||
log.warning("torrent_id: %s does not exist in the queue", torrent_id)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def queue_bottom(self, torrent_ids):
|
|
||||||
log.debug("Attempting to queue %s to bottom", torrent_ids)
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
try:
|
|
||||||
# If the queue method returns True, then we should emit a signal
|
|
||||||
if self.torrentmanager.queue_bottom(torrent_id):
|
|
||||||
component.get("EventManager").emit(TorrentQueueChangedEvent())
|
|
||||||
except KeyError:
|
|
||||||
log.warning("torrent_id: %s does not exist in the queue", torrent_id)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def glob(self, path):
|
|
||||||
return glob.glob(path)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def test_listen_port(self):
|
|
||||||
"""
|
|
||||||
Checks if the active port is open
|
|
||||||
|
|
||||||
:returns: True if the port is open, False if not
|
|
||||||
:rtype: bool
|
|
||||||
|
|
||||||
"""
|
|
||||||
from twisted.web.client import getPage
|
|
||||||
|
|
||||||
d = getPage("http://deluge-torrent.org/test_port.php?port=%s" % self.get_listen_port())
|
|
||||||
|
|
||||||
def on_get_page(result):
|
|
||||||
return bool(int(result))
|
|
||||||
|
|
||||||
d.addCallback(on_get_page)
|
|
||||||
|
|
||||||
return d
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_free_space(self, path):
|
|
||||||
"""
|
|
||||||
Returns the number of free bytes at path
|
|
||||||
|
|
||||||
:param path: the path to check free space at
|
|
||||||
:type path: string
|
|
||||||
|
|
||||||
:returns: the number of free bytes at path
|
|
||||||
:rtype: int
|
|
||||||
|
|
||||||
:raises InvalidPathError: if the path is invalid
|
|
||||||
|
|
||||||
"""
|
|
||||||
return deluge.common.free_space(path)
|
|
||||||
|
|
||||||
@export
|
|
||||||
def get_libtorrent_version(self):
|
|
||||||
"""
|
|
||||||
Returns the libtorrent version.
|
|
||||||
|
|
||||||
:returns: the version
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
"""
|
|
||||||
return lt.version
|
|
@@ -1,206 +0,0 @@
|
|||||||
#
|
|
||||||
# daemon.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
|
|
||||||
import os
|
|
||||||
import gettext
|
|
||||||
import locale
|
|
||||||
import pkg_resources
|
|
||||||
from twisted.internet import reactor
|
|
||||||
import twisted.internet.error
|
|
||||||
|
|
||||||
import deluge.component as component
|
|
||||||
import deluge.configmanager
|
|
||||||
import deluge.common
|
|
||||||
from deluge.core.rpcserver import RPCServer, export
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
import deluge.error
|
|
||||||
|
|
||||||
class Daemon(object):
|
|
||||||
def __init__(self, options=None, args=None, classic=False):
|
|
||||||
# Check for another running instance of the daemon
|
|
||||||
if os.path.isfile(deluge.configmanager.get_config_dir("deluged.pid")):
|
|
||||||
# Get the PID and the port of the supposedly running daemon
|
|
||||||
try:
|
|
||||||
(pid, port) = open(deluge.configmanager.get_config_dir("deluged.pid")).read().strip().split(";")
|
|
||||||
pid = int(pid)
|
|
||||||
port = int(port)
|
|
||||||
except ValueError:
|
|
||||||
pid = None
|
|
||||||
port = None
|
|
||||||
|
|
||||||
|
|
||||||
def process_running(pid):
|
|
||||||
if deluge.common.windows_check():
|
|
||||||
# Do some fancy WMI junk to see if the PID exists in Windows
|
|
||||||
from win32com.client import GetObject
|
|
||||||
def get_proclist():
|
|
||||||
WMI = GetObject('winmgmts:')
|
|
||||||
processes = WMI.InstancesOf('Win32_Process')
|
|
||||||
return [process.Properties_('ProcessID').Value for process in processes]
|
|
||||||
return pid in get_proclist()
|
|
||||||
else:
|
|
||||||
# We can just use os.kill on UNIX to test if the process is running
|
|
||||||
try:
|
|
||||||
os.kill(pid, 0)
|
|
||||||
except OSError:
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
|
||||||
if pid is not None and process_running(pid):
|
|
||||||
# Ok, so a process is running with this PID, let's make doubly-sure
|
|
||||||
# it's a deluged process by trying to open a socket to it's port.
|
|
||||||
import socket
|
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
||||||
try:
|
|
||||||
s.connect(("127.0.0.1", port))
|
|
||||||
except socket.error:
|
|
||||||
# Can't connect, so it must not be a deluged process..
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
# This is a deluged!
|
|
||||||
s.close()
|
|
||||||
raise deluge.error.DaemonRunningError("There is a deluge daemon running with this config directory!")
|
|
||||||
|
|
||||||
# Initialize gettext
|
|
||||||
try:
|
|
||||||
locale.setlocale(locale.LC_ALL, '')
|
|
||||||
if hasattr(locale, "bindtextdomain"):
|
|
||||||
locale.bindtextdomain("deluge", pkg_resources.resource_filename("deluge", "i18n"))
|
|
||||||
if hasattr(locale, "textdomain"):
|
|
||||||
locale.textdomain("deluge")
|
|
||||||
gettext.bindtextdomain("deluge", pkg_resources.resource_filename("deluge", "i18n"))
|
|
||||||
gettext.textdomain("deluge")
|
|
||||||
gettext.install("deluge", pkg_resources.resource_filename("deluge", "i18n"))
|
|
||||||
except Exception, e:
|
|
||||||
log.error("Unable to initialize gettext/locale: %s", e)
|
|
||||||
import __builtin__
|
|
||||||
__builtin__.__dict__["_"] = lambda x: x
|
|
||||||
|
|
||||||
# Twisted catches signals to terminate, so just have it call the shutdown
|
|
||||||
# method.
|
|
||||||
reactor.addSystemEventTrigger("after", "shutdown", self.shutdown)
|
|
||||||
|
|
||||||
# Catch some Windows specific signals
|
|
||||||
if deluge.common.windows_check():
|
|
||||||
from win32api import SetConsoleCtrlHandler
|
|
||||||
from win32con import CTRL_CLOSE_EVENT
|
|
||||||
from win32con import CTRL_SHUTDOWN_EVENT
|
|
||||||
def win_handler(ctrl_type):
|
|
||||||
log.debug("ctrl_type: %s", ctrl_type)
|
|
||||||
if ctrl_type == CTRL_CLOSE_EVENT or ctrl_type == CTRL_SHUTDOWN_EVENT:
|
|
||||||
self.__shutdown()
|
|
||||||
return 1
|
|
||||||
SetConsoleCtrlHandler(win_handler)
|
|
||||||
|
|
||||||
version = deluge.common.get_version()
|
|
||||||
|
|
||||||
log.info("Deluge daemon %s", version)
|
|
||||||
log.debug("options: %s", options)
|
|
||||||
log.debug("args: %s", args)
|
|
||||||
# Set the config directory
|
|
||||||
if options and options.config:
|
|
||||||
deluge.configmanager.set_config_dir(options.config)
|
|
||||||
|
|
||||||
from deluge.core.core import Core
|
|
||||||
# Start the core as a thread and join it until it's done
|
|
||||||
self.core = Core()
|
|
||||||
|
|
||||||
port = self.core.config["daemon_port"]
|
|
||||||
if options and options.port:
|
|
||||||
port = options.port
|
|
||||||
if options and options.ui_interface:
|
|
||||||
interface = options.ui_interface
|
|
||||||
else:
|
|
||||||
interface = ""
|
|
||||||
|
|
||||||
self.rpcserver = RPCServer(
|
|
||||||
port=port,
|
|
||||||
allow_remote=self.core.config["allow_remote"],
|
|
||||||
listen=not classic,
|
|
||||||
interface=interface
|
|
||||||
)
|
|
||||||
|
|
||||||
# Register the daemon and the core RPCs
|
|
||||||
self.rpcserver.register_object(self.core)
|
|
||||||
self.rpcserver.register_object(self)
|
|
||||||
|
|
||||||
|
|
||||||
# Make sure we start the PreferencesManager first
|
|
||||||
component.start("PreferencesManager")
|
|
||||||
|
|
||||||
if not classic:
|
|
||||||
# Write out a pid file all the time, we use this to see if a deluged is running
|
|
||||||
# We also include the running port number to do an additional test
|
|
||||||
open(deluge.configmanager.get_config_dir("deluged.pid"), "wb").write(
|
|
||||||
"%s;%s\n" % (os.getpid(), port))
|
|
||||||
|
|
||||||
component.start()
|
|
||||||
try:
|
|
||||||
reactor.run()
|
|
||||||
finally:
|
|
||||||
self._shutdown()
|
|
||||||
|
|
||||||
@export()
|
|
||||||
def shutdown(self, *args, **kwargs):
|
|
||||||
reactor.callLater(0, reactor.stop)
|
|
||||||
|
|
||||||
def _shutdown(self, *args, **kwargs):
|
|
||||||
try:
|
|
||||||
os.remove(deluge.configmanager.get_config_dir("deluged.pid"))
|
|
||||||
except Exception, e:
|
|
||||||
log.exception(e)
|
|
||||||
log.error("Error removing deluged.pid!")
|
|
||||||
|
|
||||||
component.shutdown()
|
|
||||||
try:
|
|
||||||
reactor.stop()
|
|
||||||
except twisted.internet.error.ReactorNotRunning:
|
|
||||||
log.debug("Tried to stop the reactor but it is not running..")
|
|
||||||
|
|
||||||
@export()
|
|
||||||
def info(self):
|
|
||||||
"""
|
|
||||||
Returns some info from the daemon.
|
|
||||||
|
|
||||||
:returns: str, the version number
|
|
||||||
"""
|
|
||||||
return deluge.common.get_version()
|
|
||||||
|
|
||||||
@export()
|
|
||||||
def get_method_list(self):
|
|
||||||
"""
|
|
||||||
Returns a list of the exported methods.
|
|
||||||
"""
|
|
||||||
return self.rpcserver.get_method_list()
|
|
@@ -1,81 +0,0 @@
|
|||||||
#
|
|
||||||
# eventmanager.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
import deluge.component as component
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
|
|
||||||
class EventManager(component.Component):
|
|
||||||
def __init__(self):
|
|
||||||
component.Component.__init__(self, "EventManager")
|
|
||||||
self.handlers = {}
|
|
||||||
|
|
||||||
def emit(self, event):
|
|
||||||
"""
|
|
||||||
Emits the event to interested clients.
|
|
||||||
|
|
||||||
:param event: DelugeEvent
|
|
||||||
"""
|
|
||||||
# Emit the event to the interested clients
|
|
||||||
component.get("RPCServer").emit_event(event)
|
|
||||||
# Call any handlers for the event
|
|
||||||
if event.name in self.handlers:
|
|
||||||
for handler in self.handlers[event.name]:
|
|
||||||
#log.debug("Running handler %s for event %s with args: %s", event.name, handler, event.args)
|
|
||||||
handler(*event.args)
|
|
||||||
|
|
||||||
def register_event_handler(self, event, handler):
|
|
||||||
"""
|
|
||||||
Registers a function to be called when a `:param:event` is emitted.
|
|
||||||
|
|
||||||
:param event: str, the event name
|
|
||||||
:param handler: function, to be called when `:param:event` is emitted
|
|
||||||
|
|
||||||
"""
|
|
||||||
if event not in self.handlers:
|
|
||||||
self.handlers[event] = []
|
|
||||||
|
|
||||||
if handler not in self.handlers[event]:
|
|
||||||
self.handlers[event].append(handler)
|
|
||||||
|
|
||||||
def deregister_event_handler(self, event, handler):
|
|
||||||
"""
|
|
||||||
Deregisters an event handler function.
|
|
||||||
|
|
||||||
:param event: str, the event name
|
|
||||||
:param handler: function, currently registered to handle `:param:event`
|
|
||||||
|
|
||||||
"""
|
|
||||||
if event in self.handlers and handler in self.handlers[event]:
|
|
||||||
self.handlers[event].remove(handler)
|
|
@@ -1,266 +0,0 @@
|
|||||||
#
|
|
||||||
# core.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
import deluge.component as component
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
|
|
||||||
STATE_SORT = ["All", "Downloading", "Seeding", "Active", "Paused", "Queued"]
|
|
||||||
|
|
||||||
#special purpose filters:
|
|
||||||
def filter_keywords(torrent_ids, values):
|
|
||||||
#cleanup.
|
|
||||||
keywords = ",".join([v.lower() for v in values])
|
|
||||||
keywords = keywords.split(",")
|
|
||||||
|
|
||||||
|
|
||||||
for keyword in keywords:
|
|
||||||
torrent_ids = filter_one_keyword(torrent_ids, keyword)
|
|
||||||
return torrent_ids
|
|
||||||
|
|
||||||
def filter_one_keyword(torrent_ids, keyword):
|
|
||||||
"""
|
|
||||||
search torrent on keyword.
|
|
||||||
searches title,state,tracker-status,tracker,files
|
|
||||||
"""
|
|
||||||
all_torrents = component.get("TorrentManager").torrents
|
|
||||||
#filter:
|
|
||||||
found = False
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
torrent = all_torrents[torrent_id]
|
|
||||||
if keyword in torrent.filename.lower():
|
|
||||||
yield torrent_id
|
|
||||||
elif keyword in torrent.state.lower():
|
|
||||||
yield torrent_id
|
|
||||||
elif torrent.trackers and keyword in torrent.trackers[0]["url"]:
|
|
||||||
yield torrent_id
|
|
||||||
elif keyword in torrent_id:
|
|
||||||
yield torrent_id
|
|
||||||
#i want to find broken torrents (search on "error", or "unregistered")
|
|
||||||
elif keyword in torrent.tracker_status.lower():
|
|
||||||
yield torrent_id
|
|
||||||
else:
|
|
||||||
for t_file in torrent.get_files():
|
|
||||||
if keyword in t_file["path"].lower():
|
|
||||||
yield torrent_id
|
|
||||||
break
|
|
||||||
|
|
||||||
def tracker_error_filter(torrent_ids, values):
|
|
||||||
filtered_torrent_ids = []
|
|
||||||
tm = component.get("TorrentManager")
|
|
||||||
|
|
||||||
# If this is a tracker_host, then we need to filter on it
|
|
||||||
if values[0] != "Error":
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
if values[0] == tm[torrent_id].get_status(["tracker_host"])["tracker_host"]:
|
|
||||||
filtered_torrent_ids.append(torrent_id)
|
|
||||||
return filtered_torrent_ids
|
|
||||||
|
|
||||||
# Check all the torrent's tracker_status for 'Error:' and only return torrent_ids
|
|
||||||
# that have this substring in their tracker_status
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
if "Error:" in tm[torrent_id].get_status(["tracker_status"])["tracker_status"]:
|
|
||||||
filtered_torrent_ids.append(torrent_id)
|
|
||||||
|
|
||||||
return filtered_torrent_ids
|
|
||||||
|
|
||||||
class FilterManager(component.Component):
|
|
||||||
"""FilterManager
|
|
||||||
|
|
||||||
"""
|
|
||||||
def __init__(self, core):
|
|
||||||
component.Component.__init__(self, "FilterManager")
|
|
||||||
log.debug("FilterManager init..")
|
|
||||||
self.core = core
|
|
||||||
self.torrents = core.torrentmanager
|
|
||||||
self.registered_filters = {}
|
|
||||||
self.register_filter("keyword", filter_keywords)
|
|
||||||
self.tree_fields = {}
|
|
||||||
|
|
||||||
self.register_tree_field("state", self._init_state_tree)
|
|
||||||
def _init_tracker_tree():
|
|
||||||
return {"Error": 0}
|
|
||||||
self.register_tree_field("tracker_host", _init_tracker_tree)
|
|
||||||
|
|
||||||
self.register_filter("tracker_host", tracker_error_filter)
|
|
||||||
|
|
||||||
def filter_torrent_ids(self, filter_dict):
|
|
||||||
"""
|
|
||||||
returns a list of torrent_id's matching filter_dict.
|
|
||||||
core filter method
|
|
||||||
"""
|
|
||||||
if not filter_dict:
|
|
||||||
return self.torrents.get_torrent_list()
|
|
||||||
|
|
||||||
#sanitize input: filter-value must be a list of strings
|
|
||||||
for key, value in filter_dict.items():
|
|
||||||
if isinstance(value, str):
|
|
||||||
filter_dict[key] = [value]
|
|
||||||
|
|
||||||
|
|
||||||
if "id"in filter_dict: #optimized filter for id:
|
|
||||||
torrent_ids = filter_dict["id"]
|
|
||||||
del filter_dict["id"]
|
|
||||||
else:
|
|
||||||
torrent_ids = self.torrents.get_torrent_list()
|
|
||||||
|
|
||||||
if not filter_dict: #return if there's nothing more to filter
|
|
||||||
return torrent_ids
|
|
||||||
|
|
||||||
#special purpose: state=Active.
|
|
||||||
if "state" in filter_dict:
|
|
||||||
# We need to make sure this is a list for the logic below
|
|
||||||
filter_dict["state"] = list(filter_dict["state"])
|
|
||||||
|
|
||||||
if "state" in filter_dict and "Active" in filter_dict["state"]:
|
|
||||||
filter_dict["state"].remove("Active")
|
|
||||||
if not filter_dict["state"]:
|
|
||||||
del filter_dict["state"]
|
|
||||||
torrent_ids = self.filter_state_active(torrent_ids)
|
|
||||||
|
|
||||||
if not filter_dict: #return if there's nothing more to filter
|
|
||||||
return torrent_ids
|
|
||||||
|
|
||||||
#Registered filters:
|
|
||||||
for field, values in filter_dict.items():
|
|
||||||
if field in self.registered_filters:
|
|
||||||
# a set filters out the doubles.
|
|
||||||
torrent_ids = list(set(self.registered_filters[field](torrent_ids, values)))
|
|
||||||
del filter_dict[field]
|
|
||||||
|
|
||||||
|
|
||||||
if not filter_dict: #return if there's nothing more to filter
|
|
||||||
return torrent_ids
|
|
||||||
|
|
||||||
#leftover filter arguments:
|
|
||||||
#default filter on status fields.
|
|
||||||
status_func = self.core.get_torrent_status #premature optimalisation..
|
|
||||||
for torrent_id in list(torrent_ids):
|
|
||||||
status = status_func(torrent_id, filter_dict.keys()) #status={key:value}
|
|
||||||
for field, values in filter_dict.iteritems():
|
|
||||||
if (not status[field] in values) and torrent_id in torrent_ids:
|
|
||||||
torrent_ids.remove(torrent_id)
|
|
||||||
|
|
||||||
return torrent_ids
|
|
||||||
|
|
||||||
def get_filter_tree(self, show_zero_hits=True, hide_cat=None):
|
|
||||||
"""
|
|
||||||
returns {field: [(value,count)] }
|
|
||||||
for use in sidebar.
|
|
||||||
"""
|
|
||||||
torrent_ids = self.torrents.get_torrent_list()
|
|
||||||
status_func = self.core.get_torrent_status #premature optimalisation..
|
|
||||||
tree_keys = list(self.tree_fields.keys())
|
|
||||||
if hide_cat:
|
|
||||||
for cat in hide_cat:
|
|
||||||
tree_keys.remove(cat)
|
|
||||||
|
|
||||||
items = dict( (field, self.tree_fields[field]()) for field in tree_keys)
|
|
||||||
|
|
||||||
#count status fields.
|
|
||||||
for torrent_id in list(torrent_ids):
|
|
||||||
status = status_func(torrent_id, tree_keys) #status={key:value}
|
|
||||||
for field in tree_keys:
|
|
||||||
value = status[field]
|
|
||||||
items[field][value] = items[field].get(value, 0) + 1
|
|
||||||
|
|
||||||
if "tracker_host" in items:
|
|
||||||
items["tracker_host"]["Error"] = len(tracker_error_filter(torrent_ids, ("Error",)))
|
|
||||||
|
|
||||||
if "state" in tree_keys and not show_zero_hits:
|
|
||||||
self._hide_state_items(items["state"])
|
|
||||||
|
|
||||||
#return a dict of tuples:
|
|
||||||
sorted_items = {}
|
|
||||||
for field in tree_keys:
|
|
||||||
sorted_items[field] = sorted(items[field].iteritems())
|
|
||||||
|
|
||||||
if "state" in tree_keys:
|
|
||||||
sorted_items["state"].sort(self._sort_state_items)
|
|
||||||
|
|
||||||
return sorted_items
|
|
||||||
|
|
||||||
def _init_state_tree(self):
|
|
||||||
return {"All":len(self.torrents.get_torrent_list()),
|
|
||||||
"Downloading":0,
|
|
||||||
"Seeding":0,
|
|
||||||
"Paused":0,
|
|
||||||
"Checking":0,
|
|
||||||
"Queued":0,
|
|
||||||
"Error":0,
|
|
||||||
"Active":len(self.filter_state_active(self.torrents.get_torrent_list()))
|
|
||||||
}
|
|
||||||
|
|
||||||
def register_filter(self, id, filter_func, filter_value = None):
|
|
||||||
self.registered_filters[id] = filter_func
|
|
||||||
|
|
||||||
def deregister_filter(self, id):
|
|
||||||
del self.registered_filters[id]
|
|
||||||
|
|
||||||
def register_tree_field(self, field, init_func = lambda : {}):
|
|
||||||
self.tree_fields[field] = init_func
|
|
||||||
|
|
||||||
def deregister_tree_field(self, field):
|
|
||||||
if field in self.tree_fields:
|
|
||||||
del self.tree_fields[field]
|
|
||||||
|
|
||||||
def filter_state_active(self, torrent_ids):
|
|
||||||
get_status = self.core.get_torrent_status
|
|
||||||
for torrent_id in list(torrent_ids):
|
|
||||||
status = get_status(torrent_id, ["download_payload_rate", "upload_payload_rate"])
|
|
||||||
if status["download_payload_rate"] or status["upload_payload_rate"]:
|
|
||||||
pass #ok
|
|
||||||
else:
|
|
||||||
torrent_ids.remove(torrent_id)
|
|
||||||
return torrent_ids
|
|
||||||
|
|
||||||
def _hide_state_items(self, state_items):
|
|
||||||
"for hide(show)-zero hits"
|
|
||||||
for (value, count) in state_items.items():
|
|
||||||
if value != "All" and count == 0:
|
|
||||||
del state_items[value]
|
|
||||||
|
|
||||||
def _sort_state_items(self, x, y):
|
|
||||||
""
|
|
||||||
if x[0] in STATE_SORT:
|
|
||||||
ix = STATE_SORT.index(x[0])
|
|
||||||
else:
|
|
||||||
ix = 99
|
|
||||||
if y[0] in STATE_SORT:
|
|
||||||
iy = STATE_SORT.index(y[0])
|
|
||||||
else:
|
|
||||||
iy = 99
|
|
||||||
|
|
||||||
return ix - iy
|
|
@@ -1,141 +0,0 @@
|
|||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
import os.path
|
|
||||||
import pickle
|
|
||||||
import cPickle
|
|
||||||
import shutil
|
|
||||||
|
|
||||||
from deluge._libtorrent import lt
|
|
||||||
|
|
||||||
from deluge.configmanager import ConfigManager, get_config_dir
|
|
||||||
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(get_config_dir(), "persistent.state")
|
|
||||||
self.state10_location = os.path.join(get_config_dir(), "state", "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
|
|
||||||
|
|
||||||
# Check to see if we can upgrade this file
|
|
||||||
if type(state).__name__ == 'list':
|
|
||||||
log.warning("0.5 state file is too old to upgrade")
|
|
||||||
return
|
|
||||||
|
|
||||||
new_state = deluge.core.torrentmanager.TorrentManagerState()
|
|
||||||
for ti, uid in state.torrents.items():
|
|
||||||
torrent_path = os.path.join(get_config_dir(), "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", torrent_path, e)
|
|
||||||
|
|
||||||
# Copy the torrent file to the new location
|
|
||||||
import shutil
|
|
||||||
shutil.copyfile(torrent_path, os.path.join(get_config_dir(), "state", 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(get_config_dir(), "state", "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,115 +0,0 @@
|
|||||||
#
|
|
||||||
# pluginmanager.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
"""PluginManager for Core"""
|
|
||||||
|
|
||||||
from twisted.internet import reactor
|
|
||||||
from twisted.internet.task import LoopingCall
|
|
||||||
|
|
||||||
from deluge.event import PluginEnabledEvent, PluginDisabledEvent
|
|
||||||
import deluge.pluginmanagerbase
|
|
||||||
import deluge.component as component
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
|
|
||||||
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, "CorePluginManager")
|
|
||||||
|
|
||||||
self.status_fields = {}
|
|
||||||
|
|
||||||
# Call the PluginManagerBase constructor
|
|
||||||
deluge.pluginmanagerbase.PluginManagerBase.__init__(
|
|
||||||
self, "core.conf", "deluge.plugin.core")
|
|
||||||
|
|
||||||
def start(self):
|
|
||||||
# Enable plugins that are enabled in the config
|
|
||||||
self.enable_plugins()
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
# Disable all enabled plugins
|
|
||||||
self.disable_plugins()
|
|
||||||
|
|
||||||
def shutdown(self):
|
|
||||||
self.stop()
|
|
||||||
|
|
||||||
def update_plugins(self):
|
|
||||||
for plugin in self.plugins.keys():
|
|
||||||
if hasattr(self.plugins[plugin], "update"):
|
|
||||||
try:
|
|
||||||
self.plugins[plugin].update()
|
|
||||||
except Exception, e:
|
|
||||||
log.exception(e)
|
|
||||||
|
|
||||||
def enable_plugin(self, name):
|
|
||||||
if name not in self.plugins:
|
|
||||||
super(PluginManager, self).enable_plugin(name)
|
|
||||||
if name in self.plugins:
|
|
||||||
component.get("EventManager").emit(PluginEnabledEvent(name))
|
|
||||||
|
|
||||||
def disable_plugin(self, name):
|
|
||||||
if name in self.plugins:
|
|
||||||
super(PluginManager, self).disable_plugin(name)
|
|
||||||
if name not in self.plugins:
|
|
||||||
component.get("EventManager").emit(PluginDisabledEvent(name))
|
|
||||||
|
|
||||||
def get_status(self, torrent_id, fields):
|
|
||||||
"""Return the value of status fields for the selected torrent_id."""
|
|
||||||
status = {}
|
|
||||||
for field in fields:
|
|
||||||
try:
|
|
||||||
status[field] = self.status_fields[field](torrent_id)
|
|
||||||
except KeyError:
|
|
||||||
log.warning("Status field %s is not registered with the\
|
|
||||||
PluginManager.", field)
|
|
||||||
return status
|
|
||||||
|
|
||||||
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)
|
|
||||||
try:
|
|
||||||
del self.status_fields[field]
|
|
||||||
except:
|
|
||||||
log.warning("Unable to deregister status field %s", field)
|
|
@@ -1,522 +0,0 @@
|
|||||||
#
|
|
||||||
# preferencesmanager.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.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
import os.path
|
|
||||||
import threading
|
|
||||||
import pkg_resources
|
|
||||||
from twisted.internet import reactor
|
|
||||||
from twisted.internet.task import LoopingCall
|
|
||||||
|
|
||||||
from deluge._libtorrent import lt
|
|
||||||
|
|
||||||
from deluge.event import *
|
|
||||||
import deluge.configmanager
|
|
||||||
import deluge.common
|
|
||||||
import deluge.component as component
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
|
|
||||||
DEFAULT_PREFS = {
|
|
||||||
"send_info": False,
|
|
||||||
"info_sent": 0.0,
|
|
||||||
"daemon_port": 58846,
|
|
||||||
"allow_remote": False,
|
|
||||||
"compact_allocation": False,
|
|
||||||
"download_location": deluge.common.get_default_download_dir(),
|
|
||||||
"listen_ports": [6881, 6891],
|
|
||||||
"listen_interface": "",
|
|
||||||
"copy_torrent_file": False,
|
|
||||||
"torrentfiles_location": deluge.common.get_default_download_dir(),
|
|
||||||
"plugins_location": os.path.join(deluge.configmanager.get_config_dir(), "plugins"),
|
|
||||||
"prioritize_first_last_pieces": False,
|
|
||||||
"random_port": True,
|
|
||||||
"dht": True,
|
|
||||||
"upnp": True,
|
|
||||||
"natpmp": True,
|
|
||||||
"utpex": True,
|
|
||||||
"lsd": True,
|
|
||||||
"enc_in_policy": 1,
|
|
||||||
"enc_out_policy": 1,
|
|
||||||
"enc_level": 2,
|
|
||||||
"enc_prefer_rc4": True,
|
|
||||||
"max_connections_global": 200,
|
|
||||||
"max_upload_speed": -1.0,
|
|
||||||
"max_download_speed": -1.0,
|
|
||||||
"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 50)(),
|
|
||||||
"max_connections_per_second": 20,
|
|
||||||
"ignore_limits_on_local_network": True,
|
|
||||||
"max_connections_per_torrent": -1,
|
|
||||||
"max_upload_slots_per_torrent": -1,
|
|
||||||
"max_upload_speed_per_torrent": -1,
|
|
||||||
"max_download_speed_per_torrent": -1,
|
|
||||||
"enabled_plugins": [],
|
|
||||||
"autoadd_location": deluge.common.get_default_download_dir(),
|
|
||||||
"autoadd_enable": False,
|
|
||||||
"add_paused": False,
|
|
||||||
"max_active_seeding": 5,
|
|
||||||
"max_active_downloading": 3,
|
|
||||||
"max_active_limit": 8,
|
|
||||||
"dont_count_slow_torrents": False,
|
|
||||||
"queue_new_to_top": False,
|
|
||||||
"stop_seed_at_ratio": False,
|
|
||||||
"remove_seed_at_ratio": False,
|
|
||||||
"stop_seed_ratio": 2.00,
|
|
||||||
"share_ratio_limit": 2.00,
|
|
||||||
"seed_time_ratio_limit": 7.00,
|
|
||||||
"seed_time_limit": 180,
|
|
||||||
"auto_managed": True,
|
|
||||||
"move_completed": False,
|
|
||||||
"move_completed_path": deluge.common.get_default_download_dir(),
|
|
||||||
"new_release_check": True,
|
|
||||||
"proxies": {
|
|
||||||
"peer": {
|
|
||||||
"type": 0,
|
|
||||||
"hostname": "",
|
|
||||||
"username": "",
|
|
||||||
"password": "",
|
|
||||||
"port": 8080
|
|
||||||
},
|
|
||||||
"web_seed": {
|
|
||||||
"type": 0,
|
|
||||||
"hostname": "",
|
|
||||||
"username": "",
|
|
||||||
"password": "",
|
|
||||||
"port": 8080
|
|
||||||
},
|
|
||||||
"tracker": {
|
|
||||||
"type": 0,
|
|
||||||
"hostname": "",
|
|
||||||
"username": "",
|
|
||||||
"password": "",
|
|
||||||
"port": 8080
|
|
||||||
},
|
|
||||||
"dht": {
|
|
||||||
"type": 0,
|
|
||||||
"hostname": "",
|
|
||||||
"username": "",
|
|
||||||
"password": "",
|
|
||||||
"port": 8080
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
"outgoing_ports": [0, 0],
|
|
||||||
"random_outgoing_ports": True,
|
|
||||||
"peer_tos": "0x00",
|
|
||||||
"rate_limit_ip_overhead": True,
|
|
||||||
"geoip_db_location": "/usr/share/GeoIP/GeoIP.dat",
|
|
||||||
"cache_size": 512,
|
|
||||||
"cache_expiry": 60
|
|
||||||
}
|
|
||||||
|
|
||||||
class PreferencesManager(component.Component):
|
|
||||||
def __init__(self):
|
|
||||||
component.Component.__init__(self, "PreferencesManager")
|
|
||||||
|
|
||||||
self.config = deluge.configmanager.ConfigManager("core.conf", DEFAULT_PREFS)
|
|
||||||
|
|
||||||
def start(self):
|
|
||||||
self.core = component.get("Core")
|
|
||||||
self.session = component.get("Core").session
|
|
||||||
self.settings = component.get("Core").settings
|
|
||||||
|
|
||||||
# Register set functions in the Config
|
|
||||||
self.config.register_set_function("torrentfiles_location",
|
|
||||||
self._on_set_torrentfiles_location)
|
|
||||||
self.config.register_set_function("listen_ports",
|
|
||||||
self._on_set_listen_ports)
|
|
||||||
self.config.register_set_function("listen_interface",
|
|
||||||
self._on_set_listen_interface)
|
|
||||||
self.config.register_set_function("random_port",
|
|
||||||
self._on_set_random_port)
|
|
||||||
self.config.register_set_function("outgoing_ports",
|
|
||||||
self._on_set_outgoing_ports)
|
|
||||||
self.config.register_set_function("random_outgoing_ports",
|
|
||||||
self._on_set_random_outgoing_ports)
|
|
||||||
self.config.register_set_function("peer_tos",
|
|
||||||
self._on_set_peer_tos)
|
|
||||||
self.config.register_set_function("dht", self._on_set_dht)
|
|
||||||
self.config.register_set_function("upnp", self._on_set_upnp)
|
|
||||||
self.config.register_set_function("natpmp", self._on_set_natpmp)
|
|
||||||
self.config.register_set_function("utpex", self._on_set_utpex)
|
|
||||||
self.config.register_set_function("lsd", self._on_set_lsd)
|
|
||||||
self.config.register_set_function("enc_in_policy",
|
|
||||||
self._on_set_encryption)
|
|
||||||
self.config.register_set_function("enc_out_policy",
|
|
||||||
self._on_set_encryption)
|
|
||||||
self.config.register_set_function("enc_level",
|
|
||||||
self._on_set_encryption)
|
|
||||||
self.config.register_set_function("enc_prefer_rc4",
|
|
||||||
self._on_set_encryption)
|
|
||||||
self.config.register_set_function("max_connections_global",
|
|
||||||
self._on_set_max_connections_global)
|
|
||||||
self.config.register_set_function("max_upload_speed",
|
|
||||||
self._on_set_max_upload_speed)
|
|
||||||
self.config.register_set_function("max_download_speed",
|
|
||||||
self._on_set_max_download_speed)
|
|
||||||
self.config.register_set_function("max_upload_slots_global",
|
|
||||||
self._on_set_max_upload_slots_global)
|
|
||||||
self.config.register_set_function("max_half_open_connections",
|
|
||||||
self._on_set_max_half_open_connections)
|
|
||||||
self.config.register_set_function("max_connections_per_second",
|
|
||||||
self._on_set_max_connections_per_second)
|
|
||||||
self.config.register_set_function("ignore_limits_on_local_network",
|
|
||||||
self._on_ignore_limits_on_local_network)
|
|
||||||
self.config.register_set_function("share_ratio_limit",
|
|
||||||
self._on_set_share_ratio_limit)
|
|
||||||
self.config.register_set_function("seed_time_ratio_limit",
|
|
||||||
self._on_set_seed_time_ratio_limit)
|
|
||||||
self.config.register_set_function("seed_time_limit",
|
|
||||||
self._on_set_seed_time_limit)
|
|
||||||
self.config.register_set_function("max_active_downloading",
|
|
||||||
self._on_set_max_active_downloading)
|
|
||||||
self.config.register_set_function("max_active_seeding",
|
|
||||||
self._on_set_max_active_seeding)
|
|
||||||
self.config.register_set_function("max_active_limit",
|
|
||||||
self._on_set_max_active_limit)
|
|
||||||
self.config.register_set_function("dont_count_slow_torrents",
|
|
||||||
self._on_set_dont_count_slow_torrents)
|
|
||||||
self.config.register_set_function("send_info",
|
|
||||||
self._on_send_info)
|
|
||||||
self.config.register_set_function("proxies",
|
|
||||||
self._on_set_proxies)
|
|
||||||
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_set_function("geoip_db_location",
|
|
||||||
self._on_geoip_db_location)
|
|
||||||
self.config.register_set_function("cache_size",
|
|
||||||
self._on_cache_size)
|
|
||||||
self.config.register_set_function("cache_expiry",
|
|
||||||
self._on_cache_expiry)
|
|
||||||
|
|
||||||
self.config.register_change_callback(self._on_config_value_change)
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
if self.new_release_timer:
|
|
||||||
self.new_release_timer.stop()
|
|
||||||
|
|
||||||
# Config set functions
|
|
||||||
def _on_config_value_change(self, key, value):
|
|
||||||
component.get("EventManager").emit(ConfigValueChangedEvent(key, value))
|
|
||||||
|
|
||||||
def _on_set_torrentfiles_location(self, key, value):
|
|
||||||
if self.config["copy_torrent_file"]:
|
|
||||||
try:
|
|
||||||
os.makedirs(value)
|
|
||||||
except Exception, e:
|
|
||||||
log.debug("Unable to make directory: %s", e)
|
|
||||||
|
|
||||||
def _on_set_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], str(self.config["listen_interface"]))
|
|
||||||
|
|
||||||
def _on_set_listen_interface(self, key, value):
|
|
||||||
# Call the random_port callback since it'll do what we need
|
|
||||||
self._on_set_random_port("random_port", self.config["random_port"])
|
|
||||||
|
|
||||||
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
|
|
||||||
# and then handle accordingly.
|
|
||||||
if value:
|
|
||||||
import random
|
|
||||||
listen_ports = []
|
|
||||||
randrange = lambda: random.randrange(49152, 65525)
|
|
||||||
listen_ports.append(randrange())
|
|
||||||
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],
|
|
||||||
listen_ports[1])
|
|
||||||
self.session.listen_on(listen_ports[0], listen_ports[1], str(self.config["listen_interface"]))
|
|
||||||
|
|
||||||
def _on_set_outgoing_ports(self, key, value):
|
|
||||||
if not self.config["random_outgoing_ports"]:
|
|
||||||
log.debug("outgoing port range set to %s-%s", value[0], value[1])
|
|
||||||
self.settings.outgoing_ports = value[0], value[1]
|
|
||||||
self.session.set_settings(self.settings)
|
|
||||||
|
|
||||||
def _on_set_random_outgoing_ports(self, key, value):
|
|
||||||
if value:
|
|
||||||
self.session.outgoing_ports(0, 0)
|
|
||||||
|
|
||||||
def _on_set_peer_tos(self, key, value):
|
|
||||||
log.debug("setting peer_tos to: %s", value)
|
|
||||||
try:
|
|
||||||
self.settings.peer_tos = chr(int(value, 16))
|
|
||||||
except ValueError, e:
|
|
||||||
log.debug("Invalid tos byte: %s", e)
|
|
||||||
return
|
|
||||||
|
|
||||||
self.session.set_settings(self.settings)
|
|
||||||
|
|
||||||
def _on_set_dht(self, key, value):
|
|
||||||
log.debug("dht value set to %s", value)
|
|
||||||
state_file = deluge.configmanager.get_config_dir("dht.state")
|
|
||||||
if value:
|
|
||||||
state = None
|
|
||||||
try:
|
|
||||||
state = lt.bdecode(open(state_file, "rb").read())
|
|
||||||
except Exception, e:
|
|
||||||
log.warning("Unable to read DHT state file: %s", e)
|
|
||||||
|
|
||||||
try:
|
|
||||||
self.session.start_dht(state)
|
|
||||||
except Exception, e:
|
|
||||||
log.warning("Restoring old DHT state failed: %s", e)
|
|
||||||
self.session.start_dht(None)
|
|
||||||
self.session.add_dht_router("router.bittorrent.com", 6881)
|
|
||||||
self.session.add_dht_router("router.utorrent.com", 6881)
|
|
||||||
self.session.add_dht_router("router.bitcomet.com", 6881)
|
|
||||||
else:
|
|
||||||
self.core.save_dht_state()
|
|
||||||
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:
|
|
||||||
self.session.start_natpmp()
|
|
||||||
else:
|
|
||||||
self.session.stop_natpmp()
|
|
||||||
|
|
||||||
def _on_set_lsd(self, key, value):
|
|
||||||
log.debug("lsd value set to %s", value)
|
|
||||||
if value:
|
|
||||||
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:
|
|
||||||
self.session.add_extension(lt.create_ut_pex_plugin)
|
|
||||||
|
|
||||||
def _on_set_encryption(self, key, value):
|
|
||||||
log.debug("encryption value %s set to %s..", key, value)
|
|
||||||
pe_settings = lt.pe_settings()
|
|
||||||
pe_settings.out_enc_policy = \
|
|
||||||
lt.enc_policy(self.config["enc_out_policy"])
|
|
||||||
pe_settings.in_enc_policy = lt.enc_policy(self.config["enc_in_policy"])
|
|
||||||
pe_settings.allowed_enc_level = lt.enc_level(self.config["enc_level"])
|
|
||||||
pe_settings.prefer_rc4 = self.config["enc_prefer_rc4"]
|
|
||||||
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",
|
|
||||||
set.out_enc_policy,
|
|
||||||
set.in_enc_policy,
|
|
||||||
set.allowed_enc_level,
|
|
||||||
set.prefer_rc4)
|
|
||||||
|
|
||||||
def _on_set_max_connections_global(self, key, value):
|
|
||||||
log.debug("max_connections_global set to %s..", value)
|
|
||||||
self.session.set_max_connections(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
|
|
||||||
if value < 0:
|
|
||||||
v = -1
|
|
||||||
else:
|
|
||||||
v = int(value * 1024)
|
|
||||||
|
|
||||||
self.session.set_upload_rate_limit(v)
|
|
||||||
|
|
||||||
def _on_set_max_download_speed(self, key, value):
|
|
||||||
log.debug("max_download_speed set to %s..", value)
|
|
||||||
# We need to convert Kb/s to B/s
|
|
||||||
if value < 0:
|
|
||||||
v = -1
|
|
||||||
else:
|
|
||||||
v = int(value * 1024)
|
|
||||||
self.session.set_download_rate_limit(v)
|
|
||||||
|
|
||||||
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
|
|
||||||
self.session.set_settings(self.settings)
|
|
||||||
|
|
||||||
def _on_set_seed_time_ratio_limit(self, key, value):
|
|
||||||
log.debug("%s set to %s..", key, value)
|
|
||||||
self.settings.seed_time_ratio_limit = value
|
|
||||||
self.session.set_settings(self.settings)
|
|
||||||
|
|
||||||
def _on_set_seed_time_limit(self, key, value):
|
|
||||||
log.debug("%s set to %s..", key, value)
|
|
||||||
# This value is stored in minutes in deluge, but libtorrent wants seconds
|
|
||||||
self.settings.seed_time_limit = int(value * 60)
|
|
||||||
self.session.set_settings(self.settings)
|
|
||||||
|
|
||||||
def _on_set_max_active_downloading(self, key, value):
|
|
||||||
log.debug("%s set to %s..", key, value)
|
|
||||||
log.debug("active_downloads: %s", self.settings.active_downloads)
|
|
||||||
self.settings.active_downloads = value
|
|
||||||
self.session.set_settings(self.settings)
|
|
||||||
|
|
||||||
def _on_set_max_active_seeding(self, key, value):
|
|
||||||
log.debug("%s set to %s..", key, value)
|
|
||||||
log.debug("active_seeds: %s", self.settings.active_seeds)
|
|
||||||
self.settings.active_seeds = value
|
|
||||||
self.session.set_settings(self.settings)
|
|
||||||
|
|
||||||
def _on_set_max_active_limit(self, key, value):
|
|
||||||
log.debug("%s set to %s..", key, value)
|
|
||||||
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
|
|
||||||
self.session.set_settings(self.settings)
|
|
||||||
|
|
||||||
def _on_send_info(self, key, value):
|
|
||||||
log.debug("Sending anonymous stats..")
|
|
||||||
"""sends anonymous stats home"""
|
|
||||||
class Send_Info_Thread(threading.Thread):
|
|
||||||
def __init__(self, config):
|
|
||||||
self.config = config
|
|
||||||
threading.Thread.__init__(self)
|
|
||||||
def run(self):
|
|
||||||
import time
|
|
||||||
now = time.time()
|
|
||||||
# check if we've done this within the last week or never
|
|
||||||
if (now - self.config["info_sent"]) >= (60 * 60 * 24 * 7):
|
|
||||||
import deluge.common
|
|
||||||
from urllib import quote_plus
|
|
||||||
from urllib2 import urlopen
|
|
||||||
import platform
|
|
||||||
try:
|
|
||||||
url = "http://deluge-torrent.org/stats_get.php?processor=" + \
|
|
||||||
platform.machine() + "&python=" + platform.python_version() \
|
|
||||||
+ "&deluge=" + deluge.common.get_version() \
|
|
||||||
+ "&os=" + platform.system() \
|
|
||||||
+ "&plugins=" + quote_plus(":".join(self.config["enabled_plugins"]))
|
|
||||||
urlopen(url)
|
|
||||||
except IOError, e:
|
|
||||||
log.debug("Network error while trying to send info: %s", e)
|
|
||||||
else:
|
|
||||||
self.config["info_sent"] = now
|
|
||||||
if value:
|
|
||||||
Send_Info_Thread(self.config).start()
|
|
||||||
|
|
||||||
def _on_new_release_check(self, key, value):
|
|
||||||
if value:
|
|
||||||
log.debug("Checking for new release..")
|
|
||||||
threading.Thread(target=self.core.get_new_release).start()
|
|
||||||
if self.new_release_timer:
|
|
||||||
self.new_release_timer.stop()
|
|
||||||
# Set a timer to check for a new release every 3 days
|
|
||||||
self.new_release_timer = LoopingCall(
|
|
||||||
self._on_new_release_check, "new_release_check", True)
|
|
||||||
self.new_release_timer.start(72 * 60 * 60, False)
|
|
||||||
else:
|
|
||||||
if self.new_release_timer:
|
|
||||||
self.new_release_timer.stop()
|
|
||||||
|
|
||||||
def _on_set_proxies(self, key, value):
|
|
||||||
for k, v in value.items():
|
|
||||||
if v["type"]:
|
|
||||||
proxy_settings = lt.proxy_settings()
|
|
||||||
proxy_settings.type = lt.proxy_type(v["type"])
|
|
||||||
proxy_settings.username = str(v["username"])
|
|
||||||
proxy_settings.password = str(v["password"])
|
|
||||||
proxy_settings.hostname = str(v["hostname"])
|
|
||||||
proxy_settings.port = v["port"]
|
|
||||||
log.debug("setting %s proxy settings", k)
|
|
||||||
getattr(self.session, "set_%s_proxy" % k)(proxy_settings)
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
def _on_geoip_db_location(self, key, value):
|
|
||||||
log.debug("%s: %s", key, value)
|
|
||||||
# Load the GeoIP DB for country look-ups if available
|
|
||||||
geoip_db = ""
|
|
||||||
if os.path.exists(value):
|
|
||||||
geoip_db = value
|
|
||||||
elif os.path.exists(pkg_resources.resource_filename("deluge", os.path.join("data", "GeoIP.dat"))):
|
|
||||||
geoip_db = pkg_resources.resource_filename("deluge", os.path.join("data", "GeoIP.dat"))
|
|
||||||
else:
|
|
||||||
log.warning("Unable to find GeoIP database file!")
|
|
||||||
|
|
||||||
if geoip_db:
|
|
||||||
try:
|
|
||||||
self.session.load_country_db(str(geoip_db))
|
|
||||||
except Exception, e:
|
|
||||||
log.error("Unable to load geoip database!")
|
|
||||||
log.exception(e)
|
|
||||||
|
|
||||||
def _on_cache_size(self, key, value):
|
|
||||||
log.debug("%s: %s", key, value)
|
|
||||||
self.settings.cache_size = value
|
|
||||||
self.session.set_settings(self.settings)
|
|
||||||
|
|
||||||
def _on_cache_expiry(self, key, value):
|
|
||||||
log.debug("%s: %s", key, value)
|
|
||||||
self.settings.cache_expiry = value
|
|
||||||
self.session.set_settings(self.settings)
|
|
@@ -1,466 +0,0 @@
|
|||||||
#
|
|
||||||
# rpcserver.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008,2009 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
"""RPCServer Module"""
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import zlib
|
|
||||||
import os
|
|
||||||
import stat
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from twisted.internet.protocol import Factory, Protocol
|
|
||||||
from twisted.internet import ssl, reactor, defer
|
|
||||||
|
|
||||||
from OpenSSL import crypto, SSL
|
|
||||||
from types import FunctionType
|
|
||||||
|
|
||||||
import deluge.rencode as rencode
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
|
|
||||||
import deluge.component as component
|
|
||||||
import deluge.configmanager
|
|
||||||
from deluge.core.authmanager import AUTH_LEVEL_NONE, AUTH_LEVEL_DEFAULT
|
|
||||||
|
|
||||||
RPC_RESPONSE = 1
|
|
||||||
RPC_ERROR = 2
|
|
||||||
RPC_EVENT = 3
|
|
||||||
|
|
||||||
def export(auth_level=AUTH_LEVEL_DEFAULT):
|
|
||||||
"""
|
|
||||||
Decorator function to register an object's method as an RPC. The object
|
|
||||||
will need to be registered with an :class:`RPCServer` to be effective.
|
|
||||||
|
|
||||||
:param func: the function to export
|
|
||||||
:type func: function
|
|
||||||
:param auth_level: the auth level required to call this method
|
|
||||||
:type auth_level: int
|
|
||||||
|
|
||||||
"""
|
|
||||||
def wrap(func, *args, **kwargs):
|
|
||||||
func._rpcserver_export = True
|
|
||||||
func._rpcserver_auth_level = auth_level
|
|
||||||
doc = func.__doc__
|
|
||||||
func.__doc__ = "**RPC Exported Function** (*Auth Level: %s*)\n\n" % auth_level
|
|
||||||
if doc:
|
|
||||||
func.__doc__ += doc
|
|
||||||
|
|
||||||
return func
|
|
||||||
|
|
||||||
if type(auth_level) is FunctionType:
|
|
||||||
func = auth_level
|
|
||||||
auth_level = AUTH_LEVEL_DEFAULT
|
|
||||||
return wrap(func)
|
|
||||||
else:
|
|
||||||
return wrap
|
|
||||||
|
|
||||||
class DelugeError(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class NotAuthorizedError(DelugeError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class ServerContextFactory(object):
|
|
||||||
def getContext(self):
|
|
||||||
"""
|
|
||||||
Create an SSL context.
|
|
||||||
|
|
||||||
This loads the servers cert/private key SSL files for use with the
|
|
||||||
SSL transport.
|
|
||||||
"""
|
|
||||||
ssl_dir = deluge.configmanager.get_config_dir("ssl")
|
|
||||||
ctx = SSL.Context(SSL.SSLv3_METHOD)
|
|
||||||
ctx.use_certificate_file(os.path.join(ssl_dir, "daemon.cert"))
|
|
||||||
ctx.use_privatekey_file(os.path.join(ssl_dir, "daemon.pkey"))
|
|
||||||
return ctx
|
|
||||||
|
|
||||||
class DelugeRPCProtocol(Protocol):
|
|
||||||
__buffer = None
|
|
||||||
|
|
||||||
def dataReceived(self, data):
|
|
||||||
"""
|
|
||||||
This method is called whenever data is received from a client. The
|
|
||||||
only message that a client sends to the server is a RPC Request message.
|
|
||||||
If the RPC Request message is valid, then the method is called in a thread
|
|
||||||
with :meth:`dispatch`.
|
|
||||||
|
|
||||||
:param data: the data from the client. It should be a zlib compressed
|
|
||||||
rencoded string.
|
|
||||||
:type data: str
|
|
||||||
|
|
||||||
"""
|
|
||||||
if self.__buffer:
|
|
||||||
# We have some data from the last dataReceived() so lets prepend it
|
|
||||||
data = self.__buffer + data
|
|
||||||
self.__buffer = None
|
|
||||||
|
|
||||||
while data:
|
|
||||||
dobj = zlib.decompressobj()
|
|
||||||
try:
|
|
||||||
request = rencode.loads(dobj.decompress(data))
|
|
||||||
except Exception, e:
|
|
||||||
#log.debug("Received possible invalid message (%r): %s", data, e)
|
|
||||||
# This could be cut-off data, so we'll save this in the buffer
|
|
||||||
# and try to prepend it on the next dataReceived()
|
|
||||||
self.__buffer = data
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
data = dobj.unused_data
|
|
||||||
|
|
||||||
if type(request) is not tuple:
|
|
||||||
log.debug("Received invalid message: type is not tuple")
|
|
||||||
return
|
|
||||||
|
|
||||||
if len(request) < 1:
|
|
||||||
log.debug("Received invalid message: there are no items")
|
|
||||||
return
|
|
||||||
|
|
||||||
for call in request:
|
|
||||||
if len(call) != 4:
|
|
||||||
log.debug("Received invalid rpc request: number of items in request is %s", len(call))
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Format the RPCRequest message for debug printing
|
|
||||||
try:
|
|
||||||
s = call[1] + "("
|
|
||||||
if call[2]:
|
|
||||||
s += ", ".join([str(x) for x in call[2]])
|
|
||||||
if call[3]:
|
|
||||||
if call[2]:
|
|
||||||
s += ", "
|
|
||||||
s += ", ".join([key + "=" + str(value) for key, value in call[3].items()])
|
|
||||||
s += ")"
|
|
||||||
except UnicodeEncodeError:
|
|
||||||
pass
|
|
||||||
#log.debug("RPCRequest had some non-ascii text..")
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
#log.debug("RPCRequest: %s", s)
|
|
||||||
|
|
||||||
reactor.callLater(0, self.dispatch, *call)
|
|
||||||
|
|
||||||
def sendData(self, data):
|
|
||||||
"""
|
|
||||||
Sends the data to the client.
|
|
||||||
|
|
||||||
:param data: the object that is to be sent to the client. This should
|
|
||||||
be one of the RPC message types.
|
|
||||||
|
|
||||||
"""
|
|
||||||
self.transport.write(zlib.compress(rencode.dumps(data)))
|
|
||||||
|
|
||||||
def connectionMade(self):
|
|
||||||
"""
|
|
||||||
This method is called when a new client connects.
|
|
||||||
"""
|
|
||||||
peer = self.transport.getPeer()
|
|
||||||
log.info("Deluge Client connection made from: %s:%s", peer.host, peer.port)
|
|
||||||
# Set the initial auth level of this session to AUTH_LEVEL_NONE
|
|
||||||
self.factory.authorized_sessions[self.transport.sessionno] = AUTH_LEVEL_NONE
|
|
||||||
|
|
||||||
def connectionLost(self, reason):
|
|
||||||
"""
|
|
||||||
This method is called when the client is disconnected.
|
|
||||||
|
|
||||||
:param reason: the reason the client disconnected.
|
|
||||||
:type reason: str
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
# We need to remove this session from various dicts
|
|
||||||
del self.factory.authorized_sessions[self.transport.sessionno]
|
|
||||||
if self.transport.sessionno in self.factory.session_protocols:
|
|
||||||
del self.factory.session_protocols[self.transport.sessionno]
|
|
||||||
if self.transport.sessionno in self.factory.interested_events:
|
|
||||||
del self.factory.interested_events[self.transport.sessionno]
|
|
||||||
|
|
||||||
log.info("Deluge client disconnected: %s", reason.value)
|
|
||||||
|
|
||||||
def dispatch(self, request_id, method, args, kwargs):
|
|
||||||
"""
|
|
||||||
This method is run when a RPC Request is made. It will run the local method
|
|
||||||
and will send either a RPC Response or RPC Error back to the client.
|
|
||||||
|
|
||||||
:param request_id: the request_id from the client (sent in the RPC Request)
|
|
||||||
:type request_id: int
|
|
||||||
:param method: the local method to call. It must be registered with
|
|
||||||
the :class:`RPCServer`.
|
|
||||||
:type method: str
|
|
||||||
:param args: the arguments to pass to `method`
|
|
||||||
:type args: list
|
|
||||||
:param kwargs: the keyword-arguments to pass to `method`
|
|
||||||
:type kwargs: dict
|
|
||||||
|
|
||||||
"""
|
|
||||||
def sendError():
|
|
||||||
"""
|
|
||||||
Sends an error response with the contents of the exception that was raised.
|
|
||||||
"""
|
|
||||||
exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
|
|
||||||
|
|
||||||
self.sendData((
|
|
||||||
RPC_ERROR,
|
|
||||||
request_id,
|
|
||||||
(exceptionType.__name__,
|
|
||||||
exceptionValue.args[0] if len(exceptionValue.args) == 1 else "",
|
|
||||||
"".join(traceback.format_tb(exceptionTraceback)))
|
|
||||||
))
|
|
||||||
|
|
||||||
if method == "daemon.login":
|
|
||||||
# This is a special case and used in the initial connection process
|
|
||||||
# We need to authenticate the user here
|
|
||||||
try:
|
|
||||||
ret = component.get("AuthManager").authorize(*args, **kwargs)
|
|
||||||
if ret:
|
|
||||||
self.factory.authorized_sessions[self.transport.sessionno] = ret
|
|
||||||
self.factory.session_protocols[self.transport.sessionno] = self
|
|
||||||
except Exception, e:
|
|
||||||
sendError()
|
|
||||||
log.exception(e)
|
|
||||||
else:
|
|
||||||
self.sendData((RPC_RESPONSE, request_id, (ret)))
|
|
||||||
if not ret:
|
|
||||||
self.transport.loseConnection()
|
|
||||||
finally:
|
|
||||||
return
|
|
||||||
elif method == "daemon.set_event_interest" and self.transport.sessionno in self.factory.authorized_sessions:
|
|
||||||
# This special case is to allow clients to set which events they are
|
|
||||||
# interested in receiving.
|
|
||||||
# We are expecting a sequence from the client.
|
|
||||||
try:
|
|
||||||
if self.transport.sessionno not in self.factory.interested_events:
|
|
||||||
self.factory.interested_events[self.transport.sessionno] = []
|
|
||||||
self.factory.interested_events[self.transport.sessionno].extend(args[0])
|
|
||||||
except Exception, e:
|
|
||||||
sendError()
|
|
||||||
else:
|
|
||||||
self.sendData((RPC_RESPONSE, request_id, (True)))
|
|
||||||
finally:
|
|
||||||
return
|
|
||||||
|
|
||||||
if method in self.factory.methods and self.transport.sessionno in self.factory.authorized_sessions:
|
|
||||||
try:
|
|
||||||
method_auth_requirement = self.factory.methods[method]._rpcserver_auth_level
|
|
||||||
auth_level = self.factory.authorized_sessions[self.transport.sessionno]
|
|
||||||
if auth_level < method_auth_requirement:
|
|
||||||
# This session is not allowed to call this method
|
|
||||||
log.debug("Session %s is trying to call a method it is not authorized to call!", self.transport.sessionno)
|
|
||||||
raise NotAuthorizedError("Auth level too low: %s < %s" % (auth_level, method_auth_requirement))
|
|
||||||
ret = self.factory.methods[method](*args, **kwargs)
|
|
||||||
except Exception, e:
|
|
||||||
sendError()
|
|
||||||
# Don't bother printing out DelugeErrors, because they are just for the client
|
|
||||||
if not isinstance(e, DelugeError):
|
|
||||||
log.exception("Exception calling RPC request: %s", e)
|
|
||||||
else:
|
|
||||||
# Check if the return value is a deferred, since we'll need to
|
|
||||||
# wait for it to fire before sending the RPC_RESPONSE
|
|
||||||
if isinstance(ret, defer.Deferred):
|
|
||||||
def on_success(result):
|
|
||||||
self.sendData((RPC_RESPONSE, request_id, result))
|
|
||||||
return result
|
|
||||||
|
|
||||||
def on_fail(failure):
|
|
||||||
try:
|
|
||||||
failure.raiseException()
|
|
||||||
except Exception, e:
|
|
||||||
sendError()
|
|
||||||
return failure
|
|
||||||
|
|
||||||
ret.addCallbacks(on_success, on_fail)
|
|
||||||
else:
|
|
||||||
self.sendData((RPC_RESPONSE, request_id, ret))
|
|
||||||
|
|
||||||
class RPCServer(component.Component):
|
|
||||||
"""
|
|
||||||
This class is used to handle rpc requests from the client. Objects are
|
|
||||||
registered with this class and their methods are exported using the export
|
|
||||||
decorator.
|
|
||||||
|
|
||||||
:param port: the port the RPCServer will listen on
|
|
||||||
:type port: int
|
|
||||||
:param interface: the interface to listen on, this may override the `allow_remote` setting
|
|
||||||
:type interface: str
|
|
||||||
:param allow_remote: set True if the server should allow remote connections
|
|
||||||
:type allow_remote: bool
|
|
||||||
:param listen: if False, will not start listening.. This is only useful in Classic Mode
|
|
||||||
:type listen: bool
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, port=58846, interface="", allow_remote=False, listen=True):
|
|
||||||
component.Component.__init__(self, "RPCServer")
|
|
||||||
|
|
||||||
self.factory = Factory()
|
|
||||||
self.factory.protocol = DelugeRPCProtocol
|
|
||||||
# Holds the registered methods
|
|
||||||
self.factory.methods = {}
|
|
||||||
# Holds the session_ids and auth levels
|
|
||||||
self.factory.authorized_sessions = {}
|
|
||||||
# Holds the protocol objects with the session_id as key
|
|
||||||
self.factory.session_protocols = {}
|
|
||||||
# Holds the interested event list for the sessions
|
|
||||||
self.factory.interested_events = {}
|
|
||||||
|
|
||||||
if not listen:
|
|
||||||
return
|
|
||||||
|
|
||||||
if allow_remote:
|
|
||||||
hostname = ""
|
|
||||||
else:
|
|
||||||
hostname = "localhost"
|
|
||||||
|
|
||||||
if interface:
|
|
||||||
hostname = interface
|
|
||||||
|
|
||||||
log.info("Starting DelugeRPC server %s:%s", hostname, port)
|
|
||||||
|
|
||||||
# Check for SSL keys and generate some if needed
|
|
||||||
check_ssl_keys()
|
|
||||||
|
|
||||||
try:
|
|
||||||
reactor.listenSSL(port, self.factory, ServerContextFactory(), interface=hostname)
|
|
||||||
except Exception, e:
|
|
||||||
log.info("Daemon already running or port not available..")
|
|
||||||
log.error(e)
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
def register_object(self, obj, name=None):
|
|
||||||
"""
|
|
||||||
Registers an object to export it's rpc methods. These methods should
|
|
||||||
be exported with the export decorator prior to registering the object.
|
|
||||||
|
|
||||||
:param obj: the object that we want to export
|
|
||||||
:type obj: object
|
|
||||||
:param name: the name to use, if None, it will be the class name of the object
|
|
||||||
:type name: str
|
|
||||||
"""
|
|
||||||
if not name:
|
|
||||||
name = obj.__class__.__name__.lower()
|
|
||||||
|
|
||||||
for d in dir(obj):
|
|
||||||
if d[0] == "_":
|
|
||||||
continue
|
|
||||||
if getattr(getattr(obj, d), '_rpcserver_export', False):
|
|
||||||
log.debug("Registering method: %s", name + "." + d)
|
|
||||||
self.factory.methods[name + "." + d] = getattr(obj, d)
|
|
||||||
|
|
||||||
def get_object_method(self, name):
|
|
||||||
"""
|
|
||||||
Returns a registered method.
|
|
||||||
|
|
||||||
:param name: the name of the method, usually in the form of 'object.method'
|
|
||||||
:type name: str
|
|
||||||
|
|
||||||
:returns: method
|
|
||||||
|
|
||||||
:raises KeyError: if `name` is not registered
|
|
||||||
|
|
||||||
"""
|
|
||||||
return self.factory.methods[name]
|
|
||||||
|
|
||||||
def get_method_list(self):
|
|
||||||
"""
|
|
||||||
Returns a list of the exported methods.
|
|
||||||
|
|
||||||
:returns: the exported methods
|
|
||||||
:rtype: list
|
|
||||||
"""
|
|
||||||
return self.factory.methods.keys()
|
|
||||||
|
|
||||||
def emit_event(self, event):
|
|
||||||
"""
|
|
||||||
Emits the event to interested clients.
|
|
||||||
|
|
||||||
:param event: the event to emit
|
|
||||||
:type event: :class:`deluge.event.DelugeEvent`
|
|
||||||
"""
|
|
||||||
log.debug("intevents: %s", self.factory.interested_events)
|
|
||||||
# Find sessions interested in this event
|
|
||||||
for session_id, interest in self.factory.interested_events.iteritems():
|
|
||||||
if event.name in interest:
|
|
||||||
log.debug("Emit Event: %s %s", event.name, event.args)
|
|
||||||
# This session is interested so send a RPC_EVENT
|
|
||||||
self.factory.session_protocols[session_id].sendData(
|
|
||||||
(RPC_EVENT, event.name, event.args)
|
|
||||||
)
|
|
||||||
|
|
||||||
def check_ssl_keys():
|
|
||||||
"""
|
|
||||||
Check for SSL cert/key and create them if necessary
|
|
||||||
"""
|
|
||||||
ssl_dir = deluge.configmanager.get_config_dir("ssl")
|
|
||||||
if not os.path.exists(ssl_dir):
|
|
||||||
# The ssl folder doesn't exist so we need to create it
|
|
||||||
os.makedirs(ssl_dir)
|
|
||||||
generate_ssl_keys()
|
|
||||||
else:
|
|
||||||
for f in ("daemon.pkey", "daemon.cert"):
|
|
||||||
if not os.path.exists(os.path.join(ssl_dir, f)):
|
|
||||||
generate_ssl_keys()
|
|
||||||
break
|
|
||||||
|
|
||||||
def generate_ssl_keys():
|
|
||||||
"""
|
|
||||||
This method generates a new SSL key/cert.
|
|
||||||
"""
|
|
||||||
digest = "md5"
|
|
||||||
# Generate key pair
|
|
||||||
pkey = crypto.PKey()
|
|
||||||
pkey.generate_key(crypto.TYPE_RSA, 1024)
|
|
||||||
|
|
||||||
# Generate cert request
|
|
||||||
req = crypto.X509Req()
|
|
||||||
subj = req.get_subject()
|
|
||||||
setattr(subj, "CN", "Deluge Daemon")
|
|
||||||
req.set_pubkey(pkey)
|
|
||||||
req.sign(pkey, digest)
|
|
||||||
|
|
||||||
# Generate certificate
|
|
||||||
cert = crypto.X509()
|
|
||||||
cert.set_serial_number(0)
|
|
||||||
cert.gmtime_adj_notBefore(0)
|
|
||||||
cert.gmtime_adj_notAfter(60*60*24*365*5) # Five Years
|
|
||||||
cert.set_issuer(req.get_subject())
|
|
||||||
cert.set_subject(req.get_subject())
|
|
||||||
cert.set_pubkey(req.get_pubkey())
|
|
||||||
cert.sign(pkey, digest)
|
|
||||||
|
|
||||||
# Write out files
|
|
||||||
ssl_dir = deluge.configmanager.get_config_dir("ssl")
|
|
||||||
open(os.path.join(ssl_dir, "daemon.pkey"), "w").write(crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey))
|
|
||||||
open(os.path.join(ssl_dir, "daemon.cert"), "w").write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))
|
|
||||||
# Make the files only readable by this user
|
|
||||||
for f in ("daemon.pkey", "daemon.cert"):
|
|
||||||
os.chmod(os.path.join(ssl_dir, f), stat.S_IREAD | stat.S_IWRITE)
|
|
@@ -1,840 +0,0 @@
|
|||||||
#
|
|
||||||
# torrent.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
|
|
||||||
"""Internal Torrent class"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
from urlparse import urlparse
|
|
||||||
|
|
||||||
from deluge._libtorrent import lt
|
|
||||||
|
|
||||||
import deluge.common
|
|
||||||
import deluge.component as component
|
|
||||||
from deluge.configmanager import ConfigManager, get_config_dir
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
from deluge.event import *
|
|
||||||
|
|
||||||
TORRENT_STATE = deluge.common.TORRENT_STATE
|
|
||||||
|
|
||||||
class TorrentOptions(dict):
|
|
||||||
def __init__(self):
|
|
||||||
config = ConfigManager("core.conf").config
|
|
||||||
options_conf_map = {
|
|
||||||
"max_connections": "max_connections_per_torrent",
|
|
||||||
"max_upload_slots": "max_upload_slots_per_torrent",
|
|
||||||
"max_upload_speed": "max_upload_speed_per_torrent",
|
|
||||||
"max_download_speed": "max_download_speed_per_torrent",
|
|
||||||
"prioritize_first_last_pieces": "prioritize_first_last_pieces",
|
|
||||||
"compact_allocation": "compact_allocation",
|
|
||||||
"download_location": "download_location",
|
|
||||||
"auto_managed": "auto_managed",
|
|
||||||
"stop_at_ratio": "stop_seed_at_ratio",
|
|
||||||
"stop_ratio": "stop_seed_ratio",
|
|
||||||
"remove_at_ratio": "remove_seed_at_ratio",
|
|
||||||
"move_completed": "move_completed",
|
|
||||||
"move_completed_path": "move_completed_path",
|
|
||||||
"add_paused": "add_paused",
|
|
||||||
}
|
|
||||||
for opt_k, conf_k in options_conf_map.iteritems():
|
|
||||||
self[opt_k] = config[conf_k]
|
|
||||||
self["file_priorities"] = []
|
|
||||||
self["mapped_files"] = {}
|
|
||||||
|
|
||||||
class Torrent:
|
|
||||||
"""Torrent holds information about torrents added to the libtorrent session.
|
|
||||||
"""
|
|
||||||
def __init__(self, handle, options, state=None, filename=None, magnet=None):
|
|
||||||
log.debug("Creating torrent object %s", str(handle.info_hash()))
|
|
||||||
# Get the core config
|
|
||||||
self.config = ConfigManager("core.conf")
|
|
||||||
|
|
||||||
# Set the libtorrent handle
|
|
||||||
self.handle = handle
|
|
||||||
# Set the torrent_id for this torrent
|
|
||||||
self.torrent_id = str(handle.info_hash())
|
|
||||||
|
|
||||||
# Let's us know if we're waiting on a lt alert
|
|
||||||
self.waiting_on_resume_data = False
|
|
||||||
|
|
||||||
# Keep a list of file indexes we're waiting for file_rename alerts on
|
|
||||||
# This also includes the old_folder and new_folder to know what signal to send
|
|
||||||
# This is so we can send one folder_renamed signal instead of multiple
|
|
||||||
# file_renamed signals.
|
|
||||||
# [(old_folder, new_folder, [*indexes]), ...]
|
|
||||||
self.waiting_on_folder_rename = []
|
|
||||||
|
|
||||||
# We store the filename just in case we need to make a copy of the torrentfile
|
|
||||||
if not filename:
|
|
||||||
# If no filename was provided, then just use the infohash
|
|
||||||
filename = self.torrent_id
|
|
||||||
|
|
||||||
self.filename = filename
|
|
||||||
|
|
||||||
# Store the magnet uri used to add this torrent if available
|
|
||||||
self.magnet = magnet
|
|
||||||
|
|
||||||
# Holds status info so that we don't need to keep getting it from lt
|
|
||||||
self.status = self.handle.status()
|
|
||||||
|
|
||||||
try:
|
|
||||||
self.torrent_info = self.handle.get_torrent_info()
|
|
||||||
except RuntimeError:
|
|
||||||
self.torrent_info = None
|
|
||||||
|
|
||||||
# Default total_uploaded to 0, this may be changed by the state
|
|
||||||
self.total_uploaded = 0
|
|
||||||
|
|
||||||
# Set the default options
|
|
||||||
self.options = TorrentOptions()
|
|
||||||
self.options.update(options)
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# Load values from state if we have it
|
|
||||||
if state:
|
|
||||||
# This is for saving the total uploaded between sessions
|
|
||||||
self.total_uploaded = state.total_uploaded
|
|
||||||
# Set the trackers
|
|
||||||
self.set_trackers(state.trackers)
|
|
||||||
# Set the filename
|
|
||||||
self.filename = state.filename
|
|
||||||
self.is_finished = state.is_finished
|
|
||||||
else:
|
|
||||||
# Tracker list
|
|
||||||
self.trackers = []
|
|
||||||
# Create a list of trackers
|
|
||||||
for value in self.handle.trackers():
|
|
||||||
if lt.version_minor < 15:
|
|
||||||
tracker = {}
|
|
||||||
tracker["url"] = value.url
|
|
||||||
tracker["tier"] = value.tier
|
|
||||||
else:
|
|
||||||
tracker = value
|
|
||||||
self.trackers.append(tracker)
|
|
||||||
|
|
||||||
# Various torrent options
|
|
||||||
self.handle.resolve_countries(True)
|
|
||||||
|
|
||||||
self.set_options(self.options)
|
|
||||||
|
|
||||||
# Status message holds error info about the torrent
|
|
||||||
self.statusmsg = "OK"
|
|
||||||
|
|
||||||
# The torrents state
|
|
||||||
self.update_state()
|
|
||||||
|
|
||||||
# The tracker status
|
|
||||||
self.tracker_status = ""
|
|
||||||
|
|
||||||
# This gets updated when get_tracker_host is called
|
|
||||||
self.tracker_host = None
|
|
||||||
|
|
||||||
if state:
|
|
||||||
self.time_added = state.time_added
|
|
||||||
else:
|
|
||||||
self.time_added = time.time()
|
|
||||||
|
|
||||||
log.debug("Torrent object created.")
|
|
||||||
|
|
||||||
## Options methods ##
|
|
||||||
def set_options(self, options):
|
|
||||||
OPTIONS_FUNCS = {
|
|
||||||
# Functions used for setting options
|
|
||||||
"auto_managed": self.set_auto_managed,
|
|
||||||
"download_location": self.set_save_path,
|
|
||||||
"file_priorities": self.set_file_priorities,
|
|
||||||
"max_connections": self.handle.set_max_connections,
|
|
||||||
"max_download_speed": self.set_max_download_speed,
|
|
||||||
"max_upload_slots": self.handle.set_max_uploads,
|
|
||||||
"max_upload_speed": self.set_max_upload_speed,
|
|
||||||
"prioritize_first_last_pieces": self.set_prioritize_first_last
|
|
||||||
}
|
|
||||||
for (key, value) in options.items():
|
|
||||||
if OPTIONS_FUNCS.has_key(key):
|
|
||||||
OPTIONS_FUNCS[key](value)
|
|
||||||
|
|
||||||
self.options.update(options)
|
|
||||||
|
|
||||||
def get_options(self):
|
|
||||||
return self.options
|
|
||||||
|
|
||||||
|
|
||||||
def set_max_connections(self, max_connections):
|
|
||||||
self.options["max_connections"] = int(max_connections)
|
|
||||||
self.handle.set_max_connections(max_connections)
|
|
||||||
|
|
||||||
def set_max_upload_slots(self, max_slots):
|
|
||||||
self.options["max_upload_slots"] = int(max_slots)
|
|
||||||
self.handle.set_max_uploads(max_slots)
|
|
||||||
|
|
||||||
def set_max_upload_speed(self, m_up_speed):
|
|
||||||
self.options["max_upload_speed"] = m_up_speed
|
|
||||||
if m_up_speed < 0:
|
|
||||||
v = -1
|
|
||||||
else:
|
|
||||||
v = int(m_up_speed * 1024)
|
|
||||||
|
|
||||||
self.handle.set_upload_limit(v)
|
|
||||||
|
|
||||||
def set_max_download_speed(self, m_down_speed):
|
|
||||||
self.options["max_download_speed"] = m_down_speed
|
|
||||||
if m_down_speed < 0:
|
|
||||||
v = -1
|
|
||||||
else:
|
|
||||||
v = int(m_down_speed * 1024)
|
|
||||||
self.handle.set_download_limit(v)
|
|
||||||
|
|
||||||
def set_prioritize_first_last(self, prioritize):
|
|
||||||
self.options["prioritize_first_last_pieces"] = prioritize
|
|
||||||
if prioritize:
|
|
||||||
if self.handle.has_metadata():
|
|
||||||
if self.handle.get_torrent_info().num_files() == 1:
|
|
||||||
# We only do this if one file is in the torrent
|
|
||||||
priorities = [1] * self.handle.get_torrent_info().num_pieces()
|
|
||||||
priorities[0] = 7
|
|
||||||
priorities[-1] = 7
|
|
||||||
self.handle.prioritize_pieces(priorities)
|
|
||||||
|
|
||||||
def set_auto_managed(self, auto_managed):
|
|
||||||
self.options["auto_managed"] = auto_managed
|
|
||||||
if not (self.handle.is_paused() and not self.handle.is_auto_managed()):
|
|
||||||
self.handle.auto_managed(auto_managed)
|
|
||||||
self.update_state()
|
|
||||||
|
|
||||||
def set_stop_ratio(self, stop_ratio):
|
|
||||||
self.options["stop_ratio"] = stop_ratio
|
|
||||||
|
|
||||||
def set_stop_at_ratio(self, stop_at_ratio):
|
|
||||||
self.options["stop_at_ratio"] = stop_at_ratio
|
|
||||||
|
|
||||||
def set_remove_at_ratio(self, remove_at_ratio):
|
|
||||||
self.options["remove_at_ratio"] = remove_at_ratio
|
|
||||||
|
|
||||||
def set_move_completed(self, move_completed):
|
|
||||||
self.options["move_completed"] = move_completed
|
|
||||||
|
|
||||||
def set_move_completed_path(self, move_completed_path):
|
|
||||||
self.options["move_completed_path"] = move_completed_path
|
|
||||||
|
|
||||||
def set_file_priorities(self, file_priorities):
|
|
||||||
if len(file_priorities) != len(self.get_files()):
|
|
||||||
log.debug("file_priorities len != num_files")
|
|
||||||
self.options["file_priorities"] = self.handle.file_priorities()
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.options["compact_allocation"]:
|
|
||||||
log.debug("setting file priority with compact allocation does not work!")
|
|
||||||
self.options["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.options["file_priorities"]:
|
|
||||||
# We have previously marked a file 'Do Not Download'
|
|
||||||
# Check to see if we have changed any 0's to >0 and change state accordingly
|
|
||||||
for index, priority in enumerate(self.options["file_priorities"]):
|
|
||||||
if priority == 0 and file_priorities[index] > 0:
|
|
||||||
# We have a changed 'Do Not Download' to a download priority
|
|
||||||
self.is_finished = False
|
|
||||||
self.update_state()
|
|
||||||
break
|
|
||||||
|
|
||||||
self.options["file_priorities"] = file_priorities
|
|
||||||
|
|
||||||
# Set the first/last priorities if needed
|
|
||||||
self.set_prioritize_first_last(self.options["prioritize_first_last_pieces"])
|
|
||||||
|
|
||||||
def set_trackers(self, trackers):
|
|
||||||
"""Sets trackers"""
|
|
||||||
if trackers == None:
|
|
||||||
trackers = []
|
|
||||||
for value in self.handle.trackers():
|
|
||||||
if lt.version_minor < 15:
|
|
||||||
tracker = {}
|
|
||||||
tracker["url"] = value.url
|
|
||||||
tracker["tier"] = value.tier
|
|
||||||
else:
|
|
||||||
tracker = value
|
|
||||||
trackers.append(tracker)
|
|
||||||
self.trackers = trackers
|
|
||||||
self.tracker_host = None
|
|
||||||
return
|
|
||||||
|
|
||||||
log.debug("Setting trackers for %s: %s", self.torrent_id, trackers)
|
|
||||||
tracker_list = []
|
|
||||||
|
|
||||||
for tracker in trackers:
|
|
||||||
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"])
|
|
||||||
# Set the tracker list in the torrent object
|
|
||||||
self.trackers = trackers
|
|
||||||
if len(trackers) > 0:
|
|
||||||
# Force a reannounce if there is at least 1 tracker
|
|
||||||
self.force_reannounce()
|
|
||||||
|
|
||||||
self.tracker_host = None
|
|
||||||
|
|
||||||
### End Options methods ###
|
|
||||||
|
|
||||||
def set_save_path(self, save_path):
|
|
||||||
self.options["download_location"] = save_path
|
|
||||||
|
|
||||||
def set_tracker_status(self, status):
|
|
||||||
"""Sets the tracker status"""
|
|
||||||
self.tracker_status = self.get_tracker_host() + ": " + status
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
# Set self.state to the ltstate right away just incase we don't hit some
|
|
||||||
# of the logic below
|
|
||||||
self.state = str(ltstate)
|
|
||||||
|
|
||||||
log.debug("set_state_based_on_ltstate: %s", deluge.common.LT_TORRENT_STATE[ltstate])
|
|
||||||
log.debug("session.is_paused: %s", component.get("Core").session.is_paused())
|
|
||||||
|
|
||||||
# First we check for an error from libtorrent, and set the state to that
|
|
||||||
# if any occurred.
|
|
||||||
if len(self.handle.status().error) > 0:
|
|
||||||
# This is an error'd torrent
|
|
||||||
self.state = "Error"
|
|
||||||
self.set_status_message(self.handle.status().error)
|
|
||||||
if self.handle.is_paused():
|
|
||||||
self.handle.auto_managed(False)
|
|
||||||
return
|
|
||||||
|
|
||||||
if ltstate == LTSTATE["Queued"] or ltstate == LTSTATE["Checking"]:
|
|
||||||
if self.handle.is_paused():
|
|
||||||
self.state = "Paused"
|
|
||||||
else:
|
|
||||||
self.state = "Checking"
|
|
||||||
return
|
|
||||||
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 self.handle.is_auto_managed() and not component.get("Core").session.is_paused():
|
|
||||||
self.state = "Queued"
|
|
||||||
elif component.get("Core").session.is_paused() or (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:
|
|
||||||
log.debug("Trying to set an invalid state %s", state)
|
|
||||||
return
|
|
||||||
|
|
||||||
self.state = state
|
|
||||||
return
|
|
||||||
|
|
||||||
def set_status_message(self, message):
|
|
||||||
self.statusmsg = message
|
|
||||||
|
|
||||||
def get_eta(self):
|
|
||||||
"""Returns the ETA in seconds for this torrent"""
|
|
||||||
if self.status == None:
|
|
||||||
status = self.handle.status()
|
|
||||||
else:
|
|
||||||
status = self.status
|
|
||||||
|
|
||||||
if self.is_finished and (self.options["stop_at_ratio"] or self.config["stop_seed_at_ratio"]):
|
|
||||||
# We're a seed, so calculate the time to the 'stop_share_ratio'
|
|
||||||
if not status.upload_payload_rate:
|
|
||||||
return 0
|
|
||||||
stop_ratio = self.config["stop_seed_ratio"] if self.config["stop_seed_at_ratio"] else self.options["stop_ratio"]
|
|
||||||
|
|
||||||
return ((status.all_time_download * stop_ratio) - status.all_time_upload) / status.upload_payload_rate
|
|
||||||
|
|
||||||
left = status.total_wanted - status.total_done
|
|
||||||
|
|
||||||
if left <= 0 or status.download_payload_rate == 0:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
try:
|
|
||||||
eta = left / status.download_payload_rate
|
|
||||||
except ZeroDivisionError:
|
|
||||||
eta = 0
|
|
||||||
|
|
||||||
return eta
|
|
||||||
|
|
||||||
def get_ratio(self):
|
|
||||||
"""Returns the ratio for this torrent"""
|
|
||||||
if self.status == None:
|
|
||||||
status = self.handle.status()
|
|
||||||
else:
|
|
||||||
status = self.status
|
|
||||||
|
|
||||||
if status.total_done > 0:
|
|
||||||
# We use 'total_done' if the downloaded value is 0
|
|
||||||
downloaded = status.total_done
|
|
||||||
else:
|
|
||||||
# Return -1.0 to signify infinity
|
|
||||||
return -1.0
|
|
||||||
|
|
||||||
return float(status.all_time_upload) / float(downloaded)
|
|
||||||
|
|
||||||
def get_files(self):
|
|
||||||
"""Returns a list of files this torrent contains"""
|
|
||||||
if self.torrent_info == None and self.handle.has_metadata():
|
|
||||||
torrent_info = self.handle.get_torrent_info()
|
|
||||||
else:
|
|
||||||
torrent_info = self.torrent_info
|
|
||||||
|
|
||||||
if not torrent_info:
|
|
||||||
return []
|
|
||||||
|
|
||||||
ret = []
|
|
||||||
files = torrent_info.files()
|
|
||||||
for index, file in enumerate(files):
|
|
||||||
ret.append({
|
|
||||||
'index': index,
|
|
||||||
'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:
|
|
||||||
continue
|
|
||||||
try:
|
|
||||||
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:
|
|
||||||
if not c.isalpha():
|
|
||||||
country += " "
|
|
||||||
else:
|
|
||||||
country += c
|
|
||||||
|
|
||||||
ret.append({
|
|
||||||
"client": client,
|
|
||||||
"country": country,
|
|
||||||
"down_speed": peer.down_speed,
|
|
||||||
"ip": "%s:%s" % (peer.ip[0], peer.ip[1]),
|
|
||||||
"progress": peer.progress,
|
|
||||||
"seed": peer.flags & peer.seed,
|
|
||||||
"up_speed": peer.up_speed,
|
|
||||||
})
|
|
||||||
|
|
||||||
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"""
|
|
||||||
if not self.handle.has_metadata():
|
|
||||||
return 0.0
|
|
||||||
|
|
||||||
file_progress = self.handle.file_progress()
|
|
||||||
ret = []
|
|
||||||
for i,f in enumerate(self.get_files()):
|
|
||||||
try:
|
|
||||||
ret.append(float(file_progress[i]) / float(f["size"]))
|
|
||||||
except ZeroDivisionError:
|
|
||||||
ret.append(0.0)
|
|
||||||
|
|
||||||
return ret
|
|
||||||
|
|
||||||
def get_tracker_host(self):
|
|
||||||
"""Returns just the hostname of the currently connected tracker
|
|
||||||
if no tracker is connected, it uses the 1st tracker."""
|
|
||||||
if self.tracker_host:
|
|
||||||
return self.tracker_host
|
|
||||||
|
|
||||||
if not self.status:
|
|
||||||
self.status = self.handle.status()
|
|
||||||
|
|
||||||
tracker = self.status.current_tracker
|
|
||||||
if not tracker and self.trackers:
|
|
||||||
tracker = self.trackers[0]["url"]
|
|
||||||
|
|
||||||
if tracker:
|
|
||||||
url = urlparse(tracker.replace("udp://", "http://"))
|
|
||||||
if hasattr(url, "hostname"):
|
|
||||||
host = (url.hostname or 'DHT')
|
|
||||||
# Check if hostname is an IP address and just return it if that's the case
|
|
||||||
import socket
|
|
||||||
try:
|
|
||||||
socket.inet_aton(host)
|
|
||||||
except socket.error:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
# This is an IP address because an exception wasn't raised
|
|
||||||
return url.hostname
|
|
||||||
|
|
||||||
parts = host.split(".")
|
|
||||||
if len(parts) > 2:
|
|
||||||
if parts[-2] in ("co", "com", "net", "org") or parts[-1] in ("uk"):
|
|
||||||
host = ".".join(parts[-3:])
|
|
||||||
else:
|
|
||||||
host = ".".join(parts[-2:])
|
|
||||||
self.tracker_host = host
|
|
||||||
return host
|
|
||||||
return ""
|
|
||||||
|
|
||||||
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()
|
|
||||||
if self.handle.has_metadata():
|
|
||||||
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
|
|
||||||
|
|
||||||
#if you add a key here->add it to core.py STATUS_KEYS too.
|
|
||||||
full_status = {
|
|
||||||
"active_time": self.status.active_time,
|
|
||||||
"all_time_download": self.status.all_time_download,
|
|
||||||
"compact": self.options["compact_allocation"],
|
|
||||||
"distributed_copies": distributed_copies,
|
|
||||||
"download_payload_rate": self.status.download_payload_rate,
|
|
||||||
"file_priorities": self.options["file_priorities"],
|
|
||||||
"hash": self.torrent_id,
|
|
||||||
"is_auto_managed": self.options["auto_managed"],
|
|
||||||
"is_finished": self.is_finished,
|
|
||||||
"max_connections": self.options["max_connections"],
|
|
||||||
"max_download_speed": self.options["max_download_speed"],
|
|
||||||
"max_upload_slots": self.options["max_upload_slots"],
|
|
||||||
"max_upload_speed": self.options["max_upload_speed"],
|
|
||||||
"message": self.statusmsg,
|
|
||||||
"move_on_completed_path": self.options["move_completed_path"],
|
|
||||||
"move_on_completed": self.options["move_completed"],
|
|
||||||
"next_announce": self.status.next_announce.seconds,
|
|
||||||
"num_peers": self.status.num_peers - self.status.num_seeds,
|
|
||||||
"num_seeds": self.status.num_seeds,
|
|
||||||
"paused": self.status.paused,
|
|
||||||
"prioritize_first_last": self.options["prioritize_first_last_pieces"],
|
|
||||||
"progress": progress,
|
|
||||||
"remove_at_ratio": self.options["remove_at_ratio"],
|
|
||||||
"save_path": self.options["download_location"],
|
|
||||||
"seeding_time": self.status.seeding_time,
|
|
||||||
"seed_rank": self.status.seed_rank,
|
|
||||||
"state": self.state,
|
|
||||||
"stop_at_ratio": self.options["stop_at_ratio"],
|
|
||||||
"stop_ratio": self.options["stop_ratio"],
|
|
||||||
"time_added": self.time_added,
|
|
||||||
"total_done": self.status.total_done,
|
|
||||||
"total_payload_download": self.status.total_payload_download,
|
|
||||||
"total_payload_upload": self.status.total_payload_upload,
|
|
||||||
"total_peers": self.status.num_incomplete,
|
|
||||||
"total_seeds": self.status.num_complete,
|
|
||||||
"total_uploaded": self.status.all_time_upload,
|
|
||||||
"total_wanted": self.status.total_wanted,
|
|
||||||
"tracker": self.status.current_tracker,
|
|
||||||
"trackers": self.trackers,
|
|
||||||
"tracker_status": self.tracker_status,
|
|
||||||
"upload_payload_rate": self.status.upload_payload_rate
|
|
||||||
}
|
|
||||||
|
|
||||||
def ti_comment():
|
|
||||||
if self.handle.has_metadata():
|
|
||||||
try:
|
|
||||||
return self.torrent_info.comment().decode("utf8", "ignore")
|
|
||||||
except UnicodeDecodeError:
|
|
||||||
return self.torrent_info.comment()
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def ti_name():
|
|
||||||
if self.handle.has_metadata():
|
|
||||||
name = self.torrent_info.file_at(0).path.split("/", 1)[0]
|
|
||||||
if not name:
|
|
||||||
name = self.torrent_info.name()
|
|
||||||
try:
|
|
||||||
return name.decode("utf8", "ignore")
|
|
||||||
except UnicodeDecodeError:
|
|
||||||
return name
|
|
||||||
|
|
||||||
return self.torrent_id
|
|
||||||
def ti_priv():
|
|
||||||
if self.handle.has_metadata():
|
|
||||||
return self.torrent_info.priv()
|
|
||||||
return False
|
|
||||||
def ti_total_size():
|
|
||||||
if self.handle.has_metadata():
|
|
||||||
return self.torrent_info.total_size()
|
|
||||||
return 0
|
|
||||||
def ti_num_files():
|
|
||||||
if self.handle.has_metadata():
|
|
||||||
return self.torrent_info.num_files()
|
|
||||||
return 0
|
|
||||||
def ti_num_pieces():
|
|
||||||
if self.handle.has_metadata():
|
|
||||||
return self.torrent_info.num_pieces()
|
|
||||||
return 0
|
|
||||||
def ti_piece_length():
|
|
||||||
if self.handle.has_metadata():
|
|
||||||
return self.torrent_info.piece_length()
|
|
||||||
return 0
|
|
||||||
|
|
||||||
fns = {
|
|
||||||
"comment": ti_comment,
|
|
||||||
"eta": self.get_eta,
|
|
||||||
"file_progress": self.get_file_progress,
|
|
||||||
"files": self.get_files,
|
|
||||||
"is_seed": self.handle.is_seed,
|
|
||||||
"name": ti_name,
|
|
||||||
"num_files": ti_num_files,
|
|
||||||
"num_pieces": ti_num_pieces,
|
|
||||||
"peers": self.get_peers,
|
|
||||||
"piece_length": ti_piece_length,
|
|
||||||
"private": ti_priv,
|
|
||||||
"queue": self.handle.queue_position,
|
|
||||||
"ratio": self.get_ratio,
|
|
||||||
"total_size": ti_total_size,
|
|
||||||
"tracker_host": self.get_tracker_host,
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create the desired status dictionary and return it
|
|
||||||
status_dict = {}
|
|
||||||
|
|
||||||
if len(keys) == 0:
|
|
||||||
status_dict = full_status
|
|
||||||
for key in fns:
|
|
||||||
status_dict[key] = fns[key]()
|
|
||||||
else:
|
|
||||||
for key in keys:
|
|
||||||
if key in full_status:
|
|
||||||
status_dict[key] = full_status[key]
|
|
||||||
elif key in fns:
|
|
||||||
status_dict[key] = fns[key]()
|
|
||||||
|
|
||||||
return status_dict
|
|
||||||
|
|
||||||
def apply_options(self):
|
|
||||||
"""Applies the per-torrent options that are set."""
|
|
||||||
self.handle.set_max_connections(self.max_connections)
|
|
||||||
self.handle.set_max_uploads(self.max_upload_slots)
|
|
||||||
self.handle.set_upload_limit(int(self.max_upload_speed * 1024))
|
|
||||||
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
|
|
||||||
self.handle.auto_managed(False)
|
|
||||||
if self.handle.is_paused():
|
|
||||||
# This torrent was probably paused due to being auto managed by lt
|
|
||||||
# Since we turned auto_managed off, we should update the state which should
|
|
||||||
# show it as 'Paused'. We need to emit a torrent_paused signal because
|
|
||||||
# the torrent_paused alert from libtorrent will not be generated.
|
|
||||||
self.update_state()
|
|
||||||
component.get("EventManager").emit(TorrentStateChangedEvent(self.torrent_id, "Paused"))
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
self.handle.pause()
|
|
||||||
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.options["stop_at_ratio"]:
|
|
||||||
if self.options["stop_at_ratio"]:
|
|
||||||
ratio = self.options["stop_ratio"]
|
|
||||||
else:
|
|
||||||
ratio = self.config["stop_seed_ratio"]
|
|
||||||
|
|
||||||
if self.get_ratio() >= ratio:
|
|
||||||
#XXX: This should just be returned in the RPC Response, no event
|
|
||||||
#self.signals.emit_event("torrent_resume_at_stop_ratio")
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.options["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 connect_peer(self, ip, port):
|
|
||||||
"""adds manual peer"""
|
|
||||||
try:
|
|
||||||
self.handle.connect_peer((ip, int(port)), 0)
|
|
||||||
except Exception, e:
|
|
||||||
log.debug("Unable to connect to peer: %s", e)
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def move_storage(self, dest):
|
|
||||||
"""Move a torrent's storage location"""
|
|
||||||
if not os.path.exists(dest):
|
|
||||||
log.error("Could not move storage for torrent %s since %s does not exist!", self.torrent_id, dest)
|
|
||||||
return False
|
|
||||||
try:
|
|
||||||
self.handle.move_storage(dest.encode("utf8"))
|
|
||||||
except:
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def save_resume_data(self):
|
|
||||||
"""Signals libtorrent to build resume data for this torrent, it gets
|
|
||||||
returned in a libtorrent alert"""
|
|
||||||
self.handle.save_resume_data()
|
|
||||||
self.waiting_on_resume_data = True
|
|
||||||
|
|
||||||
def write_torrentfile(self):
|
|
||||||
"""Writes the torrent file"""
|
|
||||||
path = "%s/%s.torrent" % (
|
|
||||||
os.path.join(get_config_dir(), "state"),
|
|
||||||
self.torrent_id)
|
|
||||||
log.debug("Writing torrent file: %s", path)
|
|
||||||
try:
|
|
||||||
self.torrent_info = self.handle.get_torrent_info()
|
|
||||||
# Regenerate the file priorities
|
|
||||||
self.set_file_priorities([])
|
|
||||||
md = lt.bdecode(self.torrent_info.metadata())
|
|
||||||
torrent_file = {}
|
|
||||||
torrent_file["info"] = md
|
|
||||||
open(path, "wb").write(lt.bencode(torrent_file))
|
|
||||||
except Exception, e:
|
|
||||||
log.warning("Unable to save torrent file: %s", e)
|
|
||||||
|
|
||||||
def delete_torrentfile(self):
|
|
||||||
"""Deletes the .torrent file in the state"""
|
|
||||||
path = "%s/%s.torrent" % (
|
|
||||||
os.path.join(get_config_dir(), "state"),
|
|
||||||
self.torrent_id)
|
|
||||||
log.debug("Deleting torrent file: %s", path)
|
|
||||||
try:
|
|
||||||
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:
|
|
||||||
self.handle.force_reannounce()
|
|
||||||
except Exception, e:
|
|
||||||
log.debug("Unable to force reannounce: %s", e)
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def scrape_tracker(self):
|
|
||||||
"""Scrape the tracker"""
|
|
||||||
try:
|
|
||||||
self.handle.scrape_tracker()
|
|
||||||
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:
|
|
||||||
self.handle.force_recheck()
|
|
||||||
self.handle.resume()
|
|
||||||
except Exception, e:
|
|
||||||
log.debug("Unable to force recheck: %s", e)
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def rename_files(self, filenames):
|
|
||||||
"""Renames files in the torrent. 'filenames' should be a list of
|
|
||||||
(index, filename) pairs."""
|
|
||||||
for index, filename in filenames:
|
|
||||||
self.handle.rename_file(index, filename.encode("utf-8"))
|
|
||||||
|
|
||||||
def rename_folder(self, folder, new_folder):
|
|
||||||
"""Renames a folder within a torrent. This basically does a file rename
|
|
||||||
on all of the folders children."""
|
|
||||||
log.debug("attempting to rename folder: %s to %s", folder, new_folder)
|
|
||||||
if len(new_folder) < 1:
|
|
||||||
log.error("Attempting to rename a folder with an invalid folder name: %s", new_folder)
|
|
||||||
return
|
|
||||||
|
|
||||||
if new_folder[-1:] != "/":
|
|
||||||
new_folder += "/"
|
|
||||||
|
|
||||||
wait_on_folder = (folder, new_folder, [])
|
|
||||||
for f in self.get_files():
|
|
||||||
if f["path"].startswith(folder):
|
|
||||||
# Keep a list of filerenames we're waiting on
|
|
||||||
wait_on_folder[2].append(f["index"])
|
|
||||||
self.handle.rename_file(f["index"], f["path"].replace(folder, new_folder, 1).encode("utf-8"))
|
|
||||||
self.waiting_on_folder_rename.append(wait_on_folder)
|
|
@@ -1,998 +0,0 @@
|
|||||||
#
|
|
||||||
# torrentmanager.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
"""TorrentManager handles Torrent objects"""
|
|
||||||
|
|
||||||
import cPickle
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
import shutil
|
|
||||||
import operator
|
|
||||||
|
|
||||||
from twisted.internet import reactor
|
|
||||||
from twisted.internet.task import LoopingCall
|
|
||||||
|
|
||||||
from deluge._libtorrent import lt
|
|
||||||
|
|
||||||
|
|
||||||
from deluge.event import *
|
|
||||||
from deluge.error import *
|
|
||||||
import deluge.common
|
|
||||||
import deluge.component as component
|
|
||||||
from deluge.configmanager import ConfigManager, get_config_dir
|
|
||||||
from deluge.core.torrent import Torrent
|
|
||||||
from deluge.core.torrent import TorrentOptions
|
|
||||||
import deluge.core.oldstateupgrader
|
|
||||||
|
|
||||||
from deluge.log import LOG as log
|
|
||||||
|
|
||||||
class TorrentState:
|
|
||||||
def __init__(self,
|
|
||||||
torrent_id=None,
|
|
||||||
filename=None,
|
|
||||||
total_uploaded=0,
|
|
||||||
trackers=None,
|
|
||||||
compact=False,
|
|
||||||
paused=False,
|
|
||||||
save_path=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=True,
|
|
||||||
is_finished=False,
|
|
||||||
stop_ratio=2.00,
|
|
||||||
stop_at_ratio=False,
|
|
||||||
remove_at_ratio=False,
|
|
||||||
move_completed=False,
|
|
||||||
move_completed_path=None,
|
|
||||||
magnet=None,
|
|
||||||
time_added=-1
|
|
||||||
):
|
|
||||||
self.torrent_id = torrent_id
|
|
||||||
self.filename = filename
|
|
||||||
self.total_uploaded = total_uploaded
|
|
||||||
self.trackers = trackers
|
|
||||||
self.queue = queue
|
|
||||||
self.is_finished = is_finished
|
|
||||||
self.magnet = magnet
|
|
||||||
self.time_added = time_added
|
|
||||||
|
|
||||||
# Options
|
|
||||||
self.compact = compact
|
|
||||||
self.paused = paused
|
|
||||||
self.save_path = save_path
|
|
||||||
self.max_connections = max_connections
|
|
||||||
self.max_upload_slots = max_upload_slots
|
|
||||||
self.max_upload_speed = max_upload_speed
|
|
||||||
self.max_download_speed = max_download_speed
|
|
||||||
self.prioritize_first_last = prioritize_first_last
|
|
||||||
self.file_priorities = file_priorities
|
|
||||||
self.auto_managed = auto_managed
|
|
||||||
self.stop_ratio = stop_ratio
|
|
||||||
self.stop_at_ratio = stop_at_ratio
|
|
||||||
self.remove_at_ratio = remove_at_ratio
|
|
||||||
self.move_completed = move_completed
|
|
||||||
self.move_completed_path = move_completed_path
|
|
||||||
|
|
||||||
class TorrentManagerState:
|
|
||||||
def __init__(self):
|
|
||||||
self.torrents = []
|
|
||||||
|
|
||||||
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):
|
|
||||||
component.Component.__init__(self, "TorrentManager", interval=5, depend=["CorePluginManager"])
|
|
||||||
log.debug("TorrentManager init..")
|
|
||||||
# Set the libtorrent session
|
|
||||||
self.session = component.get("Core").session
|
|
||||||
# Set the alertmanager
|
|
||||||
self.alerts = component.get("AlertManager")
|
|
||||||
# Get the core config
|
|
||||||
self.config = ConfigManager("core.conf")
|
|
||||||
|
|
||||||
# Make sure the state folder has been created
|
|
||||||
if not os.path.exists(os.path.join(get_config_dir(), "state")):
|
|
||||||
os.makedirs(os.path.join(get_config_dir(), "state"))
|
|
||||||
|
|
||||||
# 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 = []
|
|
||||||
|
|
||||||
# self.num_resume_data used to save resume_data in bulk
|
|
||||||
self.num_resume_data = 0
|
|
||||||
|
|
||||||
# Keeps track of resume data that needs to be saved to disk
|
|
||||||
self.resume_data = {}
|
|
||||||
|
|
||||||
# Register set functions
|
|
||||||
self.config.register_set_function("max_connections_per_torrent",
|
|
||||||
self.on_set_max_connections_per_torrent)
|
|
||||||
self.config.register_set_function("max_upload_slots_per_torrent",
|
|
||||||
self.on_set_max_upload_slots_per_torrent)
|
|
||||||
self.config.register_set_function("max_upload_speed_per_torrent",
|
|
||||||
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.on_alert_torrent_finished)
|
|
||||||
self.alerts.register_handler("torrent_paused_alert",
|
|
||||||
self.on_alert_torrent_paused)
|
|
||||||
self.alerts.register_handler("torrent_checked_alert",
|
|
||||||
self.on_alert_torrent_checked)
|
|
||||||
self.alerts.register_handler("tracker_reply_alert",
|
|
||||||
self.on_alert_tracker_reply)
|
|
||||||
self.alerts.register_handler("tracker_announce_alert",
|
|
||||||
self.on_alert_tracker_announce)
|
|
||||||
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.on_alert_torrent_resumed)
|
|
||||||
self.alerts.register_handler("state_changed_alert",
|
|
||||||
self.on_alert_state_changed)
|
|
||||||
self.alerts.register_handler("save_resume_data_alert",
|
|
||||||
self.on_alert_save_resume_data)
|
|
||||||
self.alerts.register_handler("save_resume_data_failed_alert",
|
|
||||||
self.on_alert_save_resume_data_failed)
|
|
||||||
self.alerts.register_handler("file_renamed_alert",
|
|
||||||
self.on_alert_file_renamed)
|
|
||||||
self.alerts.register_handler("metadata_received_alert",
|
|
||||||
self.on_alert_metadata_received)
|
|
||||||
self.alerts.register_handler("file_error_alert",
|
|
||||||
self.on_alert_file_error)
|
|
||||||
|
|
||||||
def start(self):
|
|
||||||
# Get the pluginmanager reference
|
|
||||||
self.plugins = component.get("CorePluginManager")
|
|
||||||
|
|
||||||
# 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 = LoopingCall(self.save_state)
|
|
||||||
self.save_state_timer.start(200, False)
|
|
||||||
self.save_resume_data_timer = LoopingCall(self.save_resume_data)
|
|
||||||
self.save_resume_data_timer.start(190)
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
# Stop timers
|
|
||||||
if self.save_state_timer.running:
|
|
||||||
self.save_state_timer.stop()
|
|
||||||
|
|
||||||
if self.save_resume_data_timer.running:
|
|
||||||
self.save_resume_data_timer.stop()
|
|
||||||
|
|
||||||
# Save state on shutdown
|
|
||||||
self.save_state()
|
|
||||||
|
|
||||||
# Make another list just to make sure all paused torrents will be
|
|
||||||
# passed to self.save_resume_data(). With
|
|
||||||
# self.shutdown_torrent_pause_list it is possible to have a case when
|
|
||||||
# torrent_id is removed from it in self.on_alert_torrent_paused()
|
|
||||||
# before we call self.save_resume_data() here.
|
|
||||||
save_resume_data_list = []
|
|
||||||
for key in self.torrents.keys():
|
|
||||||
if not self.torrents[key].handle.is_paused():
|
|
||||||
# We set auto_managed false to prevent lt from resuming the torrent
|
|
||||||
self.torrents[key].handle.auto_managed(False)
|
|
||||||
self.torrents[key].handle.pause()
|
|
||||||
self.shutdown_torrent_pause_list.append(key)
|
|
||||||
save_resume_data_list.append(key)
|
|
||||||
|
|
||||||
self.save_resume_data(save_resume_data_list)
|
|
||||||
|
|
||||||
# We have to wait for all torrents to pause and write their resume data
|
|
||||||
wait = True
|
|
||||||
while wait:
|
|
||||||
if self.shutdown_torrent_pause_list:
|
|
||||||
wait = True
|
|
||||||
else:
|
|
||||||
wait = False
|
|
||||||
for torrent in self.torrents.values():
|
|
||||||
if torrent.waiting_on_resume_data:
|
|
||||||
wait = True
|
|
||||||
break
|
|
||||||
|
|
||||||
time.sleep(0.01)
|
|
||||||
# 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.options["stop_at_ratio"] and torrent.state not in ("Checking", "Allocating", "Paused", "Queued"):
|
|
||||||
# If the global setting is set, but the per-torrent isn't.. Just skip to the next torrent
|
|
||||||
# This is so that a user can turn-off the stop at ratio option on a per-torrent basis
|
|
||||||
if self.config["stop_seed_at_ratio"] and not torrent.options["stop_at_ratio"]:
|
|
||||||
continue
|
|
||||||
stop_ratio = self.config["stop_seed_ratio"]
|
|
||||||
if torrent.options["stop_at_ratio"]:
|
|
||||||
stop_ratio = torrent.options["stop_ratio"]
|
|
||||||
if torrent.get_ratio() >= stop_ratio and torrent.is_finished:
|
|
||||||
if self.config["remove_seed_at_ratio"] or torrent.options["remove_at_ratio"]:
|
|
||||||
self.remove(torrent_id)
|
|
||||||
break
|
|
||||||
if not torrent.handle.is_paused():
|
|
||||||
torrent.pause()
|
|
||||||
|
|
||||||
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
|
|
||||||
# Get the torrent data from the torrent file
|
|
||||||
try:
|
|
||||||
log.debug("Attempting to create torrent_info from %s", filepath)
|
|
||||||
_file = open(filepath, "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)
|
|
||||||
|
|
||||||
return torrent_info
|
|
||||||
|
|
||||||
def legacy_get_resume_data_from_file(self, torrent_id):
|
|
||||||
"""Returns an entry with the resume data or None"""
|
|
||||||
fastresume = ""
|
|
||||||
try:
|
|
||||||
_file = open(os.path.join(get_config_dir(), "state",
|
|
||||||
torrent_id + ".fastresume"), "rb")
|
|
||||||
fastresume = _file.read()
|
|
||||||
_file.close()
|
|
||||||
except IOError, e:
|
|
||||||
log.debug("Unable to load .fastresume: %s", e)
|
|
||||||
|
|
||||||
return str(fastresume)
|
|
||||||
|
|
||||||
def legacy_delete_resume_data(self, torrent_id):
|
|
||||||
"""Deletes the .fastresume file"""
|
|
||||||
path = os.path.join(get_config_dir(), "state",
|
|
||||||
torrent_id + ".fastresume")
|
|
||||||
log.debug("Deleting fastresume file: %s", path)
|
|
||||||
try:
|
|
||||||
os.remove(path)
|
|
||||||
except Exception, e:
|
|
||||||
log.warning("Unable to delete the fastresume file: %s", e)
|
|
||||||
|
|
||||||
def add(self, torrent_info=None, state=None, options=None, save_state=True,
|
|
||||||
filedump=None, filename=None, magnet=None, resume_data=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 and magnet is None:
|
|
||||||
log.debug("You must specify a valid torrent_info, torrent state or magnet.")
|
|
||||||
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)
|
|
||||||
# XXX: Probably should raise an exception here..
|
|
||||||
return
|
|
||||||
|
|
||||||
if torrent_info is None and state:
|
|
||||||
# We have no torrent_info so we need to add the torrent with information
|
|
||||||
# from the state object.
|
|
||||||
|
|
||||||
# Populate the options dict from state
|
|
||||||
options = TorrentOptions()
|
|
||||||
options["max_connections"] = state.max_connections
|
|
||||||
options["max_upload_slots"] = state.max_upload_slots
|
|
||||||
options["max_upload_speed"] = state.max_upload_speed
|
|
||||||
options["max_download_speed"] = state.max_download_speed
|
|
||||||
options["prioritize_first_last_pieces"] = state.prioritize_first_last
|
|
||||||
options["file_priorities"] = state.file_priorities
|
|
||||||
options["compact_allocation"] = state.compact
|
|
||||||
options["download_location"] = state.save_path
|
|
||||||
options["auto_managed"] = state.auto_managed
|
|
||||||
options["stop_at_ratio"] = state.stop_at_ratio
|
|
||||||
options["stop_ratio"] = state.stop_ratio
|
|
||||||
options["remove_at_ratio"] = state.remove_at_ratio
|
|
||||||
options["move_completed"] = state.move_completed
|
|
||||||
options["move_completed_path"] = state.move_completed_path
|
|
||||||
options["add_paused"] = state.paused
|
|
||||||
|
|
||||||
ti = self.get_torrent_info_from_file(
|
|
||||||
os.path.join(get_config_dir(),
|
|
||||||
"state", state.torrent_id + ".torrent"))
|
|
||||||
if ti:
|
|
||||||
add_torrent_params["ti"] = ti
|
|
||||||
elif state.magnet:
|
|
||||||
magnet = state.magnet
|
|
||||||
else:
|
|
||||||
log.error("Unable to add torrent!")
|
|
||||||
return
|
|
||||||
|
|
||||||
# Handle legacy case with storing resume data in individual files
|
|
||||||
# for each torrent
|
|
||||||
if resume_data is None:
|
|
||||||
resume_data = self.legacy_get_resume_data_from_file(state.torrent_id)
|
|
||||||
self.legacy_delete_resume_data(state.torrent_id)
|
|
||||||
|
|
||||||
add_torrent_params["resume_data"] = resume_data
|
|
||||||
else:
|
|
||||||
# We have a torrent_info object so we're not loading from state.
|
|
||||||
# Check if options is None and load defaults
|
|
||||||
if options == None:
|
|
||||||
options = TorrentOptions()
|
|
||||||
else:
|
|
||||||
o = TorrentOptions()
|
|
||||||
o.update(options)
|
|
||||||
options = o
|
|
||||||
|
|
||||||
# Check for renamed files and if so, rename them in the torrent_info
|
|
||||||
# before adding to the session.
|
|
||||||
if options["mapped_files"]:
|
|
||||||
for index, name in options["mapped_files"].items():
|
|
||||||
log.debug("renaming file index %s to %s", index, name)
|
|
||||||
torrent_info.rename_file(index, name.encode("utf-8"))
|
|
||||||
|
|
||||||
add_torrent_params["ti"] = torrent_info
|
|
||||||
add_torrent_params["resume_data"] = ""
|
|
||||||
|
|
||||||
#log.info("Adding torrent: %s", filename)
|
|
||||||
log.debug("options: %s", options)
|
|
||||||
|
|
||||||
# Set the right storage_mode
|
|
||||||
if options["compact_allocation"]:
|
|
||||||
storage_mode = lt.storage_mode_t(2)
|
|
||||||
else:
|
|
||||||
storage_mode = lt.storage_mode_t(1)
|
|
||||||
|
|
||||||
try:
|
|
||||||
# Try to encode this as utf8 if needed
|
|
||||||
options["download_location"] = options["download_location"].encode("utf8")
|
|
||||||
except UnicodeDecodeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Fill in the rest of the add_torrent_params dictionary
|
|
||||||
add_torrent_params["save_path"] = options["download_location"]
|
|
||||||
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:
|
|
||||||
if magnet:
|
|
||||||
handle = lt.add_magnet_uri(self.session, magnet, add_torrent_params)
|
|
||||||
else:
|
|
||||||
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()))
|
|
||||||
# Set auto_managed to False because the torrent is paused
|
|
||||||
handle.auto_managed(False)
|
|
||||||
# Create a Torrent object
|
|
||||||
torrent = Torrent(handle, options, state, filename, magnet)
|
|
||||||
# Add the torrent object to the dictionary
|
|
||||||
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
|
|
||||||
if not options["add_paused"]:
|
|
||||||
torrent.resume()
|
|
||||||
|
|
||||||
# Write the .torrent file to the state directory
|
|
||||||
if filedump:
|
|
||||||
try:
|
|
||||||
save_file = open(os.path.join(get_config_dir(), "state",
|
|
||||||
torrent.torrent_id + ".torrent"),
|
|
||||||
"wb")
|
|
||||||
save_file.write(filedump)
|
|
||||||
save_file.close()
|
|
||||||
except IOError, e:
|
|
||||||
log.warning("Unable to save torrent file: %s", e)
|
|
||||||
|
|
||||||
# If the user has requested a copy of the torrent be saved elsewhere
|
|
||||||
# we need to do that.
|
|
||||||
if self.config["copy_torrent_file"] and filename is not None:
|
|
||||||
try:
|
|
||||||
save_file = open(
|
|
||||||
os.path.join(self.config["torrentfiles_location"], filename),
|
|
||||||
"wb")
|
|
||||||
save_file.write(filedump)
|
|
||||||
save_file.close()
|
|
||||||
except IOError, e:
|
|
||||||
log.warning("Unable to save torrent file: %s", e)
|
|
||||||
|
|
||||||
if save_state:
|
|
||||||
# Save the session state
|
|
||||||
self.save_state()
|
|
||||||
|
|
||||||
# Emit the torrent_added signal
|
|
||||||
component.get("EventManager").emit(TorrentAddedEvent(torrent.torrent_id))
|
|
||||||
|
|
||||||
return torrent.torrent_id
|
|
||||||
|
|
||||||
def load_torrent(self, torrent_id):
|
|
||||||
"""Load a torrent file from state and return it's torrent info"""
|
|
||||||
filedump = None
|
|
||||||
# Get the torrent data from the torrent file
|
|
||||||
try:
|
|
||||||
log.debug("Attempting to open %s for add.", torrent_id)
|
|
||||||
_file = open(
|
|
||||||
os.path.join(
|
|
||||||
get_config_dir(), "state", 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_data=False):
|
|
||||||
"""
|
|
||||||
Remove a torrent from the session.
|
|
||||||
|
|
||||||
:param torrent_id: the torrent to remove
|
|
||||||
:type torrent_id: string
|
|
||||||
:param remove_data: if True, remove the downloaded data
|
|
||||||
:type remove_data: bool
|
|
||||||
|
|
||||||
:returns: True if removed successfully, False if not
|
|
||||||
:rtype: bool
|
|
||||||
|
|
||||||
:raises InvalidTorrentError: if the torrent_id is not in the session
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
if torrent_id not in self.torrents:
|
|
||||||
raise InvalidTorrentError("torrent_id not in session")
|
|
||||||
|
|
||||||
# Emit the signal to the clients
|
|
||||||
component.get("EventManager").emit(PreTorrentRemovedEvent(torrent_id))
|
|
||||||
|
|
||||||
try:
|
|
||||||
self.session.remove_torrent(self.torrents[torrent_id].handle,
|
|
||||||
1 if remove_data else 0)
|
|
||||||
except (RuntimeError, KeyError), e:
|
|
||||||
log.warning("Error removing torrent: %s", e)
|
|
||||||
return False
|
|
||||||
|
|
||||||
# Remove fastresume data if it is exists
|
|
||||||
resume_data = self.load_resume_data_file()
|
|
||||||
resume_data.pop(torrent_id, None)
|
|
||||||
self.save_resume_data_file(resume_data)
|
|
||||||
|
|
||||||
# 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
|
|
||||||
component.get("EventManager").emit(TorrentRemovedEvent(torrent_id))
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def load_state(self):
|
|
||||||
"""Load the state of the TorrentManager from the torrents.state file"""
|
|
||||||
state = TorrentManagerState()
|
|
||||||
|
|
||||||
try:
|
|
||||||
log.debug("Opening torrent state file for load.")
|
|
||||||
state_file = open(
|
|
||||||
os.path.join(get_config_dir(), "state", "torrents.state"), "rb")
|
|
||||||
state = cPickle.load(state_file)
|
|
||||||
state_file.close()
|
|
||||||
except (EOFError, IOError, Exception), e:
|
|
||||||
log.warning("Unable to load state file: %s", e)
|
|
||||||
|
|
||||||
# Try to use an old state
|
|
||||||
try:
|
|
||||||
state_tmp = TorrentState()
|
|
||||||
if dir(state.torrents[0]) != dir(state_tmp):
|
|
||||||
for attr in (set(dir(state_tmp)) - set(dir(state.torrents[0]))):
|
|
||||||
for s in state.torrents:
|
|
||||||
setattr(s, attr, getattr(state_tmp, 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.
|
|
||||||
state.torrents.sort(key=operator.attrgetter("queue"))
|
|
||||||
|
|
||||||
resume_data = self.load_resume_data_file()
|
|
||||||
|
|
||||||
for torrent_state in state.torrents:
|
|
||||||
try:
|
|
||||||
self.add(state=torrent_state, save_state=False,
|
|
||||||
resume_data=resume_data.get(torrent_state.torrent_id))
|
|
||||||
except AttributeError, e:
|
|
||||||
log.error("Torrent state file is either corrupt or incompatible! %s", e)
|
|
||||||
break
|
|
||||||
|
|
||||||
component.get("EventManager").emit(SessionStartedEvent())
|
|
||||||
|
|
||||||
def save_state(self):
|
|
||||||
"""Save the state of the TorrentManager to the torrents.state file"""
|
|
||||||
state = TorrentManagerState()
|
|
||||||
# Create the state for each Torrent and append to the list
|
|
||||||
for torrent in self.torrents.values():
|
|
||||||
paused = False
|
|
||||||
if torrent.state == "Paused":
|
|
||||||
paused = True
|
|
||||||
|
|
||||||
torrent_state = TorrentState(
|
|
||||||
torrent.torrent_id,
|
|
||||||
torrent.filename,
|
|
||||||
torrent.get_status(["total_uploaded"])["total_uploaded"],
|
|
||||||
torrent.trackers,
|
|
||||||
torrent.options["compact_allocation"],
|
|
||||||
paused,
|
|
||||||
torrent.options["download_location"],
|
|
||||||
torrent.options["max_connections"],
|
|
||||||
torrent.options["max_upload_slots"],
|
|
||||||
torrent.options["max_upload_speed"],
|
|
||||||
torrent.options["max_download_speed"],
|
|
||||||
torrent.options["prioritize_first_last_pieces"],
|
|
||||||
torrent.options["file_priorities"],
|
|
||||||
torrent.get_queue_position(),
|
|
||||||
torrent.options["auto_managed"],
|
|
||||||
torrent.is_finished,
|
|
||||||
torrent.options["stop_ratio"],
|
|
||||||
torrent.options["stop_at_ratio"],
|
|
||||||
torrent.options["remove_at_ratio"],
|
|
||||||
torrent.options["move_completed"],
|
|
||||||
torrent.options["move_completed_path"],
|
|
||||||
torrent.magnet,
|
|
||||||
torrent.time_added
|
|
||||||
)
|
|
||||||
state.torrents.append(torrent_state)
|
|
||||||
|
|
||||||
# Pickle the TorrentManagerState object
|
|
||||||
try:
|
|
||||||
log.debug("Saving torrent state file.")
|
|
||||||
state_file = open(os.path.join(get_config_dir(),
|
|
||||||
"state", "torrents.state.new"), "wb")
|
|
||||||
cPickle.dump(state, state_file)
|
|
||||||
state_file.flush()
|
|
||||||
os.fsync(state_file.fileno())
|
|
||||||
state_file.close()
|
|
||||||
except IOError:
|
|
||||||
log.warning("Unable to save state file.")
|
|
||||||
return True
|
|
||||||
|
|
||||||
# We have to move the 'torrents.state.new' file to 'torrents.state'
|
|
||||||
try:
|
|
||||||
shutil.move(
|
|
||||||
os.path.join(get_config_dir(), "state", "torrents.state.new"),
|
|
||||||
os.path.join(get_config_dir(), "state", "torrents.state"))
|
|
||||||
except IOError:
|
|
||||||
log.warning("Unable to save state file.")
|
|
||||||
return True
|
|
||||||
|
|
||||||
# We return True so that the timer thread will continue
|
|
||||||
return True
|
|
||||||
|
|
||||||
def save_resume_data(self, torrent_ids=None):
|
|
||||||
"""
|
|
||||||
Saves resume data for list of torrent_ids or for all torrents if
|
|
||||||
torrent_ids is None
|
|
||||||
"""
|
|
||||||
|
|
||||||
if torrent_ids is None:
|
|
||||||
torrent_ids = self.torrents.keys()
|
|
||||||
|
|
||||||
for torrent_id in torrent_ids:
|
|
||||||
self.torrents[torrent_id].save_resume_data()
|
|
||||||
|
|
||||||
self.num_resume_data = len(torrent_ids)
|
|
||||||
|
|
||||||
def load_resume_data_file(self):
|
|
||||||
resume_data = {}
|
|
||||||
try:
|
|
||||||
log.debug("Opening torrents fastresume file for load.")
|
|
||||||
fastresume_file = open(os.path.join(get_config_dir(), "state",
|
|
||||||
"torrents.fastresume"), "rb")
|
|
||||||
resume_data = lt.bdecode(fastresume_file.read())
|
|
||||||
fastresume_file.close()
|
|
||||||
except (EOFError, IOError, Exception), e:
|
|
||||||
log.warning("Unable to load fastresume file: %s", e)
|
|
||||||
|
|
||||||
# If the libtorrent bdecode doesn't happen properly, it will return None
|
|
||||||
# so we need to make sure we return a {}
|
|
||||||
if resume_data is None:
|
|
||||||
return {}
|
|
||||||
|
|
||||||
return resume_data
|
|
||||||
|
|
||||||
def save_resume_data_file(self, resume_data=None):
|
|
||||||
"""
|
|
||||||
Saves the resume data file with the contents of self.resume_data. If
|
|
||||||
`resume_data` is None, then we grab the resume_data from the file on
|
|
||||||
disk, else, we update `resume_data` with self.resume_data and save
|
|
||||||
that to disk.
|
|
||||||
|
|
||||||
:param resume_data: the current resume_data, this will be loaded from disk if not provided
|
|
||||||
:type resume_data: dict
|
|
||||||
|
|
||||||
"""
|
|
||||||
# Check to see if we're waiting on more resume data
|
|
||||||
if self.num_resume_data or not self.resume_data:
|
|
||||||
return
|
|
||||||
|
|
||||||
path = os.path.join(get_config_dir(), "state", "torrents.fastresume")
|
|
||||||
|
|
||||||
# First step is to load the existing file and update the dictionary
|
|
||||||
if resume_data is None:
|
|
||||||
resume_data = self.load_resume_data_file()
|
|
||||||
|
|
||||||
resume_data.update(self.resume_data)
|
|
||||||
self.resume_data = {}
|
|
||||||
|
|
||||||
try:
|
|
||||||
log.debug("Saving fastresume file: %s", path)
|
|
||||||
fastresume_file = open(path, "wb")
|
|
||||||
fastresume_file.write(lt.bencode(resume_data))
|
|
||||||
fastresume_file.flush()
|
|
||||||
os.fsync(fastresume_file.fileno())
|
|
||||||
fastresume_file.close()
|
|
||||||
except IOError:
|
|
||||||
log.warning("Error trying to save fastresume file")
|
|
||||||
|
|
||||||
def queue_top(self, torrent_id):
|
|
||||||
"""Queue torrent to top"""
|
|
||||||
if self.torrents[torrent_id].get_queue_position() == 0:
|
|
||||||
return False
|
|
||||||
|
|
||||||
self.torrents[torrent_id].handle.queue_position_top()
|
|
||||||
return True
|
|
||||||
|
|
||||||
def queue_up(self, torrent_id):
|
|
||||||
"""Queue torrent up one position"""
|
|
||||||
if self.torrents[torrent_id].get_queue_position() == 0:
|
|
||||||
return False
|
|
||||||
|
|
||||||
self.torrents[torrent_id].handle.queue_position_up()
|
|
||||||
return True
|
|
||||||
|
|
||||||
def queue_down(self, torrent_id):
|
|
||||||
"""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
|
|
||||||
|
|
||||||
def queue_bottom(self, torrent_id):
|
|
||||||
"""Queue torrent to bottom"""
|
|
||||||
if self.torrents[torrent_id].get_queue_position() == (len(self.torrents) - 1):
|
|
||||||
return False
|
|
||||||
|
|
||||||
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)
|
|
||||||
for key in self.torrents.keys():
|
|
||||||
self.torrents[key].set_max_upload_slots(value)
|
|
||||||
|
|
||||||
def on_set_max_upload_speed_per_torrent(self, key, value):
|
|
||||||
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():
|
|
||||||
self.torrents[key].set_max_download_speed(value)
|
|
||||||
|
|
||||||
## Alert handlers ##
|
|
||||||
def on_alert_torrent_finished(self, alert):
|
|
||||||
log.debug("on_alert_torrent_finished")
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
torrent_id = str(alert.handle.info_hash())
|
|
||||||
log.debug("%s is finished..", torrent_id)
|
|
||||||
|
|
||||||
# Get the total_download and if it's 0, do not move.. It's likely
|
|
||||||
# that the torrent wasn't downloaded, but just added.
|
|
||||||
total_download = torrent.get_status(["total_payload_download"])["total_payload_download"]
|
|
||||||
|
|
||||||
# Move completed download to completed folder if needed
|
|
||||||
if not torrent.is_finished and total_download:
|
|
||||||
move_path = None
|
|
||||||
|
|
||||||
if torrent.options["move_completed"]:
|
|
||||||
move_path = torrent.options["move_completed_path"]
|
|
||||||
if torrent.options["download_location"] != move_path:
|
|
||||||
torrent.move_storage(move_path)
|
|
||||||
|
|
||||||
torrent.is_finished = True
|
|
||||||
component.get("EventManager").emit(TorrentFinishedEvent(torrent_id))
|
|
||||||
|
|
||||||
torrent.update_state()
|
|
||||||
|
|
||||||
# Only save resume data if it was actually downloaded something. Helps
|
|
||||||
# on startup with big queues with lots of seeding torrents. Libtorrent
|
|
||||||
# emits alert_torrent_finished for them, but there seems like nothing
|
|
||||||
# worth really to save in resume data, we just read it up in
|
|
||||||
# self.load_state().
|
|
||||||
if total_download:
|
|
||||||
self.save_resume_data((torrent_id, ))
|
|
||||||
|
|
||||||
def on_alert_torrent_paused(self, alert):
|
|
||||||
log.debug("on_alert_torrent_paused")
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
torrent_id = str(alert.handle.info_hash())
|
|
||||||
# Set the torrent state
|
|
||||||
old_state = torrent.state
|
|
||||||
torrent.update_state()
|
|
||||||
if torrent.state != old_state:
|
|
||||||
component.get("EventManager").emit(TorrentStateChangedEvent(torrent_id, torrent.state))
|
|
||||||
|
|
||||||
# Don't save resume data for each torrent after self.stop() was called.
|
|
||||||
# We save resume data in bulk in self.stop() in this case.
|
|
||||||
if self.save_resume_data_timer.running:
|
|
||||||
# Write the fastresume file
|
|
||||||
self.save_resume_data((torrent_id, ))
|
|
||||||
|
|
||||||
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")
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
|
|
||||||
# Set the torrent state
|
|
||||||
torrent.update_state()
|
|
||||||
|
|
||||||
def on_alert_tracker_reply(self, alert):
|
|
||||||
log.debug("on_alert_tracker_reply: %s", alert.message().decode("utf8"))
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
|
|
||||||
# Set the tracker status for the torrent
|
|
||||||
if alert.message() != "Got peers from DHT":
|
|
||||||
torrent.set_tracker_status(_("Announce OK"))
|
|
||||||
|
|
||||||
# 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:
|
|
||||||
# We didn't get peer information, so lets send a scrape request
|
|
||||||
torrent.scrape_tracker()
|
|
||||||
|
|
||||||
def on_alert_tracker_announce(self, alert):
|
|
||||||
log.debug("on_alert_tracker_announce")
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
|
|
||||||
# Set the tracker status for the torrent
|
|
||||||
torrent.set_tracker_status(_("Announce Sent"))
|
|
||||||
|
|
||||||
def on_alert_tracker_warning(self, alert):
|
|
||||||
log.debug("on_alert_tracker_warning")
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
tracker_status = '%s: %s' % (_("Warning"), str(alert.message()))
|
|
||||||
# Set the tracker status for the torrent
|
|
||||||
torrent.set_tracker_status(tracker_status)
|
|
||||||
|
|
||||||
def on_alert_tracker_error(self, alert):
|
|
||||||
log.debug("on_alert_tracker_error")
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
tracker_status = "%s: %s" % (_("Error"), alert.msg)
|
|
||||||
torrent.set_tracker_status(tracker_status)
|
|
||||||
|
|
||||||
def on_alert_storage_moved(self, alert):
|
|
||||||
log.debug("on_alert_storage_moved")
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
torrent.set_save_path(alert.handle.save_path())
|
|
||||||
|
|
||||||
def on_alert_torrent_resumed(self, alert):
|
|
||||||
log.debug("on_alert_torrent_resumed")
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
torrent_id = str(alert.handle.info_hash())
|
|
||||||
torrent.is_finished = torrent.handle.is_seed()
|
|
||||||
old_state = torrent.state
|
|
||||||
torrent.update_state()
|
|
||||||
if torrent.state != old_state:
|
|
||||||
# We need to emit a TorrentStateChangedEvent too
|
|
||||||
component.get("EventManager").emit(TorrentStateChangedEvent(torrent_id, torrent.state))
|
|
||||||
component.get("EventManager").emit(TorrentResumedEvent(torrent_id))
|
|
||||||
|
|
||||||
def on_alert_state_changed(self, alert):
|
|
||||||
log.debug("on_alert_state_changed")
|
|
||||||
try:
|
|
||||||
torrent_id = str(alert.handle.info_hash())
|
|
||||||
torrent = self.torrents[torrent_id]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
|
|
||||||
old_state = torrent.state
|
|
||||||
torrent.update_state()
|
|
||||||
# Only emit a state changed event if the state has actually changed
|
|
||||||
if torrent.state != old_state:
|
|
||||||
component.get("EventManager").emit(TorrentStateChangedEvent(torrent_id, torrent.state))
|
|
||||||
|
|
||||||
def on_alert_save_resume_data(self, alert):
|
|
||||||
log.debug("on_alert_save_resume_data")
|
|
||||||
|
|
||||||
torrent_id = str(alert.handle.info_hash())
|
|
||||||
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[torrent_id]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
|
|
||||||
# Libtorrent in add_torrent() expects resume_data to be bencoded
|
|
||||||
self.resume_data[torrent_id] = lt.bencode(alert.resume_data)
|
|
||||||
self.num_resume_data -= 1
|
|
||||||
|
|
||||||
torrent.waiting_on_resume_data = False
|
|
||||||
|
|
||||||
self.save_resume_data_file()
|
|
||||||
|
|
||||||
def on_alert_save_resume_data_failed(self, alert):
|
|
||||||
log.debug("on_alert_save_resume_data_failed: %s", alert.message())
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.num_resume_data -= 1
|
|
||||||
torrent.waiting_on_resume_data = False
|
|
||||||
|
|
||||||
self.save_resume_data_file()
|
|
||||||
|
|
||||||
|
|
||||||
def on_alert_file_renamed(self, alert):
|
|
||||||
log.debug("on_alert_file_renamed")
|
|
||||||
log.debug("index: %s name: %s", alert.index, alert.name.decode("utf8"))
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
torrent_id = str(alert.handle.info_hash())
|
|
||||||
|
|
||||||
# We need to see if this file index is in a waiting_on_folder list
|
|
||||||
folder_rename = False
|
|
||||||
for i, wait_on_folder in enumerate(torrent.waiting_on_folder_rename):
|
|
||||||
if alert.index in wait_on_folder[2]:
|
|
||||||
folder_rename = True
|
|
||||||
if len(wait_on_folder[2]) == 1:
|
|
||||||
# This is the last alert we were waiting for, time to send signal
|
|
||||||
component.get("EventManager").emit(TorrentFolderRenamedEvent(torrent_id, wait_on_folder[0], wait_on_folder[1]))
|
|
||||||
del torrent.waiting_on_folder_rename[i]
|
|
||||||
self.save_resume_data((torrent_id,))
|
|
||||||
break
|
|
||||||
# This isn't the last file to be renamed in this folder, so just
|
|
||||||
# remove the index and continue
|
|
||||||
torrent.waiting_on_folder_rename[i][2].remove(alert.index)
|
|
||||||
|
|
||||||
if not folder_rename:
|
|
||||||
# This is just a regular file rename so send the signal
|
|
||||||
component.get("EventManager").emit(TorrentFileRenamedEvent(torrent_id, alert.index, alert.name))
|
|
||||||
self.save_resume_data((torrent_id,))
|
|
||||||
|
|
||||||
def on_alert_metadata_received(self, alert):
|
|
||||||
log.debug("on_alert_metadata_received")
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
torrent.write_torrentfile()
|
|
||||||
|
|
||||||
def on_alert_file_error(self, alert):
|
|
||||||
log.debug("on_alert_file_error: %s", alert.message())
|
|
||||||
try:
|
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
torrent.update_state()
|
|
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 722 B |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 9.2 KiB |
@@ -1,150 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
width="744.09448819"
|
|
||||||
height="1052.3622047"
|
|
||||||
id="svg4848"
|
|
||||||
sodipodi:version="0.32"
|
|
||||||
inkscape:version="0.46"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/active16.png"
|
|
||||||
inkscape:export-xdpi="1.7055545"
|
|
||||||
inkscape:export-ydpi="1.7055545"
|
|
||||||
sodipodi:docname="active.svg"
|
|
||||||
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
|
||||||
<defs
|
|
||||||
id="defs4850">
|
|
||||||
<inkscape:perspective
|
|
||||||
sodipodi:type="inkscape:persp3d"
|
|
||||||
inkscape:vp_x="0 : 526.18109 : 1"
|
|
||||||
inkscape:vp_y="0 : 1000 : 0"
|
|
||||||
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
|
||||||
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
|
||||||
id="perspective4856" />
|
|
||||||
<clipPath
|
|
||||||
clipPathUnits="userSpaceOnUse"
|
|
||||||
id="clipPath5467">
|
|
||||||
<path
|
|
||||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.69776249;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
d="M 792.51261,596.13496 C 1787.1961,462.38583 1788.2786,460.03989 1788.2786,460.03989 L 2050.3447,889.51678 C 1692.1626,1024.6476 1428.8778,1128.1462 1119.6165,1246.9702 L 792.51261,596.13496 z"
|
|
||||||
id="path5469"
|
|
||||||
sodipodi:nodetypes="ccccc" />
|
|
||||||
</clipPath>
|
|
||||||
<clipPath
|
|
||||||
clipPathUnits="userSpaceOnUse"
|
|
||||||
id="clipPath5471">
|
|
||||||
<path
|
|
||||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.69776249;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
d="M 792.51261,596.13496 C 1787.1961,462.38583 1788.2786,460.03989 1788.2786,460.03989 L 2050.3447,889.51678 C 1692.1626,1024.6476 1428.8778,1128.1462 1119.6165,1246.9702 L 792.51261,596.13496 z"
|
|
||||||
id="path5473"
|
|
||||||
sodipodi:nodetypes="ccccc" />
|
|
||||||
</clipPath>
|
|
||||||
<clipPath
|
|
||||||
clipPathUnits="userSpaceOnUse"
|
|
||||||
id="clipPath5475">
|
|
||||||
<path
|
|
||||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.69776249;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
d="M 792.51261,596.13496 C 1787.1961,462.38583 1788.2786,460.03989 1788.2786,460.03989 L 2050.3447,889.51678 C 1692.1626,1024.6476 1428.8778,1128.1462 1119.6165,1246.9702 L 792.51261,596.13496 z"
|
|
||||||
id="path5477"
|
|
||||||
sodipodi:nodetypes="ccccc" />
|
|
||||||
</clipPath>
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="base"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1.0"
|
|
||||||
gridtolerance="10000"
|
|
||||||
guidetolerance="10"
|
|
||||||
objecttolerance="10"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:zoom="0.5"
|
|
||||||
inkscape:cx="798.86898"
|
|
||||||
inkscape:cy="436.74575"
|
|
||||||
inkscape:document-units="px"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
showgrid="false"
|
|
||||||
inkscape:window-width="1280"
|
|
||||||
inkscape:window-height="958"
|
|
||||||
inkscape:window-x="1280"
|
|
||||||
inkscape:window-y="0" />
|
|
||||||
<metadata
|
|
||||||
id="metadata4853">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
inkscape:label="Layer 1"
|
|
||||||
inkscape:groupmode="layer"
|
|
||||||
id="layer1">
|
|
||||||
<g
|
|
||||||
style="opacity:1"
|
|
||||||
id="g4871">
|
|
||||||
<path
|
|
||||||
inkscape:export-ydpi="1.7060417"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/seeding16.png"
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path2069"
|
|
||||||
d="M 335.10794,116.43168 L 610.53935,447.76408 C 809.45408,669.41324 696.25675,938.85368 393.35753,959.46028 C -32.813273,970.60316 -9.7709676,623.52458 107.82928,464.31364 L 335.10794,116.43168 z"
|
|
||||||
style="fill:#5599ff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
|
||||||
<path
|
|
||||||
inkscape:export-ydpi="1.7060417"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/seeding16.png"
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path2071"
|
|
||||||
d="M 337.67292,165.87552 L 585.22638,464.67366 C 773.96211,684.57988 653.37942,910.02774 383.88559,930.97978 C 4.1291863,940.68143 29.040179,639.21796 125.2355,490.1649 L 337.67292,165.87552 z"
|
|
||||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:21.67123985;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022" />
|
|
||||||
<path
|
|
||||||
inkscape:export-ydpi="1.7060417"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/seeding16.png"
|
|
||||||
id="rect2634"
|
|
||||||
d="M 359.0208,369.47132 C 289.64507,437.53055 219.98727,505.41409 150.61154,573.47313 C 187.93874,573.54143 225.35922,573.40503 262.68661,573.47313 C 262.68661,654.06643 262.68661,734.65974 262.68661,815.25304 C 329.00806,815.25304 395.32971,815.25304 461.65134,815.25304 C 461.65134,734.86969 461.65134,654.48632 461.65134,574.10276 C 496.04273,574.16582 530.52013,574.0399 564.91152,574.10276 C 496.30183,505.79126 427.63028,437.78301 359.0208,369.47132 z"
|
|
||||||
style="fill:#93beff;fill-opacity:1;stroke:#000000;stroke-width:14.10382843;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
</g>
|
|
||||||
<path
|
|
||||||
style="fill:#8dd35f;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
|
||||||
d="M 1211.4629,48.95108 L 1486.8943,380.28348 C 1685.809,601.93264 1572.6117,871.37308 1269.7125,891.97968 C 843.5417,903.12256 866.584,556.04398 984.1842,396.83304 L 1211.4629,48.95108 z"
|
|
||||||
id="path4864"
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/seeding16.png"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-ydpi="1.7060417"
|
|
||||||
clip-path="url(#clipPath5475)"
|
|
||||||
transform="translate(-876,68)" />
|
|
||||||
<path
|
|
||||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:21.67123985;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022"
|
|
||||||
d="M 1214.0279,98.39492 L 1461.5813,397.19306 C 1650.317,617.09928 1529.7344,842.54714 1260.2405,863.49918 C 880.4842,873.20083 905.3951,571.73736 1001.5905,422.6843 L 1214.0279,98.39492 z"
|
|
||||||
id="path4866"
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/seeding16.png"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-ydpi="1.7060417"
|
|
||||||
clip-path="url(#clipPath5471)"
|
|
||||||
transform="translate(-876,68)" />
|
|
||||||
<path
|
|
||||||
style="fill:#b7e399;fill-opacity:1;stroke:#000000;stroke-width:14.1288912;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
d="M 1235.158,785.66485 C 1165.4485,716.69801 1095.4555,647.90922 1025.7459,578.94258 C 1063.2527,578.87336 1100.8533,579.01159 1138.3603,578.94258 C 1138.3603,497.27453 1138.3603,415.60647 1138.3603,333.93841 C 1205.0008,333.93841 1271.6416,333.93841 1338.2823,333.93841 C 1338.2823,415.39371 1338.2823,496.84903 1338.2823,578.30455 C 1372.8392,578.24065 1407.4825,578.36825 1442.0394,578.30455 C 1373.0995,647.52701 1304.0976,716.44219 1235.158,785.66485 z"
|
|
||||||
id="path4868"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/seeding16.png"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-ydpi="1.7060417"
|
|
||||||
clip-path="url(#clipPath5467)"
|
|
||||||
transform="matrix(0.9958235,0,0,1.0000914,-871.02338,67.589213)" />
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 742 B |
@@ -1,96 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
width="744.09448819"
|
|
||||||
height="1052.3622047"
|
|
||||||
id="svg5684"
|
|
||||||
sodipodi:version="0.32"
|
|
||||||
inkscape:version="0.46"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/alert16.png"
|
|
||||||
inkscape:export-xdpi="1.7055545"
|
|
||||||
inkscape:export-ydpi="1.7055545"
|
|
||||||
sodipodi:docname="alert.svg"
|
|
||||||
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
|
||||||
<defs
|
|
||||||
id="defs5686">
|
|
||||||
<inkscape:perspective
|
|
||||||
sodipodi:type="inkscape:persp3d"
|
|
||||||
inkscape:vp_x="0 : 526.18109 : 1"
|
|
||||||
inkscape:vp_y="0 : 1000 : 0"
|
|
||||||
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
|
||||||
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
|
||||||
id="perspective5692" />
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="base"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1.0"
|
|
||||||
gridtolerance="10000"
|
|
||||||
guidetolerance="10"
|
|
||||||
objecttolerance="10"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:zoom="0.35"
|
|
||||||
inkscape:cx="807.63627"
|
|
||||||
inkscape:cy="520"
|
|
||||||
inkscape:document-units="px"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
showgrid="false"
|
|
||||||
inkscape:window-width="686"
|
|
||||||
inkscape:window-height="711"
|
|
||||||
inkscape:window-x="1395"
|
|
||||||
inkscape:window-y="223" />
|
|
||||||
<metadata
|
|
||||||
id="metadata5689">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
inkscape:label="Layer 1"
|
|
||||||
inkscape:groupmode="layer"
|
|
||||||
id="layer1">
|
|
||||||
<path
|
|
||||||
style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
|
||||||
d="M 335.10794,116.43168 L 610.53935,447.76408 C 809.45408,669.41324 696.25675,938.85368 393.35753,959.46028 C -32.813273,970.60316 -9.7709676,623.52458 107.82928,464.31364 L 335.10794,116.43168 z"
|
|
||||||
id="path2069"
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/seeding16.png"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-ydpi="1.7060417" />
|
|
||||||
<path
|
|
||||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:21.67123984999999919;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022000000000"
|
|
||||||
d="M 337.67292,165.87552 L 585.22638,464.67366 C 773.96211,684.57988 653.37942,910.02774 383.88559,930.97978 C 4.1291863,940.68143 29.040179,639.21796 125.2355,490.1649 L 337.67292,165.87552 z"
|
|
||||||
id="path2071"
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/seeding16.png"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-ydpi="1.7060417" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:1091.49255371px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:1;fill:#ff7878;fill-opacity:1;stroke:#000000;stroke-width:13.65081787;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Bitstream Vera Sans"
|
|
||||||
x="20.453644"
|
|
||||||
y="1303.4996"
|
|
||||||
id="text2767"
|
|
||||||
transform="scale(1.4928735,0.6698491)"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan2769"
|
|
||||||
x="20.453644"
|
|
||||||
y="1303.4996"
|
|
||||||
style="font-size:1091.49255371px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;stroke-width:13.65081787;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;font-family:Bitstream Vera Sans">!</tspan></text>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 590 B |
@@ -1,191 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
width="744.09448819"
|
|
||||||
height="1052.3622047"
|
|
||||||
id="svg3001"
|
|
||||||
sodipodi:version="0.32"
|
|
||||||
inkscape:version="0.46"
|
|
||||||
sodipodi:docname="all.svg"
|
|
||||||
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
|
||||||
<defs
|
|
||||||
id="defs3003">
|
|
||||||
<inkscape:perspective
|
|
||||||
sodipodi:type="inkscape:persp3d"
|
|
||||||
inkscape:vp_x="0 : 526.18109 : 1"
|
|
||||||
inkscape:vp_y="0 : 1000 : 0"
|
|
||||||
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
|
||||||
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
|
||||||
id="perspective3009" />
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="base"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1.0"
|
|
||||||
gridtolerance="10000"
|
|
||||||
guidetolerance="10"
|
|
||||||
objecttolerance="10"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:zoom="0.35"
|
|
||||||
inkscape:cx="375"
|
|
||||||
inkscape:cy="520"
|
|
||||||
inkscape:document-units="px"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
showgrid="false"
|
|
||||||
inkscape:window-width="640"
|
|
||||||
inkscape:window-height="711"
|
|
||||||
inkscape:window-x="1594"
|
|
||||||
inkscape:window-y="77" />
|
|
||||||
<metadata
|
|
||||||
id="metadata3006">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
inkscape:label="Layer 1"
|
|
||||||
inkscape:groupmode="layer"
|
|
||||||
id="layer1">
|
|
||||||
<g
|
|
||||||
id="g3011"
|
|
||||||
transform="matrix(7.4849593,0,0,7.4849593,52.997244,360.31942)"
|
|
||||||
inkscape:export-filename="/home/andrew/g3060.png"
|
|
||||||
inkscape:export-xdpi="2.4250078"
|
|
||||||
inkscape:export-ydpi="2.4250078">
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path2069"
|
|
||||||
d="M 23.942923,0.9561338 L 37.330543,18.266721 C 46.998995,29.84687 41.49692,43.923891 26.7742,45.000491 C 6.0597413,45.582655 6.5086231,27.37483 11.255313,18.609381 L 23.942923,0.9561338 z"
|
|
||||||
style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path2071"
|
|
||||||
d="M 23.996861,3.5433428 L 36.057351,19.151045 C 44.769741,29.58253 39.419346,42.414092 26.125181,43.508521 C 7.3917365,44.015286 7.4275065,28.119221 12.17284,20.333442 L 23.996861,3.5433428 z"
|
|
||||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.1000706;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022" />
|
|
||||||
<text
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
transform="scale(1.4928735,0.6698491)"
|
|
||||||
id="text2767"
|
|
||||||
y="59.560848"
|
|
||||||
x="5.0072942"
|
|
||||||
style="font-size:55.97062302px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:1;fill:#ff7878;fill-opacity:1;stroke:#000000;stroke-width:0.69999999;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Bitstream Vera Sans"
|
|
||||||
xml:space="preserve"><tspan
|
|
||||||
style="font-size:55.97062302px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;stroke-width:0.69999999;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;font-family:Bitstream Vera Sans"
|
|
||||||
y="59.560848"
|
|
||||||
x="5.0072942"
|
|
||||||
id="tspan2769"
|
|
||||||
sodipodi:role="line">!</tspan></text>
|
|
||||||
</g>
|
|
||||||
<g
|
|
||||||
id="g3022"
|
|
||||||
transform="matrix(7.874057,0,0,7.874057,232.39499,356.39427)"
|
|
||||||
inkscape:export-filename="/home/andrew/g3060.png"
|
|
||||||
inkscape:export-xdpi="2.4250078"
|
|
||||||
inkscape:export-ydpi="2.4250078">
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path3030"
|
|
||||||
d="M 23.854535,1.0445221 L 37.242155,18.355109 C 46.910607,29.935258 41.408532,44.012279 26.685812,45.088879 C 5.971353,45.671043 6.4202348,27.463218 11.166925,18.697769 L 23.854535,1.0445221 z"
|
|
||||||
style="fill:#b3b3b3;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path3032"
|
|
||||||
d="M 23.996861,3.5433428 L 36.057351,19.151045 C 44.769741,29.58253 39.419346,42.414092 26.125181,43.508521 C 7.3917365,44.015286 7.4275065,28.119221 12.17284,20.333442 L 23.996861,3.5433428 z"
|
|
||||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.1000706;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022" />
|
|
||||||
<g
|
|
||||||
transform="matrix(0.9616363,0,0,0.855461,0.9207282,3.9296533)"
|
|
||||||
id="g3590">
|
|
||||||
<rect
|
|
||||||
style="fill:#cfcfcf;fill-opacity:1;stroke:#000000;stroke-width:0.69999999;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect4415"
|
|
||||||
width="7.7589664"
|
|
||||||
height="14.866735"
|
|
||||||
x="14.548919"
|
|
||||||
y="19.754131" />
|
|
||||||
<rect
|
|
||||||
style="fill:#cfcfcf;fill-opacity:1;stroke:#000000;stroke-width:0.69999999;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect4417"
|
|
||||||
width="7.7589664"
|
|
||||||
height="14.866735"
|
|
||||||
x="25.692116"
|
|
||||||
y="19.754131" />
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<g
|
|
||||||
id="g3037"
|
|
||||||
transform="matrix(8.0037561,0,0,8.0037561,-22.312009,464.83023)"
|
|
||||||
inkscape:export-filename="/home/andrew/g3060.png"
|
|
||||||
inkscape:export-xdpi="2.4250078"
|
|
||||||
inkscape:export-ydpi="2.4250078">
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path3043"
|
|
||||||
d="M 23.854535,1.0445221 L 37.242155,18.355109 C 46.910607,29.935258 41.408532,44.012279 26.685812,45.088879 C 5.971353,45.671043 6.4202348,27.463218 11.166925,18.697769 L 23.854535,1.0445221 z"
|
|
||||||
style="fill:#d0b31d;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path3045"
|
|
||||||
d="M 23.996861,3.5433428 L 36.057351,19.151045 C 44.769741,29.58253 39.419346,42.414092 26.125181,43.508521 C 7.3917365,44.015286 7.4275065,28.119221 12.17284,20.333442 L 23.996861,3.5433428 z"
|
|
||||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.1000706;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022" />
|
|
||||||
<path
|
|
||||||
id="rect2634"
|
|
||||||
d="M 24.821384,15.512309 C 22.21433,17.952223 19.604921,20.381297 16.997867,22.821211 C 18.304685,22.818964 19.61477,22.823457 20.921589,22.821211 C 20.921589,25.684801 20.921589,28.548391 20.921589,31.411981 C 19.61477,31.409734 18.304685,31.414228 16.997867,31.411981 C 19.604921,33.851895 22.21433,36.280969 24.821384,38.720883 C 27.457552,36.289986 30.104432,33.865368 32.740602,31.43447 C 31.322226,31.432031 29.900305,31.43691 28.481929,31.43447 C 28.481929,28.555887 28.481929,25.677306 28.481929,22.798722 C 29.900305,22.796282 31.322226,22.80116 32.740602,22.798722 C 30.104432,20.367823 27.457552,17.943206 24.821384,15.512309 z"
|
|
||||||
style="fill:#e1cf6f;fill-opacity:1;stroke:#000000;stroke-width:0.56882578;stroke-linecap:round;stroke-linejoin:round;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
|
||||||
</g>
|
|
||||||
<g
|
|
||||||
id="g3048"
|
|
||||||
transform="matrix(7.6146585,0,0,7.6146585,318.27879,494.48113)"
|
|
||||||
inkscape:export-filename="/home/andrew/g3060.png"
|
|
||||||
inkscape:export-xdpi="2.4250078"
|
|
||||||
inkscape:export-ydpi="2.4250078">
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path3054"
|
|
||||||
d="M 23.942923,0.9561338 L 37.330543,18.266721 C 46.998995,29.84687 41.49692,43.923891 26.7742,45.000491 C 6.0597413,45.582655 6.5086231,27.37483 11.255313,18.609381 L 23.942923,0.9561338 z"
|
|
||||||
style="fill:#5599ff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path3056"
|
|
||||||
d="M 23.996861,3.5433428 L 36.057351,19.151045 C 44.769741,29.58253 39.419346,42.414092 26.125181,43.508521 C 7.3917365,44.015286 7.4275065,28.119221 12.17284,20.333442 L 23.996861,3.5433428 z"
|
|
||||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.1000706;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022" />
|
|
||||||
<path
|
|
||||||
id="path3058"
|
|
||||||
d="M 24.3125,14.9375 C 20.869248,18.315409 17.412003,21.684591 13.96875,25.0625 C 15.821373,25.065889 17.678627,25.059111 19.53125,25.0625 C 19.53125,29.0625 19.53125,33.0625 19.53125,37.0625 C 22.822917,37.0625 26.114582,37.0625 29.40625,37.0625 C 29.40625,33.072917 29.40625,29.083333 29.40625,25.09375 C 31.113161,25.096872 32.824339,25.090627 34.53125,25.09375 C 31.126025,21.703313 27.717725,18.327937 24.3125,14.9375 z"
|
|
||||||
style="fill:#93beff;fill-opacity:1;stroke:#000000;stroke-width:0.69999999;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
</g>
|
|
||||||
<g
|
|
||||||
id="g3060"
|
|
||||||
transform="matrix(8.2631545,0,0,8.2631545,133.25792,542.4325)"
|
|
||||||
inkscape:export-xdpi="2.4250078"
|
|
||||||
inkscape:export-ydpi="2.4250078">
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path3066"
|
|
||||||
d="M 23.942923,0.9561338 L 37.330543,18.266721 C 46.998995,29.84687 41.49692,43.923891 26.7742,45.000491 C 6.0597413,45.582655 6.5086231,27.37483 11.255313,18.609381 L 23.942923,0.9561338 z"
|
|
||||||
style="fill:#8dd35f;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
|
||||||
<path
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
id="path3068"
|
|
||||||
d="M 23.996861,3.5433428 L 36.057351,19.151045 C 44.769741,29.58253 39.419346,42.414092 26.125181,43.508521 C 7.3917365,44.015286 7.4275065,28.119221 12.17284,20.333442 L 23.996861,3.5433428 z"
|
|
||||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.1000706;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022" />
|
|
||||||
<path
|
|
||||||
id="path3070"
|
|
||||||
d="M 19.34375,17.5625 C 19.34375,21.552083 19.34375,25.541668 19.34375,29.53125 C 17.636839,29.528128 15.925661,29.534372 14.21875,29.53125 C 17.623975,32.921687 21.032275,36.297063 24.4375,39.6875 C 27.880752,36.309591 31.337996,32.94041 34.78125,29.5625 C 32.928627,29.559111 31.071373,29.565889 29.21875,29.5625 C 29.21875,25.5625 29.21875,21.562501 29.21875,17.5625 C 25.927083,17.5625 22.635418,17.562501 19.34375,17.5625 z"
|
|
||||||
style="fill:#b7e399;fill-opacity:1;stroke:#000000;stroke-width:0.69999999;stroke-linecap:round;stroke-linejoin:round;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 844 B |
@@ -1,88 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
width="744.09448819"
|
|
||||||
height="1052.3622047"
|
|
||||||
id="svg6930"
|
|
||||||
sodipodi:version="0.32"
|
|
||||||
inkscape:version="0.46"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/checking16.png"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-ydpi="1.7060417"
|
|
||||||
sodipodi:docname="checking.svg"
|
|
||||||
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
|
||||||
<defs
|
|
||||||
id="defs6932">
|
|
||||||
<inkscape:perspective
|
|
||||||
sodipodi:type="inkscape:persp3d"
|
|
||||||
inkscape:vp_x="0 : 526.18109 : 1"
|
|
||||||
inkscape:vp_y="0 : 1000 : 0"
|
|
||||||
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
|
||||||
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
|
||||||
id="perspective6938" />
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="base"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1.0"
|
|
||||||
gridtolerance="10000"
|
|
||||||
guidetolerance="10"
|
|
||||||
objecttolerance="10"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:zoom="0.7"
|
|
||||||
inkscape:cx="284.02575"
|
|
||||||
inkscape:cy="416.27643"
|
|
||||||
inkscape:document-units="px"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
showgrid="false"
|
|
||||||
inkscape:window-width="686"
|
|
||||||
inkscape:window-height="711"
|
|
||||||
inkscape:window-x="1387"
|
|
||||||
inkscape:window-y="128" />
|
|
||||||
<metadata
|
|
||||||
id="metadata6935">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
inkscape:label="Layer 1"
|
|
||||||
inkscape:groupmode="layer"
|
|
||||||
id="layer1">
|
|
||||||
<path
|
|
||||||
style="fill:#b3b3b3;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
|
||||||
d="M 335.10794,116.43168 L 610.53935,447.76408 C 809.45408,669.41324 696.25675,938.85368 393.35753,959.46028 C -32.813273,970.60316 -9.7709676,623.52458 107.82928,464.31364 L 335.10794,116.43168 z"
|
|
||||||
id="path2069"
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/checking16.png"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-ydpi="1.7060417" />
|
|
||||||
<path
|
|
||||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:21.67123984999999919;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022000000000"
|
|
||||||
d="M 337.67292,165.87552 L 585.22638,464.67366 C 773.96211,684.57988 653.37942,910.02774 383.88559,930.97978 C 4.1291863,940.68143 29.040179,639.21796 125.2355,490.1649 L 337.67292,165.87552 z"
|
|
||||||
id="path2071"
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/seeding16.png"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-ydpi="1.7060417" />
|
|
||||||
<path
|
|
||||||
style="fill:#cfcfcf;fill-opacity:1;stroke:#000000;stroke-width:11.50416565;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
d="M 170.93275,447.12091 C 174.01359,451.92804 181.6932,659.85017 179.71907,656.9136 C 178.40947,654.12718 411.7223,649.25335 412.30092,648.76646 C 411.08134,648.85003 338.31478,584.63588 338.93986,585.53435 C 410.72174,567.77973 462.65633,588.73801 481.03861,645.01437 C 484.19544,690.33553 466.3409,711.71891 434.77285,736.14895 C 385.89389,754.17146 322.59241,745.84878 312.37017,673.09575 C 312.32389,674.48492 156.52907,675.28833 153.0572,676.51233 C 202.03372,799.5504 269.9646,882.62913 421.73005,870.01325 C 463.0283,867.02946 568.27041,836.89042 606.41655,717.64626 C 627.84208,623.51263 596.80367,549.4096 547.34944,496.26853 C 457.7753,416.4389 296.11292,421.8444 245.11698,507.64417 C 247.55313,508.23771 173.58263,449.35852 170.93275,447.12091 z"
|
|
||||||
id="path3485"
|
|
||||||
sodipodi:nodetypes="ccccccccccccc" />
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 699 B |
@@ -1,433 +0,0 @@
|
|||||||
/* 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# ",
|
|
||||||
" ",
|
|
||||||
" "};
|
|
Before Width: | Height: | Size: 722 B |
@@ -1,173 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
width="744.09448819"
|
|
||||||
height="1052.3622047"
|
|
||||||
id="svg2"
|
|
||||||
sodipodi:version="0.32"
|
|
||||||
inkscape:version="0.46"
|
|
||||||
sodipodi:docbase="/home/andrew"
|
|
||||||
sodipodi:docname="dht.svg"
|
|
||||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/dht16.png"
|
|
||||||
inkscape:export-xdpi="1.9579109"
|
|
||||||
inkscape:export-ydpi="1.9579109">
|
|
||||||
<defs
|
|
||||||
id="defs4">
|
|
||||||
<inkscape:perspective
|
|
||||||
sodipodi:type="inkscape:persp3d"
|
|
||||||
inkscape:vp_x="0 : 526.18109 : 1"
|
|
||||||
inkscape:vp_y="0 : 1000 : 0"
|
|
||||||
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
|
||||||
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
|
||||||
id="perspective10561" />
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="base"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1.0"
|
|
||||||
gridtolerance="10000"
|
|
||||||
guidetolerance="10"
|
|
||||||
objecttolerance="10"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:zoom="0.49497475"
|
|
||||||
inkscape:cx="217.74745"
|
|
||||||
inkscape:cy="658.24369"
|
|
||||||
inkscape:document-units="px"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
inkscape:window-width="1024"
|
|
||||||
inkscape:window-height="711"
|
|
||||||
inkscape:window-x="1280"
|
|
||||||
inkscape:window-y="0"
|
|
||||||
showgrid="false" />
|
|
||||||
<metadata
|
|
||||||
id="metadata7">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
inkscape:label="Layer 1"
|
|
||||||
inkscape:groupmode="layer"
|
|
||||||
id="layer1">
|
|
||||||
<path
|
|
||||||
sodipodi:type="arc"
|
|
||||||
style="opacity:1;fill:#8dd35f;fill-opacity:1;stroke:#000000;stroke-width:2.48568825;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="path3437"
|
|
||||||
sodipodi:cx="325.71429"
|
|
||||||
sodipodi:cy="215.21933"
|
|
||||||
sodipodi:rx="85.714287"
|
|
||||||
sodipodi:ry="85.714287"
|
|
||||||
d="M 411.42858,215.21933 A 85.714287,85.714287 0 1 1 240.00001,215.21933 A 85.714287,85.714287 0 1 1 411.42858,215.21933 z"
|
|
||||||
transform="matrix(1.6800176,0,0,1.6800176,-275.15013,-73.06899)"
|
|
||||||
inkscape:export-filename="/home/andrew/dht16-2.png"
|
|
||||||
inkscape:export-xdpi="3.8918922"
|
|
||||||
inkscape:export-ydpi="3.8918922" />
|
|
||||||
<path
|
|
||||||
sodipodi:type="arc"
|
|
||||||
style="opacity:1;fill:#5599ff;fill-opacity:1;stroke:#000000;stroke-width:2.81711386;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="path3439"
|
|
||||||
sodipodi:cx="325.71429"
|
|
||||||
sodipodi:cy="215.21933"
|
|
||||||
sodipodi:rx="85.714287"
|
|
||||||
sodipodi:ry="85.714287"
|
|
||||||
d="M 411.42858,215.21933 A 85.714287,85.714287 0 1 1 240.00001,215.21933 A 85.714287,85.714287 0 1 1 411.42858,215.21933 z"
|
|
||||||
transform="matrix(1.4823682,0,0,1.4823682,82.877111,311.11956)"
|
|
||||||
inkscape:export-filename="/home/andrew/dht16-2.png"
|
|
||||||
inkscape:export-xdpi="3.8918922"
|
|
||||||
inkscape:export-ydpi="3.8918922" />
|
|
||||||
<path
|
|
||||||
sodipodi:type="arc"
|
|
||||||
style="opacity:1;fill:#8dd35f;fill-opacity:1;stroke:#000000;stroke-width:3.2505155;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="path3441"
|
|
||||||
sodipodi:cx="325.71429"
|
|
||||||
sodipodi:cy="215.21933"
|
|
||||||
sodipodi:rx="85.714287"
|
|
||||||
sodipodi:ry="85.714287"
|
|
||||||
d="M 411.42858,215.21933 A 85.714287,85.714287 0 1 1 240.00001,215.21933 A 85.714287,85.714287 0 1 1 411.42858,215.21933 z"
|
|
||||||
transform="matrix(1.2847193,0,0,1.2847193,-104.04248,489.18828)"
|
|
||||||
inkscape:export-filename="/home/andrew/dht16-2.png"
|
|
||||||
inkscape:export-xdpi="3.8918922"
|
|
||||||
inkscape:export-ydpi="3.8918922" />
|
|
||||||
<path
|
|
||||||
sodipodi:type="arc"
|
|
||||||
style="opacity:1;fill:#5599ff;fill-opacity:1;stroke:#000000;stroke-width:3.29273035;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="path3443"
|
|
||||||
sodipodi:cx="325.71429"
|
|
||||||
sodipodi:cy="215.21933"
|
|
||||||
sodipodi:rx="85.714287"
|
|
||||||
sodipodi:ry="85.714287"
|
|
||||||
d="M 411.42858,215.21933 A 85.714287,85.714287 0 1 1 240.00001,215.21933 A 85.714287,85.714287 0 1 1 411.42858,215.21933 z"
|
|
||||||
transform="matrix(1.2682484,0,0,1.2682484,-282.25061,288.22576)"
|
|
||||||
inkscape:export-filename="/home/andrew/dht16-2.png"
|
|
||||||
inkscape:export-xdpi="3.8918922"
|
|
||||||
inkscape:export-ydpi="3.8918922" />
|
|
||||||
<path
|
|
||||||
sodipodi:type="arc"
|
|
||||||
style="opacity:1;fill:#b3b3b3;fill-opacity:1;stroke:#000000;stroke-width:4.08935796;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="path3445"
|
|
||||||
sodipodi:cx="325.71429"
|
|
||||||
sodipodi:cy="215.21933"
|
|
||||||
sodipodi:rx="85.714287"
|
|
||||||
sodipodi:ry="85.714287"
|
|
||||||
d="M 411.42858,215.21933 A 85.714287,85.714287 0 1 1 240.00001,215.21933 A 85.714287,85.714287 0 1 1 411.42858,215.21933 z"
|
|
||||||
transform="matrix(1.0211872,0,0,1.0211872,244.38469,139.31302)"
|
|
||||||
inkscape:export-filename="/home/andrew/dht16-2.png"
|
|
||||||
inkscape:export-xdpi="3.8918922"
|
|
||||||
inkscape:export-ydpi="3.8918922" />
|
|
||||||
<path
|
|
||||||
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:10.04848194;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
d="M 409.97291,329.4348 L 487.75261,344.44338"
|
|
||||||
id="path3691"
|
|
||||||
inkscape:export-filename="/home/andrew/dht16-2.png"
|
|
||||||
inkscape:export-xdpi="3.8918922"
|
|
||||||
inkscape:export-ydpi="3.8918922"
|
|
||||||
sodipodi:nodetypes="cc" />
|
|
||||||
<path
|
|
||||||
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:8.96934509;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
d="M 423.06163,747.83054 L 464.53048,708.21583"
|
|
||||||
id="path3693"
|
|
||||||
inkscape:export-filename="/home/andrew/dht16-2.png"
|
|
||||||
inkscape:export-xdpi="3.8918922"
|
|
||||||
inkscape:export-ydpi="3.8918922"
|
|
||||||
sodipodi:nodetypes="cc" />
|
|
||||||
<path
|
|
||||||
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:11.37722969;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
d="M 315.62445,431.58184 L 310.19863,651.84005"
|
|
||||||
id="path3695"
|
|
||||||
inkscape:export-filename="/home/andrew/dht16-2.png"
|
|
||||||
inkscape:export-xdpi="3.8918922"
|
|
||||||
inkscape:export-ydpi="3.8918922"
|
|
||||||
sodipodi:nodetypes="cc" />
|
|
||||||
<path
|
|
||||||
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:10.04848194;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
d="M 143.15025,452.25537 L 171.01599,395.38786"
|
|
||||||
id="path3697"
|
|
||||||
inkscape:export-filename="/home/andrew/dht16-2.png"
|
|
||||||
inkscape:export-xdpi="3.8918922"
|
|
||||||
inkscape:export-ydpi="3.8918922"
|
|
||||||
sodipodi:nodetypes="cc" />
|
|
||||||
<path
|
|
||||||
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:11.37722969;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
d="M 360.45007,405.53416 L 474.8177,539.94039"
|
|
||||||
id="path3699"
|
|
||||||
inkscape:export-filename="/home/andrew/dht16-2.png"
|
|
||||||
inkscape:export-xdpi="3.8918922"
|
|
||||||
inkscape:export-ydpi="3.8918922"
|
|
||||||
sodipodi:nodetypes="cc" />
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 793 B |
@@ -1,90 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
width="744.09448819"
|
|
||||||
height="1052.3622047"
|
|
||||||
id="svg3535"
|
|
||||||
sodipodi:version="0.32"
|
|
||||||
inkscape:version="0.46"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/downloading16.png"
|
|
||||||
inkscape:export-xdpi="1.7075963"
|
|
||||||
inkscape:export-ydpi="1.7075963"
|
|
||||||
sodipodi:docname="downloading.svg"
|
|
||||||
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
|
||||||
<defs
|
|
||||||
id="defs3537">
|
|
||||||
<inkscape:perspective
|
|
||||||
sodipodi:type="inkscape:persp3d"
|
|
||||||
inkscape:vp_x="0 : 526.18109 : 1"
|
|
||||||
inkscape:vp_y="0 : 1000 : 0"
|
|
||||||
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
|
||||||
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
|
||||||
id="perspective3543" />
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="base"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1.0"
|
|
||||||
gridtolerance="10000"
|
|
||||||
guidetolerance="10"
|
|
||||||
objecttolerance="10"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:zoom="0.49497475"
|
|
||||||
inkscape:cx="183.87749"
|
|
||||||
inkscape:cy="492.74541"
|
|
||||||
inkscape:document-units="px"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
showgrid="false"
|
|
||||||
inkscape:window-width="686"
|
|
||||||
inkscape:window-height="711"
|
|
||||||
inkscape:window-x="1941"
|
|
||||||
inkscape:window-y="99" />
|
|
||||||
<metadata
|
|
||||||
id="metadata3540">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
inkscape:label="Layer 1"
|
|
||||||
inkscape:groupmode="layer"
|
|
||||||
id="layer1">
|
|
||||||
<path
|
|
||||||
style="fill:#8dd35f;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
|
||||||
d="M 337.34641,113.574 L 612.77782,444.9064 C 811.69255,666.55556 698.49522,935.996 395.596,956.6026 C -30.5748,967.74548 -7.5325,620.6669 110.06775,461.45596 L 337.34641,113.574 z"
|
|
||||||
id="path2069"
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/seeding16.png"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-ydpi="1.7060417" />
|
|
||||||
<path
|
|
||||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:21.67123985;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022"
|
|
||||||
d="M 339.91139,163.01784 L 587.46485,461.81598 C 776.20058,681.7222 655.61789,907.17006 386.12406,928.1221 C 6.36766,937.82375 31.27865,636.36028 127.47397,487.30722 L 339.91139,163.01784 z"
|
|
||||||
id="path2071"
|
|
||||||
sodipodi:nodetypes="ccccc"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/seeding16.png"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-ydpi="1.7060417" />
|
|
||||||
<path
|
|
||||||
style="fill:#b7e399;fill-opacity:1;stroke:#000000;stroke-width:14.10382843;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
d="M 362.09611,847.31541 C 292.72038,779.25618 223.06258,711.37264 153.68685,643.3136 C 191.01405,643.2453 228.43453,643.3817 265.76192,643.3136 C 265.76192,562.7203 265.76192,482.12699 265.76192,401.53369 C 332.08337,401.53369 398.40502,401.53369 464.72665,401.53369 C 464.72665,481.91704 464.72665,562.30041 464.72665,642.68397 C 499.11804,642.62091 533.59544,642.74683 567.98683,642.68397 C 499.37714,710.99547 430.70559,779.00372 362.09611,847.31541 z"
|
|
||||||
id="rect2634"
|
|
||||||
inkscape:export-filename="/home/andrew/Projects/deluge/trunk/deluge/data/pixmaps/seeding16.png"
|
|
||||||
inkscape:export-xdpi="1.7060417"
|
|
||||||
inkscape:export-ydpi="1.7060417" />
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 686 B |
@@ -1,2 +0,0 @@
|
|||||||
From: http://famfamfam.com/lab/icons/flags/
|
|
||||||
"These flag icons are available for free use for any purpose with no requirement for attribution."
|
|
Before Width: | Height: | Size: 643 B |
Before Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 604 B |
Before Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 643 B |
Before Width: | Height: | Size: 600 B |
Before Width: | Height: | Size: 497 B |
Before Width: | Height: | Size: 488 B |
Before Width: | Height: | Size: 428 B |
Before Width: | Height: | Size: 506 B |
Before Width: | Height: | Size: 647 B |
Before Width: | Height: | Size: 403 B |
Before Width: | Height: | Size: 673 B |
Before Width: | Height: | Size: 524 B |
Before Width: | Height: | Size: 663 B |
Before Width: | Height: | Size: 589 B |
Before Width: | Height: | Size: 593 B |
Before Width: | Height: | Size: 585 B |
Before Width: | Height: | Size: 504 B |
Before Width: | Height: | Size: 449 B |
Before Width: | Height: | Size: 497 B |
Before Width: | Height: | Size: 462 B |
Before Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 675 B |
Before Width: | Height: | Size: 486 B |
Before Width: | Height: | Size: 611 B |
Before Width: | Height: | Size: 639 B |
Before Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 593 B |
Before Width: | Height: | Size: 526 B |
Before Width: | Height: | Size: 631 B |
Before Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 443 B |
Before Width: | Height: | Size: 514 B |
Before Width: | Height: | Size: 600 B |
Before Width: | Height: | Size: 628 B |