Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

library: add protocol SupportsDiscoveryToplist #827

Merged
merged 5 commits into from
May 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
library: add protocol SupportsDiscoveryTopList
  • Loading branch information
cosven committed May 3, 2024
commit 81e465687f4cbe393dfb1f1c04f6e8c995bfb437
18 changes: 17 additions & 1 deletion feeluown/library/provider_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .models import (
BriefCommentModel, SongModel, VideoModel, AlbumModel, ArtistModel,
PlaylistModel, UserModel, ModelType, BriefArtistModel, BriefSongModel,
LyricModel, BriefVideoModel,
LyricModel, BriefVideoModel, BriefPlaylistModel,
)
from .collection import Collection

Expand Down Expand Up @@ -375,6 +375,22 @@ def current_user_fav_create_videos_rd(self):
pass


@runtime_checkable
class SupportsDiscoveryToplist(Protocol):
@abstractmethod
def discovery_list_toplist(self) -> List[BriefPlaylistModel]:
"""List all toplist(排行榜)."""

@abstractmethod
def discovery_get_toplist(self, toplist_id) -> PlaylistModel:
"""Get toplist details.

For some providers, the toplist model(schema) may be different from the
PlaylistModel. They should think about a way to solve this. For example,
turn the identifier into `toplist_{id}` and do some hack in playlist_get API.
"""


#
# Protocols for recommendation.
#
Expand Down
Loading