Redesign the Music Info (last.fm)

Turns out I wasn't really satisfied with how the very first `Info` I made aged
Don't know yet if I'll do anything with other `Info`s, they kinda look fine tbh!
This commit is contained in:
Taevas 2024-05-19 00:19:49 +02:00
parent 9dda0fd492
commit 19038f307f
5 changed files with 23 additions and 11 deletions

View file

@ -21,10 +21,13 @@ const handler: Handler = async () => {
nowplaying?: string;
};
url: string;
date?: {
uts: string;
"#text": string;
};
}>;
};
}>(`http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=TTTaevas&api_key=${process.env.API_LASTFM}&format=json&limit=1`);
const image = lastfm.recenttracks.track[0].image.find((i) => i.size == "large");
const track: LastfmInfo = {
artist: lastfm.recenttracks.track[0].artist["#text"],
@ -33,6 +36,7 @@ const handler: Handler = async () => {
image: image ? image["#text"] : "",
listening: Boolean(lastfm.recenttracks.track[0]["@attr"]?.nowplaying),
url: lastfm.recenttracks.track[0].url,
date: lastfm.recenttracks.track[0].date?.uts ?? String(Date.now()),
};
return {