~severinh/ubuntu/natty/lottanzb/merge-from-sid

« back to all changes in this revision

Viewing changes to lottanzb/config/sabnzbd/servers.py

  • Committer: Severin Heiniger
  • Date: 2011-02-18 09:11:15 UTC
  • mfrom: (2.1.5 sid)
  • Revision ID: severinheiniger@gmail.com-20110218091115-thdvummkn0ku5w52
* debian/lottanzb.install, debian/icons/*:
  + Add dark and light application icon for the panel menu.
* New upstream release.

* Switch to dpkg-source 3.0 (quilt) format.
* Use debhelper 7 instead of cdbs.
* Use dh_python2 instead of python-support.
* Delete superfluous debian/pyversions and debian/pycompat.

* debian/compat:
  + Bump to debhelper 7.
* debian/control:
  + Change Priority from extra to optional.
  + Replace XS-Python-Version with X-Python-Version and bump it to >= 2.6.
  + Remove cdbs and python-support from Build-Depends.
  + Bump debhelper to >= 7.0.50~ in Build-Depends.
  + Bump python to >= 2.6.6-3 in Build-Depends.
  + Remove python-kiwi, hellanzb and python from Depends.
  + Add python-configobj to Depends.
  + Bump python-gtk2 to >= 2.16 in Depends.
  + Bump yelp to >= 2.30 in Recommends for Mallard support.
  + Add python-apt and apturl to Recommends.
  + Add sabnzbdplus to Suggests.
  + Replace hellanzb with sabnzbdplus in Enhances.
  + Update Description.
* debian/copyright:
  + Make it machine-interpretable according to DEP-5.
  + Remove information for Kiwi code.
  + Update information for help/*.
  + Add information for lottanzb/backend/interface/multipart_post_handler.py.
* debian/lottanzb.lintian-overrides:
  + Override extra-license-file warning for documentation files.
* debian/lottanzb.menu:
  + Update application title.
* debian/patches/lock-file-name.patch:
  + Delete because fixed upstream.
* debian/rules:
  + Install into private directory /usr/share/lottanzb.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2008-2011 LottaNZB Development Team
 
2
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; version 3.
 
6
 
7
# This program is distributed in the hope that it will be useful,
 
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
# GNU General Public License for more details.
 
11
 
12
# You should have received a copy of the GNU General Public License
 
13
# along with this program; if not, write to the Free Software
 
14
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
15
 
 
16
from lottanzb.util.gobject_extras import gproperty
 
17
from lottanzb.config.sabnzbd import ListConfigSection, ListElementConfigSection
 
18
 
 
19
class Config(ListConfigSection):
 
20
    def find_section_class(self, section):
 
21
        return ServerConfig
 
22
 
 
23
class ServerConfig(ListElementConfigSection):
 
24
    username = gproperty(type=str)
 
25
    password = gproperty(type=str)
 
26
    host = gproperty(type=str)
 
27
    port = gproperty(type=int, default=119, minimum=0, maximum=2 ** 16 - 1)
 
28
    enable = gproperty(type=bool, default=True)
 
29
    fillserver = gproperty(type=bool, default=False)
 
30
    connections = gproperty(type=int, default=6, minimum=0, maximum=100)
 
31
    ssl = gproperty(type=bool, default=False)
 
32
    timeout = gproperty(type=int, default=120, minimum=30, maximum=240)
 
33
    optional = gproperty(type=bool, default=False)
 
34
    
 
35
    def set_identifier(self, identifier):
 
36
        # Don't use `str.split' as IPv6 host addresses contain ':'.
 
37
        host, separator, port = identifier.rpartition(":") # @UnusedVariable
 
38
        
 
39
        if port:
 
40
            self.host = host
 
41
            self.port = port
 
42
        else:
 
43
            raise ValueError("Expected an identifier of type 'host:port', "
 
44
                "got %r" % identifier)
 
45
    
 
46
    def get_identifier(self):
 
47
        return "%s:%s" % (self.host, self.port)
 
48
    
 
49
    @property
 
50
    def needs_authentication(self):
 
51
        return bool(self.username and self.password)