mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
The /playlist/:id/detail route was hardcoded to call the NetEase API path /playlist/detail on whatever provider was selected. For QQ this hit a non-existent path, so clicking into any QQ playlist showed "歌单不存在或加载失败". Replace the platform-specific hack in the route handler with a proper getPlaylistDetail method on MusicProvider. Implement it for NetEase (porting the existing /playlist/detail logic) and QQ (calling /getSongListDetail and reading from response.cdlist[0]). Pre-existing bug exposed by the QQ source tab. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
90 lines
2.2 KiB
TypeScript
90 lines
2.2 KiB
TypeScript
export interface Song {
|
|
id: string;
|
|
name: string;
|
|
artist: string;
|
|
album: string;
|
|
duration: number; // seconds
|
|
coverUrl: string;
|
|
platform: "netease" | "qq" | "bilibili" | "youtube";
|
|
}
|
|
|
|
export interface SongWithUrl extends Song {
|
|
url: string;
|
|
}
|
|
|
|
export interface Playlist {
|
|
id: string;
|
|
name: string;
|
|
coverUrl: string;
|
|
songCount: number;
|
|
platform: "netease" | "qq" | "bilibili" | "youtube";
|
|
}
|
|
|
|
export interface PlaylistDetail {
|
|
id: string;
|
|
name: string;
|
|
description: string;
|
|
coverUrl: string;
|
|
songCount: number;
|
|
}
|
|
|
|
export interface Album {
|
|
id: string;
|
|
name: string;
|
|
artist: string;
|
|
coverUrl: string;
|
|
songCount: number;
|
|
platform: "netease" | "qq" | "bilibili" | "youtube";
|
|
}
|
|
|
|
export interface LyricLine {
|
|
time: number; // seconds
|
|
text: string;
|
|
translation?: string;
|
|
}
|
|
|
|
export interface SearchResult {
|
|
songs: Song[];
|
|
playlists: Playlist[];
|
|
albums: Album[];
|
|
}
|
|
|
|
export interface QrCodeResult {
|
|
qrUrl: string;
|
|
qrImg?: string; // base64 data URL of QR image
|
|
key: string;
|
|
}
|
|
|
|
export interface AuthStatus {
|
|
loggedIn: boolean;
|
|
nickname?: string;
|
|
avatarUrl?: string;
|
|
}
|
|
|
|
export interface MusicProvider {
|
|
readonly platform: "netease" | "qq" | "bilibili" | "youtube";
|
|
|
|
search(query: string, limit?: number): Promise<SearchResult>;
|
|
getSongUrl(songId: string, quality?: string): Promise<string | null>;
|
|
setQuality(quality: string): void;
|
|
getQuality(): string;
|
|
getSongDetail(songId: string): Promise<Song | null>;
|
|
getPlaylistSongs(playlistId: string): Promise<Song[]>;
|
|
getRecommendPlaylists(): Promise<Playlist[]>;
|
|
getAlbumSongs(albumId: string): Promise<Song[]>;
|
|
getLyrics(songId: string): Promise<LyricLine[]>;
|
|
getQrCode(): Promise<QrCodeResult>;
|
|
checkQrCodeStatus(
|
|
key: string
|
|
): Promise<"waiting" | "scanned" | "confirmed" | "expired">;
|
|
loginWithSms?(phone: string, code: string): Promise<boolean>;
|
|
sendSmsCode?(phone: string): Promise<boolean>;
|
|
setCookie(cookie: string): void;
|
|
getCookie(): string;
|
|
getAuthStatus(): Promise<AuthStatus>;
|
|
getPersonalFm?(): Promise<Song[]>;
|
|
getDailyRecommendSongs?(): Promise<Song[]>;
|
|
getUserPlaylists?(): Promise<Playlist[]>;
|
|
getPlaylistDetail?(playlistId: string): Promise<PlaylistDetail | null>;
|
|
}
|