Move branches/deluge-0.6 to trunk
309
ChangeLog
|
@ -1,309 +0,0 @@
|
|||
Deluge 0.5.9.2 (19 June 2008)
|
||||
* Add abilitity to move to a different partition
|
||||
* Add option to send redundant haves (show peers our progress)
|
||||
* Add 'add url' from tray
|
||||
* Fix uploaded_memory from reverting to state value when doing a forced recheck
|
||||
* Fixed 64-bit overflow issues
|
||||
* Fixed total_wanted issue for files > 2 GB
|
||||
* Fixed entry and scrape bug
|
||||
* Fixed issue with torrents with 0 pieces
|
||||
* Fixed possible unicode problems
|
||||
* Fixed minimum reconnect time bug
|
||||
|
||||
Deluge 0.5.9.1 (19 May 2008)
|
||||
* Fix queue reordering on startup
|
||||
* Fix open folder
|
||||
* Fix advanced progress bar when only 1 piece in torrent
|
||||
* Fix to prevent an invalid torrent file from crashing Deluge
|
||||
|
||||
Deluge 0.5.9.0 (30 April 2008)
|
||||
* Fix ratio
|
||||
* Fix opening folers/files on windows
|
||||
* Move all packages to use Python 2.5
|
||||
|
||||
Deluge 0.5.8.9 (14 April 2008)
|
||||
* Fix segfault caused in 0.5.8.8 when adding torrents
|
||||
* Change fast resume to use is_finished
|
||||
* LT - Fix private flag
|
||||
* LT - Verify url before connection to web seed
|
||||
|
||||
Deluge 0.5.8.8 (08 April 2008)
|
||||
* Fix ubuntu hardy bug sine they've renamed and broken up the packages.
|
||||
* Fix ratio (again)
|
||||
* Sync with asio 1.0 release
|
||||
* Remove file manager from preferences
|
||||
* Sync with libtorrent 0.13 release
|
||||
* Fix for vista dbus not closing bug
|
||||
|
||||
Deluge 0.5.8.7 (25 March 2008)
|
||||
* UPnP fixes
|
||||
* Bandwidth limiter fix
|
||||
* Various DHT fixes
|
||||
* Fix upload ratio not saving
|
||||
* Fix WebUI crash (ticket #89)
|
||||
* Clear seeding torrents now deletes the ".torrent" file
|
||||
* Fix keyboard scrolling of plugins
|
||||
* Scheduler can now handle number of active torrents, upload slots and max connections - Ben
|
||||
|
||||
Deluge 0.5.8.6 (11 March 2008)
|
||||
* Fix fast-resume deletion on shutdown
|
||||
* Tweak saving of uploaded memory (more effective ratio)
|
||||
* Add torrents with .fastresume files before torrents that don't
|
||||
* Fix a UI hang (bug #72)
|
||||
|
||||
Deluge 0.5.8.5 (28 February 2008)
|
||||
* Fix force recheck
|
||||
* Auto scraping of tracker if it doesn't report number of peers on reply
|
||||
* Fix web seed proxy preference
|
||||
* Fix adding of duplicate torrents
|
||||
* Fix timers for saving fastresume and uploaded memory
|
||||
* Fix rechecking on start
|
||||
* UPnP fixes
|
||||
* Fix possible libtorrent crash in storage
|
||||
|
||||
Deluge 0.5.8.4 (14 February 2008)
|
||||
* Randomize encryption pad size to evade throttling
|
||||
* https support
|
||||
* Add "seed time" to preferences
|
||||
* Add switch torrent source to "Move Torrent" plugin
|
||||
* Fix alignment of torrent info
|
||||
* Fix possible hang with torrents with many pieces
|
||||
* Don't resave fast-resume for seeding torrents
|
||||
* Add logout to WebUI
|
||||
* Only draw the advanced progress bar if 'num_pieces' is greater than 0 - prevents crash
|
||||
|
||||
Deluge 0.5.8.3 (28 January 2008)
|
||||
* Fix remote exploit which could crash Deluge
|
||||
* Fix high cpu spikes
|
||||
* Fix torrent order between sessions
|
||||
* Fix loading of BlocklistImport plugin
|
||||
|
||||
Deluge 0.5.8.2 (24 January 2008)
|
||||
* Fix column width saving
|
||||
* Option to download new blocklist after certain number of days - Patch from Mark Stahler
|
||||
* Fix ui-locking when tracker responded in non-utf8 encoding
|
||||
* Remove Extra Stats plugin
|
||||
* Prevent Scheduler plugin from setting an invalid 'max_active_torrents'
|
||||
|
||||
Deluge 0.5.8.1 (18 January 2008)
|
||||
* Catch various exceptions from possibly corrupted persistent.state
|
||||
* 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
|
||||
* Attempt to fix issue where all the columns start very small
|
||||
* Change how we handle fastresume - should prevent rechecking
|
||||
* New theme for windows
|
||||
* Performance enhancements by removing needless casts
|
||||
* Search is now a plugin
|
||||
* Browser removed
|
||||
|
||||
Deluge 0.5.8 (29 December 2007)
|
||||
* Fix handling of corrupt torrent files
|
||||
* Fix having two instances of Deluge running on Ubuntu
|
||||
|
||||
Deluge 0.5.8RC2 (25 December 2007)
|
||||
* Change add torrent to ctrl+n
|
||||
* Change notification plugin to not show the file list, but only the torrent
|
||||
name
|
||||
* Allow removal of browser icon from toolbar
|
||||
* Add buttons to browser to launch the main and footer frames into an
|
||||
external browser
|
||||
* Fix removing torrents from deluge template of webui - vonck7
|
||||
* Set the advanced webui template as default
|
||||
* Cut down significantly on the memory usage of the blocklist plugin
|
||||
* Fix some UPnP bugs
|
||||
* Fix "New version" alert from freezing sometimes
|
||||
* Prioritizes local peers over non-local ones when finding connect
|
||||
* Wish everyone a happy holiday :)
|
||||
|
||||
|
||||
Deluge 0.5.8RC1 (22 December 2007)
|
||||
* Key bindings:
|
||||
ctrl+a adds a torrent
|
||||
ctrl+l adds a torrent via URL
|
||||
ctrl+p pauses torrent(s)
|
||||
ctrl+r resumes torrent(s)
|
||||
delete removes torrent(s)
|
||||
* Fix total uploaded display bug
|
||||
* Fix seeding ratio stop on finished torrents
|
||||
* Fix zombie processes from occurring
|
||||
* Fix saying goodbye to trackers
|
||||
* Increase auto remove ratio to 100
|
||||
* Fix problem on Windows with filenames that have special characters
|
||||
* Fix saving of which columns to show
|
||||
* Fix init script error on exotic systems
|
||||
* Add web seed to Torrent Creator plugin
|
||||
* TorrentSearch is now built-in
|
||||
* Add internal anonymizing browser - Key bindings for that are as follows:
|
||||
ctrl+l focus on location bar
|
||||
ctrl+k focus on search bar
|
||||
ctrl+r refreshes current page
|
||||
ctrl+enter adds 'www.' and '.com' to url string
|
||||
shift+enter adds 'www.' and '.net' to url string
|
||||
|
||||
Deluge 0.5.7.1 (01 December 2007)
|
||||
* Tweak full hd warning so that it only displays itself once per torrent that
|
||||
it has to pause.
|
||||
* Fixed crash and corruption of persistent.state while adding a duplicate
|
||||
torrent. Also caused yet another invalid handle error.
|
||||
* Increase tracker timeout
|
||||
|
||||
Deluge 0.5.7 (26 November 2007)
|
||||
* Scrape support
|
||||
* Manual force-recheck
|
||||
* Add local peer discovery (aka local service discovery)
|
||||
* Blocklist plugin will now display errors, instead of just crashing on a bad
|
||||
list or wrong type
|
||||
* Add torrent in paused state option
|
||||
* Add advanced progress bar
|
||||
* Fix bug in merging trackers
|
||||
* Various updates to WebUI, including https support and advanced template by vonck7
|
||||
* Add maximum connection attempts per second preference
|
||||
* Fix bug where loaded plugins were forgotten if Deluge crashed
|
||||
* Fix ratio bugs (hopefully for the last time)
|
||||
* Add preference to only show file selection popup if torrent has multiple files
|
||||
* Fix pause all and resume all bugs
|
||||
* Fix client not loading if our website goes down (new version check failing)
|
||||
* Allow torrent creation with no trackers
|
||||
* Scheduler plugin revamp by Ben Klein
|
||||
* Fix ETA from going backwards
|
||||
* UI warning on full HD - no longer just silently pauses torrents
|
||||
* Replace SimpleRSS with FlexRSS
|
||||
* Add preference for the location of torrent files
|
||||
* Add autoload folder
|
||||
* Copy translator credits from Launchpad to our about->credits
|
||||
* Differentiate between queued and paused torrents. Able to pause queued
|
||||
torrents - patch by yobbobandana
|
||||
* Show error when writing/permission problems occur
|
||||
|
||||
Deluge 0.5.6.2 (31 October 2007)
|
||||
* Set default piece size to 256-KiB in TorrentCreator plugin and add 2048KiB
|
||||
as a size option.
|
||||
* Fix a bug in Debian package that caused the UI to completely freeze when a
|
||||
torrent finished
|
||||
* Find and fix another shutdown bug that mostly Gutsy users were encountering
|
||||
* Fix a couple of WebUI bugs, including the "index" page erroring out
|
||||
|
||||
Deluge 0.5.6.1 (28 October 2007)
|
||||
* Fix invalid handle error
|
||||
* Fix shutdown hang
|
||||
|
||||
Deluge 0.5.6 (24 October 2007)
|
||||
* Web Interface Plugin
|
||||
* Hopefully fix "losing data" and having to re-download parts (for real this time :p)
|
||||
* Use new full allocation method which does not create files until one of its
|
||||
pieces is downloaded
|
||||
* Tray lock password is no longer stored in plain text
|
||||
* Update the Scheduler plugin and fix a bunch of bugs on it
|
||||
* Double-clicking on a torrent opens up its containing folder
|
||||
* Fix SpeedLimiter plugin when setting upload limits
|
||||
* Fix MoveTorrent plugin when moving actively downloading torrents
|
||||
* Pause torrents while importing blocklist and resume them when finished
|
||||
* Remove TorrentPieces and disable its use
|
||||
* A whole bunch of stuff for Win32
|
||||
* Add private flag to TorrentCreator plugin
|
||||
* Use SVG for internal logo usage (except on Win32)
|
||||
* Use theme for tray icon instead of hard-coded
|
||||
* Properly release port on shutdown
|
||||
* TorrentFiles plugin now has progress bars
|
||||
* Removing torrent files no longer deletes files that weren't part of the torrent
|
||||
* New max half-open connections setting to deal with cheap/broken routers
|
||||
* Inherit UPnP fixes from libtorrent
|
||||
* Use threading for everything, instead of spawning
|
||||
|
||||
Deluge 0.5.5 (09 September 2007)
|
||||
* Editing a torrent's tracker list is now persistent between sessions
|
||||
* Persistence between sessions for Speed Limiter, Web Seed and Desired Ratio
|
||||
plugins
|
||||
* New wizard to aid first-time users with configuration
|
||||
* Reorderable tabs and remember order (with exception of details tab)
|
||||
* Fix losing data and having to re-download parts
|
||||
* Fix password lock showing when main window is not hidden
|
||||
* Get rid of the plugin manager and integrate it into preferences
|
||||
* New Move torrent plugin - takes over for "move completed downloads" feature
|
||||
and provides a "Move Torrent" option when right-clicking on a torrent
|
||||
* Save column widths
|
||||
* Queue order after restart fixes.
|
||||
* Use payload instead of including protocol overhead to ease user confusion
|
||||
of seeding torrents "downloading"
|
||||
* New Web Seed plugin for adding URLs to torrents for http seeding
|
||||
* Add FAST-extension (http://www.bittorrent.org/fast_extensions.html)
|
||||
|
||||
Deluge 0.5.4.1 (10 August 2007)
|
||||
* Add "Open containing folder" and "Open File" to the torrent and file
|
||||
menu, respectively
|
||||
* Load Blocklist plugin last and have it not lock up the interface during
|
||||
import
|
||||
* Add full allocation to preferences for clarification
|
||||
* Catch SIGINT, SIGHUP, SIGTERM and Gnome logoff to quit properly
|
||||
* Add send local info to developers
|
||||
* Fix up pieces, peers and files plugins
|
||||
* UPnP fixes
|
||||
* Add ExtraStats plugin
|
||||
* FreeBSD full allocation fix
|
||||
* Added per torrent max upload slots and max connections preferences
|
||||
* A lot of other less visible improvements
|
||||
|
||||
Deluge 0.5.4 (06 August 2007)
|
||||
|
||||
* Tray message includes session totals
|
||||
* Ticket #198 - Display peers countries in the Peers tab.
|
||||
* Ticket #474 - Multiple password prompts displayed
|
||||
* Pause all/resume all in tray menu
|
||||
* Peers and Files tabs are now plugins
|
||||
* New Location plugin
|
||||
* Option to use a random port every time
|
||||
* Proxy system redone - you can now specify different information for each
|
||||
type of proxy (DHT, peer, tracker, web-seed)
|
||||
* TorrentPieces plugin to view piece updates and show pieces table per file
|
||||
* EventLogger plugin to view/log every activity
|
||||
* SpeedLimiter plugin, which allows you to set speed limits on a per-torrent
|
||||
basis
|
||||
* New release alerts - Client will inform user if their version of deluge is
|
||||
outdated
|
||||
|
||||
Deluge 0.5.3 (25 July 2007)
|
||||
|
||||
* Added ChangeLog
|
||||
* Ticket #53 - Added files priorities within torrent
|
||||
* Ticket #111 - Remember directory of last added torrent
|
||||
* Ticket #232 - Added Move completed downloads to feature
|
||||
* Ticket #245 - Added ability to select torrent files before starting
|
||||
* Ticked #368 - Added ability to prioritize first and last pieces of files
|
||||
in torrents
|
||||
* Ticket #371 - Proper full storage allocation of files on reiser4 and
|
||||
ntfs-3g filesystems
|
||||
* Ticket #420 - Show size of torrent minus size of unselected files as Total
|
||||
Size
|
||||
* Ticket #405 - Properly start in tray when run deluge --tray
|
||||
* Ticket #437 - Gracefully upgrade from old versions
|
||||
* Picking a file to not download now checks for compact_mode status to prevent
|
||||
all sorts of problems such as downloading pieces into the wrong file
|
||||
* RSS plugin inclusion
|
||||
* Added ability to queue new torrents above completed ones when
|
||||
seeds are set to queue at the bottom
|
||||
* Added availability and piece size display in details, availability
|
||||
column
|
||||
* Added ability to automatically remove torrents when max share ratio is set
|
||||
* Show text from clipboard in Add URL dialog only if it looks like an URL
|
||||
* Added Torrent Notification plugin
|
||||
* Added event handling callbacks for plugins
|
||||
* Added ability to designate a torrent as private (in file selection dialog)
|
||||
* Added merging trackers of duplicate torrents
|
||||
* Details, Peers and Files tabs more responsible and their performance
|
||||
greatly improved especially on torrents with many files and peers
|
||||
* A lot of other less visible improvements
|
||||
|
||||
Deluge 0.5.2 (05 July 2007)
|
||||
* ticket #6 - Torrent creation built into main client
|
||||
* ticket #315 - Plugins implemented as modules
|
||||
* ticket #310 - Configuration options for PEX and UPnP
|
||||
* ticket #390 - Individual file progress shown in File tab
|
||||
* The usual slew of improvements
|
||||
|
||||
Deluge 0.5.1 (11 June 2007)
|
||||
* Peer Exchange
|
||||
* ticket #254 - Encryption
|
||||
* ticket #142 - UPnP + NATPMP
|
||||
* Improved user interface
|
||||
* Redesigned preferences dialog
|
||||
* Proper startup and shutdown
|
40
HACKING
|
@ -1,40 +0,0 @@
|
|||
# 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.
|
12
MANIFEST.in
|
@ -1,12 +0,0 @@
|
|||
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
|
@ -1,31 +0,0 @@
|
|||
#
|
||||
# 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
|
@ -1,10 +0,0 @@
|
|||
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
|
103
README
|
@ -1,103 +0,0 @@
|
|||
==========================
|
||||
Deluge BitTorrent Client
|
||||
==========================
|
||||
|
||||
Authors:
|
||||
Zach Tibbitts, aka zachtib
|
||||
Alon Zakai, aka kripkenstein
|
||||
Marcos Pinto, aka markybob
|
||||
Andrew Resch, aka andar
|
||||
Alex Dedul, aka plisk
|
||||
|
||||
Homepage: http://deluge-torrent.org
|
||||
|
||||
==========================
|
||||
Contact/Support:
|
||||
==========================
|
||||
|
||||
We have two options available for support:
|
||||
|
||||
Our Forum, at http://forum.deluge-torrent.org
|
||||
or
|
||||
Our IRC Channel, at #deluge on Freenode
|
||||
|
||||
==========================
|
||||
Installation Instructions:
|
||||
==========================
|
||||
|
||||
First, make sure you have the proper build dependencies installed. On a normal
|
||||
Debian or Ubuntu system, those dependencies are:
|
||||
|
||||
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
|
||||
|
||||
But the names of the packages may vary depending on your OS / distro.
|
||||
|
||||
Once you have the needed libraries installed, build Deluge by running:
|
||||
|
||||
$ make
|
||||
|
||||
You shouldn't get any errors. Then run, as root (or by using sudo):
|
||||
|
||||
$ make 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
|
||||
|
||||
==========================
|
||||
Uninstallation/Upgrading:
|
||||
==========================
|
||||
|
||||
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):
|
||||
|
||||
$ make uninstall
|
||||
|
||||
If you installed via the deb package, run as root (or by using sudo:)
|
||||
$ dpkg --purge remove deluge-torrent
|
||||
|
||||
Now install the latest version (and check out the additional notes).
|
||||
|
||||
==========================
|
||||
Additional Notes:
|
||||
==========================
|
||||
|
||||
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
|
||||
"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
|
||||
with "-mt", or to alter setup.py to look for the "-mt" versions.
|
||||
|
||||
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
|
||||
Deluge to rebuild it's configuration file.
|
|
@ -1,8 +0,0 @@
|
|||
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
|
22
TODO
|
@ -1 +1,23 @@
|
|||
For 0.6 release:
|
||||
* Translations
|
||||
* Add progress bars for downloading and importing lists instead of hanging (blocklist)
|
||||
|
||||
After 0.6 release:
|
||||
* Address issue where torrents will redownload if the storage is moved outside
|
||||
of deluge.
|
||||
* Implement add by hash
|
||||
* Figure out easy way for user-made plugins to add i18n support.
|
||||
* Restart daemon function
|
||||
* Docstrings!
|
||||
* Add wizard
|
||||
* Advanced (pieces) progress bar
|
||||
* Add method for plugins to add labels
|
||||
* Add context menus for labels.. ie. setting options for all torrents in label
|
||||
* Implement caching in core
|
||||
* Use the batch torrent status info as a cache for other torrent status requests
|
||||
* Add number of torrents to labels
|
||||
* Proxy stuff
|
||||
* Webseed
|
||||
* Enable/disable webui from within gtkui
|
||||
* Notifications
|
||||
* create a clamav plugin to scan files
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/bin/bash
|
||||
for size in 16 22 24 32 36 48 64 72 96 128 192 256; do mkdir -p icons/hicolor/\
|
||||
${size}x${size}/apps; rsvg-convert -w ${size} -h ${size} \
|
||||
-o icons/hicolor/${size}x${size}/apps/deluge.png pixmaps/deluge.svg; mkdir -p \
|
||||
icons/scalable/apps/; cp pixmaps/deluge.svg icons/scalable/apps/deluge.svg; done
|
||||
for size in 16 22 24 32 36 48 64 72 96 128 192 256; do mkdir -p deluge/data/\
|
||||
icons/hicolor/${size}x${size}/apps; rsvg-convert -w ${size} -h ${size} \
|
||||
-o deluge/data/icons/hicolor/${size}x${size}/apps/deluge.png deluge/data/pixmaps\
|
||||
/deluge.svg; mkdir -p deluge/data/icons/scalable/apps/; cp deluge/data/pixmaps/\
|
||||
deluge.svg deluge/data/icons/scalable/apps/deluge.svg; done
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
deluge-torrent (0.6.0-svn3235-1) lenny; urgency=low
|
||||
|
||||
* Daily Build
|
||||
|
||||
-- Andrew Resch (andar) <andrewresch@gmail.com> Tue, 17 Jun 2008 16:31:14 -0800
|
|
@ -0,0 +1,5 @@
|
|||
deluge-torrent (0.6.0-svn3235-1) lenny; urgency=low
|
||||
|
||||
* Daily Build
|
||||
|
||||
-- Andrew Resch (andar) <andrewresch@gmail.com> Tue, 17 Jun 2008 16:31:14 -0800
|
|
@ -0,0 +1,5 @@
|
|||
deluge-torrent (0.6.0-svn3235-1) unstable; urgency=low
|
||||
|
||||
* Daily Build
|
||||
|
||||
-- Andrew Resch (andar) <andrewresch@gmail.com> Tue, 17 Jun 2008 16:31:14 -0800
|
|
@ -0,0 +1,5 @@
|
|||
deluge-torrent (0.6.0-svn3235-1) gutsy; urgency=low
|
||||
|
||||
* Daily Build
|
||||
|
||||
-- Andrew Resch (andar) <andrewresch@gmail.com> Tue, 17 Jun 2008 16:31:14 -0800
|
|
@ -0,0 +1,5 @@
|
|||
deluge-torrent (0.6.0-svn3235-1) hardy; urgency=low
|
||||
|
||||
* Daily Build
|
||||
|
||||
-- Andrew Resch (andar) <andrewresch@gmail.com> Tue, 17 Jun 2008 16:31:14 -0800
|
|
@ -0,0 +1 @@
|
|||
5
|
|
@ -0,0 +1,21 @@
|
|||
Source: deluge-torrent
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: Andrew Resch (andar) <andrewresch@gmail.com>
|
||||
Build-Depends: debhelper (>= 5.0.37.2), python-all-dev (>= 2.3.5-11), python-all, python-support (>= 0.5.3), libboost-dev (>= 1.34.1), libboost-thread-dev (>= 1.34.1), libboost-date-time-dev (>= 1.34.1), libboost-filesystem-dev (>= 1.34.1), libboost-python-dev (>= 1.34.1), libboost-iostreams-dev (>= 1.34.1), zlib1g-dev, libssl-dev, dpatch, python-setuptools
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
Package: deluge-torrent
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${python:Depends}, python-gtk2, python-glade2, python-xdg, python-notify, notification-daemon, python-dbus, librsvg2-common, python-pyopenssl, python-setuptools
|
||||
Conflicts: deluge-torrent-common
|
||||
Replaces: deluge-torrent-common
|
||||
Description: A Bittorrent client written in Python/PyGTK
|
||||
Deluge is a Bittorrent client, created using Python and GTK+.
|
||||
.
|
||||
Deluge is intended to bring a native, full-featured client to Linux GTK
|
||||
desktop environments such as Gnome and XFCE.
|
||||
.
|
||||
It uses Rasterbar's version of libtorrent.
|
||||
.
|
||||
Homepage: http://www.deluge-torrent.org/
|
|
@ -0,0 +1,19 @@
|
|||
Source: deluge-torrent
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: Andrew Resch (andar) <andrewresch@gmail.com>
|
||||
Build-Depends: debhelper (>= 5.0.37.2), python-all-dev (>= 2.3.5-11), python-all, python-support (>= 0.5.3), libboost-dev (>= 1.33.1), libboost-thread-dev (>= 1.33.1), libboost-date-time-dev (>= 1.33.1), libboost-filesystem-dev (>= 1.33.1), libboost-serialization-dev (>= 1.33.1), libboost-program-options-dev (>= 1.33.1), libboost-regex-dev (>= 1.33.1), libboost-python-dev (>= 1.33.1), zlib1g-dev, libssl-dev, dpatch, python-setuptools
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
Package: deluge-torrent
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${python:Depends}, python-gtk2, python-glade2, python-xdg, python-notify, notification-daemon, python-dbus, librsvg2-common, python-pyopenssl, python-setuptools
|
||||
Description: A Bittorrent client written in Python/PyGTK
|
||||
Deluge is a Bittorrent client, created using Python and GTK+.
|
||||
.
|
||||
Deluge is intended to bring a native, full-featured client to Linux GTK
|
||||
desktop environments such as Gnome and XFCE.
|
||||
.
|
||||
It uses Rasterbar's version of libtorrent.
|
||||
.
|
||||
Homepage: http://www.deluge-torrent.org/
|
|
@ -0,0 +1,19 @@
|
|||
Source: deluge-torrent
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: Andrew Resch (andar) <andrewresch@gmail.com>
|
||||
Build-Depends: debhelper (>= 5.0.37.2), python-all-dev (>= 2.3.5-11), python-all, python-support (>= 0.5.3), libboost-dev (>= 1.33.1), libboost-thread-dev (>= 1.33.1), libboost-date-time-dev (>= 1.33.1), libboost-filesystem-dev (>= 1.33.1), libboost-serialization-dev (>= 1.33.1), libboost-program-options-dev (>= 1.33.1), libboost-regex-dev (>= 1.33.1), libboost-python-dev (>= 1.33.1), zlib1g-dev, libssl-dev, dpatch, python-setuptools
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
Package: deluge-torrent
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${python:Depends}, python-gtk2, python-glade2, python-xdg, python-notify, notification-daemon, python-dbus, librsvg2-common, python-pyopenssl, python-setuptools
|
||||
Description: A Bittorrent client written in Python/PyGTK
|
||||
Deluge is a Bittorrent client, created using Python and GTK+.
|
||||
.
|
||||
Deluge is intended to bring a native, full-featured client to Linux GTK
|
||||
desktop environments such as Gnome and XFCE.
|
||||
.
|
||||
It uses Rasterbar's version of libtorrent.
|
||||
.
|
||||
Homepage: http://www.deluge-torrent.org/
|
|
@ -0,0 +1,19 @@
|
|||
Source: deluge-torrent
|
||||
Section: universe/net
|
||||
Priority: optional
|
||||
Maintainer: Andrew Resch (andar) <andrewresch@gmail.com>
|
||||
Build-Depends: debhelper (>= 5.0.37.2), python-all-dev (>= 2.3.5-11), python-all, python-support (>= 0.5.3), libboost-dev (>= 1.33.1), libboost-thread-dev (>= 1.33.1), libboost-date-time-dev (>= 1.33.1), libboost-filesystem-dev (>= 1.33.1), libboost-serialization-dev (>= 1.33.1), libboost-program-options-dev (>= 1.33.1), libboost-regex-dev (>= 1.33.1), libboost-python-dev (>= 1.33.1), zlib1g-dev, libssl-dev, dpatch, python-setuptools
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
Package: deluge-torrent
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${python:Depends}, python-gtk2, python-glade2, python-xdg, python-notify, notification-daemon, python-dbus, librsvg2-common, python-pyopenssl, python-setuptools
|
||||
Description: A Bittorrent client written in Python/PyGTK
|
||||
Deluge is a Bittorrent client, created using Python and GTK+.
|
||||
.
|
||||
Deluge is intended to bring a native, full-featured client to Linux GTK
|
||||
desktop environments such as Gnome and XFCE.
|
||||
.
|
||||
It uses Rasterbar's version of libtorrent.
|
||||
.
|
||||
Homepage: http://www.deluge-torrent.org/
|
|
@ -0,0 +1,19 @@
|
|||
Source: deluge-torrent
|
||||
Section: universe/net
|
||||
Priority: optional
|
||||
Maintainer: Andrew Resch (andar) <andrewresch@gmail.com>
|
||||
Build-Depends: debhelper (>= 5.0.37.2), python-all-dev (>= 2.3.5-11), python-all, python-support (>= 0.5.3), libboost-dev (>= 1.33.1), libboost-thread-dev (>= 1.33.1), libboost-date-time-dev (>= 1.33.1), libboost-filesystem-dev (>= 1.33.1), libboost-serialization-dev (>= 1.33.1), libboost-program-options-dev (>= 1.33.1), libboost-regex-dev (>= 1.33.1), libboost-python-dev (>= 1.33.1), zlib1g-dev, libssl-dev, dpatch, python-setuptools
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
Package: deluge-torrent
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${python:Depends}, python-gtk2, python-glade2, python-xdg, python-notify, notification-daemon, python-dbus, librsvg2-common, python-pyopenssl, python-setuptools
|
||||
Description: A Bittorrent client written in Python/PyGTK
|
||||
Deluge is a Bittorrent client, created using Python and GTK+.
|
||||
.
|
||||
Deluge is intended to bring a native, full-featured client to Linux GTK
|
||||
desktop environments such as Gnome and XFCE.
|
||||
.
|
||||
It uses Rasterbar's version of libtorrent.
|
||||
.
|
||||
Homepage: http://www.deluge-torrent.org/
|
|
@ -0,0 +1,103 @@
|
|||
This package was debianized by Adam Cécile (Le_Vert) <gandalf@le-vert.net> on
|
||||
Wed, 15 Nov 2006 22:03:13 +0100.
|
||||
|
||||
It was downloaded from http://www.deluge-torrent.org/
|
||||
|
||||
Upstream Author: Zach Tibbitts <zach@collegegeek.org>
|
||||
Alon Zakai <kripkensteiner@gmail.com>
|
||||
Marcos Pinto
|
||||
|
||||
Copyright: (C) 2006, Zach Tibbitts <zach@collegegeek.org>
|
||||
(C) 2006, Alon Zakai <kripkensteiner@gmail.com>
|
||||
|
||||
License:
|
||||
|
||||
This package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This package 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 package; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, 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.
|
||||
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License can be found in `/usr/share/common-licenses/GPL'.
|
||||
|
||||
libtorrent/* are (C) 2006, A. Zakai ('Kripken') <kripkensteiner@gmail.com>
|
||||
and distributed unders term of GNU General Public License.
|
||||
|
||||
This code is baded on libtorrent which is (C) 2003 Arvid Norberg and
|
||||
distributed under terms of the license below :
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
"libtorrent/include/libtorrent/asio*" are (C) 2003-2006 Christopher
|
||||
M. Kohlhoff <chris@kohlhoff.com> and distributed under terms of the Boost
|
||||
Software License, Version 1.0 :
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
"po/*" are (C) 2006 Rosetta Contributors and Canonical Ltd 2006 and distributed
|
||||
under the same license as the deluge software.
|
||||
|
||||
The Debian packaging is (C) 2006-2007, Adam Cécile (Le_Vert)
|
||||
<gandalf@le-vert.net> and is licensed under the GPL, see above.
|
|
@ -0,0 +1 @@
|
|||
debian/deluge.1
|
|
@ -0,0 +1,3 @@
|
|||
?package(deluge-torrent): needs="X11" section="Applications/Network/File Transfer" \
|
||||
title="Deluge BitTorrent Client" longtitle="Bittorrent client written in Python/PyGTK" \
|
||||
command="/usr/bin/deluge" icon="/usr/share/pixmaps/deluge.png"
|
|
@ -0,0 +1 @@
|
|||
2.5
|
|
@ -0,0 +1 @@
|
|||
2.5
|
|
@ -0,0 +1 @@
|
|||
2.5
|
|
@ -0,0 +1 @@
|
|||
2.5
|
|
@ -0,0 +1 @@
|
|||
2.5
|
|
@ -0,0 +1,75 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
# Dpatch targets
|
||||
include /usr/share/dpatch/dpatch.make
|
||||
|
||||
# Available python (using debian/pyversions) and destdir
|
||||
PYVERS = 2.5
|
||||
DESTDIR = $(CURDIR)/debian/deluge-torrent
|
||||
|
||||
# We need to known the target arch to enable/disable amd64 hack
|
||||
ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
|
||||
ARCH64 = ia64 amd64 alpha kfreebsd-amd64 ppc64
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
else
|
||||
CFLAGS += -O2
|
||||
endif
|
||||
# python-libtorrent need to define AMD64 to work fine on a 64 bits system
|
||||
ifneq (,$(findstring $(ARCH),$(ARCH64)))
|
||||
CFLAGS += -DAMD64
|
||||
endif
|
||||
|
||||
build: patch-stamp $(PYVERS:%=build-stamp%)
|
||||
build-stamp%: patch-stamp
|
||||
dh_testdir
|
||||
CFLAGS="$(CFLAGS)" python$* setup.py build
|
||||
touch $@
|
||||
|
||||
clean: unpatch
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -rf build/
|
||||
find . -name \*.pyc | xargs rm -f
|
||||
rm -rf build-stamp*
|
||||
dh_clean
|
||||
|
||||
install: build install-prereq $(PYVERS:%=install-%) install-finish
|
||||
install-prereq:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
install-%:
|
||||
python$* setup.py install --root=$(DESTDIR) --prefix=/usr --no-compile
|
||||
install-finish:
|
||||
# Desktop menu
|
||||
rm -rf $(DESTDIR)/usr/share/applications
|
||||
install -D -m644 $(CURDIR)/deluge/data/share/applications/deluge.desktop $(DESTDIR)/usr/share/applications/deluge.desktop
|
||||
|
||||
|
||||
binary-indep: build install
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
dh_installmenu
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
dh_pysupport
|
||||
dh_desktop
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install
|
|
@ -0,0 +1,75 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
# Dpatch targets
|
||||
include /usr/share/dpatch/dpatch.make
|
||||
|
||||
# Available python (using debian/pyversions) and destdir
|
||||
PYVERS = 2.4
|
||||
DESTDIR = $(CURDIR)/debian/deluge-torrent
|
||||
|
||||
# We need to known the target arch to enable/disable amd64 hack
|
||||
ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
|
||||
ARCH64 = ia64 amd64 alpha kfreebsd-amd64 ppc64
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
else
|
||||
CFLAGS += -O2
|
||||
endif
|
||||
# python-libtorrent need to define AMD64 to work fine on a 64 bits system
|
||||
ifneq (,$(findstring $(ARCH),$(ARCH64)))
|
||||
CFLAGS += -DAMD64
|
||||
endif
|
||||
|
||||
build: patch-stamp $(PYVERS:%=build-stamp%)
|
||||
build-stamp%: patch-stamp
|
||||
dh_testdir
|
||||
CFLAGS="$(CFLAGS)" python$* setup.py build
|
||||
touch $@
|
||||
|
||||
clean: unpatch
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -rf build/
|
||||
find . -name \*.pyc | xargs rm -f
|
||||
rm -rf build-stamp*
|
||||
dh_clean
|
||||
|
||||
install: build install-prereq $(PYVERS:%=install-%) install-finish
|
||||
install-prereq:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
install-%:
|
||||
python$* setup.py install --root=$(DESTDIR) --prefix=/usr --no-compile
|
||||
install-finish:
|
||||
# Desktop menu
|
||||
rm -rf $(DESTDIR)/usr/share/applications
|
||||
install -D -m644 $(CURDIR)/deluge/data/share/applications/deluge.desktop $(DESTDIR)/usr/share/applications/deluge.desktop
|
||||
|
||||
|
||||
binary-indep: build install
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
dh_installmenu
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
dh_pysupport
|
||||
dh_desktop
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install
|
|
@ -0,0 +1,75 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
# Dpatch targets
|
||||
include /usr/share/dpatch/dpatch.make
|
||||
|
||||
# Available python (using debian/pyversions) and destdir
|
||||
PYVERS = 2.4
|
||||
DESTDIR = $(CURDIR)/debian/deluge-torrent
|
||||
|
||||
# We need to known the target arch to enable/disable amd64 hack
|
||||
ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
|
||||
ARCH64 = ia64 amd64 alpha kfreebsd-amd64 ppc64
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
else
|
||||
CFLAGS += -O2
|
||||
endif
|
||||
# python-libtorrent need to define AMD64 to work fine on a 64 bits system
|
||||
ifneq (,$(findstring $(ARCH),$(ARCH64)))
|
||||
CFLAGS += -DAMD64
|
||||
endif
|
||||
|
||||
build: patch-stamp $(PYVERS:%=build-stamp%)
|
||||
build-stamp%: patch-stamp
|
||||
dh_testdir
|
||||
CFLAGS="$(CFLAGS)" python$* setup.py build
|
||||
touch $@
|
||||
|
||||
clean: unpatch
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -rf build/
|
||||
find . -name \*.pyc | xargs rm -f
|
||||
rm -rf build-stamp*
|
||||
dh_clean
|
||||
|
||||
install: build install-prereq $(PYVERS:%=install-%) install-finish
|
||||
install-prereq:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
install-%:
|
||||
python$* setup.py install --root=$(DESTDIR) --prefix=/usr --no-compile
|
||||
install-finish:
|
||||
# Desktop menu
|
||||
rm -rf $(DESTDIR)/usr/share/applications
|
||||
install -D -m644 $(CURDIR)/deluge/data/share/applications/deluge.desktop $(DESTDIR)/usr/share/applications/deluge.desktop
|
||||
|
||||
|
||||
binary-indep: build install
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
dh_installmenu
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
dh_pysupport
|
||||
dh_desktop
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install
|
|
@ -0,0 +1,75 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
# Dpatch targets
|
||||
include /usr/share/dpatch/dpatch.make
|
||||
|
||||
# Available python (using debian/pyversions) and destdir
|
||||
PYVERS = 2.5
|
||||
DESTDIR = $(CURDIR)/debian/deluge-torrent
|
||||
|
||||
# We need to known the target arch to enable/disable amd64 hack
|
||||
ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
|
||||
ARCH64 = ia64 amd64 alpha kfreebsd-amd64 ppc64
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
else
|
||||
CFLAGS += -O2
|
||||
endif
|
||||
# python-libtorrent need to define AMD64 to work fine on a 64 bits system
|
||||
ifneq (,$(findstring $(ARCH),$(ARCH64)))
|
||||
CFLAGS += -DAMD64
|
||||
endif
|
||||
|
||||
build: patch-stamp $(PYVERS:%=build-stamp%)
|
||||
build-stamp%: patch-stamp
|
||||
dh_testdir
|
||||
CFLAGS="$(CFLAGS)" python$* setup.py build
|
||||
touch $@
|
||||
|
||||
clean: unpatch
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -rf build/
|
||||
find . -name \*.pyc | xargs rm -f
|
||||
rm -rf build-stamp*
|
||||
dh_clean
|
||||
|
||||
install: build install-prereq $(PYVERS:%=install-%) install-finish
|
||||
install-prereq:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
install-%:
|
||||
python$* setup.py install --root=$(DESTDIR) --prefix=/usr --no-compile
|
||||
install-finish:
|
||||
# Desktop menu
|
||||
rm -rf $(DESTDIR)/usr/share/applications
|
||||
install -D -m644 $(CURDIR)/deluge/data/share/applications/deluge.desktop $(DESTDIR)/usr/share/applications/deluge.desktop
|
||||
|
||||
|
||||
binary-indep: build install
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
dh_installmenu
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
dh_pysupport
|
||||
dh_desktop
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install
|
|
@ -0,0 +1,75 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
# Dpatch targets
|
||||
include /usr/share/dpatch/dpatch.make
|
||||
|
||||
# Available python (using debian/pyversions) and destdir
|
||||
PYVERS = 2.5
|
||||
DESTDIR = $(CURDIR)/debian/deluge-torrent
|
||||
|
||||
# We need to known the target arch to enable/disable amd64 hack
|
||||
ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
|
||||
ARCH64 = ia64 amd64 alpha kfreebsd-amd64 ppc64
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
else
|
||||
CFLAGS += -O2
|
||||
endif
|
||||
# python-libtorrent need to define AMD64 to work fine on a 64 bits system
|
||||
ifneq (,$(findstring $(ARCH),$(ARCH64)))
|
||||
CFLAGS += -DAMD64
|
||||
endif
|
||||
|
||||
build: patch-stamp $(PYVERS:%=build-stamp%)
|
||||
build-stamp%: patch-stamp
|
||||
dh_testdir
|
||||
CFLAGS="$(CFLAGS)" python$* setup.py build
|
||||
touch $@
|
||||
|
||||
clean: unpatch
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -rf build/
|
||||
find . -name \*.pyc | xargs rm -f
|
||||
rm -rf build-stamp*
|
||||
dh_clean
|
||||
|
||||
install: build install-prereq $(PYVERS:%=install-%) install-finish
|
||||
install-prereq:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
install-%:
|
||||
python$* setup.py install --root=$(DESTDIR) --prefix=/usr --no-compile
|
||||
install-finish:
|
||||
# Desktop menu
|
||||
rm -rf $(DESTDIR)/usr/share/applications
|
||||
install -D -m644 $(CURDIR)/deluge/data/share/applications/deluge.desktop $(DESTDIR)/usr/share/applications/deluge.desktop
|
||||
|
||||
|
||||
binary-indep: build install
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
dh_installmenu
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
dh_pysupport
|
||||
dh_desktop
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install
|
|
@ -1,13 +0,0 @@
|
|||
[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
Before Width: | Height: | Size: 3.4 KiB |
|
@ -0,0 +1,595 @@
|
|||
"""Simple XML-RPC Server.
|
||||
|
||||
This module can be used to create simple XML-RPC servers
|
||||
by creating a server and either installing functions, a
|
||||
class instance, or by extending the SimpleXMLRPCServer
|
||||
class.
|
||||
|
||||
It can also be used to handle XML-RPC requests in a CGI
|
||||
environment using CGIXMLRPCRequestHandler.
|
||||
|
||||
A list of possible usage patterns follows:
|
||||
|
||||
1. Install functions:
|
||||
|
||||
server = SimpleXMLRPCServer(("localhost", 8000))
|
||||
server.register_function(pow)
|
||||
server.register_function(lambda x,y: x+y, 'add')
|
||||
server.serve_forever()
|
||||
|
||||
2. Install an instance:
|
||||
|
||||
class MyFuncs:
|
||||
def __init__(self):
|
||||
# make all of the string functions available through
|
||||
# string.func_name
|
||||
import string
|
||||
self.string = string
|
||||
def _listMethods(self):
|
||||
# implement this method so that system.listMethods
|
||||
# knows to advertise the strings methods
|
||||
return list_public_methods(self) + \
|
||||
['string.' + method for method in list_public_methods(self.string)]
|
||||
def pow(self, x, y): return pow(x, y)
|
||||
def add(self, x, y) : return x + y
|
||||
|
||||
server = SimpleXMLRPCServer(("localhost", 8000))
|
||||
server.register_introspection_functions()
|
||||
server.register_instance(MyFuncs())
|
||||
server.serve_forever()
|
||||
|
||||
3. Install an instance with custom dispatch method:
|
||||
|
||||
class Math:
|
||||
def _listMethods(self):
|
||||
# this method must be present for system.listMethods
|
||||
# to work
|
||||
return ['add', 'pow']
|
||||
def _methodHelp(self, method):
|
||||
# this method must be present for system.methodHelp
|
||||
# to work
|
||||
if method == 'add':
|
||||
return "add(2,3) => 5"
|
||||
elif method == 'pow':
|
||||
return "pow(x, y[, z]) => number"
|
||||
else:
|
||||
# By convention, return empty
|
||||
# string if no help is available
|
||||
return ""
|
||||
def _dispatch(self, method, params):
|
||||
if method == 'pow':
|
||||
return pow(*params)
|
||||
elif method == 'add':
|
||||
return params[0] + params[1]
|
||||
else:
|
||||
raise 'bad method'
|
||||
|
||||
server = SimpleXMLRPCServer(("localhost", 8000))
|
||||
server.register_introspection_functions()
|
||||
server.register_instance(Math())
|
||||
server.serve_forever()
|
||||
|
||||
4. Subclass SimpleXMLRPCServer:
|
||||
|
||||
class MathServer(SimpleXMLRPCServer):
|
||||
def _dispatch(self, method, params):
|
||||
try:
|
||||
# We are forcing the 'export_' prefix on methods that are
|
||||
# callable through XML-RPC to prevent potential security
|
||||
# problems
|
||||
func = getattr(self, 'export_' + method)
|
||||
except AttributeError:
|
||||
raise Exception('method "%s" is not supported' % method)
|
||||
else:
|
||||
return func(*params)
|
||||
|
||||
def export_add(self, x, y):
|
||||
return x + y
|
||||
|
||||
server = MathServer(("localhost", 8000))
|
||||
server.serve_forever()
|
||||
|
||||
5. CGI script:
|
||||
|
||||
server = CGIXMLRPCRequestHandler()
|
||||
server.register_function(pow)
|
||||
server.handle_request()
|
||||
"""
|
||||
|
||||
# Written by Brian Quinlan (brian@sweetapp.com).
|
||||
# Based on code written by Fredrik Lundh.
|
||||
|
||||
import xmlrpclib
|
||||
from xmlrpclib import Fault
|
||||
import SocketServer
|
||||
import BaseHTTPServer
|
||||
import sys
|
||||
import os
|
||||
try:
|
||||
import fcntl
|
||||
except ImportError:
|
||||
fcntl = None
|
||||
|
||||
def resolve_dotted_attribute(obj, attr, allow_dotted_names=True):
|
||||
"""resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d
|
||||
|
||||
Resolves a dotted attribute name to an object. Raises
|
||||
an AttributeError if any attribute in the chain starts with a '_'.
|
||||
|
||||
If the optional allow_dotted_names argument is false, dots are not
|
||||
supported and this function operates similar to getattr(obj, attr).
|
||||
"""
|
||||
|
||||
if allow_dotted_names:
|
||||
attrs = attr.split('.')
|
||||
else:
|
||||
attrs = [attr]
|
||||
|
||||
for i in attrs:
|
||||
if i.startswith('_'):
|
||||
raise AttributeError(
|
||||
'attempt to access private attribute "%s"' % i
|
||||
)
|
||||
else:
|
||||
obj = getattr(obj,i)
|
||||
return obj
|
||||
|
||||
def list_public_methods(obj):
|
||||
"""Returns a list of attribute strings, found in the specified
|
||||
object, which represent callable attributes"""
|
||||
|
||||
return [member for member in dir(obj)
|
||||
if not member.startswith('_') and
|
||||
callable(getattr(obj, member))]
|
||||
|
||||
def remove_duplicates(lst):
|
||||
"""remove_duplicates([2,2,2,1,3,3]) => [3,1,2]
|
||||
|
||||
Returns a copy of a list without duplicates. Every list
|
||||
item must be hashable and the order of the items in the
|
||||
resulting list is not defined.
|
||||
"""
|
||||
u = {}
|
||||
for x in lst:
|
||||
u[x] = 1
|
||||
|
||||
return u.keys()
|
||||
|
||||
class SimpleXMLRPCDispatcher:
|
||||
"""Mix-in class that dispatches XML-RPC requests.
|
||||
|
||||
This class is used to register XML-RPC method handlers
|
||||
and then to dispatch them. There should never be any
|
||||
reason to instantiate this class directly.
|
||||
"""
|
||||
|
||||
def __init__(self, allow_none, encoding):
|
||||
self.funcs = {}
|
||||
self.instance = None
|
||||
self.allow_none = allow_none
|
||||
self.encoding = encoding
|
||||
|
||||
def register_instance(self, instance, allow_dotted_names=False):
|
||||
"""Registers an instance to respond to XML-RPC requests.
|
||||
|
||||
Only one instance can be installed at a time.
|
||||
|
||||
If the registered instance has a _dispatch method then that
|
||||
method will be called with the name of the XML-RPC method and
|
||||
its parameters as a tuple
|
||||
e.g. instance._dispatch('add',(2,3))
|
||||
|
||||
If the registered instance does not have a _dispatch method
|
||||
then the instance will be searched to find a matching method
|
||||
and, if found, will be called. Methods beginning with an '_'
|
||||
are considered private and will not be called by
|
||||
SimpleXMLRPCServer.
|
||||
|
||||
If a registered function matches a XML-RPC request, then it
|
||||
will be called instead of the registered instance.
|
||||
|
||||
If the optional allow_dotted_names argument is true and the
|
||||
instance does not have a _dispatch method, method names
|
||||
containing dots are supported and resolved, as long as none of
|
||||
the name segments start with an '_'.
|
||||
|
||||
*** SECURITY WARNING: ***
|
||||
|
||||
Enabling the allow_dotted_names options allows intruders
|
||||
to access your module's global variables and may allow
|
||||
intruders to execute arbitrary code on your machine. Only
|
||||
use this option on a secure, closed network.
|
||||
|
||||
"""
|
||||
|
||||
self.instance = instance
|
||||
self.allow_dotted_names = allow_dotted_names
|
||||
|
||||
def register_function(self, function, name = None):
|
||||
"""Registers a function to respond to XML-RPC requests.
|
||||
|
||||
The optional name argument can be used to set a Unicode name
|
||||
for the function.
|
||||
"""
|
||||
|
||||
if name is None:
|
||||
name = function.__name__
|
||||
self.funcs[name] = function
|
||||
|
||||
def register_introspection_functions(self):
|
||||
"""Registers the XML-RPC introspection methods in the system
|
||||
namespace.
|
||||
|
||||
see http://xmlrpc.usefulinc.com/doc/reserved.html
|
||||
"""
|
||||
|
||||
self.funcs.update({'system.listMethods' : self.system_listMethods,
|
||||
'system.methodSignature' : self.system_methodSignature,
|
||||
'system.methodHelp' : self.system_methodHelp})
|
||||
|
||||
def register_multicall_functions(self):
|
||||
"""Registers the XML-RPC multicall method in the system
|
||||
namespace.
|
||||
|
||||
see http://www.xmlrpc.com/discuss/msgReader$1208"""
|
||||
|
||||
self.funcs.update({'system.multicall' : self.system_multicall})
|
||||
|
||||
def _marshaled_dispatch(self, data, dispatch_method = None):
|
||||
"""Dispatches an XML-RPC method from marshalled (XML) data.
|
||||
|
||||
XML-RPC methods are dispatched from the marshalled (XML) data
|
||||
using the _dispatch method and the result is returned as
|
||||
marshalled data. For backwards compatibility, a dispatch
|
||||
function can be provided as an argument (see comment in
|
||||
SimpleXMLRPCRequestHandler.do_POST) but overriding the
|
||||
existing method through subclassing is the prefered means
|
||||
of changing method dispatch behavior.
|
||||
"""
|
||||
|
||||
try:
|
||||
params, method = xmlrpclib.loads(data)
|
||||
|
||||
# generate response
|
||||
if dispatch_method is not None:
|
||||
response = dispatch_method(method, params)
|
||||
else:
|
||||
response = self._dispatch(method, params)
|
||||
# wrap response in a singleton tuple
|
||||
response = (response,)
|
||||
response = xmlrpclib.dumps(response, methodresponse=1,
|
||||
allow_none=self.allow_none, encoding=self.encoding)
|
||||
except Fault, fault:
|
||||
response = xmlrpclib.dumps(fault, allow_none=self.allow_none,
|
||||
encoding=self.encoding)
|
||||
except:
|
||||
# report exception back to server
|
||||
response = xmlrpclib.dumps(
|
||||
xmlrpclib.Fault(1, "%s:%s" % (sys.exc_type, sys.exc_value)),
|
||||
encoding=self.encoding, allow_none=self.allow_none,
|
||||
)
|
||||
|
||||
return response
|
||||
|
||||
def system_listMethods(self):
|
||||
"""system.listMethods() => ['add', 'subtract', 'multiple']
|
||||
|
||||
Returns a list of the methods supported by the server."""
|
||||
|
||||
methods = self.funcs.keys()
|
||||
if self.instance is not None:
|
||||
# Instance can implement _listMethod to return a list of
|
||||
# methods
|
||||
if hasattr(self.instance, '_listMethods'):
|
||||
methods = remove_duplicates(
|
||||
methods + self.instance._listMethods()
|
||||
)
|
||||
# if the instance has a _dispatch method then we
|
||||
# don't have enough information to provide a list
|
||||
# of methods
|
||||
elif not hasattr(self.instance, '_dispatch'):
|
||||
methods = remove_duplicates(
|
||||
methods + list_public_methods(self.instance)
|
||||
)
|
||||
methods.sort()
|
||||
return methods
|
||||
|
||||
def system_methodSignature(self, method_name):
|
||||
"""system.methodSignature('add') => [double, int, int]
|
||||
|
||||
Returns a list describing the signature of the method. In the
|
||||
above example, the add method takes two integers as arguments
|
||||
and returns a double result.
|
||||
|
||||
This server does NOT support system.methodSignature."""
|
||||
|
||||
# See http://xmlrpc.usefulinc.com/doc/sysmethodsig.html
|
||||
|
||||
return 'signatures not supported'
|
||||
|
||||
def system_methodHelp(self, method_name):
|
||||
"""system.methodHelp('add') => "Adds two integers together"
|
||||
|
||||
Returns a string containing documentation for the specified method."""
|
||||
|
||||
method = None
|
||||
if self.funcs.has_key(method_name):
|
||||
method = self.funcs[method_name]
|
||||
elif self.instance is not None:
|
||||
# Instance can implement _methodHelp to return help for a method
|
||||
if hasattr(self.instance, '_methodHelp'):
|
||||
return self.instance._methodHelp(method_name)
|
||||
# if the instance has a _dispatch method then we
|
||||
# don't have enough information to provide help
|
||||
elif not hasattr(self.instance, '_dispatch'):
|
||||
try:
|
||||
method = resolve_dotted_attribute(
|
||||
self.instance,
|
||||
method_name,
|
||||
self.allow_dotted_names
|
||||
)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
# Note that we aren't checking that the method actually
|
||||
# be a callable object of some kind
|
||||
if method is None:
|
||||
return ""
|
||||
else:
|
||||
import pydoc
|
||||
return pydoc.getdoc(method)
|
||||
|
||||
def system_multicall(self, call_list):
|
||||
"""system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \
|
||||
[[4], ...]
|
||||
|
||||
Allows the caller to package multiple XML-RPC calls into a single
|
||||
request.
|
||||
|
||||
See http://www.xmlrpc.com/discuss/msgReader$1208
|
||||
"""
|
||||
|
||||
results = []
|
||||
for call in call_list:
|
||||
method_name = call['methodName']
|
||||
params = call['params']
|
||||
|
||||
try:
|
||||
# XXX A marshalling error in any response will fail the entire
|
||||
# multicall. If someone cares they should fix this.
|
||||
results.append([self._dispatch(method_name, params)])
|
||||
except Fault, fault:
|
||||
results.append(
|
||||
{'faultCode' : fault.faultCode,
|
||||
'faultString' : fault.faultString}
|
||||
)
|
||||
except:
|
||||
results.append(
|
||||
{'faultCode' : 1,
|
||||
'faultString' : "%s:%s" % (sys.exc_type, sys.exc_value)}
|
||||
)
|
||||
return results
|
||||
|
||||
def _dispatch(self, method, params):
|
||||
"""Dispatches the XML-RPC method.
|
||||
|
||||
XML-RPC calls are forwarded to a registered function that
|
||||
matches the called XML-RPC method name. If no such function
|
||||
exists then the call is forwarded to the registered instance,
|
||||
if available.
|
||||
|
||||
If the registered instance has a _dispatch method then that
|
||||
method will be called with the name of the XML-RPC method and
|
||||
its parameters as a tuple
|
||||
e.g. instance._dispatch('add',(2,3))
|
||||
|
||||
If the registered instance does not have a _dispatch method
|
||||
then the instance will be searched to find a matching method
|
||||
and, if found, will be called.
|
||||
|
||||
Methods beginning with an '_' are considered private and will
|
||||
not be called.
|
||||
"""
|
||||
|
||||
func = None
|
||||
try:
|
||||
# check to see if a matching function has been registered
|
||||
func = self.funcs[method]
|
||||
except KeyError:
|
||||
if self.instance is not None:
|
||||
# check for a _dispatch method
|
||||
if hasattr(self.instance, '_dispatch'):
|
||||
return self.instance._dispatch(method, params)
|
||||
else:
|
||||
# call instance method directly
|
||||
try:
|
||||
func = resolve_dotted_attribute(
|
||||
self.instance,
|
||||
method,
|
||||
self.allow_dotted_names
|
||||
)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
if func is not None:
|
||||
return func(*params)
|
||||
else:
|
||||
raise Exception('method "%s" is not supported' % method)
|
||||
|
||||
class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
"""Simple XML-RPC request handler class.
|
||||
|
||||
Handles all HTTP POST requests and attempts to decode them as
|
||||
XML-RPC requests.
|
||||
"""
|
||||
|
||||
# Class attribute listing the accessible path components;
|
||||
# paths not on this list will result in a 404 error.
|
||||
rpc_paths = ('/', '/RPC2')
|
||||
|
||||
def is_rpc_path_valid(self):
|
||||
if self.rpc_paths:
|
||||
return self.path in self.rpc_paths
|
||||
else:
|
||||
# If .rpc_paths is empty, just assume all paths are legal
|
||||
return True
|
||||
|
||||
def do_POST(self):
|
||||
"""Handles the HTTP POST request.
|
||||
|
||||
Attempts to interpret all HTTP POST requests as XML-RPC calls,
|
||||
which are forwarded to the server's _dispatch method for handling.
|
||||
"""
|
||||
|
||||
# Check that the path is legal
|
||||
if not self.is_rpc_path_valid():
|
||||
self.report_404()
|
||||
return
|
||||
|
||||
try:
|
||||
# Get arguments by reading body of request.
|
||||
# We read this in chunks to avoid straining
|
||||
# socket.read(); around the 10 or 15Mb mark, some platforms
|
||||
# begin to have problems (bug #792570).
|
||||
max_chunk_size = 10*1024*1024
|
||||
size_remaining = int(self.headers["content-length"])
|
||||
L = []
|
||||
while size_remaining:
|
||||
chunk_size = min(size_remaining, max_chunk_size)
|
||||
L.append(self.rfile.read(chunk_size))
|
||||
size_remaining -= len(L[-1])
|
||||
data = ''.join(L)
|
||||
|
||||
# In previous versions of SimpleXMLRPCServer, _dispatch
|
||||
# could be overridden in this class, instead of in
|
||||
# SimpleXMLRPCDispatcher. To maintain backwards compatibility,
|
||||
# check to see if a subclass implements _dispatch and dispatch
|
||||
# using that method if present.
|
||||
response = self.server._marshaled_dispatch(
|
||||
data, getattr(self, '_dispatch', None)
|
||||
)
|
||||
except: # This should only happen if the module is buggy
|
||||
# internal error, report as HTTP server error
|
||||
self.send_response(500)
|
||||
self.end_headers()
|
||||
else:
|
||||
# got a valid XML RPC response
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "text/xml")
|
||||
self.send_header("Content-length", str(len(response)))
|
||||
self.end_headers()
|
||||
self.wfile.write(response)
|
||||
|
||||
# shut down the connection
|
||||
self.wfile.flush()
|
||||
self.connection.shutdown(1)
|
||||
|
||||
def report_404 (self):
|
||||
# Report a 404 error
|
||||
self.send_response(404)
|
||||
response = 'No such page'
|
||||
self.send_header("Content-type", "text/plain")
|
||||
self.send_header("Content-length", str(len(response)))
|
||||
self.end_headers()
|
||||
self.wfile.write(response)
|
||||
# shut down the connection
|
||||
self.wfile.flush()
|
||||
self.connection.shutdown(1)
|
||||
|
||||
def log_request(self, code='-', size='-'):
|
||||
"""Selectively log an accepted request."""
|
||||
|
||||
if self.server.logRequests:
|
||||
BaseHTTPServer.BaseHTTPRequestHandler.log_request(self, code, size)
|
||||
|
||||
class SimpleXMLRPCServer(SocketServer.TCPServer,
|
||||
SimpleXMLRPCDispatcher):
|
||||
"""Simple XML-RPC server.
|
||||
|
||||
Simple XML-RPC server that allows functions and a single instance
|
||||
to be installed to handle requests. The default implementation
|
||||
attempts to dispatch XML-RPC calls to the functions or instance
|
||||
installed in the server. Override the _dispatch method inhereted
|
||||
from SimpleXMLRPCDispatcher to change this behavior.
|
||||
"""
|
||||
|
||||
allow_reuse_address = True
|
||||
|
||||
def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler,
|
||||
logRequests=True, allow_none=False, encoding=None):
|
||||
self.logRequests = logRequests
|
||||
|
||||
SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)
|
||||
SocketServer.TCPServer.__init__(self, addr, requestHandler)
|
||||
|
||||
# [Bug #1222790] If possible, set close-on-exec flag; if a
|
||||
# method spawns a subprocess, the subprocess shouldn't have
|
||||
# the listening socket open.
|
||||
if fcntl is not None and hasattr(fcntl, 'FD_CLOEXEC'):
|
||||
flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
|
||||
flags |= fcntl.FD_CLOEXEC
|
||||
fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)
|
||||
|
||||
class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
|
||||
"""Simple handler for XML-RPC data passed through CGI."""
|
||||
|
||||
def __init__(self, allow_none=False, encoding=None):
|
||||
SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)
|
||||
|
||||
def handle_xmlrpc(self, request_text):
|
||||
"""Handle a single XML-RPC request"""
|
||||
|
||||
response = self._marshaled_dispatch(request_text)
|
||||
|
||||
print 'Content-Type: text/xml'
|
||||
print 'Content-Length: %d' % len(response)
|
||||
print
|
||||
sys.stdout.write(response)
|
||||
|
||||
def handle_get(self):
|
||||
"""Handle a single HTTP GET request.
|
||||
|
||||
Default implementation indicates an error because
|
||||
XML-RPC uses the POST method.
|
||||
"""
|
||||
|
||||
code = 400
|
||||
message, explain = \
|
||||
BaseHTTPServer.BaseHTTPRequestHandler.responses[code]
|
||||
|
||||
response = BaseHTTPServer.DEFAULT_ERROR_MESSAGE % \
|
||||
{
|
||||
'code' : code,
|
||||
'message' : message,
|
||||
'explain' : explain
|
||||
}
|
||||
print 'Status: %d %s' % (code, message)
|
||||
print 'Content-Type: text/html'
|
||||
print 'Content-Length: %d' % len(response)
|
||||
print
|
||||
sys.stdout.write(response)
|
||||
|
||||
def handle_request(self, request_text = None):
|
||||
"""Handle a single XML-RPC request passed through a CGI post method.
|
||||
|
||||
If no XML data is given then it is read from stdin. The resulting
|
||||
XML-RPC response is printed to stdout along with the correct HTTP
|
||||
headers.
|
||||
"""
|
||||
|
||||
if request_text is None and \
|
||||
os.environ.get('REQUEST_METHOD', None) == 'GET':
|
||||
self.handle_get()
|
||||
else:
|
||||
# POST data is normally available through stdin
|
||||
if request_text is None:
|
||||
request_text = sys.stdin.read()
|
||||
|
||||
self.handle_xmlrpc(request_text)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print 'Running XML-RPC server on port 8000'
|
||||
server = SimpleXMLRPCServer(("localhost", 8000))
|
||||
server.register_function(pow)
|
||||
server.register_function(lambda x,y: x+y, 'add')
|
||||
server.serve_forever()
|
|
@ -0,0 +1 @@
|
|||
"""Deluge"""
|
|
@ -0,0 +1,354 @@
|
|||
#
|
||||
# common.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option)
|
||||
# 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 pkg_resources
|
||||
import xdg, xdg.BaseDirectory
|
||||
|
||||
LT_TORRENT_STATE = {
|
||||
"Queued": 0,
|
||||
"Checking": 1,
|
||||
"Connecting": 2,
|
||||
"Downloading Metadata": 3,
|
||||
"Downloading": 4,
|
||||
"Finished": 5,
|
||||
"Seeding": 6,
|
||||
"Allocating": 7,
|
||||
"Paused": 8,
|
||||
0: "Queued",
|
||||
1: "Checking",
|
||||
2: "Connecting",
|
||||
3: "Downloading Metadata",
|
||||
4: "Downloading",
|
||||
5: "Finished",
|
||||
6: "Seeding",
|
||||
7: "Allocating",
|
||||
8: "Paused"
|
||||
}
|
||||
|
||||
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"""
|
||||
return pkg_resources.require("Deluge")[0].version.split("r")[0]
|
||||
|
||||
def get_revision():
|
||||
revision = ""
|
||||
try:
|
||||
f = open(pkg_resources.resource_filename("deluge", os.path.join("data", "revision")))
|
||||
revision = f.read()
|
||||
f.close()
|
||||
except IOError, e:
|
||||
pass
|
||||
|
||||
return revision
|
||||
|
||||
def get_default_config_dir(filename=None):
|
||||
""" Returns the config path if no filename is specified
|
||||
Returns the config directory + filename as a path if filename is specified
|
||||
"""
|
||||
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"""
|
||||
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 if it is Windows
|
||||
and False if not."""
|
||||
import platform
|
||||
if platform.system() in ('Windows', 'Microsoft'):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def get_pixmap(fname):
|
||||
"""Returns a pixmap file included with deluge"""
|
||||
return pkg_resources.resource_filename("deluge", os.path.join("data", \
|
||||
"pixmaps", fname))
|
||||
|
||||
def get_logo(size):
|
||||
"""Returns a deluge logo pixbuf based on the size parameter."""
|
||||
import gtk
|
||||
if windows_check():
|
||||
return gtk.gdk.pixbuf_new_from_file_at_size(get_pixmap("deluge.png"), \
|
||||
size, size)
|
||||
else:
|
||||
return gtk.gdk.pixbuf_new_from_file_at_size(get_pixmap("deluge.svg"), \
|
||||
size, size)
|
||||
|
||||
def open_file(path):
|
||||
"""Opens a file or folder."""
|
||||
if windows_check():
|
||||
os.startfile("'%s'" % path)
|
||||
else:
|
||||
os.popen("xdg-open '%s'" % path)
|
||||
|
||||
def open_url_in_browser(url):
|
||||
"""Opens link in the desktop's default browser"""
|
||||
def start_browser():
|
||||
import threading
|
||||
import webbrowser
|
||||
class BrowserThread(threading.Thread):
|
||||
def __init__(self, url):
|
||||
threading.Thread.__init__(self)
|
||||
self.url = url
|
||||
def run(self):
|
||||
webbrowser.open(self.url)
|
||||
BrowserThread(url).start()
|
||||
return False
|
||||
|
||||
import gobject
|
||||
gobject.idle_add(start_browser)
|
||||
|
||||
|
||||
def build_menu_radio_list(value_list, callback, pref_value=None,
|
||||
suffix=None, show_notset=False, notset_label=None, notset_lessthan=0,
|
||||
show_other=False, show_activated=False, activated_label=None):
|
||||
# Build a menu with radio menu items from a list and connect them to
|
||||
# the callback. The pref_value is what you would like to test for the
|
||||
# default active radio item.
|
||||
import gtk
|
||||
if notset_label is None:
|
||||
notset_label = _("Unlimited")
|
||||
|
||||
if activated_label is None:
|
||||
activated_label = _("Activated")
|
||||
|
||||
menu = gtk.Menu()
|
||||
group = None
|
||||
if show_activated is False:
|
||||
if pref_value > -1 and pref_value not in value_list:
|
||||
value_list.pop()
|
||||
value_list.append(pref_value)
|
||||
|
||||
for value in sorted(value_list):
|
||||
if suffix != None:
|
||||
menuitem = gtk.RadioMenuItem(group, str(value) + " " + \
|
||||
suffix)
|
||||
else:
|
||||
menuitem = gtk.RadioMenuItem(group, str(value))
|
||||
|
||||
group = menuitem
|
||||
|
||||
if value == pref_value and pref_value != None:
|
||||
menuitem.set_active(True)
|
||||
|
||||
if callback != None:
|
||||
menuitem.connect("toggled", callback)
|
||||
|
||||
menu.append(menuitem)
|
||||
|
||||
if show_activated is True:
|
||||
for value in sorted(value_list):
|
||||
menuitem = gtk.RadioMenuItem(group, str(activated_label))
|
||||
|
||||
group = menuitem
|
||||
|
||||
if value == pref_value and pref_value != None:
|
||||
menuitem.set_active(True)
|
||||
|
||||
if callback != None:
|
||||
menuitem.connect("toggled", callback)
|
||||
|
||||
menu.append(menuitem)
|
||||
|
||||
if show_notset:
|
||||
menuitem = gtk.RadioMenuItem(group, notset_label)
|
||||
if pref_value < notset_lessthan and pref_value != None:
|
||||
menuitem.set_active(True)
|
||||
if show_activated and pref_value == 1:
|
||||
menuitem.set_active(True)
|
||||
menuitem.connect("toggled", callback)
|
||||
menu.append(menuitem)
|
||||
|
||||
# Add the Other... menuitem
|
||||
if show_other is True:
|
||||
menuitem = gtk.SeparatorMenuItem()
|
||||
menu.append(menuitem)
|
||||
menuitem = gtk.MenuItem(_("Other..."))
|
||||
menuitem.connect("activate", callback)
|
||||
menu.append(menuitem)
|
||||
|
||||
return menu
|
||||
|
||||
def show_other_dialog(string, default=None):
|
||||
"""Shows a dialog to get an 'other' speed and return the value"""
|
||||
import gtk
|
||||
import gtk.glade
|
||||
dialog_glade = gtk.glade.XML(
|
||||
pkg_resources.resource_filename("deluge.ui.gtkui",
|
||||
"glade/dgtkpopups.glade"))
|
||||
speed_dialog = dialog_glade.get_widget("speed_dialog")
|
||||
spin_title = dialog_glade.get_widget("spin_title")
|
||||
spin_title.set_text(_("%s" % string))
|
||||
spin_speed = dialog_glade.get_widget("spin_speed")
|
||||
if default != None:
|
||||
spin_speed.set_value(default)
|
||||
spin_speed.select_region(0, -1)
|
||||
response = speed_dialog.run()
|
||||
if response == 1: # OK Response
|
||||
value = spin_speed.get_value()
|
||||
else:
|
||||
speed_dialog.destroy()
|
||||
return None
|
||||
|
||||
speed_dialog.destroy()
|
||||
return value
|
||||
|
||||
## Formatting text functions
|
||||
|
||||
def fsize(fsize_b):
|
||||
"""Returns formatted string describing filesize
|
||||
fsize_b should be in bytes
|
||||
Returned value will be in either KB, MB, or GB
|
||||
"""
|
||||
fsize_kb = fsize_b / 1024.0
|
||||
if fsize_kb < 1000:
|
||||
return "%.1f KiB" % fsize_kb
|
||||
fsize_mb = fsize_kb / 1024.0
|
||||
if fsize_mb < 1000:
|
||||
return "%.1f MiB" % fsize_mb
|
||||
fsize_gb = fsize_mb / 1024.0
|
||||
return "%.1f GiB" % fsize_gb
|
||||
|
||||
def fpcnt(dec):
|
||||
"""Returns a formatted string representing a percentage"""
|
||||
return '%.2f%%' % (dec * 100)
|
||||
|
||||
def fspeed(bps):
|
||||
"""Returns a formatted string representing transfer speed"""
|
||||
return '%s/s' % (fsize(bps))
|
||||
|
||||
def fpeer(num_peers, total_peers):
|
||||
"""Returns a formatted string num_peers (total_peers)"""
|
||||
if total_peers > -1:
|
||||
return "%d (%d)" % (num_peers, total_peers)
|
||||
else:
|
||||
return "%d" % num_peers
|
||||
|
||||
def ftime(seconds):
|
||||
"""Returns a formatted time string"""
|
||||
if seconds == 0:
|
||||
return "Infinity"
|
||||
if seconds < 60:
|
||||
return '%ds' % (seconds)
|
||||
minutes = seconds / 60
|
||||
seconds = seconds % 60
|
||||
if minutes < 60:
|
||||
return '%dm %ds' % (minutes, seconds)
|
||||
hours = minutes / 60
|
||||
minutes = minutes % 60
|
||||
if hours < 24:
|
||||
return '%dh %dm' % (hours, minutes)
|
||||
days = hours / 24
|
||||
hours = hours % 24
|
||||
if days < 7:
|
||||
return '%dd %dh' % (days, hours)
|
||||
weeks = days / 7
|
||||
days = days % 7
|
||||
if weeks < 10:
|
||||
return '%dw %dd' % (weeks, days)
|
||||
return 'unknown'
|
||||
|
||||
def is_url(url):
|
||||
"""A simple regex test to check if the URL is valid."""
|
||||
import re
|
||||
return bool(re.search('^(https?|ftp)://', url))
|
||||
|
||||
def fetch_url(url):
|
||||
"""Downloads a torrent file from a given
|
||||
URL and checks the file's validity."""
|
||||
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 pythonize(var):
|
||||
"""Translates DBUS types back to basic Python types."""
|
||||
if isinstance(var, list):
|
||||
return [pythonize(value) for value in var]
|
||||
if isinstance(var, tuple):
|
||||
return tuple([pythonize(value) for value in var])
|
||||
if isinstance(var, dict):
|
||||
return dict(
|
||||
[(pythonize(key), pythonize(value)) for key, value in var.iteritems()]
|
||||
)
|
||||
|
||||
for klass in [unicode, str, bool, int, float, long]:
|
||||
if isinstance(var, klass):
|
||||
return klass(var)
|
||||
return var
|
|
@ -0,0 +1,229 @@
|
|||
#
|
||||
# component.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
import gobject
|
||||
from deluge.log import LOG as log
|
||||
|
||||
COMPONENT_STATE = [
|
||||
"Stopped",
|
||||
"Started",
|
||||
"Paused"
|
||||
]
|
||||
|
||||
class Component:
|
||||
def __init__(self, name, interval=1000, depend=None):
|
||||
# Register with the ComponentRegistry
|
||||
register(name, self, depend)
|
||||
self._interval = interval
|
||||
self._timer = None
|
||||
self._state = COMPONENT_STATE.index("Stopped")
|
||||
|
||||
def get_state(self):
|
||||
return self._state
|
||||
|
||||
def start(self):
|
||||
pass
|
||||
|
||||
def _start(self):
|
||||
self._state = COMPONENT_STATE.index("Started")
|
||||
if self._update():
|
||||
self._timer = gobject.timeout_add(self._interval, self._update)
|
||||
|
||||
def stop(self):
|
||||
pass
|
||||
|
||||
def _stop(self):
|
||||
self._state = COMPONENT_STATE.index("Stopped")
|
||||
try:
|
||||
gobject.source_remove(self._timer)
|
||||
except:
|
||||
pass
|
||||
|
||||
def _pause(self):
|
||||
self._state = COMPONENT_STATE.index("Paused")
|
||||
try:
|
||||
gobject.source_remove(self._timer)
|
||||
except:
|
||||
pass
|
||||
|
||||
def _resume(self):
|
||||
self._start()
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def _update(self):
|
||||
try:
|
||||
self.update()
|
||||
except AttributeError:
|
||||
# This will stop the timer since the component doesn't have an
|
||||
# update method.
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class ComponentRegistry:
|
||||
def __init__(self):
|
||||
self.components = {}
|
||||
self.depend = {}
|
||||
|
||||
def register(self, name, obj, depend):
|
||||
"""Registers a component.. depend must be list or None"""
|
||||
log.debug("Registered %s with ComponentRegistry..", name)
|
||||
self.components[name] = obj
|
||||
if depend != None:
|
||||
self.depend[name] = depend
|
||||
|
||||
def get(self, name):
|
||||
"""Returns a reference to the component 'name'"""
|
||||
return self.components[name]
|
||||
|
||||
def start(self):
|
||||
"""Starts all components"""
|
||||
for component in self.components.keys():
|
||||
self.start_component(component)
|
||||
|
||||
def start_component(self, name):
|
||||
"""Starts a component"""
|
||||
# Check to see if this component has any dependencies
|
||||
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"""
|
||||
for component in self.components.keys():
|
||||
self.stop_component(component)
|
||||
|
||||
def stop_component(self, component):
|
||||
if self.components[component].get_state() != \
|
||||
COMPONENT_STATE.index("Stopped"):
|
||||
log.debug("Stopping component %s..", component)
|
||||
self.components[component].stop()
|
||||
self.components[component]._stop()
|
||||
|
||||
def pause(self):
|
||||
"""Pauses all components. Stops calling update()"""
|
||||
for component in self.components.keys():
|
||||
self.pause_component(component)
|
||||
|
||||
def pause_component(self, component):
|
||||
if self.components[component].get_state() not in \
|
||||
[COMPONENT_STATE.index("Paused"), COMPONENT_STATE.index("Stopped")]:
|
||||
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(): %s", e)
|
||||
|
||||
|
||||
_ComponentRegistry = ComponentRegistry()
|
||||
|
||||
def register(name, obj, depend=None):
|
||||
"""Registers a component with the registry"""
|
||||
_ComponentRegistry.register(name, obj, depend)
|
||||
|
||||
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)
|
|
@ -0,0 +1,176 @@
|
|||
#
|
||||
# config.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
"""Configuration class used to access/create/modify configuration files."""
|
||||
|
||||
import cPickle
|
||||
import os.path
|
||||
|
||||
import gobject
|
||||
import deluge.common
|
||||
from deluge.log import LOG as log
|
||||
|
||||
class Config:
|
||||
"""This class is used to access configuration files."""
|
||||
|
||||
def __init__(self, filename, defaults=None, config_dir=None):
|
||||
log.debug("Config created with filename: %s", filename)
|
||||
log.debug("Config defaults: %s", defaults)
|
||||
self.config = {}
|
||||
self.previous_config = {}
|
||||
self.set_functions = {}
|
||||
self._change_callback = None
|
||||
|
||||
# If defaults is not None then we need to use "defaults".
|
||||
if defaults != None:
|
||||
self.config = defaults
|
||||
|
||||
# Load the config from file in the config_dir
|
||||
if config_dir == None:
|
||||
self.config_file = deluge.common.get_default_config_dir(filename)
|
||||
else:
|
||||
self.config_file = os.path.join(config_dir, filename)
|
||||
|
||||
self.load(self.config_file)
|
||||
# Save
|
||||
self.save()
|
||||
|
||||
def __del__(self):
|
||||
self.save()
|
||||
|
||||
def load(self, filename=None):
|
||||
"""Load a config file either by 'filename' or the filename set during
|
||||
construction of this object."""
|
||||
# Use self.config_file if filename is None
|
||||
if filename is None:
|
||||
filename = self.config_file
|
||||
try:
|
||||
# Un-pickle the file and update the config dictionary
|
||||
pkl_file = open(filename, "rb")
|
||||
filedump = cPickle.load(pkl_file)
|
||||
self.config.update(filedump)
|
||||
pkl_file.close()
|
||||
except IOError:
|
||||
log.warning("IOError: Unable to load file '%s'", filename)
|
||||
except EOFError:
|
||||
pkl_file.close()
|
||||
|
||||
def save(self, filename=None):
|
||||
"""Save configuration to either 'filename' or the filename set during
|
||||
construction of this object."""
|
||||
# Saves the config dictionary
|
||||
if filename is None:
|
||||
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:
|
||||
pkl_file = open(filename, "rb")
|
||||
filedump = cPickle.load(pkl_file)
|
||||
pkl_file.close()
|
||||
if filedump == self.config:
|
||||
# The config has not changed so lets just return
|
||||
return
|
||||
except (EOFError, IOError):
|
||||
log.warning("IOError: Unable to open file: '%s'", filename)
|
||||
|
||||
try:
|
||||
pkl_file = open(filename, "wb")
|
||||
cPickle.dump(self.config, pkl_file)
|
||||
pkl_file.close()
|
||||
except IOError:
|
||||
log.warning("IOError: Unable to save file '%s'", filename)
|
||||
|
||||
def set(self, key, value):
|
||||
"""Set the 'key' with 'value'."""
|
||||
# Sets the "key" with "value" in the config dict
|
||||
if self.config[key] != value:
|
||||
log.debug("Setting '%s' to %s of %s", key, value, type(value))
|
||||
# Make a copy of the current config prior to changing it
|
||||
self.previous_config = self.config.copy()
|
||||
self.config[key] = value
|
||||
# Run the set_function for this key if any
|
||||
try:
|
||||
gobject.idle_add(self.set_functions[key], key, value)
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
gobject.idle_add(self._change_callback, key, value)
|
||||
except:
|
||||
pass
|
||||
|
||||
def get(self, key):
|
||||
"""Get the value of 'key'. If it is an invalid key then get() will
|
||||
return None."""
|
||||
# Attempts to get the "key" value and returns None if the key is
|
||||
# invalid
|
||||
try:
|
||||
value = self.config[key]
|
||||
log.debug("Getting '%s' as %s of %s", key, value, type(value))
|
||||
return value
|
||||
except KeyError:
|
||||
log.warning("Key does not exist, returning None")
|
||||
return None
|
||||
|
||||
def get_config(self):
|
||||
"""Returns the entire configuration as a dictionary."""
|
||||
return self.config
|
||||
|
||||
def get_previous_config(self):
|
||||
"""Returns the config prior to the last set()"""
|
||||
return self.previous_config
|
||||
|
||||
def register_change_callback(self, callback):
|
||||
"""Registers a callback that will be called when a value is changed"""
|
||||
self._change_callback = callback
|
||||
|
||||
def register_set_function(self, key, function, apply_now=True):
|
||||
"""Register a function to be run when a config value changes."""
|
||||
log.debug("Registering function for %s key..", key)
|
||||
self.set_functions[key] = function
|
||||
# Run the function now if apply_now is set
|
||||
if apply_now:
|
||||
self.set_functions[key](key, self.config[key])
|
||||
return
|
||||
|
||||
def apply_all(self):
|
||||
"""Runs all set functions"""
|
||||
log.debug("Running all set functions..")
|
||||
for key in self.set_functions.keys():
|
||||
self.set_functions[key](key, self.config[key])
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.config[key]
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
self.set(key, value)
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
#
|
||||
# configmanager.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
import gobject
|
||||
import os
|
||||
import os.path
|
||||
|
||||
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 = deluge.common.get_default_config_dir()
|
||||
# Set a 5 minute timer to call save()
|
||||
gobject.timeout_add(300000, self.save)
|
||||
|
||||
def __del__(self):
|
||||
log.debug("ConfigManager stopping..")
|
||||
del self.config_files
|
||||
|
||||
def set_config_dir(self, directory):
|
||||
"""Sets the config directory"""
|
||||
if directory == None:
|
||||
return
|
||||
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.warning("Unable to make config directory: %s", e)
|
||||
|
||||
self.config_directory = directory
|
||||
|
||||
def get_config_dir(self):
|
||||
log.debug("get_config_dir: %s", self.config_directory)
|
||||
return self.config_directory
|
||||
|
||||
def close(self, config):
|
||||
"""Closes a config file."""
|
||||
try:
|
||||
del self.config_files[config]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
def save(self):
|
||||
"""Saves all the configs to disk."""
|
||||
for key in self.config_files.keys():
|
||||
self.config_files[key].save()
|
||||
# We need to return True to keep the timer active
|
||||
return True
|
||||
|
||||
def get_config(self, config_file, defaults=None):
|
||||
"""Get a reference to the Config object for this filename"""
|
||||
log.debug("Getting config '%s'", config_file)
|
||||
# Create the config object if not already created
|
||||
if config_file not in self.config_files.keys():
|
||||
self.config_files[config_file] = Config(config_file, defaults, self.config_directory)
|
||||
|
||||
return self.config_files[config_file]
|
||||
|
||||
# Singleton functions
|
||||
_configmanager = _ConfigManager()
|
||||
|
||||
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)
|
|
@ -0,0 +1,109 @@
|
|||
#
|
||||
# alertmanager.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
"""The AlertManager handles all the libtorrent alerts."""
|
||||
|
||||
import gobject
|
||||
|
||||
import deluge.component as component
|
||||
import deluge.libtorrent as lt
|
||||
from deluge.log import LOG as log
|
||||
|
||||
class AlertManager(component.Component):
|
||||
def __init__(self, session):
|
||||
log.debug("AlertManager initialized..")
|
||||
component.Component.__init__(self, "AlertManager", interval=50)
|
||||
self.session = 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)
|
||||
|
||||
# handlers is a dictionary of lists {"alert_type": [handler1,h2,..]}
|
||||
self.handlers = {}
|
||||
|
||||
def update(self):
|
||||
self.handle_alerts()
|
||||
|
||||
def shutdown(self):
|
||||
del self.session
|
||||
del self.handlers
|
||||
|
||||
def register_handler(self, alert_type, handler):
|
||||
"""Registers a function that will be called when 'alert_type' is pop'd
|
||||
in handle_alerts. The handler function should look like:
|
||||
handler(alert)
|
||||
Where 'alert' is the actual alert object from libtorrent
|
||||
"""
|
||||
if alert_type not in self.handlers.keys():
|
||||
# There is no entry for this alert type yet, so lets make it with an
|
||||
# empty list.
|
||||
self.handlers[alert_type] = []
|
||||
|
||||
# Append the handler to the list in the handlers dictionary
|
||||
self.handlers[alert_type].append(handler)
|
||||
log.debug("Registered handler for alert %s", alert_type)
|
||||
|
||||
def deregister_handler(self, handler):
|
||||
"""De-registers the 'handler' function from all alert types."""
|
||||
# Iterate through all handlers and remove 'handler' where found
|
||||
for (key, value) in self.handlers:
|
||||
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."""
|
||||
alert = self.session.pop_alert()
|
||||
while alert is not None:
|
||||
# Loop through all alerts in the queue
|
||||
# Do some magic to get the alert type as a string
|
||||
alert_type = str(type(alert)).split("'")[1].split(".")[2]
|
||||
# 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.keys():
|
||||
for handler in self.handlers[alert_type]:
|
||||
if not wait:
|
||||
gobject.idle_add(handler, alert)
|
||||
else:
|
||||
handler(alert)
|
||||
|
||||
alert = self.session.pop_alert()
|
||||
|
||||
# Return True so that the timer continues
|
||||
return True
|
|
@ -0,0 +1,125 @@
|
|||
#
|
||||
# autoadd.py
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
import os
|
||||
|
||||
import deluge.libtorrent as lt
|
||||
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=3000)
|
||||
# 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.exists(self.config["autoadd_location"]):
|
||||
log.warning("Invalid AutoAdd folder: %s", self.config["autoadd_location"])
|
||||
component.pause("AutoAdd")
|
||||
return
|
||||
|
||||
for filename in os.listdir(self.config["autoadd_location"]):
|
||||
if filename.split(".")[-1] == "torrent":
|
||||
filepath = os.path.join(self.config["autoadd_location"], filename)
|
||||
try:
|
||||
filedump = self.load_torrent(filepath)
|
||||
except 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()
|
||||
_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")
|
|
@ -0,0 +1,912 @@
|
|||
#
|
||||
# core.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
import gettext
|
||||
import locale
|
||||
import pkg_resources
|
||||
import sys
|
||||
import shutil
|
||||
import os
|
||||
import os.path
|
||||
import signal
|
||||
import deluge.SimpleXMLRPCServer as SimpleXMLRPCServer
|
||||
from SocketServer import ThreadingMixIn
|
||||
import deluge.xmlrpclib as xmlrpclib
|
||||
import gobject
|
||||
import threading
|
||||
import socket
|
||||
|
||||
import deluge.libtorrent as lt
|
||||
import deluge.configmanager
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
from deluge.core.torrentmanager import TorrentManager
|
||||
from deluge.core.pluginmanager import PluginManager
|
||||
from deluge.core.alertmanager import AlertManager
|
||||
from deluge.core.signalmanager import SignalManager
|
||||
from deluge.core.autoadd import AutoAdd
|
||||
from deluge.log import LOG as log
|
||||
|
||||
DEFAULT_PREFS = {
|
||||
"config_location": deluge.configmanager.get_config_dir(),
|
||||
"send_info": False,
|
||||
"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],
|
||||
"copy_torrent_file": False,
|
||||
"torrentfiles_location": os.path.join(deluge.common.get_default_download_dir(), "torrentfiles"),
|
||||
"plugins_location": os.path.join(deluge.configmanager.get_config_dir(), "plugins"),
|
||||
"state_location": os.path.join(deluge.configmanager.get_config_dir(), "state"),
|
||||
"prioritize_first_last_pieces": False,
|
||||
"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": -1,
|
||||
"max_upload_speed": -1.0,
|
||||
"max_download_speed": -1.0,
|
||||
"max_upload_slots_global": -1,
|
||||
"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,
|
||||
}
|
||||
|
||||
class Core(
|
||||
ThreadingMixIn,
|
||||
SimpleXMLRPCServer.SimpleXMLRPCServer,
|
||||
component.Component):
|
||||
def __init__(self, port):
|
||||
log.debug("Core init..")
|
||||
component.Component.__init__(self, "Core")
|
||||
self.client_address = None
|
||||
|
||||
# Get config
|
||||
self.config = deluge.configmanager.ConfigManager("core.conf", DEFAULT_PREFS)
|
||||
|
||||
if port == None:
|
||||
port = self.config["daemon_port"]
|
||||
|
||||
if self.config["allow_remote"]:
|
||||
hostname = ""
|
||||
else:
|
||||
hostname = "localhost"
|
||||
|
||||
# Setup the xmlrpc server
|
||||
try:
|
||||
log.info("Starting XMLRPC server on port %s", port)
|
||||
SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(
|
||||
self, (hostname, port), logRequests=False, allow_none=True)
|
||||
except:
|
||||
log.info("Daemon already running or port not available..")
|
||||
sys.exit(0)
|
||||
|
||||
self.register_multicall_functions()
|
||||
|
||||
# Register all export_* functions
|
||||
for func in dir(self):
|
||||
if func.startswith("export_"):
|
||||
self.register_function(getattr(self, "%s" % func), func[7:])
|
||||
|
||||
self.register_introspection_functions()
|
||||
|
||||
# Initialize gettext
|
||||
if deluge.common.windows_check():
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
else:
|
||||
locale.setlocale(locale.LC_MESSAGES, '')
|
||||
locale.bindtextdomain("deluge",
|
||||
pkg_resources.resource_filename(
|
||||
"deluge", "i18n"))
|
||||
locale.textdomain("deluge")
|
||||
|
||||
gettext.bindtextdomain("deluge",
|
||||
pkg_resources.resource_filename(
|
||||
"deluge", "i18n"))
|
||||
gettext.textdomain("deluge")
|
||||
gettext.install("deluge",
|
||||
pkg_resources.resource_filename(
|
||||
"deluge", "i18n"))
|
||||
# Setup signals
|
||||
try:
|
||||
import gnome.ui
|
||||
self.gnome_client = gnome.ui.Client()
|
||||
self.gnome_client.connect("die", self._shutdown)
|
||||
except:
|
||||
pass
|
||||
|
||||
signal.signal(signal.SIGINT, self._shutdown)
|
||||
signal.signal(signal.SIGTERM, self._shutdown)
|
||||
if not deluge.common.windows_check():
|
||||
signal.signal(signal.SIGHUP, self._shutdown)
|
||||
else:
|
||||
from win32api import SetConsoleCtrlHandler
|
||||
from win32con import CTRL_CLOSE_EVENT
|
||||
result = 0
|
||||
def win_handler(ctrl_type):
|
||||
if ctrl_type == CTRL_CLOSE_EVENT:
|
||||
self._shutdown()
|
||||
result = 1
|
||||
return result
|
||||
SetConsoleCtrlHandler(win_handler)
|
||||
|
||||
def get_request(self):
|
||||
"""Get the request and client address from the socket.
|
||||
We override this so that we can get the ip address of the client.
|
||||
"""
|
||||
request, client_address = self.socket.accept()
|
||||
self.client_address = client_address[0]
|
||||
return (request, client_address)
|
||||
|
||||
def run(self):
|
||||
"""Starts the core"""
|
||||
|
||||
# Create the client fingerprint
|
||||
version = []
|
||||
for value in deluge.common.get_version().split("."):
|
||||
version.append(int(value.split("-")[0]))
|
||||
while len(version) < 4:
|
||||
version.append(0)
|
||||
fingerprint = lt.fingerprint("DE", *version)
|
||||
|
||||
# Start the libtorrent session
|
||||
log.debug("Starting libtorrent session..")
|
||||
self.session = lt.session(fingerprint)
|
||||
|
||||
# Set the user agent
|
||||
self.settings = lt.session_settings()
|
||||
self.settings.user_agent = "Deluge %s" % deluge.common.get_version()
|
||||
|
||||
# Set lazy bitfield
|
||||
self.settings.lazy_bitfields = 1
|
||||
self.session.set_settings(self.settings)
|
||||
|
||||
# Load metadata extension
|
||||
self.session.add_extension(lt.create_metadata_plugin)
|
||||
|
||||
# Register set functions in the Config
|
||||
self.config.register_set_function("torrentfiles_location",
|
||||
self._on_set_torrentfiles_location)
|
||||
self.config.register_set_function("state_location",
|
||||
self._on_set_state_location)
|
||||
self.config.register_set_function("listen_ports",
|
||||
self._on_set_listen_ports)
|
||||
self.config.register_set_function("random_port",
|
||||
self._on_set_random_port)
|
||||
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("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.new_release = None
|
||||
self.new_release_timer = None
|
||||
self.config.register_set_function("new_release_check",
|
||||
self._on_new_release_check)
|
||||
|
||||
self.config.register_change_callback(self._on_config_value_change)
|
||||
# Start the AlertManager
|
||||
self.alerts = AlertManager(self.session)
|
||||
|
||||
# Start the SignalManager
|
||||
self.signals = SignalManager()
|
||||
|
||||
# Load plugins
|
||||
self.plugins = PluginManager(self)
|
||||
|
||||
# Start the TorrentManager
|
||||
self.torrents = TorrentManager(self.session, self.alerts)
|
||||
|
||||
# Create the AutoAdd component
|
||||
self.autoadd = AutoAdd()
|
||||
|
||||
component.start()
|
||||
|
||||
self._should_shutdown = False
|
||||
|
||||
self.listen_thread = threading.Thread(target=self.handle_thread)
|
||||
self.listen_thread.setDaemon(False)
|
||||
self.listen_thread.start()
|
||||
gobject.threads_init()
|
||||
|
||||
self.loop = gobject.MainLoop()
|
||||
try:
|
||||
self.loop.run()
|
||||
except KeyboardInterrupt:
|
||||
self._shutdown()
|
||||
|
||||
def handle_thread(self):
|
||||
try:
|
||||
while not self._should_shutdown:
|
||||
self.handle_request()
|
||||
self._should_shutdown = False
|
||||
|
||||
except Exception, e:
|
||||
log.debug("handle_thread: %s", e)
|
||||
|
||||
def _shutdown(self, *data):
|
||||
"""This is called by a thread from shutdown()"""
|
||||
log.info("Shutting down core..")
|
||||
self._should_shutdown = True
|
||||
# Shutdown the socket
|
||||
try:
|
||||
self.socket.shutdown(socket.SHUT_RDWR)
|
||||
except Exception, e:
|
||||
log.debug("exception in socket shutdown: %s", e)
|
||||
log.debug("Joining listen thread to make sure it shutdowns cleanly..")
|
||||
# Join the listen thread for a maximum of 1 second
|
||||
self.listen_thread.join(1.0)
|
||||
|
||||
# Start shutting down the components
|
||||
component.shutdown()
|
||||
|
||||
# Make sure the config file has been saved
|
||||
self.config.save()
|
||||
del self.config
|
||||
del deluge.configmanager
|
||||
del self.session
|
||||
self.loop.quit()
|
||||
try:
|
||||
self.gnome_client.disconnect()
|
||||
except:
|
||||
pass
|
||||
|
||||
# Exported Methods
|
||||
def export_ping(self):
|
||||
"""A method to see if the core is running"""
|
||||
return True
|
||||
|
||||
def export_shutdown(self):
|
||||
"""Shutdown the core"""
|
||||
# Make shutdown an async call
|
||||
gobject.idle_add(self._shutdown)
|
||||
|
||||
def export_register_client(self, port):
|
||||
"""Registers a client with the signal manager so that signals are
|
||||
sent to it."""
|
||||
self.signals.register_client(self.client_address, port)
|
||||
if self.config["new_release_check"]:
|
||||
self.check_new_release()
|
||||
|
||||
def export_deregister_client(self):
|
||||
"""De-registers a client with the signal manager."""
|
||||
self.signals.deregister_client(self.client_address)
|
||||
|
||||
def export_add_torrent_file(self, filename, filedump, options):
|
||||
"""Adds a torrent file to the libtorrent session
|
||||
This requires the torrents filename and a dump of it's content
|
||||
"""
|
||||
gobject.idle_add(self._add_torrent_file, filename, filedump, options)
|
||||
|
||||
def _add_torrent_file(self, filename, filedump, options):
|
||||
# Turn the filedump into a torrent_info
|
||||
if not isinstance(filedump, str):
|
||||
filedump = filedump.data
|
||||
|
||||
if len(filedump) == 0:
|
||||
log.warning("Torrent file is corrupt!")
|
||||
return
|
||||
|
||||
try:
|
||||
torrent_info = lt.torrent_info(lt.bdecode(filedump))
|
||||
except RuntimeError, e:
|
||||
log.warning("Unable to decode torrent file: %s", e)
|
||||
return None
|
||||
|
||||
torrent_id = self.torrents.add(filedump=filedump, options=options, filename=filename)
|
||||
|
||||
# Run the plugin hooks for 'post_torrent_add'
|
||||
self.plugins.run_post_torrent_add(torrent_id)
|
||||
|
||||
def export_add_torrent_url(self, url, save_path, options):
|
||||
log.info("Attempting to add url %s", url)
|
||||
|
||||
# Get the actual filename of the torrent from the url provided.
|
||||
filename = url.split("/")[-1]
|
||||
|
||||
# Get the .torrent file from the url
|
||||
torrent_file = deluge.common.fetch_url(url)
|
||||
if torrent_file is None:
|
||||
return False
|
||||
|
||||
# Dump the torrents file contents to a string
|
||||
try:
|
||||
filedump = open(torrent_file, "rb").read()
|
||||
except IOError:
|
||||
log.warning("Unable to open %s for reading.", torrent_file)
|
||||
return False
|
||||
|
||||
# Add the torrent to session
|
||||
return self.export_add_torrent_file(
|
||||
filename, filedump, options)
|
||||
|
||||
def export_remove_torrent(self, torrent_ids, remove_torrent, remove_data):
|
||||
log.debug("Removing torrent %s from the core.", torrent_ids)
|
||||
for torrent_id in torrent_ids:
|
||||
if self.torrents.remove(torrent_id, remove_torrent, remove_data):
|
||||
# Run the plugin hooks for 'post_torrent_remove'
|
||||
self.plugins.run_post_torrent_remove(torrent_id)
|
||||
# Emit the torrent_removed signal
|
||||
self.torrent_removed(torrent_id)
|
||||
|
||||
def export_force_reannounce(self, torrent_ids):
|
||||
log.debug("Forcing reannouncment to: %s", torrent_ids)
|
||||
for torrent_id in torrent_ids:
|
||||
self.torrents[torrent_id].force_reannounce()
|
||||
|
||||
def export_pause_torrent(self, torrent_ids):
|
||||
log.debug("Pausing: %s", torrent_ids)
|
||||
for torrent_id in torrent_ids:
|
||||
if not self.torrents[torrent_id].pause():
|
||||
log.warning("Error pausing torrent %s", torrent_id)
|
||||
|
||||
def export_move_storage(self, torrent_ids, dest):
|
||||
log.debug("Moving storage %s to %s", torrent_ids, dest)
|
||||
for torrent_id in torrent_ids:
|
||||
if not self.torrents[torrent_id].move_storage(dest):
|
||||
log.warning("Error moving torrent %s to %s", torrent_id, dest)
|
||||
|
||||
def export_pause_all_torrents(self):
|
||||
"""Pause all torrents in the session"""
|
||||
if not self.torrents.pause_all():
|
||||
log.warning("Error pausing all torrents..")
|
||||
|
||||
def export_resume_all_torrents(self):
|
||||
"""Resume all torrents in the session"""
|
||||
if self.torrents.resume_all():
|
||||
# Emit the 'torrent_all_resumed' signal
|
||||
self.torrent_all_resumed()
|
||||
|
||||
def export_resume_torrent(self, torrent_ids):
|
||||
log.debug("Resuming: %s", torrent_ids)
|
||||
for torrent_id in torrent_ids:
|
||||
if self.torrents[torrent_id].resume():
|
||||
self.torrent_resumed(torrent_id)
|
||||
|
||||
def export_get_torrent_status(self, torrent_id, keys):
|
||||
# Build the status dictionary
|
||||
try:
|
||||
status = self.torrents[torrent_id].get_status(keys)
|
||||
except KeyError:
|
||||
# The torrent_id is not found in the torrentmanager, so return None
|
||||
return None
|
||||
|
||||
# Get the leftover fields and ask the plugin manager to fill them
|
||||
leftover_fields = list(set(keys) - set(status.keys()))
|
||||
if len(leftover_fields) > 0:
|
||||
status.update(self.plugins.get_status(torrent_id, leftover_fields))
|
||||
return status
|
||||
|
||||
def export_get_torrents_status(self, torrent_ids, keys):
|
||||
status_dict = {}.fromkeys(torrent_ids)
|
||||
|
||||
# Get the torrent status for each torrent_id
|
||||
for torrent_id in torrent_ids:
|
||||
try:
|
||||
status = self.torrents[torrent_id].get_status(keys)
|
||||
except KeyError:
|
||||
return None
|
||||
# Get the leftover fields and ask the plugin manager to fill them
|
||||
leftover_fields = list(set(keys) - set(status.keys()))
|
||||
if len(leftover_fields) > 0:
|
||||
status.update(
|
||||
self.plugins.get_status(torrent_id, leftover_fields))
|
||||
|
||||
status_dict[torrent_id] = status
|
||||
# Emit the torrent_status signal to the clients
|
||||
return status_dict
|
||||
|
||||
def export_get_session_state(self):
|
||||
"""Returns a list of torrent_ids in the session."""
|
||||
# Get the torrent list from the TorrentManager
|
||||
return self.torrents.get_torrent_list()
|
||||
|
||||
def export_save_state(self):
|
||||
"""Save the current session state to file."""
|
||||
# Have the TorrentManager save it's state
|
||||
self.torrents.save_state()
|
||||
|
||||
def export_get_config(self):
|
||||
"""Get all the preferences as a dictionary"""
|
||||
return self.config.get_config()
|
||||
|
||||
def export_get_config_value(self, key):
|
||||
"""Get the config value for key"""
|
||||
try:
|
||||
value = self.config[key]
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
return value
|
||||
|
||||
def export_set_config(self, config):
|
||||
"""Set the config with values from dictionary"""
|
||||
config = deluge.common.pythonize(config)
|
||||
# Load all the values into the configuration
|
||||
for key in config.keys():
|
||||
self.config[key] = config[key]
|
||||
|
||||
def export_get_listen_port(self):
|
||||
"""Returns the active listen port"""
|
||||
return self.session.listen_port()
|
||||
|
||||
def export_get_num_connections(self):
|
||||
"""Returns the current number of connections"""
|
||||
return self.session.num_connections()
|
||||
|
||||
def export_get_dht_nodes(self):
|
||||
"""Returns the number of dht nodes"""
|
||||
return self.session.status().dht_nodes
|
||||
|
||||
def export_get_download_rate(self):
|
||||
"""Returns the payload download rate"""
|
||||
return self.session.status().payload_download_rate
|
||||
|
||||
def export_get_upload_rate(self):
|
||||
"""Returns the payload upload rate"""
|
||||
return self.session.status().payload_upload_rate
|
||||
|
||||
def export_get_available_plugins(self):
|
||||
"""Returns a list of plugins available in the core"""
|
||||
return self.plugins.get_available_plugins()
|
||||
|
||||
def export_get_enabled_plugins(self):
|
||||
"""Returns a list of enabled plugins in the core"""
|
||||
return self.plugins.get_enabled_plugins()
|
||||
|
||||
def export_enable_plugin(self, plugin):
|
||||
self.plugins.enable_plugin(plugin)
|
||||
return None
|
||||
|
||||
def export_disable_plugin(self, plugin):
|
||||
self.plugins.disable_plugin(plugin)
|
||||
return None
|
||||
|
||||
def export_force_recheck(self, torrent_ids):
|
||||
"""Forces a data recheck on torrent_ids"""
|
||||
for torrent_id in torrent_ids:
|
||||
self.torrents[torrent_id].force_recheck()
|
||||
|
||||
def export_set_torrent_trackers(self, torrent_id, trackers):
|
||||
"""Sets a torrents tracker list. trackers will be [{"url", "tier"}]"""
|
||||
return self.torrents[torrent_id].set_trackers(trackers)
|
||||
|
||||
def export_set_torrent_max_connections(self, torrent_id, value):
|
||||
"""Sets a torrents max number of connections"""
|
||||
return self.torrents[torrent_id].set_max_connections(value)
|
||||
|
||||
def export_set_torrent_max_upload_slots(self, torrent_id, value):
|
||||
"""Sets a torrents max number of upload slots"""
|
||||
return self.torrents[torrent_id].set_max_upload_slots(value)
|
||||
|
||||
def export_set_torrent_max_upload_speed(self, torrent_id, value):
|
||||
"""Sets a torrents max upload speed"""
|
||||
return self.torrents[torrent_id].set_max_upload_speed(value)
|
||||
|
||||
def export_set_torrent_max_download_speed(self, torrent_id, value):
|
||||
"""Sets a torrents max download speed"""
|
||||
return self.torrents[torrent_id].set_max_download_speed(value)
|
||||
|
||||
def export_set_torrent_file_priorities(self, torrent_id, priorities):
|
||||
"""Sets a torrents file priorities"""
|
||||
return self.torrents[torrent_id].set_file_priorities(priorities)
|
||||
|
||||
def export_set_torrent_prioritize_first_last(self, torrent_id, value):
|
||||
"""Sets a higher priority to the first and last pieces"""
|
||||
return self.torrents[torrent_id].set_prioritize_first_last(value)
|
||||
|
||||
def export_set_torrent_auto_managed(self, torrent_id, value):
|
||||
"""Sets the auto managed flag for queueing purposes"""
|
||||
return self.torrents[torrent_id].set_auto_managed(value)
|
||||
|
||||
def export_set_torrent_stop_at_ratio(self, torrent_id, value):
|
||||
"""Sets the torrent to stop at 'stop_ratio'"""
|
||||
return self.torrents[torrent_id].set_stop_at_ratio(value)
|
||||
|
||||
def export_set_torrent_stop_ratio(self, torrent_id, value):
|
||||
"""Sets the ratio when to stop a torrent if 'stop_at_ratio' is set"""
|
||||
return self.torrents[torrent_id].set_stop_ratio(value)
|
||||
|
||||
def export_set_torrent_remove_at_ratio(self, torrent_id, value):
|
||||
"""Sets the torrent to be removed at 'stop_ratio'"""
|
||||
return self.torrents[torrent_id].set_remove_at_ratio(value)
|
||||
|
||||
def export_block_ip_range(self, range):
|
||||
"""Block an ip range"""
|
||||
try:
|
||||
self.ip_filter.add_rule(range[0], range[1], 1)
|
||||
except AttributeError:
|
||||
self.export_reset_ip_filter()
|
||||
self.ip_filter.add_rule(range[0], range[1], 1)
|
||||
|
||||
def export_reset_ip_filter(self):
|
||||
"""Clears the ip filter"""
|
||||
self.ip_filter = lt.ip_filter()
|
||||
self.session.set_ip_filter(self.ip_filter)
|
||||
|
||||
def export_get_health(self):
|
||||
"""Returns True if we have established incoming connections"""
|
||||
return self.session.status().has_incoming_connections
|
||||
|
||||
## Queueing functions ##
|
||||
def export_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.torrents.queue_top(torrent_id):
|
||||
self._torrent_queue_changed()
|
||||
except KeyError:
|
||||
log.warning("torrent_id: %s does not exist in the queue", torrent_id)
|
||||
|
||||
def export_queue_up(self, torrent_ids):
|
||||
log.debug("Attempting to queue %s to up", torrent_ids)
|
||||
#torrent_ids must be sorted before moving.
|
||||
torrent_ids.sort(key = lambda id: self.torrents.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.torrents.queue_up(torrent_id):
|
||||
self._torrent_queue_changed()
|
||||
except KeyError:
|
||||
log.warning("torrent_id: %s does not exist in the queue", torrent_id)
|
||||
|
||||
def export_queue_down(self, torrent_ids):
|
||||
log.debug("Attempting to queue %s to down", torrent_ids)
|
||||
#torrent_ids must be sorted before moving.
|
||||
torrent_ids.sort(key = lambda id: -self.torrents.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.torrents.queue_down(torrent_id):
|
||||
self._torrent_queue_changed()
|
||||
except KeyError:
|
||||
log.warning("torrent_id: %s does not exist in the queue", torrent_id)
|
||||
|
||||
def export_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.torrents.queue_bottom(torrent_id):
|
||||
self._torrent_queue_changed()
|
||||
except KeyError:
|
||||
log.warning("torrent_id: %s does not exist in the queue", torrent_id)
|
||||
|
||||
# Signals
|
||||
def torrent_removed(self, torrent_id):
|
||||
"""Emitted when a torrent has been removed from the core"""
|
||||
log.debug("torrent_remove signal emitted")
|
||||
self.signals.emit("torrent_removed", torrent_id)
|
||||
|
||||
def torrent_paused(self, torrent_id):
|
||||
"""Emitted when a torrent is paused"""
|
||||
log.debug("torrent_paused signal emitted")
|
||||
self.signals.emit("torrent_paused", torrent_id)
|
||||
|
||||
def torrent_resumed(self, torrent_id):
|
||||
"""Emitted when a torrent is resumed"""
|
||||
log.debug("torrent_resumed signal emitted")
|
||||
self.signals.emit("torrent_resumed", torrent_id)
|
||||
|
||||
def torrent_all_paused(self):
|
||||
"""Emitted when all torrents have been paused"""
|
||||
log.debug("torrent_all_paused signal emitted")
|
||||
self.signals.emit("torrent_all_paused")
|
||||
|
||||
def torrent_all_resumed(self):
|
||||
"""Emitted when all torrents have been resumed"""
|
||||
log.debug("torrent_all_resumed signal emitted")
|
||||
self.signals.emit("torrent_all_resumed")
|
||||
|
||||
def config_value_changed(self, key, value):
|
||||
"""Emitted when a config value has changed"""
|
||||
log.debug("config_value_changed signal emitted")
|
||||
self.signals.emit("config_value_changed", key, value)
|
||||
|
||||
def _torrent_queue_changed(self):
|
||||
"""Emitted when a torrent queue position is changed"""
|
||||
log.debug("torrent_queue_changed signal emitted")
|
||||
self.signals.emit("torrent_queue_changed")
|
||||
|
||||
# Config set functions
|
||||
def _on_config_value_change(self, key, value):
|
||||
self.config_value_changed(key, value)
|
||||
|
||||
def _on_set_torrentfiles_location(self, key, value):
|
||||
# First try to create the new directory
|
||||
try:
|
||||
os.makedirs(value)
|
||||
except Exception, e:
|
||||
log.debug("Unable to make directory: %s", e)
|
||||
|
||||
def _on_set_state_location(self, key, value):
|
||||
if not os.access(value, os.F_OK):
|
||||
try:
|
||||
os.makedirs(value)
|
||||
except Exception, e:
|
||||
log.debug("Unable to make directory: %s", e)
|
||||
|
||||
def _on_set_listen_ports(self, key, value):
|
||||
# Only set the listen ports if random_port is not true
|
||||
if self.config["random_port"] is not True:
|
||||
log.debug("listen port range set to %s-%s", value[0], value[1])
|
||||
self.session.listen_on(value[0], value[1])
|
||||
|
||||
def _on_set_random_port(self, key, value):
|
||||
log.debug("random port value set to %s", value)
|
||||
# We need to check if the value has been changed to true and false
|
||||
# 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])
|
||||
|
||||
def _on_set_dht(self, key, value):
|
||||
log.debug("dht value set to %s", value)
|
||||
if value:
|
||||
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.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
|
||||
self.session.set_upload_rate_limit(int(value * 1024))
|
||||
|
||||
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
|
||||
self.session.set_download_rate_limit(int(value * 1024))
|
||||
|
||||
def _on_set_max_upload_slots_global(self, key, value):
|
||||
log.debug("max_upload_slots_global set to %s..", value)
|
||||
self.session.set_max_uploads(value)
|
||||
|
||||
def _on_set_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
|
||||
import urllib
|
||||
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=" + urllib.quote_plus(self.config["enabled_plugins"])
|
||||
urllib.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 get_new_release(self):
|
||||
log.debug("get_new_release")
|
||||
import urllib
|
||||
try:
|
||||
self.new_release = urllib.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 self.new_release > deluge.common.get_version():
|
||||
self.signals.emit("new_version_available", self.new_release)
|
||||
return self.new_release
|
||||
return False
|
||||
|
||||
def _on_new_release_check(self, key, value):
|
||||
if value:
|
||||
log.debug("Checking for new release..")
|
||||
threading.Thread(target=self.get_new_release).start()
|
||||
if self.new_release_timer:
|
||||
gobject.source_remove(self.new_release_timer)
|
||||
# Set a timer to check for a new release every 3 days
|
||||
self.new_release_timer = gobject.timeout_add(
|
||||
72 * 60 * 60 * 1000, self._on_new_release_check, "new_release_check", True)
|
||||
else:
|
||||
if self.new_release_timer:
|
||||
gobject.source.remove(self.new_release_timer)
|
|
@ -0,0 +1,53 @@
|
|||
#
|
||||
# daemon.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
import deluge.configmanager
|
||||
import deluge.common
|
||||
from deluge.log import LOG as log
|
||||
|
||||
class Daemon:
|
||||
def __init__(self, options, args):
|
||||
version = deluge.common.get_version()
|
||||
if deluge.common.get_revision() != "":
|
||||
version = version + "r" + deluge.common.get_revision()
|
||||
|
||||
log.info("Deluge daemon %s", version)
|
||||
log.debug("options: %s", options)
|
||||
log.debug("args: %s", args)
|
||||
# Set the config directory
|
||||
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(options.port).run()
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
#
|
||||
# pluginmanager.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option)
|
||||
# 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"""
|
||||
|
||||
import gobject
|
||||
|
||||
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, "PluginManager")
|
||||
self.core = core
|
||||
# Set up the hooks dictionary
|
||||
self.hooks = {
|
||||
"post_torrent_add": [],
|
||||
"post_torrent_remove": [],
|
||||
"post_session_load": []
|
||||
}
|
||||
|
||||
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()
|
||||
|
||||
# Set update timer to call update() in plugins every second
|
||||
self.update_timer = gobject.timeout_add(1000, self.update_plugins)
|
||||
|
||||
def stop(self):
|
||||
# Disable all enabled plugins
|
||||
self.disable_plugins()
|
||||
# Stop the update timer
|
||||
gobject.source_remove(self.update_timer)
|
||||
|
||||
def shutdown(self):
|
||||
self.stop()
|
||||
|
||||
def update_plugins(self):
|
||||
for plugin in self.plugins.keys():
|
||||
try:
|
||||
self.plugins[plugin].update()
|
||||
except AttributeError:
|
||||
# We don't care if this doesn't work
|
||||
pass
|
||||
|
||||
def get_core(self):
|
||||
"""Returns a reference to the core"""
|
||||
return self.core
|
||||
|
||||
def register_status_field(self, field, function):
|
||||
"""Register a new status field. This can be used in the same way the
|
||||
client requests other status information from core."""
|
||||
log.debug("Registering status field %s with PluginManager", field)
|
||||
self.status_fields[field] = function
|
||||
|
||||
def deregister_status_field(self, field):
|
||||
"""Deregisters a status field"""
|
||||
log.debug("Deregistering status field %s with PluginManager", field)
|
||||
try:
|
||||
del self.status_fields[field]
|
||||
except:
|
||||
log.warning("Unable to deregister status field %s", field)
|
||||
|
||||
def get_status(self, torrent_id, fields):
|
||||
"""Return the value of status fields for the selected torrent_id."""
|
||||
status = {}
|
||||
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_hook(self, hook, function):
|
||||
"""Register a hook function with the plugin manager"""
|
||||
try:
|
||||
self.hooks[hook].append(function)
|
||||
except KeyError:
|
||||
log.warning("Plugin attempting to register invalid hook.")
|
||||
|
||||
def deregister_hook(self, hook, function):
|
||||
"""Deregisters a hook function"""
|
||||
try:
|
||||
self.hooks[hook].remove(function)
|
||||
except:
|
||||
log.warning("Unable to deregister hook %s", hook)
|
||||
|
||||
def run_post_torrent_add(self, torrent_id):
|
||||
"""This hook is run after a torrent has been added to the session."""
|
||||
log.debug("run_post_torrent_add")
|
||||
for function in self.hooks["post_torrent_add"]:
|
||||
function(torrent_id)
|
||||
|
||||
def run_post_torrent_remove(self, torrent_id):
|
||||
"""This hook is run after a torrent has been removed from the session.
|
||||
"""
|
||||
log.debug("run_post_torrent_remove")
|
||||
for function in self.hooks["post_torrent_remove"]:
|
||||
function(torrent_id)
|
||||
|
||||
def run_post_session_load(self):
|
||||
"""This hook is run after all the torrents have been loaded into the
|
||||
session from the saved state. It is called prior to resuming the
|
||||
torrents and they all will have a 'Paused' state."""
|
||||
log.debug("run_post_session_load")
|
||||
for function in self.hooks["post_session_load"]:
|
||||
function()
|
||||
|
||||
def get_torrent_list(self):
|
||||
"""Returns a list of torrent_id's in the current session."""
|
||||
return component.get("TorrentManager").get_torrent_list()
|
||||
|
||||
def block_ip_range(self, range):
|
||||
"""Blocks the ip range in the core"""
|
||||
return self.core.export_block_ip_range(range)
|
||||
|
||||
def reset_ip_filter(self):
|
||||
"""Resets the ip filter"""
|
||||
return self.core.export_reset_ip_filter()
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
#
|
||||
# signalmanager.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
import deluge.xmlrpclib as xmlrpclib
|
||||
import socket
|
||||
|
||||
import gobject
|
||||
|
||||
import deluge.component as component
|
||||
from deluge.log import LOG as log
|
||||
|
||||
class SignalManager(component.Component):
|
||||
def __init__(self):
|
||||
component.Component.__init__(self, "SignalManager")
|
||||
self.clients = {}
|
||||
|
||||
def shutdown(self):
|
||||
self.clients = {}
|
||||
|
||||
def deregister_client(self, address):
|
||||
"""Deregisters a client"""
|
||||
log.debug("Deregistering %s as a signal reciever..", address)
|
||||
for client in self.clients.keys():
|
||||
if client.split("//")[1].split(":")[0] == address:
|
||||
del self.clients[client]
|
||||
break
|
||||
|
||||
def register_client(self, address, port):
|
||||
"""Registers a client to emit signals to."""
|
||||
uri = "http://" + str(address) + ":" + str(port)
|
||||
log.debug("Registering %s as a signal reciever..", uri)
|
||||
self.clients[uri] = xmlrpclib.ServerProxy(uri)
|
||||
|
||||
def emit(self, signal, *data):
|
||||
for uri in self.clients:
|
||||
gobject.idle_add(self._emit, uri, signal, 1, *data)
|
||||
|
||||
def _emit(self, uri, signal, count, *data):
|
||||
if uri not in self.clients:
|
||||
return
|
||||
client = self.clients[uri]
|
||||
try:
|
||||
client.emit_signal(signal, *data)
|
||||
except (socket.error, Exception), e:
|
||||
log.warning("Unable to emit signal to client %s: %s (%d)", client, e, count)
|
||||
if count < 30:
|
||||
gobject.timeout_add(1000, self._emit, uri, signal, count + 1, *data)
|
||||
else:
|
||||
log.info("Removing %s because it couldn't be reached..", uri)
|
||||
del self.clients[uri]
|
||||
|
|
@ -0,0 +1,586 @@
|
|||
#
|
||||
# torrent.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
"""Internal Torrent class"""
|
||||
|
||||
import os
|
||||
|
||||
import deluge.libtorrent as lt
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
from deluge.configmanager import ConfigManager
|
||||
from deluge.log import LOG as log
|
||||
import deluge.xmlrpclib
|
||||
|
||||
TORRENT_STATE = deluge.common.TORRENT_STATE
|
||||
|
||||
class Torrent:
|
||||
"""Torrent holds information about torrents added to the libtorrent session.
|
||||
"""
|
||||
def __init__(self, handle, options, state=None, filename=None):
|
||||
log.debug("Creating torrent object %s", str(handle.info_hash()))
|
||||
# Get the core config
|
||||
self.config = ConfigManager("core.conf")
|
||||
|
||||
self.signals = component.get("SignalManager")
|
||||
|
||||
# Set the libtorrent handle
|
||||
self.handle = handle
|
||||
# Set the torrent_id for this torrent
|
||||
self.torrent_id = str(handle.info_hash())
|
||||
|
||||
# We store the filename just in case we need to make a copy of the torrentfile
|
||||
self.filename = filename
|
||||
|
||||
# Holds status info so that we don't need to keep getting it from lt
|
||||
self.status = self.handle.status()
|
||||
self.torrent_info = self.handle.get_torrent_info()
|
||||
|
||||
# Files dictionary
|
||||
self.files = self.get_files()
|
||||
# Set the default file priorities to normal
|
||||
self.file_priorities = [1]* len(self.files)
|
||||
|
||||
# Default total_uploaded to 0, this may be changed by the state
|
||||
self.total_uploaded = 0
|
||||
|
||||
# Set default auto_managed value
|
||||
self.auto_managed = options["auto_managed"]
|
||||
if not handle.is_paused():
|
||||
handle.auto_managed(self.auto_managed)
|
||||
|
||||
# We need to keep track if the torrent is finished in the state to prevent
|
||||
# some weird things on state load.
|
||||
self.is_finished = False
|
||||
|
||||
# Queueing options
|
||||
self.stop_at_ratio = False
|
||||
self.stop_ratio = 2.00
|
||||
self.remove_at_ratio = False
|
||||
|
||||
# Load values from state if we have it
|
||||
if state is not None:
|
||||
# This is for saving the total uploaded between sessions
|
||||
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
|
||||
# Set the per-torrent queue options
|
||||
self.set_stop_at_ratio(state.stop_at_ratio)
|
||||
self.set_stop_ratio(state.stop_ratio)
|
||||
self.set_remove_at_ratio(state.remove_at_ratio)
|
||||
else:
|
||||
# Tracker list
|
||||
self.trackers = []
|
||||
# Create a list of trackers
|
||||
for value in self.handle.trackers():
|
||||
tracker = {}
|
||||
tracker["url"] = value.url
|
||||
tracker["tier"] = value.tier
|
||||
self.trackers.append(tracker)
|
||||
|
||||
# Various torrent options
|
||||
self.set_max_connections(options["max_connections_per_torrent"])
|
||||
self.set_max_upload_slots(options["max_upload_slots_per_torrent"])
|
||||
self.set_max_upload_speed(options["max_upload_speed_per_torrent"])
|
||||
self.set_max_download_speed(options["max_download_speed_per_torrent"])
|
||||
self.set_prioritize_first_last(options["prioritize_first_last_pieces"])
|
||||
self.handle.resolve_countries(True)
|
||||
if options.has_key("file_priorities"):
|
||||
self.set_file_priorities(options["file_priorities"])
|
||||
|
||||
# Set the allocation mode
|
||||
self.compact = options["compact_allocation"]
|
||||
# Where the torrent is being saved to
|
||||
self.save_path = options["download_location"]
|
||||
# Status message holds error info about the torrent
|
||||
self.statusmsg = "OK"
|
||||
|
||||
# The torrents state
|
||||
self.update_state()
|
||||
|
||||
# The tracker status
|
||||
self.tracker_status = ""
|
||||
|
||||
log.debug("Torrent object created.")
|
||||
|
||||
def set_tracker_status(self, status):
|
||||
"""Sets the tracker status"""
|
||||
self.tracker_status = status
|
||||
|
||||
def set_max_connections(self, max_connections):
|
||||
self.max_connections = int(max_connections)
|
||||
self.handle.set_max_connections(self.max_connections)
|
||||
|
||||
def set_max_upload_slots(self, max_slots):
|
||||
self.max_upload_slots = int(max_slots)
|
||||
self.handle.set_max_uploads(self.max_upload_slots)
|
||||
|
||||
def set_max_upload_speed(self, m_up_speed):
|
||||
self.max_upload_speed = m_up_speed
|
||||
self.handle.set_upload_limit(int(m_up_speed * 1024))
|
||||
|
||||
def set_max_download_speed(self, m_down_speed):
|
||||
self.max_download_speed = m_down_speed
|
||||
self.handle.set_download_limit(int(m_down_speed * 1024))
|
||||
|
||||
def set_prioritize_first_last(self, prioritize):
|
||||
self.prioritize_first_last = prioritize
|
||||
if self.prioritize_first_last:
|
||||
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_save_path(self, save_path):
|
||||
self.save_path = save_path
|
||||
|
||||
def set_auto_managed(self, auto_managed):
|
||||
self.auto_managed = auto_managed
|
||||
self.handle.auto_managed(auto_managed)
|
||||
self.update_state()
|
||||
|
||||
def set_stop_ratio(self, stop_ratio):
|
||||
self.stop_ratio = stop_ratio
|
||||
|
||||
def set_stop_at_ratio(self, stop_at_ratio):
|
||||
self.stop_at_ratio = stop_at_ratio
|
||||
|
||||
def set_remove_at_ratio(self, remove_at_ratio):
|
||||
self.remove_at_ratio = remove_at_ratio
|
||||
|
||||
def set_file_priorities(self, file_priorities):
|
||||
log.debug("setting %s's file priorities: %s", self.torrent_id, file_priorities)
|
||||
if len(file_priorities) != len(self.files):
|
||||
log.debug("file_priorities len != num_files")
|
||||
return
|
||||
|
||||
self.handle.prioritize_files(file_priorities)
|
||||
|
||||
if 0 in self.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.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.file_priorities = file_priorities
|
||||
|
||||
# Set the first/last priorities if needed
|
||||
self.set_prioritize_first_last(self.prioritize_first_last)
|
||||
|
||||
def set_trackers(self, trackers):
|
||||
"""Sets trackers"""
|
||||
if trackers == None:
|
||||
trackers = []
|
||||
|
||||
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()
|
||||
|
||||
def update_state(self):
|
||||
"""Updates the state based on what libtorrent's state for the torrent is"""
|
||||
# Set the initial state based on the lt state
|
||||
LTSTATE = deluge.common.LT_TORRENT_STATE
|
||||
ltstate = int(self.handle.status().state)
|
||||
|
||||
log.debug("set_state_based_on_ltstate: %s", ltstate)
|
||||
|
||||
if ltstate == LTSTATE["Queued"] or ltstate == LTSTATE["Checking"]:
|
||||
self.state = "Checking"
|
||||
return
|
||||
elif ltstate == LTSTATE["Connecting"] or ltstate == LTSTATE["Downloading"] or\
|
||||
ltstate == LTSTATE["Downloading Metadata"]:
|
||||
self.state = "Downloading"
|
||||
elif ltstate == LTSTATE["Finished"] or ltstate == LTSTATE["Seeding"]:
|
||||
self.state = "Seeding"
|
||||
elif ltstate == LTSTATE["Allocating"]:
|
||||
self.state = "Allocating"
|
||||
|
||||
if self.handle.is_paused() and len(self.handle.status().error) > 0:
|
||||
# This is an error'd torrent
|
||||
self.state = "Error"
|
||||
self.set_status_message(self.handle.status().error)
|
||||
self.handle.auto_managed(False)
|
||||
elif self.handle.is_paused() and self.handle.is_auto_managed():
|
||||
self.state = "Queued"
|
||||
elif self.handle.is_paused() and not self.handle.is_auto_managed():
|
||||
self.state = "Paused"
|
||||
|
||||
def set_state(self, state):
|
||||
"""Accepts state strings, ie, "Paused", "Seeding", etc."""
|
||||
if state not in TORRENT_STATE:
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
up = self.total_uploaded + status.total_payload_upload
|
||||
down = status.total_done
|
||||
|
||||
# Convert 'up' and 'down' to floats for proper calculation
|
||||
up = float(up)
|
||||
down = float(down)
|
||||
|
||||
try:
|
||||
ratio = up / down
|
||||
except ZeroDivisionError:
|
||||
return 0.0
|
||||
|
||||
return ratio
|
||||
|
||||
def get_files(self):
|
||||
"""Returns a list of files this torrent contains"""
|
||||
if self.torrent_info == None:
|
||||
torrent_info = self.handle.get_torrent_info()
|
||||
else:
|
||||
torrent_info = self.torrent_info
|
||||
|
||||
ret = []
|
||||
files = torrent_info.files()
|
||||
for index, file in enumerate(files):
|
||||
ret.append({
|
||||
'index': index,
|
||||
'path': file.path,
|
||||
'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({
|
||||
"ip": "%s:%s" % (peer.ip[0], peer.ip[1]),
|
||||
"up_speed": peer.up_speed,
|
||||
"down_speed": peer.down_speed,
|
||||
"country": country,
|
||||
"client": client,
|
||||
"seed": peer.flags & peer.seed
|
||||
})
|
||||
|
||||
return ret
|
||||
|
||||
def get_queue_position(self):
|
||||
"""Returns the torrents queue position"""
|
||||
return self.handle.queue_position()
|
||||
|
||||
def get_status(self, keys):
|
||||
"""Returns the status of the torrent based on the keys provided"""
|
||||
# Create the full dictionary
|
||||
self.status = self.handle.status()
|
||||
self.torrent_info = self.handle.get_torrent_info()
|
||||
|
||||
# Adjust progress to be 0-100 value
|
||||
progress = self.status.progress * 100
|
||||
|
||||
# Adjust status.distributed_copies to return a non-negative value
|
||||
distributed_copies = self.status.distributed_copies
|
||||
if distributed_copies < 0:
|
||||
distributed_copies = 0.0
|
||||
|
||||
full_status = {
|
||||
"distributed_copies": distributed_copies,
|
||||
"total_done": self.status.total_done,
|
||||
"total_uploaded": self.total_uploaded + self.status.total_payload_upload,
|
||||
"state": self.state,
|
||||
"paused": self.status.paused,
|
||||
"progress": progress,
|
||||
"next_announce": self.status.next_announce.seconds,
|
||||
"total_payload_download": self.status.total_payload_download,
|
||||
"total_payload_upload": self.status.total_payload_upload,
|
||||
"download_payload_rate": self.status.download_payload_rate,
|
||||
"upload_payload_rate": self.status.upload_payload_rate,
|
||||
"num_peers": self.status.num_peers - self.status.num_seeds,
|
||||
"num_seeds": self.status.num_seeds,
|
||||
"total_peers": self.status.num_incomplete,
|
||||
"total_seeds": self.status.num_complete,
|
||||
"total_wanted": self.status.total_wanted,
|
||||
"tracker": self.status.current_tracker,
|
||||
"trackers": self.trackers,
|
||||
"tracker_status": self.tracker_status,
|
||||
"save_path": self.save_path,
|
||||
"files": self.files,
|
||||
"file_priorities": self.file_priorities,
|
||||
"compact": self.compact,
|
||||
"max_connections": self.max_connections,
|
||||
"max_upload_slots": self.max_upload_slots,
|
||||
"max_upload_speed": self.max_upload_speed,
|
||||
"max_download_speed": self.max_download_speed,
|
||||
"prioritize_first_last": self.prioritize_first_last,
|
||||
"message": self.statusmsg,
|
||||
"hash": self.torrent_id,
|
||||
"active_time": self.status.active_time,
|
||||
"seeding_time": self.status.seeding_time,
|
||||
"seed_rank": self.status.seed_rank,
|
||||
"is_auto_managed": self.auto_managed,
|
||||
"stop_ratio": self.stop_ratio,
|
||||
"stop_at_ratio": self.stop_at_ratio,
|
||||
"remove_at_ratio": self.remove_at_ratio
|
||||
}
|
||||
|
||||
fns = {
|
||||
"name": self.torrent_info.name,
|
||||
"private": self.torrent_info.priv,
|
||||
"total_size": self.torrent_info.total_size,
|
||||
"num_files": self.torrent_info.num_files,
|
||||
"num_pieces": self.torrent_info.num_pieces,
|
||||
"piece_length": self.torrent_info.piece_length,
|
||||
"eta": self.get_eta,
|
||||
"ratio": self.get_ratio,
|
||||
"file_progress": self.handle.file_progress,
|
||||
"queue": self.handle.queue_position,
|
||||
"is_seed": self.handle.is_seed,
|
||||
"peers": self.get_peers,
|
||||
}
|
||||
|
||||
self.status = None
|
||||
self.torrent_info = None
|
||||
|
||||
# Create the desired status dictionary and return it
|
||||
status_dict = {}
|
||||
|
||||
if len(keys) == 0:
|
||||
status_dict = full_status
|
||||
for key in fns:
|
||||
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()
|
||||
self.signals.emit("torrent_paused", self.torrent_id)
|
||||
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"]:
|
||||
if self.get_ratio() >= self.config["stop_seed_ratio"]:
|
||||
self.signals.emit("torrent_resume_at_stop_ratio")
|
||||
return
|
||||
|
||||
if self.auto_managed:
|
||||
# This torrent is to be auto-managed by lt queueing
|
||||
self.handle.auto_managed(True)
|
||||
|
||||
try:
|
||||
self.handle.resume()
|
||||
except:
|
||||
pass
|
||||
|
||||
return True
|
||||
|
||||
def move_storage(self, dest):
|
||||
"""Move a torrent's storage location"""
|
||||
try:
|
||||
self.handle.move_storage(dest)
|
||||
except:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def write_fastresume(self):
|
||||
"""Writes the .fastresume file for the torrent"""
|
||||
resume_data = lt.bencode(self.handle.write_resume_data())
|
||||
path = "%s/%s.fastresume" % (
|
||||
self.config["state_location"],
|
||||
self.torrent_id)
|
||||
log.debug("Saving fastresume file: %s", path)
|
||||
try:
|
||||
fastresume = open(path, "wb")
|
||||
fastresume.write(resume_data)
|
||||
fastresume.close()
|
||||
except IOError:
|
||||
log.warning("Error trying to save fastresume file")
|
||||
|
||||
def delete_fastresume(self):
|
||||
"""Deletes the .fastresume file"""
|
||||
path = "%s/%s.fastresume" % (
|
||||
self.config["state_location"],
|
||||
self.torrent_id)
|
||||
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 delete_torrentfile(self):
|
||||
"""Deletes the .torrent file in the state"""
|
||||
path = "%s/%s.torrent" % (
|
||||
self.config["state_location"],
|
||||
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()
|
||||
except Exception, e:
|
||||
log.debug("Unable to force recheck: %s", e)
|
||||
return False
|
||||
return True
|
|
@ -0,0 +1,716 @@
|
|||
#
|
||||
# torrentmanager.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option)
|
||||
# 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.path
|
||||
import os
|
||||
import time
|
||||
|
||||
import gobject
|
||||
|
||||
import deluge.libtorrent as lt
|
||||
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
from deluge.configmanager import ConfigManager
|
||||
from deluge.core.torrent import Torrent
|
||||
|
||||
from deluge.log import LOG as log
|
||||
|
||||
class TorrentState:
|
||||
def __init__(self,
|
||||
torrent_id=None,
|
||||
filename=None,
|
||||
total_uploaded=None,
|
||||
trackers=None,
|
||||
compact=None,
|
||||
paused=None,
|
||||
save_path=None,
|
||||
max_connections=None,
|
||||
max_upload_slots=None,
|
||||
max_upload_speed=None,
|
||||
max_download_speed=None,
|
||||
prioritize_first_last=None,
|
||||
file_priorities=None,
|
||||
queue=None,
|
||||
auto_managed=None,
|
||||
is_finished=False,
|
||||
stop_ratio=2.00,
|
||||
stop_at_ratio=False,
|
||||
remove_at_ratio=True
|
||||
):
|
||||
self.torrent_id = torrent_id
|
||||
self.filename = filename
|
||||
self.total_uploaded = total_uploaded
|
||||
self.trackers = trackers
|
||||
self.queue = queue
|
||||
self.is_finished = is_finished
|
||||
|
||||
# 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
|
||||
|
||||
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, session, alerts):
|
||||
component.Component.__init__(self, "TorrentManager", interval=5000, depend=["PluginManager"])
|
||||
log.debug("TorrentManager init..")
|
||||
# Set the libtorrent session
|
||||
self.session = session
|
||||
# Set the alertmanager
|
||||
self.alerts = alerts
|
||||
# Get the core config
|
||||
self.config = ConfigManager("core.conf")
|
||||
|
||||
# Create the torrents dict { torrent_id: Torrent }
|
||||
self.torrents = {}
|
||||
|
||||
# This is a list of torrent_id when we shutdown the torrentmanager.
|
||||
# We use this list to determine if all active torrents have been paused
|
||||
# and that their resume data has been written.
|
||||
self.shutdown_torrent_pause_list = []
|
||||
|
||||
# Register set functions
|
||||
self.config.register_set_function("max_connections_per_torrent",
|
||||
self.on_set_max_connections_per_torrent)
|
||||
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_alert", self.on_alert_tracker)
|
||||
self.alerts.register_handler("tracker_warning_alert",
|
||||
self.on_alert_tracker_warning)
|
||||
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)
|
||||
|
||||
def start(self):
|
||||
# Get the pluginmanager reference
|
||||
self.plugins = component.get("PluginManager")
|
||||
|
||||
self.signals = component.get("SignalManager")
|
||||
|
||||
# Try to load the state from file
|
||||
self.load_state()
|
||||
|
||||
# Save the state every 5 minutes
|
||||
self.save_state_timer = gobject.timeout_add(300000, self.save_state)
|
||||
|
||||
def stop(self):
|
||||
# Save state on shutdown
|
||||
self.save_state()
|
||||
|
||||
component.pause("AlertManager")
|
||||
for key in self.torrents.keys():
|
||||
if not self.torrents[key].handle.is_paused():
|
||||
# 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)
|
||||
while self.shutdown_torrent_pause_list:
|
||||
time.sleep(0.1)
|
||||
# Wait for all alerts
|
||||
self.alerts.handle_alerts(True)
|
||||
|
||||
def update(self):
|
||||
for torrent in self.torrents:
|
||||
if self.config["stop_seed_at_ratio"] or torrent.stop_at_ratio:
|
||||
if (torrent.get_ratio() >= self.config["stop_seed_ratio"] or\
|
||||
torrent.get_ratio() > torrent.stop_ratio) and torrent.is_finished:
|
||||
torrent.pause()
|
||||
if self.config["remove_seed_at_ratio"] or torrent.remove_at_ratio:
|
||||
self.remove(torrent.torrent_id)
|
||||
|
||||
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 get_resume_data_from_file(self, torrent_id):
|
||||
"""Returns an entry with the resume data or None"""
|
||||
fastresume = None
|
||||
try:
|
||||
_file = open(
|
||||
os.path.join(
|
||||
self.config["state_location"],
|
||||
torrent_id + ".fastresume"),
|
||||
"rb")
|
||||
fastresume = _file.read()
|
||||
_file.close()
|
||||
except IOError, e:
|
||||
log.debug("Unable to load .fastresume: %s", e)
|
||||
|
||||
return str(fastresume)
|
||||
|
||||
def add(self, torrent_info=None, state=None, options=None, save_state=True,
|
||||
filedump=None, filename=None):
|
||||
"""Add a torrent to the manager and returns it's torrent_id"""
|
||||
|
||||
if torrent_info is None and state is None and filedump is None:
|
||||
log.debug("You must specify a valid torrent_info or a torrent state object!")
|
||||
return
|
||||
|
||||
log.debug("torrentmanager.add")
|
||||
add_torrent_params = {}
|
||||
|
||||
if filedump is not None:
|
||||
try:
|
||||
torrent_info = lt.torrent_info(lt.bdecode(filedump))
|
||||
except Exception, e:
|
||||
log.error("Unable to decode torrent file!: %s", e)
|
||||
|
||||
if torrent_info is None:
|
||||
# We have no torrent_info so we need to add the torrent with information
|
||||
# from the state object.
|
||||
|
||||
# Populate the options dict from state
|
||||
options = {}
|
||||
options["max_connections_per_torrent"] = state.max_connections
|
||||
options["max_upload_slots_per_torrent"] = state.max_upload_slots
|
||||
options["max_upload_speed_per_torrent"] = state.max_upload_speed
|
||||
options["max_download_speed_per_torrent"] = 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["add_paused"] = state.paused
|
||||
|
||||
add_torrent_params["ti"] =\
|
||||
self.get_torrent_info_from_file(
|
||||
os.path.join(self.config["state_location"], state.torrent_id + ".torrent"))
|
||||
if not add_torrent_params["ti"]:
|
||||
log.error("Unable to add torrent!")
|
||||
return
|
||||
|
||||
add_torrent_params["resume_data"] = self.get_resume_data_from_file(state.torrent_id)
|
||||
else:
|
||||
# We have a torrent_info object so we're not loading from state.
|
||||
# Check if options is None and load defaults
|
||||
options_keys = [
|
||||
"compact_allocation",
|
||||
"max_connections_per_torrent",
|
||||
"max_upload_slots_per_torrent",
|
||||
"max_upload_speed_per_torrent",
|
||||
"max_download_speed_per_torrent",
|
||||
"prioritize_first_last_pieces",
|
||||
"download_location",
|
||||
"add_paused",
|
||||
"auto_managed"
|
||||
]
|
||||
|
||||
if options == None:
|
||||
options = {}
|
||||
for key in options_keys:
|
||||
options[key] = self.config[key]
|
||||
else:
|
||||
for key in options_keys:
|
||||
if not options.has_key(key):
|
||||
options[key] = self.config[key]
|
||||
|
||||
add_torrent_params["ti"] = torrent_info
|
||||
add_torrent_params["resume_data"] = ""
|
||||
|
||||
#log.info("Adding torrent: %s", filename)
|
||||
log.debug("options: %s", options)
|
||||
|
||||
# Set the right storage_mode
|
||||
if options["compact_allocation"]:
|
||||
storage_mode = lt.storage_mode_t(2)
|
||||
else:
|
||||
storage_mode = lt.storage_mode_t(1)
|
||||
|
||||
# Fill in the rest of the add_torrent_params dictionary
|
||||
add_torrent_params["save_path"] = str(options["download_location"])
|
||||
|
||||
add_torrent_params["storage_mode"] = storage_mode
|
||||
add_torrent_params["paused"] = True
|
||||
add_torrent_params["auto_managed"] = False
|
||||
add_torrent_params["duplicate_is_error"] = True
|
||||
|
||||
# We need to pause the AlertManager momentarily to prevent alerts
|
||||
# for this torrent being generated before a Torrent object is created.
|
||||
component.pause("AlertManager")
|
||||
|
||||
handle = None
|
||||
try:
|
||||
handle = self.session.add_torrent(add_torrent_params)
|
||||
except RuntimeError, e:
|
||||
log.warning("Error adding torrent: %s", e)
|
||||
|
||||
if not handle or not handle.is_valid():
|
||||
log.debug("torrent handle is invalid!")
|
||||
# The torrent was not added to the session
|
||||
component.resume("AlertManager")
|
||||
return
|
||||
|
||||
log.debug("handle id: %s", str(handle.info_hash()))
|
||||
# Create a Torrent object
|
||||
torrent = Torrent(handle, options, state, filename)
|
||||
# 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"]:
|
||||
handle.resume()
|
||||
handle.auto_managed(options["auto_managed"])
|
||||
|
||||
# Write the .torrent file to the state directory
|
||||
if filedump:
|
||||
try:
|
||||
save_file = open(os.path.join(self.config["state_location"],
|
||||
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
|
||||
self.signals.emit("torrent_added", 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(
|
||||
self.config["state_location"], torrent_id + ".torrent"),
|
||||
"rb")
|
||||
filedump = lt.bdecode(_file.read())
|
||||
_file.close()
|
||||
except (IOError, RuntimeError), e:
|
||||
log.warning("Unable to open %s: %s", torrent_id, e)
|
||||
return False
|
||||
|
||||
return filedump
|
||||
|
||||
def remove(self, torrent_id, remove_torrent=False, remove_data=False):
|
||||
"""Remove a torrent from the manager"""
|
||||
try:
|
||||
# Remove from libtorrent session
|
||||
option = 0
|
||||
# Remove data if set
|
||||
if remove_data:
|
||||
option = 1
|
||||
self.session.remove_torrent(self.torrents[torrent_id].handle,
|
||||
option)
|
||||
except (RuntimeError, KeyError), e:
|
||||
log.warning("Error removing torrent: %s", e)
|
||||
return False
|
||||
|
||||
# Remove the .torrent file if requested
|
||||
if remove_torrent:
|
||||
try:
|
||||
torrent_file = os.path.join(
|
||||
self.config["torrentfiles_location"],
|
||||
self.torrents[torrent_id].filename)
|
||||
os.remove(torrent_file)
|
||||
except Exception, e:
|
||||
log.warning("Unable to remove .torrent file: %s", e)
|
||||
|
||||
# Remove the .fastresume if it exists
|
||||
self.torrents[torrent_id].delete_fastresume()
|
||||
|
||||
# Remove the .torrent file in the state
|
||||
self.torrents[torrent_id].delete_torrentfile()
|
||||
|
||||
# Remove the torrent from deluge's session
|
||||
try:
|
||||
del self.torrents[torrent_id]
|
||||
except KeyError, ValueError:
|
||||
return False
|
||||
|
||||
# Save the session state
|
||||
self.save_state()
|
||||
return True
|
||||
|
||||
def pause_all(self):
|
||||
"""Pauses all torrents.. Returns a list of torrents paused."""
|
||||
torrent_was_paused = False
|
||||
for key in self.torrents.keys():
|
||||
try:
|
||||
self.torrents[key].pause()
|
||||
torrent_was_paused = True
|
||||
except:
|
||||
log.warning("Unable to pause torrent %s", key)
|
||||
|
||||
return torrent_was_paused
|
||||
|
||||
def resume_all(self):
|
||||
"""Resumes all torrents.. Returns True if at least 1 torrent is resumed"""
|
||||
torrent_was_resumed = False
|
||||
for key in self.torrents.keys():
|
||||
if self.torrents[key].resume():
|
||||
torrent_was_resumed = True
|
||||
else:
|
||||
log.warning("Unable to resume torrent %s", key)
|
||||
|
||||
return torrent_was_resumed
|
||||
|
||||
def load_state(self):
|
||||
"""Load the state of the TorrentManager from the torrents.state file"""
|
||||
state = TorrentManagerState()
|
||||
|
||||
try:
|
||||
log.debug("Opening torrent state file for load.")
|
||||
state_file = open(
|
||||
os.path.join(self.config["state_location"], "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:
|
||||
if dir(state.torrents[0]) != dir(TorrentState()):
|
||||
for attr in (set(dir(TorrentState())) - set(dir(state.torrents[0]))):
|
||||
for s in state.torrents:
|
||||
setattr(s, attr, getattr(TorrentState(), attr, None))
|
||||
except Exception, e:
|
||||
log.warning("Unable to update state file to a compatible version: %s", e)
|
||||
|
||||
# Reorder the state.torrents list to add torrents in the correct queue
|
||||
# order.
|
||||
ordered_state = []
|
||||
for torrent_state in state.torrents:
|
||||
for t in ordered_state:
|
||||
if torrent_state.queue < t.queue:
|
||||
ordered_state.insert(0, torrent_state)
|
||||
break
|
||||
ordered_state.append(torrent_state)
|
||||
|
||||
for torrent_state in ordered_state:
|
||||
try:
|
||||
self.add(state=torrent_state, save_state=False)
|
||||
except AttributeError, e:
|
||||
log.error("Torrent state file is either corrupt or incompatible!")
|
||||
break
|
||||
|
||||
# Run the post_session_load plugin hooks
|
||||
self.plugins.run_post_session_load()
|
||||
|
||||
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.compact,
|
||||
paused,
|
||||
torrent.save_path,
|
||||
torrent.max_connections,
|
||||
torrent.max_upload_slots,
|
||||
torrent.max_upload_speed,
|
||||
torrent.max_download_speed,
|
||||
torrent.prioritize_first_last,
|
||||
torrent.file_priorities,
|
||||
torrent.get_queue_position(),
|
||||
torrent.auto_managed,
|
||||
torrent.is_finished,
|
||||
torrent.stop_ratio,
|
||||
torrent.stop_at_ratio,
|
||||
torrent.remove_at_ratio
|
||||
)
|
||||
state.torrents.append(torrent_state)
|
||||
|
||||
# Pickle the TorrentManagerState object
|
||||
try:
|
||||
log.debug("Saving torrent state file.")
|
||||
state_file = open(
|
||||
os.path.join(self.config["state_location"], "torrents.state"),
|
||||
"wb")
|
||||
cPickle.dump(state, state_file)
|
||||
state_file.close()
|
||||
except IOError:
|
||||
log.warning("Unable to save state file.")
|
||||
|
||||
# We return True so that the timer thread will continue
|
||||
return True
|
||||
|
||||
def 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")
|
||||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
torrent = self.torrents[torrent_id]
|
||||
log.debug("%s is finished..", torrent_id)
|
||||
# Move completed download to completed folder if needed
|
||||
if self.config["move_completed"] and not torrent.is_finished:
|
||||
if torrent.save_path != self.config["move_completed_path"]:
|
||||
torrent.move_storage(self.config["move_completed_path"])
|
||||
|
||||
torrent.is_finished = True
|
||||
torrent.update_state()
|
||||
torrent.write_fastresume()
|
||||
component.get("SignalManager").emit("torrent_finished", torrent_id)
|
||||
|
||||
def on_alert_torrent_paused(self, alert):
|
||||
log.debug("on_alert_torrent_paused")
|
||||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
# Set the torrent state
|
||||
self.torrents[torrent_id].update_state()
|
||||
component.get("SignalManager").emit("torrent_paused", torrent_id)
|
||||
|
||||
# Write the fastresume file
|
||||
self.torrents[torrent_id].write_fastresume()
|
||||
|
||||
if torrent_id in self.shutdown_torrent_pause_list:
|
||||
self.shutdown_torrent_pause_list.remove(torrent_id)
|
||||
|
||||
def on_alert_torrent_checked(self, alert):
|
||||
log.debug("on_alert_torrent_checked")
|
||||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
# Set the torrent state
|
||||
self.torrents[torrent_id].update_state()
|
||||
|
||||
def on_alert_tracker_reply(self, alert):
|
||||
log.debug("on_alert_tracker_reply")
|
||||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
# Set the tracker status for the torrent
|
||||
try:
|
||||
if alert.message != "Got peers from DHT":
|
||||
self.torrents[torrent_id].set_tracker_status(_("Announce OK"))
|
||||
except KeyError:
|
||||
log.debug("torrent_id doesn't exist.")
|
||||
|
||||
# Check to see if we got any peer information from the tracker
|
||||
if alert.handle.status().num_complete == -1 or \
|
||||
alert.handle.status().num_incomplete == -1:
|
||||
# We didn't get peer information, so lets send a scrape request
|
||||
self.torrents[torrent_id].scrape_tracker()
|
||||
|
||||
def on_alert_tracker_announce(self, alert):
|
||||
log.debug("on_alert_tracker_announce")
|
||||
# Get the torrent_id
|
||||
try:
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
except RuntimeError:
|
||||
log.debug("Invalid torrent handle.")
|
||||
return
|
||||
|
||||
# Set the tracker status for the torrent
|
||||
try:
|
||||
self.torrents[torrent_id].set_tracker_status(_("Announce Sent"))
|
||||
except KeyError:
|
||||
log.debug("torrent_id doesn't exist.")
|
||||
|
||||
def on_alert_tracker(self, alert):
|
||||
log.debug("on_alert_tracker")
|
||||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
tracker_status = "%s: %s" % \
|
||||
(_("Alert"), str(alert.message()).strip('"')[8:])
|
||||
# Set the tracker status for the torrent
|
||||
try:
|
||||
self.torrents[torrent_id].set_tracker_status(tracker_status)
|
||||
except KeyError:
|
||||
log.debug("torrent_id doesn't exist.")
|
||||
|
||||
def on_alert_tracker_warning(self, alert):
|
||||
log.debug("on_alert_tracker_warning")
|
||||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
tracker_status = '%s: %s' % (_("Warning"), str(alert.message()))
|
||||
# Set the tracker status for the torrent
|
||||
try:
|
||||
self.torrents[torrent_id].set_tracker_status(tracker_status)
|
||||
except KeyError:
|
||||
log.debug("torrent_id doesn't exist.")
|
||||
|
||||
def on_alert_storage_moved(self, alert):
|
||||
log.debug("on_alert_storage_moved")
|
||||
log.debug("save_path: %s", alert.handle.save_path())
|
||||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
try:
|
||||
log.debug("save_path2: %s", self.torrents[torrent_id].handle.save_path())
|
||||
self.torrents[torrent_id].set_save_path(alert.handle.save_path())
|
||||
except KeyError:
|
||||
log.debug("torrent_id doesn't exist.")
|
||||
|
||||
def on_alert_torrent_resumed(self, alert):
|
||||
log.debug("on_alert_torrent_resumed")
|
||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
||||
torrent.is_finished = torrent.handle.is_seed()
|
||||
torrent.update_state()
|
||||
|
||||
def on_alert_state_changed(self, alert):
|
||||
log.debug("on_alert_state_changed")
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
self.torrents[torrent_id].update_state()
|
||||
component.get("SignalManager").emit("torrent_state_changed", torrent_id)
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 722 B After Width: | Height: | Size: 722 B |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
@ -14,11 +14,11 @@
|
|||
id="svg3440"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.45"
|
||||
sodipodi:docbase="/home/zach/deluge/trunk"
|
||||
sodipodi:docname="deluge.svg"
|
||||
inkscape:export-filename="/home/zach/deluge.png"
|
||||
inkscape:export-xdpi="480"
|
||||
inkscape:export-ydpi="480"
|
||||
sodipodi:docbase="/home/andrew"
|
||||
sodipodi:docname="alert.svg"
|
||||
inkscape:export-filename="/home/andrew/alert16.png"
|
||||
inkscape:export-xdpi="32.603073"
|
||||
inkscape:export-ydpi="32.603073"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
sodipodi:modified="TRUE">
|
||||
<defs
|
||||
|
@ -261,17 +261,6 @@
|
|||
fx="65.800331"
|
||||
fy="27.16758"
|
||||
r="12.972491" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4989"
|
||||
id="radialGradient6115"
|
||||
cx="16.651781"
|
||||
cy="32.187485"
|
||||
fx="16.651781"
|
||||
fy="32.187485"
|
||||
r="17.089519"
|
||||
gradientTransform="matrix(1.486175,-1.536108,0.932321,0.902016,-38.10476,31.42646)"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
|
@ -280,17 +269,17 @@
|
|||
borderopacity="0.17254902"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="8"
|
||||
inkscape:cx="36.250498"
|
||||
inkscape:cy="38.275489"
|
||||
inkscape:zoom="7.4062501"
|
||||
inkscape:cx="11.667315"
|
||||
inkscape:cy="19.059135"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:window-width="1266"
|
||||
inkscape:window-height="944"
|
||||
inkscape:window-x="124"
|
||||
inkscape:window-y="52"
|
||||
inkscape:window-width="1024"
|
||||
inkscape:window-height="693"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="25"
|
||||
inkscape:showpageshadow="false" />
|
||||
<metadata
|
||||
id="metadata4">
|
||||
|
@ -345,58 +334,27 @@
|
|||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:url(#radialGradient6090);fill-opacity:1;stroke:none;stroke-opacity:1"
|
||||
id="path4112"
|
||||
sodipodi:cx="24.849752"
|
||||
sodipodi:cy="38.908627"
|
||||
sodipodi:rx="20.203051"
|
||||
sodipodi:ry="7.4751287"
|
||||
d="M 45.052803 38.908627 A 20.203051 7.4751287 0 1 1 4.6467018,38.908627 A 20.203051 7.4751287 0 1 1 45.052803 38.908627 z"
|
||||
transform="matrix(0.947409,0,0,1.17786,1.244375,-6.853427)"
|
||||
inkscape:export-xdpi="480"
|
||||
inkscape:export-ydpi="480" />
|
||||
<path
|
||||
style="fill:url(#radialGradient6115);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
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 "
|
||||
id="path2069"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="fill:#1b4075;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 35.111358,26.143133 C 28.972772,13.030586 17.560684,17.697957 17.274449,26.949974 C 16.894738,39.223415 34.748874,37.615429 36.715244,41.468778 C 28.821643,47.675479 14.973233,45.226508 10.962289,39.715204 C 6.9574776,34.212326 7.2383598,25.630263 10.784249,19.587632 C 24.158625,0.978654 39.749127,24.383766 35.111358,26.143133 z "
|
||||
id="path2969"
|
||||
sodipodi:nodetypes="cscscc" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:white;stroke-width:1.1000706;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022"
|
||||
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 "
|
||||
id="path2071"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="opacity:0.46;fill:url(#radialGradient6109);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 23.940758,0.96491709 L 34.727367,14.909752 C 42.647208,24.392311 40.447304,20.283975 28.362481,21.278846 C 25.083165,11.203805 18.13871,11.859899 13.523802,15.675236 L 23.940758,0.96491709 z "
|
||||
id="path3945"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="fill:url(#radialGradient6106);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 35.159701,26.173667 C 29.021115,13.06112 18.734027,17.978491 18.447792,27.230508 C 18.068081,39.503949 34.797217,37.645963 36.763587,41.499312 C 28.869986,47.706013 15.021576,45.257042 11.010632,39.745738 C 7.0058197,34.24286 7.2867027,25.660797 10.832592,19.618166 C 24.206968,1.0091879 39.79747,24.4143 35.159701,26.173667 z "
|
||||
id="path3868"
|
||||
sodipodi:nodetypes="cscscc" />
|
||||
<path
|
||||
style="fill:url(#radialGradient6103);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 35.120795,26.14195 C 28.553327,12.814962 15.685968,17.224233 15.399733,26.47625 C 15.020022,38.749691 32.874158,37.141705 34.840528,40.995054 C 26.946927,47.201755 13.098517,44.752784 9.0875727,39.24148 C 5.0827617,33.738602 5.3636437,25.156539 8.9095327,19.113908 C 22.315509,0.47615954 40.03233,23.660113 35.120795,26.14195 z "
|
||||
id="path4874"
|
||||
sodipodi:nodetypes="cscscc" />
|
||||
<path
|
||||
transform="matrix(-0.829136,1.052307,1.239307,7.58326e-2,26.32898,25.58605)"
|
||||
inkscape:r_cy="true"
|
||||
inkscape:r_cx="true"
|
||||
d="M 18.788838 12.493138 A 6.7175145 6.7175145 0 1 1 5.3538089,12.493138 A 6.7175145 6.7175145 0 1 1 18.788838 12.493138 z"
|
||||
sodipodi:ry="6.7175145"
|
||||
sodipodi:rx="6.7175145"
|
||||
sodipodi:cy="12.493138"
|
||||
sodipodi:cx="12.071323"
|
||||
id="path4941"
|
||||
style="opacity:0.21999996;color:black;fill:url(#radialGradient6098);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
|
||||
sodipodi:type="arc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
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.70000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Bitstream Vera Sans"
|
||||
x="5.0072942"
|
||||
y="59.560848"
|
||||
id="text2767"
|
||||
transform="scale(1.4928735,0.6698491)"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2769"
|
||||
x="5.0072942"
|
||||
y="59.560848"
|
||||
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.70000001;font-family:Bitstream Vera Sans;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-linecap:round">!</tspan></text>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 586 B |
|
@ -0,0 +1,297 @@
|
|||
<?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:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="48px"
|
||||
height="48px"
|
||||
id="svg3440"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.46"
|
||||
sodipodi:docbase="/home/andrew/Projects/deluge-icons"
|
||||
sodipodi:docname="checking.svg"
|
||||
inkscape:export-filename="/home/andrew/checking16.png"
|
||||
inkscape:export-xdpi="32.603073"
|
||||
inkscape:export-ydpi="32.603073"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="0.17254902"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="8"
|
||||
inkscape:cx="37.674028"
|
||||
inkscape:cy="16.114442"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:window-width="768"
|
||||
inkscape:window-height="722"
|
||||
inkscape:window-x="4"
|
||||
inkscape:window-y="25"
|
||||
inkscape:showpageshadow="false" />
|
||||
<defs
|
||||
id="defs3">
|
||||
<inkscape:perspective
|
||||
id="perspective2513"
|
||||
inkscape:persp3d-origin="24 : 16 : 1"
|
||||
inkscape:vp_z="48 : 24 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 24 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<linearGradient
|
||||
id="linearGradient2973"
|
||||
inkscape:collect="always">
|
||||
<stop
|
||||
id="stop2975"
|
||||
offset="0"
|
||||
style="stop-color:#eeeeec;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop2977"
|
||||
offset="1"
|
||||
style="stop-color:#eeeeec;stop-opacity:0;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient4126">
|
||||
<stop
|
||||
id="stop4128"
|
||||
offset="0.0000000"
|
||||
style="stop-color:#ffffff;stop-opacity:1.0000000;" />
|
||||
<stop
|
||||
id="stop4130"
|
||||
offset="1.0000000"
|
||||
style="stop-color:#ffffff;stop-opacity:0.16494845;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient4114"
|
||||
inkscape:collect="always">
|
||||
<stop
|
||||
id="stop4116"
|
||||
offset="0"
|
||||
style="stop-color:#000000;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop4118"
|
||||
offset="1"
|
||||
style="stop-color:#000000;stop-opacity:0;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient3962">
|
||||
<stop
|
||||
id="stop3964"
|
||||
offset="0.0000000"
|
||||
style="stop-color:#d3e9ff;stop-opacity:1.0000000;" />
|
||||
<stop
|
||||
id="stop4134"
|
||||
offset="0.15517241"
|
||||
style="stop-color:#d3e9ff;stop-opacity:1.0000000;" />
|
||||
<stop
|
||||
id="stop4346"
|
||||
offset="0.75000000"
|
||||
style="stop-color:#4074ae;stop-opacity:1.0000000;" />
|
||||
<stop
|
||||
id="stop3966"
|
||||
offset="1.0000000"
|
||||
style="stop-color:#36486c;stop-opacity:1.0000000;" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3993"
|
||||
id="radialGradient4019"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.791446,-14.01786,-11.28667)"
|
||||
cx="-10.089286"
|
||||
cy="33.506763"
|
||||
fx="-10.089286"
|
||||
fy="33.506763"
|
||||
r="13.994944" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3993"
|
||||
id="radialGradient4004"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.792374,-19.58761,2.818569)"
|
||||
cx="-10.323107"
|
||||
cy="31.329016"
|
||||
fx="-10.323107"
|
||||
fy="31.329016"
|
||||
r="14.057444" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3993"
|
||||
id="radialGradient3999"
|
||||
cx="-10.323107"
|
||||
cy="31.329016"
|
||||
fx="-10.323107"
|
||||
fy="31.329016"
|
||||
r="14.057444"
|
||||
gradientTransform="matrix(1,0,0,0.792374,0,6.785475)"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient1312"
|
||||
id="radialGradient3943"
|
||||
cx="61.662098"
|
||||
cy="24.241488"
|
||||
fx="61.662098"
|
||||
fy="24.241488"
|
||||
r="13.994946"
|
||||
gradientTransform="matrix(0.341185,-0.153831,1.08001,2.395374,-15.42222,-25.62103)"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
id="linearGradient1312">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop1314" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop1316" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient3993">
|
||||
<stop
|
||||
id="stop3995"
|
||||
offset="0"
|
||||
style="stop-color:#ffffff;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop3997"
|
||||
offset="1"
|
||||
style="stop-color:#000000;stop-opacity:0" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,1.140022,40.17678,1.347091)"
|
||||
r="14.33462"
|
||||
fy="18.499998"
|
||||
fx="-22.375"
|
||||
cy="18.499998"
|
||||
cx="-22.375"
|
||||
id="radialGradient3866"
|
||||
xlink:href="#linearGradient2973"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4114"
|
||||
id="radialGradient5000"
|
||||
gradientTransform="scale(1.643990,0.608276)"
|
||||
cx="15.115514"
|
||||
cy="63.965388"
|
||||
fx="15.115514"
|
||||
fy="63.965388"
|
||||
r="12.289036"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
id="linearGradient4989">
|
||||
<stop
|
||||
style="stop-color:#d3e9ff;stop-opacity:1.0000000;"
|
||||
offset="0.0000000"
|
||||
id="stop4991" />
|
||||
<stop
|
||||
style="stop-color:#d3e9ff;stop-opacity:1.0000000;"
|
||||
offset="0.15517241"
|
||||
id="stop4993" />
|
||||
<stop
|
||||
style="stop-color:#4074ae;stop-opacity:1.0000000;"
|
||||
offset="0.75000000"
|
||||
id="stop4995" />
|
||||
<stop
|
||||
style="stop-color:#36486c;stop-opacity:1.0000000;"
|
||||
offset="1.0000000"
|
||||
id="stop4997" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient4977">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1.0000000;"
|
||||
offset="0.0000000"
|
||||
id="stop4979" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0.16494845;"
|
||||
offset="1.0000000"
|
||||
id="stop4981" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata4">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Internet Category</dc:title>
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Jakub Steiner</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
<dc:title>Tuomas Kuosmanen</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:contributor>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
|
||||
<dc:source>http://jimmac.musichall.cz</dc:source>
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
<rdf:li>internet</rdf:li>
|
||||
<rdf:li>tools</rdf:li>
|
||||
<rdf:li>applications</rdf:li>
|
||||
<rdf:li>category</rdf:li>
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
inkscape:label="Layer 1"
|
||||
id="layer1">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
id="path2069"
|
||||
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="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:white;stroke-width:1.1000706;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccccccc"
|
||||
style="fill:#cfcfcf;fill-opacity:1;stroke:#000000;stroke-width:0.65121293;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 11.907735,28.259103 C 15.765379,27.553911 20.775812,26.031856 24.400866,26.377315 C 22.598873,25.111024 22.522108,24.694978 21.821837,23.470303 C 26.445155,22.178774 28.937476,23.679964 34.217776,26.922312 C 35.006715,25.3802 35.778476,24.67098 36.817957,22.869809 C 31.198009,18.792719 25.868522,17.760268 20.454911,19.207042 C 19.842813,18.404348 19.795799,17.541278 19.728831,15.812086 C 17.778356,18.179212 14.825215,22.457523 11.907735,28.259103 C 11.907735,28.259103 11.907735,28.259103 11.907735,28.259103"
|
||||
id="path3463" />
|
||||
<path
|
||||
id="path3485"
|
||||
d="M 36.668898,28.597896 C 32.811254,29.303088 27.800821,30.825143 24.175767,30.479684 C 25.97776,31.745975 26.054525,32.162021 26.754796,33.386696 C 22.131478,34.678225 19.639157,33.177035 14.358857,29.934687 C 13.569918,31.476799 12.798157,32.186019 11.758676,33.98719 C 17.378624,38.06428 22.708111,39.096731 28.121722,37.649957 C 28.73382,38.452651 28.780834,39.315721 28.847802,41.044913 C 30.798277,38.677787 33.751418,34.399476 36.668898,28.597896 C 36.668898,28.597896 36.668898,28.597896 36.668898,28.597896"
|
||||
style="fill:#cfcfcf;fill-opacity:1;stroke:#000000;stroke-width:0.65121293;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
sodipodi:nodetypes="ccccccccc" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 683 B |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 607 B |
|
@ -13,12 +13,13 @@
|
|||
height="48px"
|
||||
id="svg3440"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.45"
|
||||
sodipodi:docname="FlexRSS.svg"
|
||||
inkscape:export-xdpi="480"
|
||||
inkscape:export-ydpi="480"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
sodipodi:modified="true">
|
||||
inkscape:version="0.45.1"
|
||||
sodipodi:docbase="/home/andrew/Projects/deluge-icons"
|
||||
sodipodi:docname="downloading-border.svg"
|
||||
inkscape:export-filename="/home/andrew/Projects/deluge-icons/downloading16.png"
|
||||
inkscape:export-xdpi="32.603073"
|
||||
inkscape:export-ydpi="32.603073"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
||||
<defs
|
||||
id="defs3">
|
||||
<linearGradient
|
||||
|
@ -166,33 +167,21 @@
|
|||
<linearGradient
|
||||
id="linearGradient4989">
|
||||
<stop
|
||||
offset="0.0"
|
||||
stop-color="#E3702D"
|
||||
id="stop13201" />
|
||||
id="stop4991"
|
||||
offset="0.0000000"
|
||||
style="stop-color:#d3e9ff;stop-opacity:1.0000000;" />
|
||||
<stop
|
||||
offset="0.1071"
|
||||
stop-color="#EA7D31"
|
||||
id="stop13203" />
|
||||
id="stop4993"
|
||||
offset="0.15517241"
|
||||
style="stop-color:#d3e9ff;stop-opacity:1.0000000;" />
|
||||
<stop
|
||||
offset="0.3503"
|
||||
stop-color="#F69537"
|
||||
id="stop13205" />
|
||||
id="stop4995"
|
||||
offset="0.75000000"
|
||||
style="stop-color:#4074ae;stop-opacity:1.0000000;" />
|
||||
<stop
|
||||
offset="0.5"
|
||||
stop-color="#FB9E3A"
|
||||
id="stop13207" />
|
||||
<stop
|
||||
offset="0.7016"
|
||||
stop-color="#EA7C31"
|
||||
id="stop13209" />
|
||||
<stop
|
||||
offset="0.8866"
|
||||
stop-color="#DE642B"
|
||||
id="stop13211" />
|
||||
<stop
|
||||
offset="1.0"
|
||||
stop-color="#D95B29"
|
||||
id="stop13213" />
|
||||
id="stop4997"
|
||||
offset="1.0000000"
|
||||
style="stop-color:#36486c;stop-opacity:1.0000000;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient4977">
|
||||
|
@ -238,6 +227,28 @@
|
|||
fx="12.071323"
|
||||
fy="12.493138"
|
||||
r="6.7175145" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2973"
|
||||
id="radialGradient6103"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.25463,-0.898371,0.979785,0.277703,-18.00903,32.03312)"
|
||||
cx="17.903898"
|
||||
cy="40.159222"
|
||||
fx="17.903898"
|
||||
fy="40.159222"
|
||||
r="14.33681" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2973"
|
||||
id="radialGradient6106"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.583269,-0.431533,0.577146,0.78008,-5.80022,4.004109)"
|
||||
cx="12.525543"
|
||||
cy="38.09042"
|
||||
fx="12.525543"
|
||||
fy="38.09042"
|
||||
r="14.33681" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient1312"
|
||||
|
@ -249,17 +260,6 @@
|
|||
fx="65.800331"
|
||||
fy="27.16758"
|
||||
r="12.972491" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4989"
|
||||
id="radialGradient15360"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.486175,1.536108,0.932321,-0.902016,-38.10476,16.57354)"
|
||||
cx="16.651781"
|
||||
cy="32.187485"
|
||||
fx="16.651781"
|
||||
fy="32.187485"
|
||||
r="17.089519" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
|
@ -269,16 +269,16 @@
|
|||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="8"
|
||||
inkscape:cx="36.657417"
|
||||
inkscape:cy="37.982995"
|
||||
inkscape:cx="34.258571"
|
||||
inkscape:cy="32.884169"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:window-width="1266"
|
||||
inkscape:window-height="944"
|
||||
inkscape:window-x="6"
|
||||
inkscape:window-y="28"
|
||||
inkscape:window-x="12"
|
||||
inkscape:window-y="34"
|
||||
inkscape:showpageshadow="false" />
|
||||
<metadata
|
||||
id="metadata4">
|
||||
|
@ -333,61 +333,18 @@
|
|||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:url(#radialGradient6090);fill-opacity:1;stroke:none;stroke-opacity:1"
|
||||
id="path4112"
|
||||
sodipodi:cx="24.849752"
|
||||
sodipodi:cy="38.908627"
|
||||
sodipodi:rx="20.203051"
|
||||
sodipodi:ry="7.4751287"
|
||||
d="M 45.052803 38.908627 A 20.203051 7.4751287 0 1 1 4.6467018,38.908627 A 20.203051 7.4751287 0 1 1 45.052803 38.908627 z"
|
||||
transform="matrix(0.947409,0,0,1.17786,1.244375,-6.853427)"
|
||||
inkscape:export-xdpi="480"
|
||||
inkscape:export-ydpi="480" />
|
||||
<path
|
||||
style="fill:url(#radialGradient15360);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 23.9375 0.96875 L 11.25 18.625 C 11.083253 18.932923 10.936659 19.263746 10.78125 19.59375 C 10.761069 19.636604 10.738726 19.675547 10.71875 19.71875 C 7.2395433 25.754509 6.9905394 34.252425 10.96875 39.71875 C 14.403259 44.437994 25.023267 46.877018 32.96875 43.59375 C 33.644467 43.314527 34.306967 43.02091 34.9375 42.65625 C 34.977742 42.632977 35.022469 42.617381 35.0625 42.59375 C 35.095502 42.574645 35.12346 42.550547 35.15625 42.53125 C 35.214913 42.496047 35.285557 42.473482 35.34375 42.4375 C 35.558127 42.307459 35.763748 42.169493 35.96875 42.03125 C 35.980782 42.02298 35.987992 42.008307 36 42 C 36.248731 41.831254 36.484083 41.64914 36.71875 41.46875 C 43.376411 36.350984 44.348198 26.670654 37.34375 18.28125 L 23.9375 0.96875 z "
|
||||
id="path2069" />
|
||||
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 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 "
|
||||
id="path2069"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:white;stroke-width:1.1000706;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022"
|
||||
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 "
|
||||
id="path2071"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="opacity:0.46;fill:url(#radialGradient6109);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 23.940758,0.96491709 L 34.727367,14.909752 C 42.647208,24.392311 40.447304,20.283975 28.362481,21.278846 C 25.083165,11.203805 18.13871,11.859899 13.523802,15.675236 L 23.940758,0.96491709 z "
|
||||
id="path3945"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
transform="matrix(-0.829136,1.052307,1.239307,7.58326e-2,26.32898,25.58605)"
|
||||
inkscape:r_cy="true"
|
||||
inkscape:r_cx="true"
|
||||
d="M 18.788838 12.493138 A 6.7175145 6.7175145 0 1 1 5.3538089,12.493138 A 6.7175145 6.7175145 0 1 1 18.788838 12.493138 z"
|
||||
sodipodi:ry="6.7175145"
|
||||
sodipodi:rx="6.7175145"
|
||||
sodipodi:cy="12.493138"
|
||||
sodipodi:cx="12.071323"
|
||||
id="path4941"
|
||||
style="opacity:0.21999996;color:black;fill:url(#radialGradient6098);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
|
||||
sodipodi:type="arc" />
|
||||
<circle
|
||||
transform="matrix(0.1085714,0,0,0.1085714,11.347857,13.999286)"
|
||||
cx="68"
|
||||
cy="189"
|
||||
r="24"
|
||||
id="circle15442"
|
||||
sodipodi:cx="68"
|
||||
sodipodi:cy="189"
|
||||
sodipodi:rx="24"
|
||||
sodipodi:ry="24"
|
||||
style="fill:#ffffff" />
|
||||
<path
|
||||
d="M 28.719284,37.125 L 25.027858,37.125 C 25.027858,32.208088 21.041912,28.222143 16.125,28.222143 L 16.125,24.530714 C 23.080632,24.530714 28.719284,30.169368 28.719284,37.125 z "
|
||||
id="path15444"
|
||||
style="fill:#ffffff" />
|
||||
<path
|
||||
d="M 31.325,37.125 C 31.325,28.730272 24.519728,21.925 16.125,21.925 L 16.125,18.125 C 26.61841,18.125 35.125,26.631589 35.125,37.125 L 31.325,37.125 z "
|
||||
id="path15446"
|
||||
style="fill:#ffffff" />
|
||||
style="fill:#b7e399;fill-opacity:1;stroke:#000000;stroke-opacity:1;marker-end:none;stroke-width:0.7;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-linecap:round;stroke-linejoin:round"
|
||||
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 "
|
||||
id="rect2634" />
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 662 B After Width: | Height: | Size: 662 B |
After Width: | Height: | Size: 643 B |
After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 604 B |
After Width: | Height: | Size: 591 B |
After Width: | Height: | Size: 643 B |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 497 B |
After Width: | Height: | Size: 488 B |
After Width: | Height: | Size: 428 B |
Before Width: | Height: | Size: 836 B After Width: | Height: | Size: 836 B |
After Width: | Height: | Size: 506 B |
After Width: | Height: | Size: 647 B |
After Width: | Height: | Size: 403 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 524 B |
After Width: | Height: | Size: 663 B |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 593 B |
After Width: | Height: | Size: 585 B |
After Width: | Height: | Size: 504 B |
After Width: | Height: | Size: 449 B |
After Width: | Height: | Size: 497 B |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 675 B |