Skip to content
Browse files

adjust to latest kaa changes

git-svn-id: svn://svn.freevo.org/freevo/trunk/tvserver@11627 cc3e1ea1-1e01-0410-8d68-8b121e83a9d5
  • Loading branch information...
1 parent 5ba8857 commit f86a10e45b95e1beff3b2448986715a5e0c922e3 @Dischi Dischi committed Aug 30, 2009
Showing with 22 additions and 16 deletions.
  1. +5 −8 bin/tvserver
  2. +12 −7 src/devices/plugins/dvbstreamer.py
  3. +2 −0 src/devices/system.py
  4. +1 −1 src/scheduler/config.cxml
  5. +2 −0 src/scheduler/controller.py
View
13 bin/tvserver
@@ -7,7 +7,7 @@
#
# -----------------------------------------------------------------------------
# TVServer - A generic TV device wrapper and scheduler
-# Copyright (C) 2004-2008 Dirk Meyer, et al.
+# Copyright (C) 2004-2009 Dirk Meyer, et al.
#
# Maintainer: Dirk Meyer <dischi@freevo.org>
#
@@ -54,10 +54,6 @@ if os.path.dirname(__file__) in sys.path:
import kaa
import kaa.utils
-print 'This code is broken right now and needs to be adjusted to the'
-print 'latest kaa.base.Process changes. All plugins need to be updated.'
-sys.exit(0)
-
def usage(error_code):
print 'tvserver [options]'
print 'options:'
@@ -152,7 +148,7 @@ log.addHandler(handler)
if scheduler:
import tvserver.scheduler
# load config file
- tvserver.scheduler.config.load('/etc/scheduler.conf')
+ tvserver.scheduler.config.load('/etc/tvserver/scheduler.conf')
# if started as user add personal config file
if os.getuid() > 0:
cfgdir = os.path.expanduser('~/.tvserver')
@@ -162,7 +158,7 @@ if scheduler:
if devices:
import tvserver.devices
# load config file
- tvserver.devices.config.load('/etc/devices.conf')
+ tvserver.devices.config.load('/etc/tvserver/devices.conf')
# if started as user add personal config file
if os.getuid() > 0:
cfgdir = os.path.expanduser('~/.tvserver')
@@ -186,10 +182,11 @@ kaa.utils.set_running('tvserver')
# set additional debug
logging.getLogger('tvserver').setLevel(logging.DEBUG)
logging.getLogger('epg').setLevel(logging.INFO)
+logging.getLogger().setLevel(logging.DEBUG)
# start tvserver
if scheduler:
- datafile = '/etc/schedule.xml'
+ datafile = '/var/lib/tvserver/schedule.xml'
if os.getuid() > 0:
datafile = os.path.expanduser('~/.tvserver/schedule.xml')
tvserver.scheduler.init(datafile)
View
19 src/devices/plugins/dvbstreamer.py
@@ -6,7 +6,7 @@
#
# -----------------------------------------------------------------------------
# TVServer - A generic TV device wrapper and scheduler
-# Copyright (C) 2008 Dirk Meyer, et al.
+# Copyright (C) 2008-2009 Dirk Meyer, et al.
#
# First Edition: Dirk Meyer <dischi@freevo.org>
# Maintainer: Dirk Meyer <dischi@freevo.org>
@@ -55,8 +55,9 @@ def __init__(self, config):
self._callback = None
self._requests = []
self.dvbstreamer = kaa.Process('dvbstreamer')
- self.dvbstreamer.signals['raw-stdout'].connect(self._read)
- self.dvbstreamer.signals['completed'].connect(self._dvbstreamer_died)
+ self.dvbstreamer.signals['read'].connect(self._read)
+ self.dvbstreamer.signals['finished'].connect(self._dvbstreamer_died)
+ self.dvbstreamer.stop_command = 'quit'
self._ready = False
self._busy = True
self._current_multiplex = None
@@ -98,6 +99,9 @@ def _dvbstreamer_init(self):
continue
attr, value = line.split(':', 1)
service[attr.strip()] = value.strip()
+ if not service:
+ log.error('invalid service %s: %s', service_id, info)
+ continue
if service['Name'] in self.channels:
continue
if not service.get('Multiplex UID'):
@@ -134,8 +138,7 @@ def idle(self):
self._epg_counter += 1
if self._epg_counter < 0:
# no need to scan again, check tuner status
- if not self._recordings and self.dvbstreamer.in_progress and \
- not self.dvbstreamer.stopping:
+ if not self._recordings and self.dvbstreamer.running and not self.dvbstreamer.stopping:
if self._busy:
# mark as not busy
self._busy = False
@@ -162,9 +165,11 @@ def _call(self, cmd):
self._busy = True
log.debug('cmd %s', cmd)
if self.dvbstreamer.stopping:
- yield self.dvbstreamer.in_progress
- if not self.dvbstreamer.in_progress:
+ log.info('waiting for dvbstreamer to be stopped')
+ yield kaa.inprogress(self.dvbstreamer)
+ if not self.dvbstreamer.running:
# FIXME: this only works up to dvb9 but that should be enough
+ log.info('starting dvbstreamer')
self.dvbstreamer.start(['-a', self.config.adapter[-1]])
async = kaa.InProgress()
if self._ready:
View
2 src/devices/system.py
@@ -92,8 +92,10 @@ def get_devices():
else:
log.info('skipping %s' % i.device)
continue
+ log.info('activate %s' % i.device)
exec('from plugins.%s import Plugin' % i.plugin)
device = Plugin(i)
yield device.initialized
+ log.info('device %s ready' % i.device)
_devices.append(device)
yield _devices
View
2 src/scheduler/config.cxml
@@ -41,7 +41,7 @@
</group>
<code>
import kaa.epg
- for cfg in kaa.epg.update.config.get_variables():
+ for cfg in kaa.epg.update.config.variables:
config.epg.add_variable(cfg, kaa.epg.update.config._cfg_get(cfg))
</code>
</config>
View
2 src/scheduler/controller.py
@@ -203,6 +203,8 @@ def save_schedule(self):
r.__xml__(xml)
for f in self.favorites:
f.__xml__(xml)
+ if not os.path.isdir(os.path.dirname(self.datafile)):
+ os.makedirs(os.path.dirname(self.datafile))
xml.save(self.datafile)
#

0 comments on commit f86a10e

Please sign in to comment.
Something went wrong with that request. Please try again.