Also do not output when music is stopped.
This commit is contained in:
parent
4984001bf1
commit
e31be56ff1
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue