From 0c8be82c7aa51b34129b98fd76f28ad731ac6c02 Mon Sep 17 00:00:00 2001 From: cosven Date: Sun, 7 Jan 2024 01:10:49 +0800 Subject: [PATCH] ok to run --- feeluown/app/app.py | 2 ++ feeluown/library/uri.py | 6 +----- feeluown/server/handlers/search.py | 4 +++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/feeluown/app/app.py b/feeluown/app/app.py index ef6fc13cbf..4b9b69375f 100644 --- a/feeluown/app/app.py +++ b/feeluown/app/app.py @@ -139,6 +139,8 @@ def apply_state(self, state): song = resolve(song) except ResolverNotFound: pass + except ResolveFailed as e: + logger.warning(f'resolve failed, {e}') else: songs.append(song) playlist.set_models(songs) diff --git a/feeluown/library/uri.py b/feeluown/library/uri.py index 61e97ff232..25a943af1f 100644 --- a/feeluown/library/uri.py +++ b/feeluown/library/uri.py @@ -252,9 +252,7 @@ def resolve(line, model=None): for example, line can be 'fuo://local/songs/1/cover/data' """ - from feeluown.library import ( - ProviderFlags, get_modelcls_by_type, V2SupportedModelTypes, - ) + from feeluown.library import get_modelcls_by_type, V2SupportedModelTypes if model is None: model, path = parse_line(line) @@ -263,8 +261,6 @@ def resolve(line, model=None): if provider is None: model.state = ModelState.not_exists else: - # Try to use model v2 since v1 is deprecated. - assert library.check_flags_by_model(model, ProviderFlags.model_v2) model_type = ModelType(model.meta.model_type) modelcls = get_modelcls_by_type(model_type, brief=True) assert modelcls is not None and model_type in V2SupportedModelTypes diff --git a/feeluown/server/handlers/search.py b/feeluown/server/handlers/search.py index 6809876ecb..0448f4233d 100644 --- a/feeluown/server/handlers/search.py +++ b/feeluown/server/handlers/search.py @@ -1,4 +1,6 @@ import logging + +from feeluown.library import SupportsSongGet from .base import AbstractHandler logger = logging.getLogger(__name__) @@ -31,7 +33,7 @@ def search(self, keyword, options=None): """ providers = self.library.list() source_in = [provd.identifier for provd in providers - if provd.Song.meta.allow_get] + if isinstance(provd, SupportsSongGet)] params = {} if options is not None: type_in = options.pop('type', None)