From cb1501a4006d08015c58f5b360f2ddf2937bdd0a Mon Sep 17 00:00:00 2001 From: Shaowen Yin Date: Sun, 2 Jun 2024 23:49:34 +0800 Subject: [PATCH] library: add more metadata fields for models (#837) --- feeluown/library/models.py | 7 +++++++ feeluown/plugin.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/feeluown/library/models.py b/feeluown/library/models.py index 015032e367..deb067d209 100644 --- a/feeluown/library/models.py +++ b/feeluown/library/models.py @@ -342,6 +342,9 @@ class ArtistModel(BriefArtistModel, BaseNormalModel): aliases: List[str] hot_songs: List[BriefSongModel] description: str + song_count: int = -1 + album_count: int = -1 + mv_count: int = -1 class AlbumModel(BriefAlbumModel, BaseNormalModel): @@ -387,6 +390,8 @@ class VideoModel(BriefVideoModel, BaseNormalModel): artists: List[BriefArtistModel] duration: int cover: str + play_count: int = -1 # -1 means unknown + released: str = '' # publish date. format: 2000-12-27 def model_post_init(self, _): super().model_post_init(_) @@ -402,6 +407,8 @@ class PlaylistModel(BriefPlaylistModel, BaseNormalModel): cover: str description: str play_count: int = -1 # -1 means unknown + created: str = '' # format: 2000-12-27 + updated: str = '' # format: 2000-12-27 def model_post_init(self, _): super().model_post_init(_) diff --git a/feeluown/plugin.py b/feeluown/plugin.py index e7e358775e..760ff07483 100644 --- a/feeluown/plugin.py +++ b/feeluown/plugin.py @@ -98,6 +98,8 @@ def init_config(self, config: Config): # instead of app.fuo_xxx.X=Y. if self.name.startswith('fuo_'): names.append(self.name[4:]) + elif self.name.startswith('feeluown_'): + names.append(self.name[9:]) # Define a subconfig(namespace) for plugin so that plugin can # define its own configuration fields.