Update of /cvsroot/freevo/freevo/src/record
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29448
Modified Files:
server.py
Log Message:
o send record.list.update when the schedule changes
o try to find a bad bug that causes the recordserver.fxd to be empty
Index: server.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/record/server.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** server.py 11 Dec 2004 16:21:47 -0000 1.27
--- server.py 20 Dec 2004 21:26:15 -0000 1.28
***************
*** 83,90 ****
def __init__(self):
RPCServer.__init__(self, 'recordserver')
config.detect('tvcards', 'channels')
- plugin.init(exclusive = [ 'record' ])
# file to load / save the recordings and favorites
self.fxdfile = sysconfig.datafile('recordserver.fxd')
# get list of best recorder for each channel
self.best_recorder = {}
--- 83,94 ----
def __init__(self):
RPCServer.__init__(self, 'recordserver')
+ self.clients = []
config.detect('tvcards', 'channels')
# file to load / save the recordings and favorites
self.fxdfile = sysconfig.datafile('recordserver.fxd')
+ # load the recordings file
+ self.load(True)
+ # init the recorder
+ plugin.init(exclusive = [ 'record' ])
# get list of best recorder for each channel
self.best_recorder = {}
***************
*** 103,110 ****
self.check_running = False
self.check_needed = False
! # load the recordings file
! self.load(True)
def check_recordings(self):
"""
--- 107,129 ----
self.check_running = False
self.check_needed = False
! # add notify callback
! self.mbus_instance.register_entity_notification(self.__entity_update)
! # check everything
! self.check_favorites()
+ def send_update(self):
+ # send and updated list to the clients
+ try:
+ ret = []
+ for r in self.recordings:
+ ret.append(r.short_list())
+ for c in self.clients:
+ print 'send update', c
+ self.mbus_instance.send_event(c, 'record.list.update', ret)
+ except:
+ log.exception('send_update')
+
+
def check_recordings(self):
"""
***************
*** 164,168 ****
info += '%s\n' % f
log.info(info)
! log.info('next ids: record=%s favorite=%s' % (self.rec_id,
self.fav_id))
# save status
--- 183,188 ----
info += '%s\n' % f
log.info(info)
! log.info('next ids: record=%s favorite=%s' % \
! (self.rec_id, self.fav_id))
# save status
***************
*** 177,180 ****
--- 197,203 ----
(float(int((time.time() - ctime) * 100)) / 100))
+ # send update
+ self.send_update()
+
# check if something requested a new check while this function was
# running. If so, call the check_recordings functions again
***************
*** 182,185 ****
--- 205,209 ----
if self.check_needed:
self.check_recordings()
+
return False
***************
*** 267,271 ****
for f in self.favorites:
f.id = self.favorites.index(f)
- self.check_favorites()
--- 291,294 ----
***************
*** 274,287 ****
save the fxd file
"""
! if os.path.isfile(self.fxdfile):
! os.unlink(self.fxdfile)
! fxd = util.fxdparser.FXD(self.fxdfile)
! for r in self.recordings:
! fxd.add(r)
! for r in self.favorites:
! fxd.add(r)
! fxd.save()
#
# home.theatre.recording rpc commands
--- 297,324 ----
save the fxd file
"""
! if not len(self.recordings) and not len(self.favorites):
! # do not save here, it is a bug I havn't found yet
! log.info('do not save fxd file')
! return
! try:
! log.info('save fxd file')
! if os.path.isfile(self.fxdfile):
! os.unlink(self.fxdfile)
! fxd = util.fxdparser.FXD(self.fxdfile)
! for r in self.recordings:
! fxd.add(r)
! for r in self.favorites:
! fxd.add(r)
! fxd.save()
! except:
! log.exception('lost the recordings.fxd, send me the trace')
+
+ def __entity_update(self, entity):
+ if not entity.present and entity in self.clients:
+ log.info('lost client %s' % entity)
+ self.client.remove(entity)
+
#
# home.theatre.recording rpc commands
***************
*** 293,296 ****
--- 330,336 ----
result: [ ( id channel priority start stop status ) (...) ]
"""
+ if not addr in self.clients:
+ log.info('add client %s' % addr)
+ self.clients.append(addr)
self.parse_parameter(val, () )
ret = []
***************
*** 432,435 ****
--- 472,478 ----
"""
"""
+ if not addr in self.clients:
+ log.info('add client %s' % addr)
+ self.clients.append(addr)
self.parse_parameter(val, () )
ret = []
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog