Fix up doc strings in deluge.common and generate documentation html for
it
This commit is contained in:
parent
277b75e66b
commit
1920f3ce72
266
deluge/common.py
266
deluge/common.py
|
@ -80,10 +80,23 @@ FILE_PRIORITY = {
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
"""Returns the program version from the egg metadata"""
|
"""
|
||||||
|
Returns the program version from the egg metadata
|
||||||
|
|
||||||
|
:returns: the version of Deluge
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
|
"""
|
||||||
return pkg_resources.require("Deluge")[0].version.split("r")[0]
|
return pkg_resources.require("Deluge")[0].version.split("r")[0]
|
||||||
|
|
||||||
def get_revision():
|
def get_revision():
|
||||||
|
"""
|
||||||
|
The svn revision of the build if available
|
||||||
|
|
||||||
|
:returns: the svn revision, or ""
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
|
"""
|
||||||
revision = ""
|
revision = ""
|
||||||
try:
|
try:
|
||||||
f = open(pkg_resources.resource_filename("deluge", os.path.join("data", "revision")))
|
f = open(pkg_resources.resource_filename("deluge", os.path.join("data", "revision")))
|
||||||
|
@ -95,8 +108,11 @@ def get_revision():
|
||||||
return revision
|
return revision
|
||||||
|
|
||||||
def get_default_config_dir(filename=None):
|
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
|
:param filename: if None, only the config path is returned, if provided, a path including the filename will be returned
|
||||||
|
:returns: a file path to the config directory and optional filename
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if windows_check():
|
if windows_check():
|
||||||
if filename:
|
if filename:
|
||||||
|
@ -110,37 +126,76 @@ def get_default_config_dir(filename=None):
|
||||||
return xdg.BaseDirectory.save_config_path("deluge")
|
return xdg.BaseDirectory.save_config_path("deluge")
|
||||||
|
|
||||||
def get_default_download_dir():
|
def get_default_download_dir():
|
||||||
"""Returns the default download directory"""
|
"""
|
||||||
|
:returns: the default download directory
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
|
"""
|
||||||
if windows_check():
|
if windows_check():
|
||||||
return os.path.expanduser("~")
|
return os.path.expanduser("~")
|
||||||
else:
|
else:
|
||||||
return os.environ.get("HOME")
|
return os.environ.get("HOME")
|
||||||
|
|
||||||
def windows_check():
|
def windows_check():
|
||||||
"""Checks if the current platform is Windows. Returns True if it is Windows
|
"""
|
||||||
and False if not."""
|
Checks if the current platform is Windows
|
||||||
|
|
||||||
|
:returns: True or False
|
||||||
|
:rtype: bool
|
||||||
|
|
||||||
|
"""
|
||||||
return platform.system() in ('Windows', 'Microsoft')
|
return platform.system() in ('Windows', 'Microsoft')
|
||||||
|
|
||||||
def vista_check():
|
def vista_check():
|
||||||
|
"""
|
||||||
|
Checks if the current platform is Windows Vista
|
||||||
|
|
||||||
|
:returns: True or False
|
||||||
|
:rtype: bool
|
||||||
|
|
||||||
|
"""
|
||||||
return platform.release() == "Vista"
|
return platform.release() == "Vista"
|
||||||
|
|
||||||
def osx_check():
|
def osx_check():
|
||||||
|
"""
|
||||||
|
Checks if the current platform is Mac OS X
|
||||||
|
|
||||||
|
:returns: True or False
|
||||||
|
:rtype: bool
|
||||||
|
|
||||||
|
"""
|
||||||
return platform.system() == "Darwin"
|
return platform.system() == "Darwin"
|
||||||
|
|
||||||
def get_pixmap(fname):
|
def get_pixmap(fname):
|
||||||
"""Returns a pixmap file included with deluge"""
|
"""
|
||||||
|
Provides easy access to files in the deluge/data/pixmaps folder within the Deluge egg
|
||||||
|
|
||||||
|
:param fname: the filename to look for
|
||||||
|
:returns: a path to a pixmap file included with Deluge
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
|
"""
|
||||||
return pkg_resources.resource_filename("deluge", os.path.join("data", \
|
return pkg_resources.resource_filename("deluge", os.path.join("data", \
|
||||||
"pixmaps", fname))
|
"pixmaps", fname))
|
||||||
|
|
||||||
def open_file(path):
|
def open_file(path):
|
||||||
"""Opens a file or folder."""
|
"""
|
||||||
|
Opens a file or folder using the system configured program
|
||||||
|
|
||||||
|
:param path: the path to the file or folder to open
|
||||||
|
|
||||||
|
"""
|
||||||
if windows_check():
|
if windows_check():
|
||||||
os.startfile("%s" % path)
|
os.startfile("%s" % path)
|
||||||
else:
|
else:
|
||||||
subprocess.Popen(["xdg-open", "%s" % path])
|
subprocess.Popen(["xdg-open", "%s" % path])
|
||||||
|
|
||||||
def open_url_in_browser(url):
|
def open_url_in_browser(url):
|
||||||
"""Opens link in the desktop's default browser"""
|
"""
|
||||||
|
Opens a url in the desktop's default browser
|
||||||
|
|
||||||
|
:param url: the url to open
|
||||||
|
"""
|
||||||
def start_browser():
|
def start_browser():
|
||||||
import threading
|
import threading
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
@ -153,16 +208,21 @@ def open_url_in_browser(url):
|
||||||
BrowserThread(url).start()
|
BrowserThread(url).start()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
import gobject
|
|
||||||
gobject.idle_add(start_browser)
|
|
||||||
|
|
||||||
|
|
||||||
## Formatting text functions
|
## Formatting text functions
|
||||||
|
|
||||||
def fsize(fsize_b):
|
def fsize(fsize_b):
|
||||||
"""Returns formatted string describing filesize
|
"""
|
||||||
fsize_b should be in bytes
|
Formats the bytes value into a string with KiB, MiB or GiB units
|
||||||
Returned value will be in either KiB, MiB, or GiB
|
|
||||||
|
:param fsize_b: int, the filesize in bytes
|
||||||
|
:returns: formatted string in KiB, MiB or GiB units
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
|
** Usage **
|
||||||
|
|
||||||
|
>>> fsize(112245)
|
||||||
|
'109.6 KiB'
|
||||||
|
|
||||||
"""
|
"""
|
||||||
fsize_kb = fsize_b / 1024.0
|
fsize_kb = fsize_b / 1024.0
|
||||||
if fsize_kb < 1024:
|
if fsize_kb < 1024:
|
||||||
|
@ -174,22 +234,73 @@ def fsize(fsize_b):
|
||||||
return "%.1f GiB" % fsize_gb
|
return "%.1f GiB" % fsize_gb
|
||||||
|
|
||||||
def fpcnt(dec):
|
def fpcnt(dec):
|
||||||
"""Returns a formatted string representing a percentage"""
|
"""
|
||||||
|
Formats a string to display a percentage with two decimal places
|
||||||
|
|
||||||
|
:param dec: float, the ratio in the range [0.0, 1.0]
|
||||||
|
:returns: a formatted string representing a percentage
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
|
** Usage **
|
||||||
|
|
||||||
|
>>> fpcnt(0.9311)
|
||||||
|
'93.11%'
|
||||||
|
|
||||||
|
"""
|
||||||
return '%.2f%%' % (dec * 100)
|
return '%.2f%%' % (dec * 100)
|
||||||
|
|
||||||
def fspeed(bps):
|
def fspeed(bps):
|
||||||
"""Returns a formatted string representing transfer speed"""
|
"""
|
||||||
|
Formats a string to display a transfer speed utilizing :func:`fsize`
|
||||||
|
|
||||||
|
:param bps: int, bytes per second
|
||||||
|
:returns: a formatted string representing transfer speed
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
|
** Usage **
|
||||||
|
|
||||||
|
>>> fspeed(43134)
|
||||||
|
'42.1 KiB/s'
|
||||||
|
|
||||||
|
"""
|
||||||
return '%s/s' % (fsize(bps))
|
return '%s/s' % (fsize(bps))
|
||||||
|
|
||||||
def fpeer(num_peers, total_peers):
|
def fpeer(num_peers, total_peers):
|
||||||
"""Returns a formatted string num_peers (total_peers)"""
|
"""
|
||||||
|
Formats a string to show 'num_peers' ('total_peers')
|
||||||
|
|
||||||
|
:param num_peers: int, the number of connected peers
|
||||||
|
:param total_peers: int, the total number of peers
|
||||||
|
:returns: a formatted string: num_peers (total_peers), if total_peers < 0, then it will not be shown
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
|
** Usage **
|
||||||
|
|
||||||
|
>>> fpeer(10, 20)
|
||||||
|
'10 (20)'
|
||||||
|
>>> fpeer(10, -1)
|
||||||
|
'10'
|
||||||
|
|
||||||
|
"""
|
||||||
if total_peers > -1:
|
if total_peers > -1:
|
||||||
return "%d (%d)" % (num_peers, total_peers)
|
return "%d (%d)" % (num_peers, total_peers)
|
||||||
else:
|
else:
|
||||||
return "%d" % num_peers
|
return "%d" % num_peers
|
||||||
|
|
||||||
def ftime(seconds):
|
def ftime(seconds):
|
||||||
"""Returns a formatted time string"""
|
"""
|
||||||
|
Formats a string to show time in a human readable form
|
||||||
|
|
||||||
|
:param seconds: int, the number of seconds
|
||||||
|
:returns: a formatted time string, will return 'unknown' for values greater than 10 weeks and 'Infinity' if seconds == 0
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
|
** Usage **
|
||||||
|
|
||||||
|
>>> ftime(23011)
|
||||||
|
'6h 23m'
|
||||||
|
|
||||||
|
"""
|
||||||
if seconds == 0:
|
if seconds == 0:
|
||||||
return "Infinity"
|
return "Infinity"
|
||||||
if seconds < 60:
|
if seconds < 60:
|
||||||
|
@ -212,26 +323,63 @@ def ftime(seconds):
|
||||||
return '%dw %dd' % (weeks, days)
|
return '%dw %dd' % (weeks, days)
|
||||||
return 'unknown'
|
return 'unknown'
|
||||||
|
|
||||||
def fdate(value):
|
def fdate(seconds):
|
||||||
"""Returns a date string, eg 05/05/08, given a time in seconds since the Epoch"""
|
"""
|
||||||
if value < 0:
|
Formats a date string in the form of DD/MM/YY based on the systems timezone
|
||||||
|
|
||||||
|
:param seconds: float, time in seconds since the Epoch
|
||||||
|
:returns: a string in the form of DD/MM/YY or "" if seconds < 0
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
|
"""
|
||||||
|
if seconds < 0:
|
||||||
return ""
|
return ""
|
||||||
return time.strftime("%d/%m/%y", time.localtime(value))
|
return time.strftime("%d/%m/%y", time.localtime(seconds))
|
||||||
|
|
||||||
def is_url(url):
|
def is_url(url):
|
||||||
"""A simple regex test to check if the URL is valid."""
|
"""
|
||||||
|
A simple regex test to check if the URL is valid
|
||||||
|
|
||||||
|
:param url: string, the url to test
|
||||||
|
:returns: True or False
|
||||||
|
:rtype: bool
|
||||||
|
|
||||||
|
** Usage **
|
||||||
|
|
||||||
|
>>> is_url("http://deluge-torrent.org")
|
||||||
|
True
|
||||||
|
|
||||||
|
"""
|
||||||
import re
|
import re
|
||||||
return bool(re.search('^(https?|ftp|udp)://', url))
|
return bool(re.search('^(https?|ftp|udp)://', url))
|
||||||
|
|
||||||
def is_magnet(uri):
|
def is_magnet(uri):
|
||||||
"""Returns True if uri is a valid bittorrent magnet uri."""
|
"""
|
||||||
|
A check to determine if a uri is a valid bittorrent magnet uri
|
||||||
|
|
||||||
|
:param uri: string, the uri to check
|
||||||
|
:returns: True or False
|
||||||
|
:rtype: bool
|
||||||
|
|
||||||
|
** Usage **
|
||||||
|
|
||||||
|
>>> is_magnet("magnet:?xt=urn:btih:SU5225URMTUEQLDXQWRB2EQWN6KLTYKN")
|
||||||
|
True
|
||||||
|
|
||||||
|
"""
|
||||||
if uri[:20] == "magnet:?xt=urn:btih:":
|
if uri[:20] == "magnet:?xt=urn:btih:":
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def fetch_url(url):
|
def fetch_url(url):
|
||||||
"""Downloads a torrent file from a given
|
"""
|
||||||
URL and checks the file's validity."""
|
Downloads a torrent file from a given URL and checks the file's validity
|
||||||
|
|
||||||
|
:param url: string, the url of the .torrent file to fetch
|
||||||
|
:returns: the filepath to the downloaded file
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
|
"""
|
||||||
import urllib
|
import urllib
|
||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
try:
|
try:
|
||||||
|
@ -246,23 +394,18 @@ def fetch_url(url):
|
||||||
log.debug("URL doesn't appear to be a valid torrent file: %s", url)
|
log.debug("URL doesn't appear to be a valid torrent file: %s", url)
|
||||||
return None
|
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
|
|
||||||
|
|
||||||
def create_magnet_uri(infohash, name=None, trackers=[]):
|
def create_magnet_uri(infohash, name=None, trackers=[]):
|
||||||
|
"""
|
||||||
|
Creates a magnet uri
|
||||||
|
|
||||||
|
:param infohash: string, the info-hash of the torrent
|
||||||
|
:param name: string, the name of the torrent (optional)
|
||||||
|
:param trackers: list of strings, the trackers to announce to (optional)
|
||||||
|
|
||||||
|
:returns: a magnet uri string
|
||||||
|
:rtype: string
|
||||||
|
|
||||||
|
"""
|
||||||
from base64 import b32encode
|
from base64 import b32encode
|
||||||
uri = "magnet:?xt=urn:btih:" + b32encode(infohash.decode("hex"))
|
uri = "magnet:?xt=urn:btih:" + b32encode(infohash.decode("hex"))
|
||||||
if name:
|
if name:
|
||||||
|
@ -274,8 +417,14 @@ def create_magnet_uri(infohash, name=None, trackers=[]):
|
||||||
return uri
|
return uri
|
||||||
|
|
||||||
def get_path_size(path):
|
def get_path_size(path):
|
||||||
"""Returns the size in bytes of 'path'. If path does not exist, then -1 is
|
"""
|
||||||
returned."""
|
Gets the size in bytes of 'path'
|
||||||
|
|
||||||
|
:param path: string, the path to check for size
|
||||||
|
:returns: the size in bytes of the path or -1 if the path does not exist
|
||||||
|
:rtype: int
|
||||||
|
|
||||||
|
"""
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
|
@ -290,7 +439,14 @@ def get_path_size(path):
|
||||||
return dir_size
|
return dir_size
|
||||||
|
|
||||||
def free_space(path):
|
def free_space(path):
|
||||||
"""returns free space"""
|
"""
|
||||||
|
Gets the free space available at 'path'
|
||||||
|
|
||||||
|
:param path: string, the path to check
|
||||||
|
:returns: the free space at path in bytes
|
||||||
|
:rtype: int
|
||||||
|
|
||||||
|
"""
|
||||||
if windows_check():
|
if windows_check():
|
||||||
import win32api
|
import win32api
|
||||||
drive = path.split(":")[0]
|
drive = path.split(":")[0]
|
||||||
|
@ -302,7 +458,19 @@ def free_space(path):
|
||||||
return disk_data.f_bavail * block_size
|
return disk_data.f_bavail * block_size
|
||||||
|
|
||||||
def is_ip(ip):
|
def is_ip(ip):
|
||||||
"""a simple test to see if we're given a valid ip"""
|
"""
|
||||||
|
A simple test to see if 'ip' is valid
|
||||||
|
|
||||||
|
:param ip: string, the ip to check
|
||||||
|
:returns: True or False
|
||||||
|
:rtype: bool
|
||||||
|
|
||||||
|
** Usage **
|
||||||
|
|
||||||
|
>>> is_ip("127.0.0.1")
|
||||||
|
True
|
||||||
|
|
||||||
|
"""
|
||||||
import socket
|
import socket
|
||||||
#first we test ipv4
|
#first we test ipv4
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -23,4 +23,5 @@ Modules
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
|
modules/common
|
||||||
modules/config
|
modules/config
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
:mod:'deluge.config'
|
:mod:`deluge.config`
|
||||||
====================
|
====================
|
||||||
|
|
||||||
.. automodule:: deluge.config
|
.. automodule:: deluge.config
|
||||||
|
@ -6,3 +6,6 @@
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
|
|
||||||
|
.. automethod:: __setitem__
|
||||||
|
.. automethod:: __getitem__
|
||||||
|
|
|
@ -42,11 +42,19 @@
|
||||||
|
|
||||||
<h1 id="index">Index</h1>
|
<h1 id="index">Index</h1>
|
||||||
|
|
||||||
<a href="#A"><strong>A</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#D"><strong>D</strong></a> | <a href="#G"><strong>G</strong></a> | <a href="#L"><strong>L</strong></a> | <a href="#R"><strong>R</strong></a> | <a href="#S"><strong>S</strong></a>
|
<a href="#_"><strong>_</strong></a> | <a href="#A"><strong>A</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#D"><strong>D</strong></a> | <a href="#F"><strong>F</strong></a> | <a href="#G"><strong>G</strong></a> | <a href="#I"><strong>I</strong></a> | <a href="#L"><strong>L</strong></a> | <a href="#O"><strong>O</strong></a> | <a href="#R"><strong>R</strong></a> | <a href="#S"><strong>S</strong></a> | <a href="#V"><strong>V</strong></a> | <a href="#W"><strong>W</strong></a>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
|
||||||
|
<h2 id="_">_</h2>
|
||||||
|
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
||||||
|
<dl>
|
||||||
|
|
||||||
|
<dt><a href="modules/config.html#deluge.config.Config.__getitem__">__getitem__() (deluge.config.Config method)</a></dt>
|
||||||
|
<dt><a href="modules/config.html#deluge.config.Config.__setitem__">__setitem__() (deluge.config.Config method)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
||||||
|
</dl></td></tr></table>
|
||||||
|
|
||||||
<h2 id="A">A</h2>
|
<h2 id="A">A</h2>
|
||||||
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
||||||
<dl>
|
<dl>
|
||||||
|
@ -58,23 +66,53 @@
|
||||||
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
||||||
<dl>
|
<dl>
|
||||||
|
|
||||||
<dt><a href="modules/config.html#deluge.config.Config">Config (class in deluge.config)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
<dt><a href="modules/config.html#deluge.config.Config">Config (class in deluge.config)</a></dt>
|
||||||
|
<dt><a href="modules/config.html#deluge.config.Config.config">config (deluge.config.Config attribute)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.create_magnet_uri">create_magnet_uri() (in module deluge.common)</a></dt>
|
||||||
</dl></td></tr></table>
|
</dl></td></tr></table>
|
||||||
|
|
||||||
<h2 id="D">D</h2>
|
<h2 id="D">D</h2>
|
||||||
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
||||||
<dl>
|
<dl>
|
||||||
|
|
||||||
|
<dt><a href="modules/common.html#module-deluge.common">deluge.common (module)</a></dt>
|
||||||
<dt><a href="modules/config.html#module-deluge.config">deluge.config (module)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
<dt><a href="modules/config.html#module-deluge.config">deluge.config (module)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
||||||
</dl></td></tr></table>
|
</dl></td></tr></table>
|
||||||
|
|
||||||
|
<h2 id="F">F</h2>
|
||||||
|
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
||||||
|
<dl>
|
||||||
|
|
||||||
|
<dt><a href="modules/common.html#deluge.common.fdate">fdate() (in module deluge.common)</a></dt>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.fetch_url">fetch_url() (in module deluge.common)</a></dt>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.fpcnt">fpcnt() (in module deluge.common)</a></dt>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.fpeer">fpeer() (in module deluge.common)</a></dt>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.free_space">free_space() (in module deluge.common)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.fsize">fsize() (in module deluge.common)</a></dt>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.fspeed">fspeed() (in module deluge.common)</a></dt>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.ftime">ftime() (in module deluge.common)</a></dt>
|
||||||
|
</dl></td></tr></table>
|
||||||
|
|
||||||
<h2 id="G">G</h2>
|
<h2 id="G">G</h2>
|
||||||
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
||||||
<dl>
|
<dl>
|
||||||
|
|
||||||
<dt><a href="modules/config.html#deluge.config.Config.get">get() (deluge.config.Config method)</a></dt>
|
<dt><a href="modules/common.html#deluge.common.get_default_config_dir">get_default_config_dir() (in module deluge.common)</a></dt>
|
||||||
<dt><a href="modules/config.html#deluge.config.Config.get_config">get_config() (deluge.config.Config method)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
<dt><a href="modules/common.html#deluge.common.get_default_download_dir">get_default_download_dir() (in module deluge.common)</a></dt>
|
||||||
<dt><a href="modules/config.html#deluge.config.Config.get_previous_config">get_previous_config() (deluge.config.Config method)</a></dt>
|
<dt><a href="modules/config.html#deluge.config.Config.get_item">get_item() (deluge.config.Config method)</a></dt>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.get_path_size">get_path_size() (in module deluge.common)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.get_pixmap">get_pixmap() (in module deluge.common)</a></dt>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.get_revision">get_revision() (in module deluge.common)</a></dt>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.get_version">get_version() (in module deluge.common)</a></dt>
|
||||||
|
</dl></td></tr></table>
|
||||||
|
|
||||||
|
<h2 id="I">I</h2>
|
||||||
|
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
||||||
|
<dl>
|
||||||
|
|
||||||
|
<dt><a href="modules/common.html#deluge.common.is_ip">is_ip() (in module deluge.common)</a></dt>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.is_magnet">is_magnet() (in module deluge.common)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.is_url">is_url() (in module deluge.common)</a></dt>
|
||||||
</dl></td></tr></table>
|
</dl></td></tr></table>
|
||||||
|
|
||||||
<h2 id="L">L</h2>
|
<h2 id="L">L</h2>
|
||||||
|
@ -84,6 +122,15 @@
|
||||||
<dt><a href="modules/config.html#deluge.config.Config.load">load() (deluge.config.Config method)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
<dt><a href="modules/config.html#deluge.config.Config.load">load() (deluge.config.Config method)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
||||||
</dl></td></tr></table>
|
</dl></td></tr></table>
|
||||||
|
|
||||||
|
<h2 id="O">O</h2>
|
||||||
|
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
||||||
|
<dl>
|
||||||
|
|
||||||
|
<dt><a href="modules/common.html#deluge.common.open_file">open_file() (in module deluge.common)</a></dt>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.open_url_in_browser">open_url_in_browser() (in module deluge.common)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
||||||
|
<dt><a href="modules/common.html#deluge.common.osx_check">osx_check() (in module deluge.common)</a></dt>
|
||||||
|
</dl></td></tr></table>
|
||||||
|
|
||||||
<h2 id="R">R</h2>
|
<h2 id="R">R</h2>
|
||||||
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
||||||
<dl>
|
<dl>
|
||||||
|
@ -97,7 +144,21 @@
|
||||||
<dl>
|
<dl>
|
||||||
|
|
||||||
<dt><a href="modules/config.html#deluge.config.Config.save">save() (deluge.config.Config method)</a></dt>
|
<dt><a href="modules/config.html#deluge.config.Config.save">save() (deluge.config.Config method)</a></dt>
|
||||||
<dt><a href="modules/config.html#deluge.config.Config.set">set() (deluge.config.Config method)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
<dt><a href="modules/config.html#deluge.config.Config.set_item">set_item() (deluge.config.Config method)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
||||||
|
</dl></td></tr></table>
|
||||||
|
|
||||||
|
<h2 id="V">V</h2>
|
||||||
|
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
||||||
|
<dl>
|
||||||
|
|
||||||
|
<dt><a href="modules/common.html#deluge.common.vista_check">vista_check() (in module deluge.common)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
||||||
|
</dl></td></tr></table>
|
||||||
|
|
||||||
|
<h2 id="W">W</h2>
|
||||||
|
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
|
||||||
|
<dl>
|
||||||
|
|
||||||
|
<dt><a href="modules/common.html#deluge.common.windows_check">windows_check() (in module deluge.common)</a></dt></dl></td><td width="33%" valign="top"><dl>
|
||||||
</dl></td></tr></table>
|
</dl></td></tr></table>
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,7 +194,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
© Copyright 2008, Andrew Resch.
|
© Copyright 2008, Andrew Resch.
|
||||||
Last updated on Nov 04, 2008.
|
Last updated on Nov 05, 2008.
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<link rel="index" title="Global index" href="genindex.html" />
|
<link rel="index" title="Global index" href="genindex.html" />
|
||||||
<link rel="search" title="Search" href="search.html" />
|
<link rel="search" title="Search" href="search.html" />
|
||||||
<link rel="top" title="deluge v1.1.0 documentation" href="" />
|
<link rel="top" title="deluge v1.1.0 documentation" href="" />
|
||||||
<link rel="next" title=":mod:’deluge.config’" href="modules/config.html" />
|
<link rel="next" title="deluge.common" href="modules/common.html" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="related">
|
<div class="related">
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
<a href="modindex.html" title="Global Module Index"
|
<a href="modindex.html" title="Global Module Index"
|
||||||
accesskey="M">modules</a> |</li>
|
accesskey="M">modules</a> |</li>
|
||||||
<li class="right" >
|
<li class="right" >
|
||||||
<a href="modules/config.html" title=":mod:’deluge.config’"
|
<a href="modules/common.html" title="deluge.common"
|
||||||
accesskey="N">next</a> |</li>
|
accesskey="N">next</a> |</li>
|
||||||
<li><a href="">deluge v1.1.0 documentation</a> »</li>
|
<li><a href="">deluge v1.1.0 documentation</a> »</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -59,7 +59,10 @@
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h1 id="modules">Modules<a class="headerlink" href="#modules" title="Permalink to this headline">¶</a></h1>
|
<h1 id="modules">Modules<a class="headerlink" href="#modules" title="Permalink to this headline">¶</a></h1>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a class="reference" href="modules/config.html">:mod:’deluge.config’</a></li>
|
<li><a class="reference" href="modules/common.html"><tt class="docutils literal"><span class="pre">deluge.common</span></tt></a></li>
|
||||||
|
</ul>
|
||||||
|
<ul>
|
||||||
|
<li><a class="reference" href="modules/config.html"><tt class="docutils literal"><span class="pre">deluge.config</span></tt></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +84,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h4>Next topic</h4>
|
<h4>Next topic</h4>
|
||||||
<p class="topless"><a href="modules/config.html" title="next chapter">:mod:’deluge.config’</a></p>
|
<p class="topless"><a href="modules/common.html" title="next chapter"><tt class="docutils literal"><span class="pre">deluge.common</span></tt></a></p>
|
||||||
<h3>This Page</h3>
|
<h3>This Page</h3>
|
||||||
<ul class="this-page-menu">
|
<ul class="this-page-menu">
|
||||||
<li><a href="_sources/index.txt">Show Source</a></li>
|
<li><a href="_sources/index.txt">Show Source</a></li>
|
||||||
|
@ -106,14 +109,14 @@
|
||||||
<a href="modindex.html" title="Global Module Index"
|
<a href="modindex.html" title="Global Module Index"
|
||||||
accesskey="M">modules</a> |</li>
|
accesskey="M">modules</a> |</li>
|
||||||
<li class="right" >
|
<li class="right" >
|
||||||
<a href="modules/config.html" title=":mod:’deluge.config’"
|
<a href="modules/common.html" title="deluge.common"
|
||||||
accesskey="N">next</a> |</li>
|
accesskey="N">next</a> |</li>
|
||||||
<li><a href="">deluge v1.1.0 documentation</a> »</li>
|
<li><a href="">deluge v1.1.0 documentation</a> »</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
© Copyright 2008, Andrew Resch.
|
© Copyright 2008, Andrew Resch.
|
||||||
Last updated on Nov 04, 2008.
|
Last updated on Nov 05, 2008.
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -57,6 +57,10 @@
|
||||||
<em></em></td></tr><tr class="cg-1">
|
<em></em></td></tr><tr class="cg-1">
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
|
<a href="modules/common.html#module-deluge.common"><tt class="xref">deluge.common</tt></a></td><td>
|
||||||
|
<em></em></td></tr><tr class="cg-1">
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
<a href="modules/config.html#module-deluge.config"><tt class="xref">deluge.config</tt></a></td><td>
|
<a href="modules/config.html#module-deluge.config"><tt class="xref">deluge.config</tt></a></td><td>
|
||||||
<em></em></td></tr>
|
<em></em></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -91,7 +95,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
© Copyright 2008, Andrew Resch.
|
© Copyright 2008, Andrew Resch.
|
||||||
Last updated on Nov 04, 2008.
|
Last updated on Nov 05, 2008.
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -0,0 +1,614 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<title>deluge.common — deluge v1.1.0 documentation</title>
|
||||||
|
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
var DOCUMENTATION_OPTIONS = {
|
||||||
|
URL_ROOT: '../',
|
||||||
|
VERSION: '1.1.0',
|
||||||
|
COLLAPSE_MODINDEX: false,
|
||||||
|
FILE_SUFFIX: ''
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../_static/interface.js"></script>
|
||||||
|
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||||||
|
<link rel="contents" title="Global table of contents" href="../contents.html" />
|
||||||
|
<link rel="index" title="Global index" href="../genindex.html" />
|
||||||
|
<link rel="search" title="Search" href="../search.html" />
|
||||||
|
<link rel="top" title="deluge v1.1.0 documentation" href="../index.html" />
|
||||||
|
<link rel="next" title="deluge.config" href="config.html" />
|
||||||
|
<link rel="prev" title="Welcome to deluge’s documentation!" href="../index.html" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="related">
|
||||||
|
<h3>Navigation</h3>
|
||||||
|
<ul>
|
||||||
|
<li class="right" style="margin-right: 10px">
|
||||||
|
<a href="../genindex.html" title="General Index"
|
||||||
|
accesskey="I">index</a></li>
|
||||||
|
<li class="right" >
|
||||||
|
<a href="../modindex.html" title="Global Module Index"
|
||||||
|
accesskey="M">modules</a> |</li>
|
||||||
|
<li class="right" >
|
||||||
|
<a href="config.html" title="deluge.config"
|
||||||
|
accesskey="N">next</a> |</li>
|
||||||
|
<li class="right" >
|
||||||
|
<a href="../index.html" title="Welcome to deluge’s documentation!"
|
||||||
|
accesskey="P">previous</a> |</li>
|
||||||
|
<li><a href="../index.html">deluge v1.1.0 documentation</a> »</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="document">
|
||||||
|
<div class="documentwrapper">
|
||||||
|
<div class="bodywrapper">
|
||||||
|
<div class="body">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="section">
|
||||||
|
<h1 id="module-deluge.common"><tt class="xref docutils literal"><span class="pre">deluge.common</span></tt><a class="headerlink" href="#module-deluge.common" title="Permalink to this headline">¶</a></h1>
|
||||||
|
<p>Common functions for various parts of Deluge to use.</p>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.create_magnet_uri">
|
||||||
|
<!--[deluge.common.create_magnet_uri]--><tt class="descclassname">deluge.common.</tt><tt class="descname">create_magnet_uri</tt><big>(</big><em>infohash</em>, <em>name=None</em>, <em>trackers=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#deluge.common.create_magnet_uri" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Creates a magnet uri</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>infohash</em> – string, the info-hash of the torrent</li>
|
||||||
|
<li><em>name</em> – string, the name of the torrent (optional)</li>
|
||||||
|
<li><em>trackers</em> – list of strings, the trackers to announce to (optional)</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a magnet uri string</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.fdate">
|
||||||
|
<!--[deluge.common.fdate]--><tt class="descclassname">deluge.common.</tt><tt class="descname">fdate</tt><big>(</big><em>seconds</em><big>)</big><a class="headerlink" href="#deluge.common.fdate" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Formats a date string in the form of DD/MM/YY based on the systems timezone</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>seconds</em> – float, time in seconds since the Epoch</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a string in the form of DD/MM/YY or “” if seconds < 0</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.fetch_url">
|
||||||
|
<!--[deluge.common.fetch_url]--><tt class="descclassname">deluge.common.</tt><tt class="descname">fetch_url</tt><big>(</big><em>url</em><big>)</big><a class="headerlink" href="#deluge.common.fetch_url" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Downloads a torrent file from a given URL and checks the file’s validity</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>url</em> – string, the url of the .torrent file to fetch</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the filepath to the downloaded file</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.fpcnt">
|
||||||
|
<!--[deluge.common.fpcnt]--><tt class="descclassname">deluge.common.</tt><tt class="descname">fpcnt</tt><big>(</big><em>dec</em><big>)</big><a class="headerlink" href="#deluge.common.fpcnt" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Formats a string to display a percentage with two decimal places</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>dec</em> – float, the ratio in the range [0.0, 1.0]</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a formatted string representing a percentage</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>** Usage **</p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">fpcnt</span><span class="p">(</span><span class="mf">0.9311</span><span class="p">)</span>
|
||||||
|
<span class="go">'93.11%'</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.fpeer">
|
||||||
|
<!--[deluge.common.fpeer]--><tt class="descclassname">deluge.common.</tt><tt class="descname">fpeer</tt><big>(</big><em>num_peers</em>, <em>total_peers</em><big>)</big><a class="headerlink" href="#deluge.common.fpeer" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Formats a string to show ‘num_peers’ (‘total_peers’)</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>num_peers</em> – int, the number of connected peers</li>
|
||||||
|
<li><em>total_peers</em> – int, the total number of peers</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a formatted string: num_peers (total_peers), if total_peers < 0, then it will not be shown</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>** Usage **</p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">fpeer</span><span class="p">(</span><span class="mf">10</span><span class="p">,</span> <span class="mf">20</span><span class="p">)</span>
|
||||||
|
<span class="go">'10 (20)'</span>
|
||||||
|
<span class="gp">>>> </span><span class="n">fpeer</span><span class="p">(</span><span class="mf">10</span><span class="p">,</span> <span class="o">-</span><span class="mf">1</span><span class="p">)</span>
|
||||||
|
<span class="go">'10'</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.free_space">
|
||||||
|
<!--[deluge.common.free_space]--><tt class="descclassname">deluge.common.</tt><tt class="descname">free_space</tt><big>(</big><em>path</em><big>)</big><a class="headerlink" href="#deluge.common.free_space" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Gets the free space available at ‘path’</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>path</em> – string, the path to check</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the free space at path in bytes</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.fsize">
|
||||||
|
<!--[deluge.common.fsize]--><tt class="descclassname">deluge.common.</tt><tt class="descname">fsize</tt><big>(</big><em>fsize_b</em><big>)</big><a class="headerlink" href="#deluge.common.fsize" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Formats the bytes value into a string with KiB, MiB or GiB units</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>fsize_b</em> – int, the filesize in bytes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">formatted string in KiB, MiB or GiB units</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>** Usage **</p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">fsize</span><span class="p">(</span><span class="mf">112245</span><span class="p">)</span>
|
||||||
|
<span class="go">'109.6 KiB'</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.fspeed">
|
||||||
|
<!--[deluge.common.fspeed]--><tt class="descclassname">deluge.common.</tt><tt class="descname">fspeed</tt><big>(</big><em>bps</em><big>)</big><a class="headerlink" href="#deluge.common.fspeed" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Formats a string to display a transfer speed utilizing <a title="deluge.common.fsize" class="reference" href="#deluge.common.fsize"><tt class="xref docutils literal"><span class="pre">fsize()</span></tt></a></p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>bps</em> – int, bytes per second</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a formatted string representing transfer speed</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>** Usage **</p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">fspeed</span><span class="p">(</span><span class="mf">43134</span><span class="p">)</span>
|
||||||
|
<span class="go">'42.1 KiB/s'</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.ftime">
|
||||||
|
<!--[deluge.common.ftime]--><tt class="descclassname">deluge.common.</tt><tt class="descname">ftime</tt><big>(</big><em>seconds</em><big>)</big><a class="headerlink" href="#deluge.common.ftime" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Formats a string to show time in a human readable form</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>seconds</em> – int, the number of seconds</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a formatted time string, will return ‘unknown’ for values greater than 10 weeks and ‘Infinity’ if seconds == 0</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>** Usage **</p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">ftime</span><span class="p">(</span><span class="mf">23011</span><span class="p">)</span>
|
||||||
|
<span class="go">'6h 23m'</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.get_default_config_dir">
|
||||||
|
<!--[deluge.common.get_default_config_dir]--><tt class="descclassname">deluge.common.</tt><tt class="descname">get_default_config_dir</tt><big>(</big><em>filename=None</em><big>)</big><a class="headerlink" href="#deluge.common.get_default_config_dir" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>filename</em> – if None, only the config path is returned, if provided, a path including the filename will be returned</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a file path to the config directory and optional filename</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.get_default_download_dir">
|
||||||
|
<!--[deluge.common.get_default_download_dir]--><tt class="descclassname">deluge.common.</tt><tt class="descname">get_default_download_dir</tt><big>(</big><big>)</big><a class="headerlink" href="#deluge.common.get_default_download_dir" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the default download directory</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">string</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.get_path_size">
|
||||||
|
<!--[deluge.common.get_path_size]--><tt class="descclassname">deluge.common.</tt><tt class="descname">get_path_size</tt><big>(</big><em>path</em><big>)</big><a class="headerlink" href="#deluge.common.get_path_size" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Gets the size in bytes of ‘path’</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>path</em> – string, the path to check for size</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the size in bytes of the path or -1 if the path does not exist</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.get_pixmap">
|
||||||
|
<!--[deluge.common.get_pixmap]--><tt class="descclassname">deluge.common.</tt><tt class="descname">get_pixmap</tt><big>(</big><em>fname</em><big>)</big><a class="headerlink" href="#deluge.common.get_pixmap" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Provides easy access to files in the deluge/data/pixmaps folder within the Deluge egg</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>fname</em> – the filename to look for</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a path to a pixmap file included with Deluge</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.get_revision">
|
||||||
|
<!--[deluge.common.get_revision]--><tt class="descclassname">deluge.common.</tt><tt class="descname">get_revision</tt><big>(</big><big>)</big><a class="headerlink" href="#deluge.common.get_revision" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>The svn revision of the build if available</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the svn revision, or “”</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">string</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.get_version">
|
||||||
|
<!--[deluge.common.get_version]--><tt class="descclassname">deluge.common.</tt><tt class="descname">get_version</tt><big>(</big><big>)</big><a class="headerlink" href="#deluge.common.get_version" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Returns the program version from the egg metadata</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the version of Deluge</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">string</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.is_ip">
|
||||||
|
<!--[deluge.common.is_ip]--><tt class="descclassname">deluge.common.</tt><tt class="descname">is_ip</tt><big>(</big><em>ip</em><big>)</big><a class="headerlink" href="#deluge.common.is_ip" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>A simple test to see if ‘ip’ is valid</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>ip</em> – string, the ip to check</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True or False</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>** Usage **</p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">is_ip</span><span class="p">(</span><span class="s">"127.0.0.1"</span><span class="p">)</span>
|
||||||
|
<span class="go">True</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.is_magnet">
|
||||||
|
<!--[deluge.common.is_magnet]--><tt class="descclassname">deluge.common.</tt><tt class="descname">is_magnet</tt><big>(</big><em>uri</em><big>)</big><a class="headerlink" href="#deluge.common.is_magnet" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>A check to determine if a uri is a valid bittorrent magnet uri</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>uri</em> – string, the uri to check</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True or False</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>** Usage **</p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">is_magnet</span><span class="p">(</span><span class="s">"magnet:?xt=urn:btih:SU5225URMTUEQLDXQWRB2EQWN6KLTYKN"</span><span class="p">)</span>
|
||||||
|
<span class="go">True</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.is_url">
|
||||||
|
<!--[deluge.common.is_url]--><tt class="descclassname">deluge.common.</tt><tt class="descname">is_url</tt><big>(</big><em>url</em><big>)</big><a class="headerlink" href="#deluge.common.is_url" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>A simple regex test to check if the URL is valid</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>url</em> – string, the url to test</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True or False</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>** Usage **</p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">is_url</span><span class="p">(</span><span class="s">"http://deluge-torrent.org"</span><span class="p">)</span>
|
||||||
|
<span class="go">True</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.open_file">
|
||||||
|
<!--[deluge.common.open_file]--><tt class="descclassname">deluge.common.</tt><tt class="descname">open_file</tt><big>(</big><em>path</em><big>)</big><a class="headerlink" href="#deluge.common.open_file" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Opens a file or folder using the system configured program</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><em>path</em> – the path to the file or folder to open</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.open_url_in_browser">
|
||||||
|
<!--[deluge.common.open_url_in_browser]--><tt class="descclassname">deluge.common.</tt><tt class="descname">open_url_in_browser</tt><big>(</big><em>url</em><big>)</big><a class="headerlink" href="#deluge.common.open_url_in_browser" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Opens a url in the desktop’s default browser</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><em>url</em> – the url to open</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.osx_check">
|
||||||
|
<!--[deluge.common.osx_check]--><tt class="descclassname">deluge.common.</tt><tt class="descname">osx_check</tt><big>(</big><big>)</big><a class="headerlink" href="#deluge.common.osx_check" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Checks if the current platform is Mac OS X</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">True or False</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.vista_check">
|
||||||
|
<!--[deluge.common.vista_check]--><tt class="descclassname">deluge.common.</tt><tt class="descname">vista_check</tt><big>(</big><big>)</big><a class="headerlink" href="#deluge.common.vista_check" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Checks if the current platform is Windows Vista</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">True or False</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="deluge.common.windows_check">
|
||||||
|
<!--[deluge.common.windows_check]--><tt class="descclassname">deluge.common.</tt><tt class="descname">windows_check</tt><big>(</big><big>)</big><a class="headerlink" href="#deluge.common.windows_check" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Checks if the current platform is Windows</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">True or False</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sphinxsidebar">
|
||||||
|
<div class="sphinxsidebarwrapper">
|
||||||
|
<h4>Previous topic</h4>
|
||||||
|
<p class="topless"><a href="../index.html" title="previous chapter">Welcome to deluge’s documentation!</a></p>
|
||||||
|
<h4>Next topic</h4>
|
||||||
|
<p class="topless"><a href="config.html" title="next chapter"><tt class="docutils literal"><span class="pre">deluge.config</span></tt></a></p>
|
||||||
|
<h3>This Page</h3>
|
||||||
|
<ul class="this-page-menu">
|
||||||
|
<li><a href="../_sources/modules/common.txt">Show Source</a></li>
|
||||||
|
</ul>
|
||||||
|
<h3>Quick search</h3>
|
||||||
|
<form class="search" action="../search.html" method="get">
|
||||||
|
<input type="text" name="q" size="18" /> <input type="submit" value="Go" />
|
||||||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||||||
|
<input type="hidden" name="area" value="default" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="clearer"></div>
|
||||||
|
</div>
|
||||||
|
<div class="related">
|
||||||
|
<h3>Navigation</h3>
|
||||||
|
<ul>
|
||||||
|
<li class="right" style="margin-right: 10px">
|
||||||
|
<a href="../genindex.html" title="General Index"
|
||||||
|
accesskey="I">index</a></li>
|
||||||
|
<li class="right" >
|
||||||
|
<a href="../modindex.html" title="Global Module Index"
|
||||||
|
accesskey="M">modules</a> |</li>
|
||||||
|
<li class="right" >
|
||||||
|
<a href="config.html" title="deluge.config"
|
||||||
|
accesskey="N">next</a> |</li>
|
||||||
|
<li class="right" >
|
||||||
|
<a href="../index.html" title="Welcome to deluge’s documentation!"
|
||||||
|
accesskey="P">previous</a> |</li>
|
||||||
|
<li><a href="../index.html">deluge v1.1.0 documentation</a> »</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="footer">
|
||||||
|
© Copyright 2008, Andrew Resch.
|
||||||
|
Last updated on Nov 05, 2008.
|
||||||
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -2,7 +2,7 @@
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<title>:mod:’deluge.config’ — deluge v1.1.0 documentation</title>
|
<title>deluge.config — deluge v1.1.0 documentation</title>
|
||||||
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
|
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
<link rel="index" title="Global index" href="../genindex.html" />
|
<link rel="index" title="Global index" href="../genindex.html" />
|
||||||
<link rel="search" title="Search" href="../search.html" />
|
<link rel="search" title="Search" href="../search.html" />
|
||||||
<link rel="top" title="deluge v1.1.0 documentation" href="../index.html" />
|
<link rel="top" title="deluge v1.1.0 documentation" href="../index.html" />
|
||||||
<link rel="prev" title="Welcome to deluge’s documentation!" href="../index.html" />
|
<link rel="prev" title="deluge.common" href="common.html" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="related">
|
<div class="related">
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
<a href="../modindex.html" title="Global Module Index"
|
<a href="../modindex.html" title="Global Module Index"
|
||||||
accesskey="M">modules</a> |</li>
|
accesskey="M">modules</a> |</li>
|
||||||
<li class="right" >
|
<li class="right" >
|
||||||
<a href="../index.html" title="Welcome to deluge’s documentation!"
|
<a href="common.html" title="deluge.common"
|
||||||
accesskey="P">previous</a> |</li>
|
accesskey="P">previous</a> |</li>
|
||||||
<li><a href="../index.html">deluge v1.1.0 documentation</a> »</li>
|
<li><a href="../index.html">deluge v1.1.0 documentation</a> »</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -45,59 +45,200 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h1 id="module-deluge.config">:mod:’deluge.config’<a class="headerlink" href="#module-deluge.config" title="Permalink to this headline">¶</a></h1>
|
<h1 id="module-deluge.config"><tt class="xref docutils literal"><span class="pre">deluge.config</span></tt><a class="headerlink" href="#module-deluge.config" title="Permalink to this headline">¶</a></h1>
|
||||||
<p>Configuration class used to access/create/modify configuration files.</p>
|
<p>Deluge Config Module</p>
|
||||||
<dl class="class">
|
<dl class="class">
|
||||||
<dt id="deluge.config.Config">
|
<dt id="deluge.config.Config">
|
||||||
<!--[deluge.config.Config]-->class <tt class="descclassname">deluge.config.</tt><tt class="descname">Config</tt><big>(</big><em>filename</em>, <em>defaults=None</em>, <em>config_dir=None</em><big>)</big><a class="headerlink" href="#deluge.config.Config" title="Permalink to this definition">¶</a></dt>
|
<!--[deluge.config.Config]-->class <tt class="descclassname">deluge.config.</tt><tt class="descname">Config</tt><big>(</big><em>filename</em>, <em>defaults=None</em>, <em>config_dir=None</em><big>)</big><a class="headerlink" href="#deluge.config.Config" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd><p>This class is used to access configuration files.</p>
|
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">object</span></tt></p>
|
||||||
|
<p>This class is used to access/create/modify config files</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><em>filename</em> – the name of the config file</li>
|
||||||
|
<li><em>defaults</em> – dictionary of default values</li>
|
||||||
|
<li><em>config_dir</em> – the path to the config directory</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<dl class="method">
|
||||||
|
<dt id="deluge.config.Config.__setitem__">
|
||||||
|
<!--[deluge.config.Config.__setitem__]--><tt class="descname">__setitem__</tt><big>(</big><em>key</em>, <em>value</em><big>)</big><a class="headerlink" href="#deluge.config.Config.__setitem__" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd>See
|
||||||
|
<a title="deluge.config.Config.set_item" class="reference" href="#deluge.config.Config.set_item"><tt class="xref docutils literal"><span class="pre">set_item()</span></tt></a></dd></dl>
|
||||||
|
|
||||||
|
<dl class="method">
|
||||||
|
<dt id="deluge.config.Config.__getitem__">
|
||||||
|
<!--[deluge.config.Config.__getitem__]--><tt class="descname">__getitem__</tt><big>(</big><em>key</em><big>)</big><a class="headerlink" href="#deluge.config.Config.__getitem__" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd>See
|
||||||
|
<a title="deluge.config.Config.get_item" class="reference" href="#deluge.config.Config.get_item"><tt class="xref docutils literal"><span class="pre">get_item()</span></tt></a></dd></dl>
|
||||||
|
|
||||||
<dl class="method">
|
<dl class="method">
|
||||||
<dt id="deluge.config.Config.apply_all">
|
<dt id="deluge.config.Config.apply_all">
|
||||||
<!--[deluge.config.Config.apply_all]--><tt class="descname">apply_all</tt><big>(</big><big>)</big><a class="headerlink" href="#deluge.config.Config.apply_all" title="Permalink to this definition">¶</a></dt>
|
<!--[deluge.config.Config.apply_all]--><tt class="descname">apply_all</tt><big>(</big><big>)</big><a class="headerlink" href="#deluge.config.Config.apply_all" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd>Runs all set functions</dd></dl>
|
<dd><p>Calls all set functions</p>
|
||||||
|
<p><strong>Usage</strong></p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">config</span> <span class="o">=</span> <span class="n">Config</span><span class="p">(</span><span class="s">"test.conf"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s">"test"</span><span class="p">:</span> <span class="mf">5</span><span class="p">})</span>
|
||||||
|
<span class="gp">>>> </span><span class="k">def</span> <span class="nf">cb</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
|
||||||
|
<span class="gp">... </span> <span class="k">print</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span>
|
||||||
|
<span class="gp">...</span>
|
||||||
|
<span class="gp">>>> </span><span class="n">config</span><span class="o">.</span><span class="n">register_set_function</span><span class="p">(</span><span class="s">"test"</span><span class="p">,</span> <span class="n">cb</span><span class="p">,</span> <span class="n">apply_now</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
|
||||||
|
<span class="gp">>>> </span><span class="n">config</span><span class="o">.</span><span class="n">apply_all</span><span class="p">()</span>
|
||||||
|
<span class="go">test 5</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="attribute">
|
||||||
|
<dt id="deluge.config.Config.config">
|
||||||
|
<!--[deluge.config.Config.config]--><tt class="descname">config</tt><a class="headerlink" href="#deluge.config.Config.config" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd>The config dictionary</dd></dl>
|
||||||
|
|
||||||
<dl class="method">
|
<dl class="method">
|
||||||
<dt id="deluge.config.Config.get">
|
<dt id="deluge.config.Config.get_item">
|
||||||
<!--[deluge.config.Config.get]--><tt class="descname">get</tt><big>(</big><em>key</em><big>)</big><a class="headerlink" href="#deluge.config.Config.get" title="Permalink to this definition">¶</a></dt>
|
<!--[deluge.config.Config.get_item]--><tt class="descname">get_item</tt><big>(</big><em>key</em><big>)</big><a class="headerlink" href="#deluge.config.Config.get_item" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd>Get the value of ‘key’. If it is an invalid key then get() will
|
<dd><p>Gets the value of item ‘key’</p>
|
||||||
return None.</dd></dl>
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
<dl class="method">
|
<col class="field-body" />
|
||||||
<dt id="deluge.config.Config.get_config">
|
<tbody valign="top">
|
||||||
<!--[deluge.config.Config.get_config]--><tt class="descname">get_config</tt><big>(</big><big>)</big><a class="headerlink" href="#deluge.config.Config.get_config" title="Permalink to this definition">¶</a></dt>
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
<dd>Returns the entire configuration as a dictionary.</dd></dl>
|
<li><em>key</em> – the item for which you want it’s value</li>
|
||||||
|
</ul>
|
||||||
<dl class="method">
|
</td>
|
||||||
<dt id="deluge.config.Config.get_previous_config">
|
</tr>
|
||||||
<!--[deluge.config.Config.get_previous_config]--><tt class="descname">get_previous_config</tt><big>(</big><big>)</big><a class="headerlink" href="#deluge.config.Config.get_previous_config" title="Permalink to this definition">¶</a></dt>
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the value of item ‘key’</p>
|
||||||
<dd>Returns the config prior to the last set()</dd></dl>
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name" colspan="2">Raises KeyError:</th></tr>
|
||||||
|
<tr><td> </td><td class="field-body"><p class="first last">if ‘key’ is not in the config dictionary</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p><strong>Usage</strong></p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">config</span> <span class="o">=</span> <span class="n">Config</span><span class="p">(</span><span class="s">"test.conf"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s">"test"</span><span class="p">:</span> <span class="mf">5</span><span class="p">})</span>
|
||||||
|
<span class="gp">>>> </span><span class="n">config</span><span class="p">[</span><span class="s">"test"</span><span class="p">]</span>
|
||||||
|
<span class="go">5</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="method">
|
<dl class="method">
|
||||||
<dt id="deluge.config.Config.load">
|
<dt id="deluge.config.Config.load">
|
||||||
<!--[deluge.config.Config.load]--><tt class="descname">load</tt><big>(</big><em>filename=None</em><big>)</big><a class="headerlink" href="#deluge.config.Config.load" title="Permalink to this definition">¶</a></dt>
|
<!--[deluge.config.Config.load]--><tt class="descname">load</tt><big>(</big><em>filename=None</em><big>)</big><a class="headerlink" href="#deluge.config.Config.load" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd>Load a config file either by ‘filename’ or the filename set during
|
<dd><p>Load a config file</p>
|
||||||
construction of this object.</dd></dl>
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><em>filename</em> – if None, uses filename set in object initialization</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="method">
|
<dl class="method">
|
||||||
<dt id="deluge.config.Config.register_change_callback">
|
<dt id="deluge.config.Config.register_change_callback">
|
||||||
<!--[deluge.config.Config.register_change_callback]--><tt class="descname">register_change_callback</tt><big>(</big><em>callback</em><big>)</big><a class="headerlink" href="#deluge.config.Config.register_change_callback" title="Permalink to this definition">¶</a></dt>
|
<!--[deluge.config.Config.register_change_callback]--><tt class="descname">register_change_callback</tt><big>(</big><em>callback</em><big>)</big><a class="headerlink" href="#deluge.config.Config.register_change_callback" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd>Registers a callback that will be called when a value is changed</dd></dl>
|
<dd><p>Registers a callback function that will be called when a value is changed in the config dictionary</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><em>callback</em> – the function, callback(key, value)</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p><strong>Usage</strong></p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">config</span> <span class="o">=</span> <span class="n">Config</span><span class="p">(</span><span class="s">"test.conf"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s">"test"</span><span class="p">:</span> <span class="mf">5</span><span class="p">})</span>
|
||||||
|
<span class="gp">>>> </span><span class="k">def</span> <span class="nf">cb</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
|
||||||
|
<span class="gp">... </span> <span class="k">print</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span>
|
||||||
|
<span class="gp">...</span>
|
||||||
|
<span class="gp">>>> </span><span class="n">config</span><span class="o">.</span><span class="n">register_change_callback</span><span class="p">(</span><span class="n">cb</span><span class="p">)</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="method">
|
<dl class="method">
|
||||||
<dt id="deluge.config.Config.register_set_function">
|
<dt id="deluge.config.Config.register_set_function">
|
||||||
<!--[deluge.config.Config.register_set_function]--><tt class="descname">register_set_function</tt><big>(</big><em>key</em>, <em>function</em>, <em>apply_now=True</em><big>)</big><a class="headerlink" href="#deluge.config.Config.register_set_function" title="Permalink to this definition">¶</a></dt>
|
<!--[deluge.config.Config.register_set_function]--><tt class="descname">register_set_function</tt><big>(</big><em>key</em>, <em>function</em>, <em>apply_now=True</em><big>)</big><a class="headerlink" href="#deluge.config.Config.register_set_function" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd>Register a function to be run when a config value changes.</dd></dl>
|
<dd><p>Register a function to be called when a config value changes</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><em>key</em> – the item to monitor for change</li>
|
||||||
|
<li><em>function</em> – the function to call when the value changes, f(key, value)</li>
|
||||||
|
<li><em>apply_now</em> – if True, the function will be called after it’s registered</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p><strong>Usage</strong></p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">config</span> <span class="o">=</span> <span class="n">Config</span><span class="p">(</span><span class="s">"test.conf"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s">"test"</span><span class="p">:</span> <span class="mf">5</span><span class="p">})</span>
|
||||||
|
<span class="gp">>>> </span><span class="k">def</span> <span class="nf">cb</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
|
||||||
|
<span class="gp">... </span> <span class="k">print</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span>
|
||||||
|
<span class="gp">...</span>
|
||||||
|
<span class="gp">>>> </span><span class="n">config</span><span class="o">.</span><span class="n">register_set_function</span><span class="p">(</span><span class="s">"test"</span><span class="p">,</span> <span class="n">cb</span><span class="p">,</span> <span class="n">apply_now</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
|
||||||
|
<span class="go">test 5</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="method">
|
<dl class="method">
|
||||||
<dt id="deluge.config.Config.save">
|
<dt id="deluge.config.Config.save">
|
||||||
<!--[deluge.config.Config.save]--><tt class="descname">save</tt><big>(</big><em>filename=None</em><big>)</big><a class="headerlink" href="#deluge.config.Config.save" title="Permalink to this definition">¶</a></dt>
|
<!--[deluge.config.Config.save]--><tt class="descname">save</tt><big>(</big><em>filename=None</em><big>)</big><a class="headerlink" href="#deluge.config.Config.save" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd>Save configuration to either ‘filename’ or the filename set during
|
<dd><p>Save configuration to disk</p>
|
||||||
construction of this object.</dd></dl>
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><em>filename</em> – if None, uses filename set in object initiliazation</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="method">
|
<dl class="method">
|
||||||
<dt id="deluge.config.Config.set">
|
<dt id="deluge.config.Config.set_item">
|
||||||
<!--[deluge.config.Config.set]--><tt class="descname">set</tt><big>(</big><em>key</em>, <em>value</em><big>)</big><a class="headerlink" href="#deluge.config.Config.set" title="Permalink to this definition">¶</a></dt>
|
<!--[deluge.config.Config.set_item]--><tt class="descname">set_item</tt><big>(</big><em>key</em>, <em>value</em><big>)</big><a class="headerlink" href="#deluge.config.Config.set_item" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd>Set the ‘key’ with ‘value’.</dd></dl>
|
<dd><p>Sets item ‘key’ to ‘value’ in the config dictionary, but does not allow
|
||||||
|
changing the item’s type unless it is None</p>
|
||||||
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
|
<li><em>key</em> – string, item to change to change</li>
|
||||||
|
<li><em>value</em> – the value to change item to, must be same type as what is currently in the config</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name" colspan="2">Raises ValueError:</th></tr>
|
||||||
|
<tr><td> </td><td class="field-body"><p class="first last">raised when the type of value is not the same as what is currently in the config</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p><strong>Usage</strong></p>
|
||||||
|
<div class="highlight"><pre><span class="gp">>>> </span><span class="n">config</span> <span class="o">=</span> <span class="n">Config</span><span class="p">(</span><span class="s">"test.conf"</span><span class="p">)</span>
|
||||||
|
<span class="gp">>>> </span><span class="n">config</span><span class="p">[</span><span class="s">"test"</span><span class="p">]</span> <span class="o">=</span> <span class="mf">5</span>
|
||||||
|
<span class="gp">>>> </span><span class="n">config</span><span class="p">[</span><span class="s">"test"</span><span class="p">]</span>
|
||||||
|
<span class="go">5</span>
|
||||||
|
</pre></div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
|
@ -110,7 +251,7 @@ construction of this object.</dd></dl>
|
||||||
<div class="sphinxsidebar">
|
<div class="sphinxsidebar">
|
||||||
<div class="sphinxsidebarwrapper">
|
<div class="sphinxsidebarwrapper">
|
||||||
<h4>Previous topic</h4>
|
<h4>Previous topic</h4>
|
||||||
<p class="topless"><a href="../index.html" title="previous chapter">Welcome to deluge’s documentation!</a></p>
|
<p class="topless"><a href="common.html" title="previous chapter"><tt class="docutils literal docutils literal docutils literal"><span class="pre">deluge.common</span></tt></a></p>
|
||||||
<h3>This Page</h3>
|
<h3>This Page</h3>
|
||||||
<ul class="this-page-menu">
|
<ul class="this-page-menu">
|
||||||
<li><a href="../_sources/modules/config.txt">Show Source</a></li>
|
<li><a href="../_sources/modules/config.txt">Show Source</a></li>
|
||||||
|
@ -135,14 +276,14 @@ construction of this object.</dd></dl>
|
||||||
<a href="../modindex.html" title="Global Module Index"
|
<a href="../modindex.html" title="Global Module Index"
|
||||||
accesskey="M">modules</a> |</li>
|
accesskey="M">modules</a> |</li>
|
||||||
<li class="right" >
|
<li class="right" >
|
||||||
<a href="../index.html" title="Welcome to deluge’s documentation!"
|
<a href="common.html" title="deluge.common"
|
||||||
accesskey="P">previous</a> |</li>
|
accesskey="P">previous</a> |</li>
|
||||||
<li><a href="../index.html">deluge v1.1.0 documentation</a> »</li>
|
<li><a href="../index.html">deluge v1.1.0 documentation</a> »</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
© Copyright 2008, Andrew Resch.
|
© Copyright 2008, Andrew Resch.
|
||||||
Last updated on Nov 04, 2008.
|
Last updated on Nov 05, 2008.
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
© Copyright 2008, Andrew Resch.
|
© Copyright 2008, Andrew Resch.
|
||||||
Last updated on Nov 04, 2008.
|
Last updated on Nov 05, 2008.
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
[["index","modules/config"],["Welcome to deluge’s documentation!",":mod:’deluge.config’"],{"all":[1],"24":[0],"access":[1],"with":[1],"configur":[1],"should":[0],"to":[0,1],"register_change_callback":[1],"4":[0],"save":[1],"then":[1],"return":[1],"get":[1],"nov":[0],"mod":[0,1],"register_set_funct":[1],"like":[0],"either":[1],"contain":[0],"get_previous_config":[1],"page":[0],"the":[0,1],"set":[1],"direct":[0],"delug":[0,1],"toctre":[0],"config_dir":[1],"index":[0],"06":[0],"content":[0],"adapt":[0],"be":[1],"run":[1],"kei":[1],"entir":[1],"dictionari":[1],"modifi":[1],"by":[0,1],"valu":[1],"on":[0],"search":[0],"last":[1],"of":[1],"prior":[1],"s":[0],"chang":[1],"or":[1],"load":[1],"modul":[0],"8217":[0,1],"filenam":[1],"least":[0],"your":[0],"regist":[1],"construct":[1],"tue":[0],"call":[1],"master":[0],"dure":[1],"function":[1],"that":[1],"but":[0],"apply_al":[1],"true":[1],"none":[1],"default":[1],"18":[0],"us":[1],"will":[1],"can":[0],"root":[0],"and":[0],"quickstart":[0],"creat":[0,1],"is":[1],"it":[0,1],"indic":[0],"an":[1],"as":[1],"at":[0],"file":[0,1],"tabl":[0],"if":[1],"welcom":[0],"when":[1],"invalid":[1],"you":[0],"document":[0],"config":[0,1],"complet":[0],"object":[1],"get_config":[1],"class":[1],"a":[1],"sphinx":[0],"callback":[1],"thi":[0,1],"apply_now":[1],"2008":[0]}]
|
[["index","modules/config","modules/common"],["Welcome to deluge’s documentation!","<tt class=\"docutils literal docutils literal\"><span class=\"pre\">deluge.config</span></tt>","<tt class=\"docutils literal docutils literal\"><span class=\"pre\">deluge.common</span></tt>"],{"is_ip":[2],"all":[1],"least":[0],"get_pixmap":[2],"show":[2],"is":[1,2],"42":[2],"2008":[0],"fpeer":[2],"same":[1],"human":[2],"disk":[1],"dbu":[],"paramet":[1,2],"24":[0],"pixmap":[2],"onli":[2],"ratio":[2],"monitor":[1],"easi":[2],"is_magnet":[2],"name":[1,2],"tt":[1,2],"configur":[1,2],"readabl":[2],"epoch":[2],"should":[0],"to":[0,1,2],"window":[2],"program":[2],"register_change_callback":[1],"4":[0],"bittorr":[2],"folder":[2],"save":[1],"determin":[2],"into":[2],"then":[2],"file":[0,1,2],"liter":[1,2],"return":[1,2],"string":[1,2],"__getitem__":[1],"format":[2],"python":[],"show_other_dialog":[],"pixbuf":[],"initi":[1],"yy":[2],"total_p":[2],"tue":[0],"open_url_in_brows":[2],"base":[1,2],"127":[2],"not":[1,2],"nov":[0],"get_item":[1],"mod":[],"register_set_funct":[1],"like":[0],"docutil":[1,2],"list":[2],"metadata":[2],"is_url":[2],"magnet":[2],"provid":[2],"either":[],"contain":[0],"x":[2],"get_previous_config":[],"refer":[],"fname":[2],"page":[0],"egg":[2],"set":[1],"float":[2],"fsize":[2],"direct":[0],"percentag":[2],"fspeed":[2],"delug":[0,1,2],"connect":[2],"toctre":[0],"download":[2],"logo":[],"simpl":[2],"config_dir":[1],"index":[0],"what":[1],"announc":[2],"06":[0],"for":[1,2],"space":[2],"speed":[2],"per":[2],"18":[0],"current":[1,2],"version":[2],"ftime":[2],"adapt":[0],"print":[1],"get_default_config_dir":[2],"transfer":[2],"content":[0],"open_fil":[2],"common":[0,2],"be":[1,2],"object":[1],"run":[],"kei":[1],"vista_check":[2],"usag":[1,2],"infin":[2],"free":[2],"__setitem__":[1],"109":[2],"bp":[2],"dictionari":[1],"peer":[2],"20":[2],"byte":[2],"modifi":[1],"sinc":[2],"9311":[2],"get_default_download_dir":[2],"on":[0,2],"search":[0],"create_magnet_uri":[2],"last":[],"document":[0],"of":[1,2],"http":[2],"torrent":[2],"prior":[],"s":[0,1,2],"entir":[],"place":[2],"includ":[2],"osx_check":[2],"span":[1,2],"fals":[1,2],"desktop":[2],"chang":[1],"timezon":[2],"infohash":[2],"or":[2],"load":[1],"pre":[1,2],"rang":[2],"decim":[2],"bool":[2],"cb":[1],"modul":[0,1],"within":[2],"number":[2],"8217":[0],"system":[2],"filenam":[1,2],"initiliaz":[1],"num_peer":[2],"platform":[2],"path":[1,2],"total":[2],"open":[2],"your":[0],"xt":[2],"size":[2],"regex":[2],"23011":[2],"given":[2],"fetch_url":[2],"43134":[2],"describ":[],"second":[2],"0":[2],"unknown":[2],"regist":[1],"two":[2],"construct":[],"by":[0],"avail":[2],"master":[0],"valu":[1,2],"basic":[],"var":[],"call":[1],"type":[1,2],"valueerror":[1],"get_vers":[2],"gib":[2],"function":[1,2],"a":[1,2],"from":[2],"tracker":[2],"option":[2],"form":[2],"that":[1],"6h":[2],"fsize_b":[2],"6":[2],"keyerror":[1],"but":[0,1],"back":[],"part":[2],"link":[],"translat":[],"apply_al":[1],"93":[2],"repres":[2],"true":[1,2],"than":[2],"must":[1],"info":[2],"10":[2],"none":[1,2],"look":[2],"f":[1],"mm":[2],"free_spac":[2],"directori":[1,2],"access":[1,2],"displai":[2],"us":[1,2],"windows_check":[2],"will":[1,2],"other":[],"fpcnt":[2],"can":[0],"fdate":[2],"dec":[2],"root":[0],"fetch":[2],"def":[1],"browser":[2],"and":[0,2],"files":[2],"hash":[2],"quickstart":[0],"creat":[0,1,2],"item":[1],"int":[2],"ip":[2],"dure":[],"in":[1,2],"it":[0,1,2],"indic":[0],"an":[],"unit":[2],"exist":[2],"at":[0,2],"conf":[1],"tabl":[0],"revis":[2],"check":[2],"as":[1],"greater":[2],"11":[2],"vista":[2],"variou":[2],"want":[1],"filepath":[2],"mib":[2],"when":[1],"invalid":[],"get_revis":[2],"1":[2],"default":[1,2],"set_item":[1],"valid":[2],"5":[1],"build":[2],"get":[1,2],"test":[1,2],"you":[0,1],"if":[1,2],"config":[0,1,2],"dd":[2],"complet":[0],"week":[2],"23m":[2],"unless":[1],"dialog":[],"see":[1,2],"callback":[1],"org":[2],"after":[1],"112245":[2],"get_logo":[],"mac":[2],"get_config":[],"specifi":[],"thi":[0,1],"date":[2],"kib":[2],"data":[2],"class":[1,2],"shown":[2],"welcom":[0],"svn":[2],"util":[2],"sphinx":[0],"url":[2],"os":[2],"urn":[2],"no":[],"uri":[2],"rais":[1],"doe":[1,2],"btih":[2],"which":[1],"u":[],"su5225urmtueqldxqwrb2eqwn6kltykn":[2],"allow":[1],"time":[2],"apply_now":[1],"the":[0,1,2],"with":[2],"get_path_s":[2]}]
|
|
@ -16,7 +16,7 @@ import sys, os
|
||||||
# If your extensions are in another directory, add it here. If the directory
|
# If your extensions are in another directory, add it here. If the directory
|
||||||
# is relative to the documentation root, use os.path.abspath to make it
|
# is relative to the documentation root, use os.path.abspath to make it
|
||||||
# absolute, like shown here.
|
# absolute, like shown here.
|
||||||
sys.path.append(os.path.abspath(os.path.dirname(__file__ + "../../../")))
|
sys.path.append(os.path.abspath(os.path.dirname(__file__ + "../../")))
|
||||||
|
|
||||||
# General configuration
|
# General configuration
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
|
|
@ -23,4 +23,5 @@ Modules
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
|
modules/common
|
||||||
modules/config
|
modules/config
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
:mod:`deluge.common`
|
||||||
|
====================
|
||||||
|
|
||||||
|
.. automodule:: deluge.common
|
||||||
|
:members:
|
Loading…
Reference in New Issue