def deleteExternalRecorder(self, ext_recorder): timestep('deleteExternalRecorder init') try: self.rec_del(ext_recorder.dbuspath) timestep(config.wyplayer_dbus_record_path_name + ' delete') except BaseException, e: log.debug(str(e))
def stopRec(self): log.info('ExternalRecorder called: stopRec dest => ' + self.dest_uri) timestep('stopRec init') res = 'failed' try: res = self.rec_stop() except BaseException, e: log.debug(str(e))
def startRec(self, source_uri): res = 'failed' self.source_uri = source_uri log.info('ExternalRecorder called: startRec dest => ' + self.dest_uri + 'source => ' + self.source_uri) timestep('startRec init') try: res = self.rec_start(source_uri) except BaseException, e: log.debug(str(e))
def getNewExternalRecorder(self, dest_uri): log.info('ExternalRecorderFactory called: getNewExternalRecorder' + dest_uri) dest_dir = os.path.split(dest_uri[len(URL_PREFIX_REC_TIMESHIFT):])[0] log.debug('dest_dir timeshift ' + dest_dir) os.makedirs(dest_dir) dest_uri = dest_uri + '?cksize=' + str(config.timeshift_chunk_max_size) + '&recsize=' + str(config.max_size_for_timeshift) + '&silent_seek=1' timestep('rec_new_init') try: new_dbuspath = self.rec_new(dest_uri) except BaseException, e: log.debug(str(e)) return False
def appendRecorderToDelete(self, recorder): if not recorder: log.debug('ask to delete a None recorder') dest_uri = recorder.dest_uri ActionDeleteRecorderInstance(self, recorder).execute() if dest_uri: if dest_uri.startswith(URL_PREFIX_REC_TIMESHIFT): folder_path = os.path.split(dest_uri[len(URL_PREFIX_REC_TIMESHIFT):])[0] if config.asynchronous_chunk_removal: AsynchronousAction().appendAction(ActionRemoveFolder(folder_path)) else: log.debug('remove timeshift folder: ' + folder_path) removeFolder(folder_path) timestep('delete_timeshift time')
class ExternalRecorderFactory(object): def __init__(self, wydb): self.wydb = wydb record = wydb.reference(config.wyplayer_dbus_bus_name, config.wyplayer_dbus_record_path_name) self.rec_new = record.method('new', 's', 'o') self.rec_del = record.method('del', 'o', '') self.recorder_to_delete_list = [] def getNewExternalRecorder(self, dest_uri): log.info('ExternalRecorderFactory called: getNewExternalRecorder' + dest_uri) dest_dir = os.path.split(dest_uri[len(URL_PREFIX_REC_TIMESHIFT):])[0] log.debug('dest_dir timeshift ' + dest_dir) os.makedirs(dest_dir) dest_uri = dest_uri + '?cksize=' + str(config.timeshift_chunk_max_size) + '&recsize=' + str(config.max_size_for_timeshift) + '&silent_seek=1' timestep('rec_new_init') try: new_dbuspath = self.rec_new(dest_uri) except BaseException, e: log.debug(str(e)) return False timestep(config.wyplayer_dbus_record_path_name + ' new') log.debug('new_dbuspath= ' + new_dbuspath) reference = self.wydb.reference(config.wyplayer_dbus_bus_name, new_dbuspath) return ExternalRecorder(dest_uri, reference, new_dbuspath)
class ExternalRecorder(object): def __init__(self, dest_uri, wydbus_reference, dbuspath): self.dbuspath = dbuspath self.dest_uri = dest_uri self.source_uri = None self.wydbus_reference = wydbus_reference self.last_size = config.max_size_for_timeshift self.rec_start = wydbus_reference.method('start', 's', 'i') self.rec_stop = wydbus_reference.method('stop', '', 'i') self.set_max_size = wydbus_reference.method('set_max_size', 't', 'i') self.protect_segment = wydbus_reference.method('protect_segment', 't', 'i') return None def startRec(self, source_uri): res = 'failed' self.source_uri = source_uri log.info('ExternalRecorder called: startRec dest => ' + self.dest_uri + 'source => ' + self.source_uri) timestep('startRec init') try: res = self.rec_start(source_uri) except BaseException, e: log.debug(str(e)) timestep('recorder instance: start') log.debug('rec_start result= ' + str(res))
def deleteExternalRecorder(self, ext_recorder): timestep('deleteExternalRecorder init')
# Licenced under Academic Free License version 3.0 # Review WyGui README & LICENSE files for further details. nname: 0 n 0(None)[self.wydb = wydb record = wydb.reference(config.wyplayer_dbus_bus_name, config.wyplayer_dbus_record_path_name) self.rec_new = record.method('new', 's', 'o') self.rec_del = record.method('del', 'o', '') self.recorder_to_delete_list = [] ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb76aff6c>} nname: 199 n 199(None)[timestep(config.wyplayer_dbus_record_path_name + ' new') log.debug('new_dbuspath= ' + new_dbuspath) reference = self.wydb.reference(config.wyplayer_dbus_bus_name, new_dbuspath) return ExternalRecorder(dest_uri, reference, new_dbuspath) ]: i: 136(), 165(), 197(AE) o: nname: 197 n 197(None)[]: i: 155(f) o: 199(AE) nname: 165 n 165(None)[#, e log.debug(str(e))
def setMaxRecSize(self, size): log.info('ExternalRecorde called: setMaxRecSize: ' + str(int(size))) timestep('setMaxRecSize init') self.last_size = int(size) self.set_max_size(int(size)) timestep('recorder instance: set_max_size')
self.dest_uri = dest_uri self.source_uri = None self.wydbus_reference = wydbus_reference self.last_size = config.max_size_for_timeshift self.rec_start = wydbus_reference.method('start', 's', 'i') self.rec_stop = wydbus_reference.method('stop', '', 'i') self.set_max_size = wydbus_reference.method('set_max_size', 't', 'i') self.protect_segment = wydbus_reference.method('protect_segment', 't', 'i') return None ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb776c3ec>} nname: 118 n 118(None)[timestep('recorder instance: start') log.debug('rec_start result= ' + str(res)) ]: i: 59(), 88(), 116(AE) o: nname: 116 n 116(None)[]: i: 78(f) o: 118(AE) nname: 88 n 88(None)[#, e log.debug(str(e)) ]: i: 78(t)