export interface Artist { id: string; name: string; sortName?: string; disambiguation?: string; coverArt?: string; starred?: string; userRating?: number; albumCount?: number; } export interface Album { id: string; name: string; sortName?: string; song?: Song | Song[]; coverArt?: string; artistId?: string; artist?: string; displayArtist?: string; year?: number; genre?: string; genres?: { name: string }[]; starred?: string; userRating?: number; playCount?: number; played?: string; created?: string; } export interface ArtistWithAlbums extends Artist { album?: Album | Album[]; } interface InfoBase { musicBrainzId?: string; lastFmUrl?: string; smallImageUrl?: string; mediumImageUrl?: string; largeImageUrl?: string; } export interface AlbumInfo extends InfoBase { notes?: string; } interface SimilarArtist { id: string; name: string; coverArt?: string; disambiguation?: string; } export interface ArtistInfo extends InfoBase { biography?: string; similarArtist?: SimilarArtist[]; } export interface InfoResponse { artist?: ArtistWithAlbums; album?: Album; song?: Song; } export interface Playlist { id: string; name: string; coverArt?: string; readonly?: boolean; owner?: string; public?: boolean; } export interface Share { id: string; url: string; coverArt?: string; description?: string; username: string; created: string; visitCount: number; expires?: string; entry?: Song[]; } interface LyricsLine { start: string; value: string; } export interface LyricsResponse { lyrics?: { value?: string } | string; lyricsList?: { structuredLyrics?: Array<{ synced?: boolean; line?: LyricsLine[]; }>; }; } export interface Song { id: string; title: string; sortName?: string; artist: string; displayArtist?: string; artists?: { id: string; name: string }[]; album: string; genre?: string; genres?: { name: string }[]; duration?: number; coverArt?: string; albumId?: string; artistId?: string; albumArtist?: string; albumArtistId?: string; displayAlbumArtist?: string; albumArtists?: { id: string; name: string }[]; starred?: string; userRating?: number; discNumber?: number; track?: number; year?: number; musicBrainzId?: string; playCount?: number; playcount?: number; played?: string; created?: string; bitRate?: number; contentType?: string; suffix?: string; replayGain?: { trackGain?: number; albumGain?: number; trackPeak?: number; albumPeak?: number; baseGain?: number; fallbackGain?: number; }; lyrics?: LyricsResponse; accessed?: number; _origStarred?: string; _origUserRating?: number; _radioStreamUrl?: string; } export interface InternetRadioStation { id: string; name: string; streamUrl: string; homePageUrl?: string; coverArt?: string; } export interface ServerSong extends Song { replayGainTrackGain?: number; replayGainAlbumGain?: number; replayGainTrackPeak?: number; replayGainAlbumPeak?: number; replayGainBaseGain?: number; replayGainFallbackGain?: number; } export interface ScanStatus { scanning: boolean; count?: number; } export type PlaybackReportState = "starting" | "playing" | "paused" | "stopped"; export type InfoItemType = | "artist" | "album" | "playlist" | "radio" | "song" | "share"; export type InfoItem = { type: InfoItemType; id: string; label: string; }; export const trackInfoItem = (track: Song, radio = false): InfoItem => { return { type: radio ? "radio" : "song", id: track.id, label: track.title, }; }; export const isInfoItemType = (type: string): type is InfoItemType => type === "artist" || type === "album" || type === "playlist" || type === "radio" || type === "song" || type === "share";