Skip to content

Commit

Permalink
update library docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cosven committed Nov 20, 2024
1 parent 95e2038 commit f343541
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 138 deletions.
3 changes: 1 addition & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ FeelUOwn 是一个用户友好、可玩性强的播放器
dev_quickstart
arch
api
media_assets_management_v1
media_assets_management/index_v2
media_assets_management/index
protocol
glossary
research
Expand Down
41 changes: 41 additions & 0 deletions docs/source/media_assets_management/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
媒体资源管理
===================

feeluown 一个设计目标是让用户能够高效使用各个音乐平台的合法资源。
媒体资源管理定义、规范并统一了各个音乐平台资源的访问接口。

音乐库是媒体资源管理子系统的入口。音乐库部分负责管理 feeluown 的音乐资源,
包括歌曲、歌手、专辑详情获取,专辑、歌单封面获取等。它主要由几个部分组成:
音乐对象模型(*Model*)、音乐提供方(*Provider*)、提供方管理(*Library*)。

.. code::
+---------------------------------------------------------------------------+
| +---------+ |
| | Library | |
| +---------+ +-------------+ |
| | | song_get | |
| | +-------------------+ | ... | |
| |--| provider(netease) |--| aritst_get |-----+ |
| | +-------------------+ | search | | +----------------+ |
| | | ... | | | BriefSongModel | |
| | +-------------+ | | ... | |
| | +-------------+ +-----| | |
| | | song_get_mv | | | SongModel | |
| | +-----------------+ | ... | | | ArtistModel | |
| |--| provider(xiami) |--| album_get |-------+ | ... | |
| | +-----------------+ | search | +----------------+ |
| | | ... | |
| | +-------------+ |
| |--... |
| |
+---------------------------------------------------------------------------+
.. toctree::
:maxdepth: 2
:caption: 目录

library
provider
model
10 changes: 0 additions & 10 deletions docs/source/media_assets_management/index_v2.rst

This file was deleted.

23 changes: 23 additions & 0 deletions docs/source/media_assets_management/library.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
音乐库
=====================

.. _library:

音乐库模块管理资源提供方(*Provider*)。音乐库还提供了一些通用接口,简化了对资源提供方的访问。

.. code::
# 注册一个资源提供方
library.register(provider)
# 获取资源提供方实例
provider = library.get(provider.identifier)
# 列出所有资源提供方
library.list()
# 在音乐库中搜索关键词
library.search('linkin park')
.. autoclass:: feeluown.library.Library
:members:
8 changes: 8 additions & 0 deletions docs/source/media_assets_management/model.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
数据模型
=====================

feeluown 定义了常见音乐资源的数据模型,包括歌曲、歌手、专辑、视频、MV、歌单等。
这样,上层模块就能以统一的方式访问这些资源。

.. automodule:: feeluown.library.models
:members:
31 changes: 31 additions & 0 deletions docs/source/media_assets_management/provider.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
资源提供方
=====================

歌曲等音乐资源都来自于某一个提供方。比如,我们认为本地音乐的提供方是本地,
网易云音乐资源的提供方是网易,等等。对应到程序设计上,每个提供方都对应一个 provider 实例。
provider 是我们访问具体一个音乐平台资源音乐的入口。

在 feeluown 生态中,每个音乐资源提供方都对应着一个插件,我们现在有 feeluown-local/feeluown-netease
等许多插件,这些插件在启动时,会注册一个 provider 实例到 feeluown 的音乐库模块上。
注册完成之后,音乐库和 feeluown 其它模块就能访问到这个提供方的资源

举个栗子,feeluown-local 插件在启动时就创建了一个 *identifier* 为 ``local`` 的 provider 实例,
并将它注册到音乐库中,这样,当我们访问音乐库资源时,就能访问到本地音乐资源。

详细信息请参考 :doc:`provider`。

定义一个资源提供方
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: feeluown.library.AbstractProvider
:members:

.. autoclass:: feeluown.library.Provider
:members:

协议
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. automodule:: feeluown.library.provider_protocol
:members:

5 changes: 0 additions & 5 deletions docs/source/media_assets_management/topics.rst

This file was deleted.

121 changes: 0 additions & 121 deletions docs/source/media_assets_management_v1.rst

This file was deleted.

0 comments on commit f343541

Please sign in to comment.