tangled
alpha
login
or
join now
vielle.dev
/
site
0
fork
atom
Personal Site
0
fork
atom
overview
issues
pulls
pipelines
Create now playing function
vielle.dev
7 months ago
cc43861c
c4b330a4
verified
This commit was signed with the committer's
known signature
.
vielle.dev
SSH Key Fingerprint:
SHA256:/4bvxqoEh9iMdjAPgcgAgXKZZQTROL3ULiPt6nH9RSs=
+11
1 changed file
expand all
collapse all
unified
split
src
components
playing
spotify.ts
+11
src/components/playing/spotify.ts
···
163
163
164
164
return res;
165
165
}
166
166
+
167
167
+
export async function nowPlayingSongID() {
168
168
+
const res = await getSpotifyApi("/me/player/currently-playing");
169
169
+
if (res instanceof Error) return res;
170
170
+
171
171
+
// https://developer.spotify.com/documentation/web-api/reference/get-the-users-currently-playing-track
172
172
+
const trackID = (res as { item: { id: string } | null }).item?.id;
173
173
+
if (trackID === null) return null;
174
174
+
175
175
+
return trackID;
176
176
+
}