1
Fork 0

Also do not output when music is stopped.

This commit is contained in:
Bauke 2024-02-28 16:34:02 +01:00
parent 4984001bf1
commit e31be56ff1
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 3 additions and 5 deletions

View File

@ -85,7 +85,7 @@ type Status = {
artist: string; artist: string;
id: number; id: number;
progress: number; progress: number;
status: "playing" | "paused"; status: "playing" | "paused" | "stopped";
title: string; title: string;
track: { track: {
duration: number; duration: number;
@ -100,11 +100,9 @@ async function getStatus(): Promise<Status> {
/** Print the current song's artist and title. */ /** Print the current song's artist and title. */
async function getCurrentSong(): Promise<void> { async function getCurrentSong(): Promise<void> {
const status = await getStatus(); const status = await getStatus();
if (status.status === "paused") { if (status.status === "playing") {
return; console.log(`${status.artist} - ${status.title}`);
} }
console.log(`${status.artist} - ${status.title}`);
} }
if (import.meta.main) { if (import.meta.main) {