コード例 #1
0
    def run(self):
        if self.checker is not None:
            if self.checker() is not True:
                self.log.info("Check falsed for action %s" % self.action)
                return
        self.log.debug("Caching %s" % self.action)

        #TODO: QtConcurrent.run
        cache_audio = []
        for path in self.action.get_audio(get_libraries()):
            cacher = cacheutils.CacheCopy(path)
            cacher.run()
            cache_audio.append(cacheutils.AudioCacheFile(cacher.path))
            self.cachedFile.emit(path)
        b = Bell(self.time, cache_audio)
        self.ready.emit(b)
コード例 #2
0
ファイル: controller.py プロジェクト: boyska/tamarradio
    app.connect(app, QtCore.SIGNAL('really_run()'), _c.start)


def parse_options(args):
    # TODO: move to argparse
    opts = {'config': []}
    if len(args) > 1:
        opts['config'].append(args[1])
    return opts


if __name__ == '__main__':
    import sys
    #logging.basicConfig(filename=None, level=logging.DEBUG)
    opts = parse_options(sys.argv)
    log.ColoredLogger.default_level = logging.DEBUG
    logger.info('start')
    app = Tamarradio(sys.argv)
    app.connect(app, QtCore.SIGNAL('start_app()'), main)
    get_config().from_pyfile("default_config.py")
    get_config().from_pyfile("/etc/tamarradio/player.cfg", silent=True)
    for configfile in opts['config']:
        get_config().from_pyfile(configfile)
    for d in get_config()['LIBRARIES_PATH']:
        get_libraries().update(find_libraries(d))

    signal.signal(signal.SIGINT, lambda *args: app.quit())
    ret = app.exec_()
    logger.info('end %d' % ret)
    sys.exit(ret)
コード例 #3
0
ファイル: controller.py プロジェクト: boyska/tamarradio
    app.connect(app, QtCore.SIGNAL('really_run()'), _c.start)


def parse_options(args):
    # TODO: move to argparse
    opts = {'config': []}
    if len(args) > 1:
        opts['config'].append(args[1])
    return opts


if __name__ == '__main__':
    import sys
    #logging.basicConfig(filename=None, level=logging.DEBUG)
    opts = parse_options(sys.argv)
    log.ColoredLogger.default_level = logging.DEBUG
    logger.info('start')
    app = Tamarradio(sys.argv)
    app.connect(app, QtCore.SIGNAL('start_app()'), main)
    get_config().from_pyfile("default_config.py")
    get_config().from_pyfile("/etc/tamarradio/player.cfg", silent=True)
    for configfile in opts['config']:
        get_config().from_pyfile(configfile)
    for d in get_config()['LIBRARIES_PATH']:
        get_libraries().update(find_libraries(d))

    signal.signal(signal.SIGINT, lambda *args: app.quit())
    ret = app.exec_()
    logger.info('end %d' % ret)
    sys.exit(ret)