1
# Copyright (C) 2008 LottaNZB Development Team
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.
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.
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.
16
from lottanzb.core import App
19
def __init__(self, config):
25
App().backend.connectToHella(*self.get_connection_args())
27
event_map = { "unexpected-disconnect" : self.handle_disconnect }
29
for event, handler in event_map.iteritems():
30
self._signal_ids.append(App().backend.connect(event, handler))
35
App().backend.disconnectFromHella()
37
map(App().backend.disconnect, self._signal_ids)
47
def handle_disconnect(self, backend):
50
def get_connection_args(self):
51
raise NotImplementedError
55
return cls.__module__.split(".")[-1]