1 #!/usr/bin/env python2.5
4 # Copyright (c) 2007-2008 INdT.
5 # Copyright (c) 2011 Neal H. Walfield
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Lesser General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # ============================================================================
22 # Author : Yves Marcoz
24 # Description : Simple RSS Reader
25 # ============================================================================
29 logger = logging.getLogger(__name__)
31 _update_server_object = None
32 def update_server_object():
33 global _update_server_object
34 assert _update_server_object is not None, \
35 "No UpdateServerObject instantiated!"
36 return _update_server_object
38 class UpdateServerObject(dbus.service.Object):
39 def __init__(self, bus_name):
41 Start listening for requests.
43 global _update_server_object
44 assert _update_server_object is None, \
45 "Attempt to instantiate multiple UpdateServerObject objects."
46 _update_server_object = self
48 dbus.service.Object.__init__(self, bus_name,
49 '/org/marcoz/feedingit/update')
51 @dbus.service.method('org.marcoz.feedingit')
53 logger.debug("Stop update called.")
55 @dbus.service.method('org.marcoz.feedingit')
57 logger.debug("UpdateAll called.")
59 @dbus.service.method('org.marcoz.feedingit', in_signature='s')
60 def Update(self, feed):
61 logger.debug("Update(%s) called." % feed)
63 # A signal that will be exported to dbus
64 @dbus.service.signal('org.marcoz.feedingit', signature='')
65 def ArticleCountUpdated(self):
68 # A signal that will be exported to dbus
69 @dbus.service.signal('org.marcoz.feedingit', signature='uuuuttus')
70 def UpdateProgress(self, percent_complete,
71 feeds_downloaded, feeds_downloading, feeds_pending,
72 bytes_downloaded, bytes_uploaded, bytes_per_second,
76 # A signal that will be exported to dbus
77 @dbus.service.signal('org.marcoz.feedingit', signature='')
78 def UpdateStarted(self):
81 # A signal that will be exported to dbus
82 @dbus.service.signal('org.marcoz.feedingit', signature='')
83 def UpdateFinished(self):