Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
Arquivo: json.py Projeto: vrs01/mopidy
 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)
Exemplo n.º 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:
            with _actor_error_handling(frontend_class.__name__):
                with timer.time_logger(frontend_class.__name__):
                    frontend_class.start(config=config, core=core)
Exemplo n.º 4
0
 def load(self):
     logger.debug('Loading library: %s', self._json_file)
     with timer.time_logger('Loading tracks'):
         if not os.path.isfile(self._json_file):
             logger.info(
                 'No local library metadata cache found at %s. Please run '
                 '`mopidy local scan` to index your local music library. '
                 'If you do not have a local music collection, you can '
                 'disable the local backend to hide this message.',
                 self._json_file)
             self._tracks = {}
         else:
             library = internal_storage.load(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)
Exemplo n.º 5
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:
            with _actor_error_handling(frontend_class.__name__):
                with timer.time_logger(frontend_class.__name__):
                    frontend_class.start(config=config, core=core)
Exemplo n.º 6
0
 def load(self):
     logger.debug('Loading library: %s', self._json_file)
     with timer.time_logger('Loading tracks'):
         if not os.path.isfile(self._json_file):
             logger.info(
                 'No local library metadata cache found at %s. Please run '
                 '`mopidy local scan` to index your local music library. '
                 'If you do not have a local music collection, you can '
                 'disable the local backend to hide this message.',
                 self._json_file)
             self._tracks = {}
         else:
             library = internal_storage.load(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)
Exemplo n.º 7
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:
            with _actor_error_handling(backend_class.__name__):
                with timer.time_logger(backend_class.__name__):
                    backend = backend_class.start(config=config,
                                                  audio=audio).proxy()
                    backends.append(backend)

        # Block until all on_starts have finished, letting them run in parallel
        for backend in backends[:]:
            try:
                backend.ping().get()
            except pykka.ActorDeadError as exc:
                backends.remove(backend)
                logger.error('Actor died: %s', exc)

        return backends
Exemplo n.º 8
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:
            with _actor_error_handling(backend_class.__name__):
                with timer.time_logger(backend_class.__name__):
                    backend = backend_class.start(
                        config=config, audio=audio).proxy()
                    backends.append(backend)

        # Block until all on_starts have finished, letting them run in parallel
        for backend in backends[:]:
            try:
                backend.ping().get()
            except pykka.ActorDeadError as exc:
                backends.remove(backend)
                logger.error('Actor died: %s', exc)

        return backends