mirror of
https://github.com/hanxi/xiaomusic.git
synced 2026-04-14 20:53:41 +08:00
Add optional dirname parameter to single music download endpoint, allowing downloads to be saved to a subdirectory under download_path. This makes it consistent with /downloadplaylist which already supports dirname. Changes: - Add dirname field to DownloadOneMusic schema (default empty) - Update download_one_music() to accept dirname parameter - Update /downloadonemusic endpoint to pass dirname Co-authored-by: pc hu <>
74 lines
1.1 KiB
Python
74 lines
1.1 KiB
Python
"""Pydantic 数据模型定义"""
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class Did(BaseModel):
|
|
did: str
|
|
|
|
|
|
class DidVolume(BaseModel):
|
|
did: str
|
|
volume: int = 0
|
|
|
|
|
|
class DidCmd(BaseModel):
|
|
did: str
|
|
cmd: str
|
|
|
|
|
|
class MusicInfoObj(BaseModel):
|
|
musicname: str
|
|
title: str = ""
|
|
artist: str = ""
|
|
album: str = ""
|
|
year: str = ""
|
|
genre: str = ""
|
|
lyrics: str = ""
|
|
picture: str = "" # base64
|
|
|
|
|
|
class MusicItem(BaseModel):
|
|
name: str
|
|
|
|
|
|
class UrlInfo(BaseModel):
|
|
url: str
|
|
|
|
|
|
class DidPlayMusic(BaseModel):
|
|
did: str
|
|
musicname: str = ""
|
|
searchkey: str = ""
|
|
|
|
|
|
class DidPlayMusicList(BaseModel):
|
|
did: str
|
|
listname: str = ""
|
|
musicname: str = ""
|
|
|
|
|
|
class DownloadPlayList(BaseModel):
|
|
dirname: str
|
|
url: str
|
|
|
|
|
|
class DownloadOneMusic(BaseModel):
|
|
name: str = ""
|
|
url: str
|
|
dirname: str = ""
|
|
|
|
|
|
class PlayListObj(BaseModel):
|
|
name: str = "" # 歌单名
|
|
|
|
|
|
class PlayListUpdateObj(BaseModel):
|
|
oldname: str # 旧歌单名字
|
|
newname: str # 新歌单名字
|
|
|
|
|
|
class PlayListMusicObj(BaseModel):
|
|
name: str = "" # 歌单名
|
|
music_list: list[str] # 歌曲名列表
|