v56

latestSwagger 2.0Apache 2.0raw.githubusercontent.com2026-08-0616186383.8 KB
播放历史

查询播放上下文的播放历史

返回指定播放上下文内最近播放过的歌曲,按最后播放时间倒序,含完整歌曲详情。 「播放上下文」由 context_type + context_key 二元组标识:歌单为 (playlist, 歌单 ID),分面维度为 (artist, 歌手名) / (album, 专辑名) 等。 同一上下文内按歌曲去重(重复播放只刷新时间并累加 play_count),最多保留最近 50 条,因此本端点不分页。 记录由 POST /songs/{id}/played 在 type=play 时写入。歌曲从库中删除时其历史自动级联清理;歌曲仅被移出歌单时历史仍保留,客户端起播时自行判定失效。

get/play-history

Query parameters

context_type'playlist' | 'artist' | 'album' | 'genre' | 'year' | 'decade' | 'language' | 'style' required

播放上下文类型

context_keystring required

播放上下文标识:playlist 传歌单 ID,分面维度传该维度取值

limitinteger

返回条数,缺省 50,上限 50

Response

成功返回播放历史列表

totalinteger

本次返回的条数(上限 50,故与 items 长度一致)

Example response

{
  "items": [
    {
      "play_count": 3,
      "played_at": "2024-01-01T12:00:00Z",
      "song": {
        "added_at": "2024-01-01T12:00:00Z",
        "album": "十一月的萧邦",
        "artist": "周杰伦",
        "bit_rate": 320,
        "cover_url": "https://example.com/cover.jpg",
        "duration": 253.5,
        "file_path": "/music/周杰伦/夜曲.mp3",
        "file_size": 10485760,
        "format": "mp3",
        "genre": "Pop",
        "id": 1,
        "language": "国语",
        "plugin_entry_path": "my-source",
        "sample_rate": 44100,
        "style": "抒情",
        "title": "夜曲",
        "track": "3/12",
        "type": "local",
        "updated_at": "2024-01-01T12:00:00Z",
        "url": "https://example.com/song.mp3",
        "year": 2005
      }
    }
  ],
  "total": 12
}