From: Dirk M. <di...@fr...> - 2005-09-25 17:56:50
|
Author: dmeyer Date: Sun Sep 25 17:56:26 2005 New Revision: 7697 Removed: trunk/freevo/src/record/plugins/ Modified: trunk/freevo/freevo_config.py trunk/freevo/src/record/recording.py trunk/freevo/src/record/server.py Log: Move fxd generation and thumbnailing back into the server. Since the recorder are also external now, plugin support is not needed anymore. Modified: trunk/freevo/freevo_config.py ============================================================================== --- trunk/freevo/freevo_config.py (original) +++ trunk/freevo/freevo_config.py Sun Sep 25 17:56:26 2005 @@ -425,13 +425,6 @@ # show some messages on the screen plugin.activate('tiny_osd') -# For recording tv -# - -plugin.activate('record.fxdfile') -plugin.activate('record.thumbnail') - - # # Use ivtv_record instead if you have an ivtv based card (PVR-250/350) # and want freevo to do everthing for you. To use you need to set the Modified: trunk/freevo/src/record/recording.py ============================================================================== --- trunk/freevo/src/record/recording.py (original) +++ trunk/freevo/src/record/recording.py Sun Sep 25 17:56:26 2005 @@ -37,9 +37,11 @@ import copy import re import logging +import os # freevo imports import util.fxdparser as fxdparser +from util.fxdimdb import FxdImdb, makeVideo # record imports from record_types import * @@ -266,4 +268,39 @@ if self.scheduled_recorder: self.scheduled_recorder.remove(self) self.scheduled_recorder = None + + def create_fxd(self): + """ + Create a fxd file for the recording. + """ + if not self.url.startswith('file:'): + return + filename = self.url[5:] + + fxd = FxdImdb() + (filebase, fileext) = os.path.splitext(filename) + fxd.setFxdFile(filebase, overwrite = True) + + video = makeVideo('file', 'f1', os.path.basename(filename)) + fxd.setVideo(video) + if self.episode: + fxd.info['episode'] = fxd.str2XML(self.episode) + if self.subtitle: + fxd.info['subtitle'] = fxd.str2XML(self.subtitle) + elif self.subtitle: + fxd.info['tagline'] = fxd.str2XML(self.subtitle) + if self.description: + fxd.info['plot'] = fxd.str2XML(self.description) + for i in self.info: + fxd.info[i] = fxd.str2XML(self.info[i]) + + fxd.info['runtime'] = '%s min.' % int((self.stop - self.start) / 60) + fxd.info['record-start'] = str(int(time.time())) + fxd.info['record-stop'] = str(self.stop + self.stop_padding) + fxd.info['year'] = time.strftime('%m-%d %H:%M', time.localtime(self.start)) + if self.fxdname: + fxd.title = self.fxdname + else: + fxd.title = self.name + fxd.writeFxd() Modified: trunk/freevo/src/record/server.py ============================================================================== --- trunk/freevo/src/record/server.py (original) +++ trunk/freevo/src/record/server.py Sun Sep 25 17:56:26 2005 @@ -41,19 +41,18 @@ # kaa.epg import kaa.epg +import kaa.thumb from kaa.notifier import Timer, OneShotTimer # freevo imports import sysconfig import config import util.fxdparser -import plugin # mbus support from mcomm import RPCServer, RPCError, RPCReturn # record imports -import plugins import recorder from record_types import * @@ -68,8 +67,7 @@ class RecordServer(RPCServer): """ Class for the recordserver. It handles the rpc calls and checks the - schedule for recordings and favorites. The recordings itself are - done by plugins in record/plugins. + schedule for recordings and favorites. """ LIVE_TV_ID = 0 @@ -85,9 +83,6 @@ channel.port = port + index channel.registered = [] - # init the recorder, start only 'record.' plugins - plugin.init(os.environ['FREEVO_PYTHON'], plugins = [ 'record' ]) - # file to load / save the recordings and favorites self.fxdfile = sysconfig.datafile('recordserver.fxd') # load the recordings file @@ -436,9 +431,8 @@ recording.status = RECORDING # send update to mbus entities self.send_update([recording.short_list()]) - # call plugins - for p in plugins.list: - p.start_recording(recording) + # create fxd file + recording.create_fxd() # print some debug self.print_schedule() @@ -452,9 +446,17 @@ filename = recording.url[5:] if os.path.isfile(filename): recording.status = SAVED + # create thumbnail + kaa.thumb.videothumb(filename) else: log.info('failed: file not found %s' % recording.url) recording.status = FAILED + # Without a recording file, the fxd file is useless + fxdfile = os.path.splitext(filename)[0] + '.fxd' + if os.path.isfile(fxdfile): + # fxd file must be in real not in overlay dir, without + # that, the recorder couldn't even store the file + os.unlink(fxdfile) else: recording.status = SAVED @@ -465,9 +467,6 @@ recording.status = FAILED # send update to mbus entities self.send_update([recording.short_list()]) - # call plugins - for p in plugins.list: - OneShotTimer(p.stop_recording, recording).start(10) # print some debug self.print_schedule() |