deluge/docs/build/html/modules/common.html

561 lines
26 KiB
HTML
Raw Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2009-07-20 09:09:53 +00:00
"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" />
2009-07-20 09:09:53 +00:00
<title>deluge.common &mdash; deluge v1.2.0-dev 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 = {
2009-07-20 09:09:53 +00:00
URL_ROOT: '../',
VERSION: '1.2.0-dev',
2009-07-20 09:09:53 +00:00
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="deluge v1.2.0-dev documentation" href="../index.html" />
<link rel="next" title="deluge.config" href="config.html" />
<link rel="prev" title="Deluge Console UI" href="../interfaces/console.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="../interfaces/console.html" title="Deluge Console UI"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">deluge v1.2.0-dev documentation</a> &raquo;</li>
</ul>
2009-07-20 09:09:53 +00:00
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
2009-07-20 09:09:53 +00:00
<div class="section" id="module-deluge.common">
<h1><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">
2009-07-20 09:09:53 +00:00
<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> &#8211; string, the info-hash of the torrent</li>
<li><em>name</em> &#8211; string, the name of the torrent (optional)</li>
<li><em>trackers</em> &#8211; 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">
2009-07-20 09:09:53 +00:00
<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 locale&#8217;s date representation 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">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>seconds</em> &#8211; float, time in seconds since the Epoch</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a string in the locale&#8217;s date representation or &#8220;&#8221; if seconds &lt; 0</td>
</tr>
2009-07-20 09:09:53 +00:00
<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.fetch_url">
2009-07-20 09:09:53 +00:00
<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&#8217;s validity</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>url</em> &#8211; string, the url of the .torrent file to fetch</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the filepath to the downloaded file</td>
</tr>
2009-07-20 09:09:53 +00:00
<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.fpcnt">
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>dec</em> &#8211; float, the ratio in the range [0.0, 1.0]</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a formatted string representing a percentage</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
2008-11-08 06:13:40 +00:00
<p><strong>Usage</strong></p>
2009-07-20 09:09:53 +00:00
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">fpcnt</span><span class="p">(</span><span class="mf">0.9311</span><span class="p">)</span>
<span class="go">&#39;93.11%&#39;</span>
</pre></div>
2009-07-20 09:09:53 +00:00
</div>
</dd></dl>
<dl class="function">
<dt id="deluge.common.fpeer">
2009-07-20 09:09:53 +00:00
<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 &#8216;num_peers&#8217; (&#8216;total_peers&#8217;)</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> &#8211; int, the number of connected peers</li>
<li><em>total_peers</em> &#8211; 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 &lt; 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>
2008-11-08 06:13:40 +00:00
<p><strong>Usage</strong></p>
2009-07-20 09:09:53 +00:00
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </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">&#39;10 (20)&#39;</span>
<span class="gp">&gt;&gt;&gt; </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">&#39;10&#39;</span>
</pre></div>
2009-07-20 09:09:53 +00:00
</div>
</dd></dl>
<dl class="function">
<dt id="deluge.common.free_space">
2009-07-20 09:09:53 +00:00
<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 &#8216;path&#8217;</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>path</em> &#8211; string, the path to check</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the free space at path in bytes</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">int</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="deluge.common.fsize">
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>fsize_b</em> &#8211; int, the filesize in bytes</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">formatted string in KiB, MiB or GiB units</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
2008-11-08 06:13:40 +00:00
<p><strong>Usage</strong></p>
2009-07-20 09:09:53 +00:00
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">fsize</span><span class="p">(</span><span class="mf">112245</span><span class="p">)</span>
<span class="go">&#39;109.6 KiB&#39;</span>
</pre></div>
2009-07-20 09:09:53 +00:00
</div>
</dd></dl>
<dl class="function">
<dt id="deluge.common.fspeed">
2009-07-20 09:09:53 +00:00
<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 internal" 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">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>bps</em> &#8211; int, bytes per second</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a formatted string representing transfer speed</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
2008-11-08 06:13:40 +00:00
<p><strong>Usage</strong></p>
2009-07-20 09:09:53 +00:00
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">fspeed</span><span class="p">(</span><span class="mf">43134</span><span class="p">)</span>
<span class="go">&#39;42.1 KiB/s&#39;</span>
</pre></div>
2009-07-20 09:09:53 +00:00
</div>
</dd></dl>
<dl class="function">
<dt id="deluge.common.ftime">
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>seconds</em> &#8211; int, the number of seconds</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a formatted time string, will return &#8216;&#8217; if seconds == 0</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
2008-11-08 06:13:40 +00:00
<p><strong>Usage</strong></p>
2009-07-20 09:09:53 +00:00
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">ftime</span><span class="p">(</span><span class="mf">23011</span><span class="p">)</span>
<span class="go">&#39;6h 23m&#39;</span>
</pre></div>
2009-07-20 09:09:53 +00:00
</div>
</dd></dl>
<dl class="function">
<dt id="deluge.common.get_default_config_dir">
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>filename</em> &#8211; if None, only the config path is returned, if provided, a path including the filename will be returned</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a file path to the config directory and optional filename</td>
</tr>
2009-07-20 09:09:53 +00:00
<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_default_download_dir">
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<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 &#8216;path&#8217;</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>path</em> &#8211; string, the path to check for size</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the size in bytes of the path or -1 if the path does not exist</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">int</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="deluge.common.get_pixmap">
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>fname</em> &#8211; the filename to look for</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a path to a pixmap file included with Deluge</td>
</tr>
2009-07-20 09:09:53 +00:00
<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_revision">
2009-07-20 09:09:53 +00:00
<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 &#8220;&#8221;</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">
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<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 &#8216;ip&#8217; is valid</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>ip</em> &#8211; string, the ip to check</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">True or False</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
</tr>
</tbody>
</table>
<p>** Usage **</p>
2009-07-20 09:09:53 +00:00
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">is_ip</span><span class="p">(</span><span class="s">&quot;127.0.0.1&quot;</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
2009-07-20 09:09:53 +00:00
</div>
</dd></dl>
<dl class="function">
<dt id="deluge.common.is_magnet">
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>uri</em> &#8211; string, the uri to check</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">True or False</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
</tr>
</tbody>
</table>
2008-11-08 06:13:40 +00:00
<p><strong>Usage</strong></p>
2009-07-20 09:09:53 +00:00
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">is_magnet</span><span class="p">(</span><span class="s">&quot;magnet:?xt=urn:btih:SU5225URMTUEQLDXQWRB2EQWN6KLTYKN&quot;</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
2009-07-20 09:09:53 +00:00
</div>
</dd></dl>
<dl class="function">
<dt id="deluge.common.is_url">
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>url</em> &#8211; string, the url to test</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">True or False</td>
</tr>
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
</tr>
</tbody>
</table>
2008-11-08 06:13:40 +00:00
<p><strong>Usage</strong></p>
2009-07-20 09:09:53 +00:00
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">is_url</span><span class="p">(</span><span class="s">&quot;http://deluge-torrent.org&quot;</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
2009-07-20 09:09:53 +00:00
</div>
</dd></dl>
<dl class="function">
<dt id="deluge.common.open_file">
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>path</em> &#8211; the path to the file or folder to open</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="deluge.common.open_url_in_browser">
2009-07-20 09:09:53 +00:00
<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&#8217;s default browser</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
2009-07-20 09:09:53 +00:00
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>url</em> &#8211; the url to open</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="deluge.common.osx_check">
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<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="../interfaces/console.html"
title="previous chapter">Deluge Console UI</a></p>
<h4>Next topic</h4>
2009-07-20 09:09:53 +00:00
<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">
2009-07-20 09:09:53 +00:00
<li><a href="../_sources/modules/common.txt"
rel="nofollow">Show Source</a></li>
</ul>
2009-07-20 09:09:53 +00:00
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
2009-07-20 09:09:53 +00:00
<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>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</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"
2009-07-20 09:09:53 +00:00
>index</a></li>
<li class="right" >
<a href="../modindex.html" title="Global Module Index"
2009-07-20 09:09:53 +00:00
>modules</a> |</li>
<li class="right" >
<a href="config.html" title="deluge.config"
2009-07-20 09:09:53 +00:00
>next</a> |</li>
<li class="right" >
<a href="../interfaces/console.html" title="Deluge Console UI"
2009-07-20 09:09:53 +00:00
>previous</a> |</li>
<li><a href="../index.html">deluge v1.2.0-dev documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2008, Andrew Resch.
2009-07-20 09:09:53 +00:00
Last updated on Jul 20, 2009.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
</div>
</body>
</html>