Something went wrong. Try again.
a simple but full-featured web player for OpenSubsonic music servers (Navidrome, Gonic, Ampache, etc) devins.page/tinysub
svelte typescript javascript subsonic gonic navidrome
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031323334import type { Song } from "./client.svelte.js";
export type InfoItemType = | "artist" | "album" | "playlist" | "radio" | "song" | "share";
export type InfoItem = { type: InfoItemType; id: string; label: string; sourceId?: string;};
export const trackInfoItem = (track: Song, radio = false): InfoItem => { return { type: radio ? "radio" : "song", id: track.id, label: track.title, sourceId: track.sourceId, };};
export const isInfoItemType = (type: string): type is InfoItemType => type === "artist" || type === "album" || type === "playlist" || type === "radio" || type === "song" || type === "share";