示例#1
0
文件: json.py 项目: CarnosOS/Peridot
 def load(self):
     logger.debug('Loading library: %s', self._json_file)
     with timer.time_logger('Loading tracks'):
         library = load_library(self._json_file)
         self._tracks = dict((t.uri, t) for t in library.get('tracks', []))
     with timer.time_logger('Building browse cache'):
         self._browse_cache = _BrowseCache(sorted(self._tracks.keys()))
     return len(self._tracks)
示例#2
0
    def start_frontends(self, config, frontend_classes, core):
        logger.info('Starting Mopidy frontends: %s',
                    ', '.join(f.__name__ for f in frontend_classes) or 'none')

        for frontend_class in frontend_classes:
            try:
                with timer.time_logger(frontend_class.__name__):
                    frontend_class.start(config=config, core=core)
            except exceptions.FrontendError as exc:
                logger.error('Frontend (%s) initialization error: %s',
                             frontend_class.__name__, exc.message)
                raise
示例#3
0
    def start_frontends(self, config, frontend_classes, core):
        logger.info(
            'Starting Mopidy frontends: %s',
            ', '.join(f.__name__ for f in frontend_classes) or 'none')

        for frontend_class in frontend_classes:
            try:
                with timer.time_logger(frontend_class.__name__):
                    frontend_class.start(config=config, core=core)
            except exceptions.FrontendError as exc:
                logger.error(
                    'Frontend (%s) initialization error: %s',
                    frontend_class.__name__, exc.message)
                raise
示例#4
0
    def start_backends(self, config, backend_classes, audio):
        logger.info('Starting Mopidy backends: %s',
                    ', '.join(b.__name__ for b in backend_classes) or 'none')

        backends = []
        for backend_class in backend_classes:
            try:
                with timer.time_logger(backend_class.__name__):
                    backend = backend_class.start(config=config,
                                                  audio=audio).proxy()
                backends.append(backend)
            except exceptions.BackendError as exc:
                logger.error('Backend (%s) initialization error: %s',
                             backend_class.__name__, exc.message)
                raise

        return backends
示例#5
0
    def start_backends(self, config, backend_classes, audio):
        logger.info(
            'Starting Mopidy backends: %s',
            ', '.join(b.__name__ for b in backend_classes) or 'none')

        backends = []
        for backend_class in backend_classes:
            try:
                with timer.time_logger(backend_class.__name__):
                    backend = backend_class.start(
                        config=config, audio=audio).proxy()
                backends.append(backend)
            except exceptions.BackendError as exc:
                logger.error(
                    'Backend (%s) initialization error: %s',
                    backend_class.__name__, exc.message)
                raise

        return backends