lastfm fix
This commit is contained in:
parent
c0658e9f40
commit
5f57bb6e84
|
@ -43,10 +43,14 @@ const lastFM = {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
getRecentTracks: async (user) => {
|
getRecentTracks: async (user) => {
|
||||||
|
try {
|
||||||
const request = await Utils.fetch(
|
const request = await Utils.fetch(
|
||||||
lastFM.constructUrl("User.getrecenttracks", { user, limit: 1 })
|
lastFM.constructUrl("User.getrecenttracks", { user, limit: 1 })
|
||||||
);
|
);
|
||||||
return await request.json();
|
return await request.json();
|
||||||
|
} catch {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -82,9 +86,10 @@ export function LastfmWidget(monitor = 0) {
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.interval(
|
Utils.interval(
|
||||||
2150,
|
5000,
|
||||||
() => {
|
() => {
|
||||||
lastFM.getRecentTracks("yourfriendoss").then((z) => {
|
lastFM.getRecentTracks("yourfriendoss").then((z) => {
|
||||||
|
if(!z) return;
|
||||||
const track = z.recenttracks.track[0];
|
const track = z.recenttracks.track[0];
|
||||||
if (!track) return;
|
if (!track) return;
|
||||||
nowplayingLabel.set_label(
|
nowplayingLabel.set_label(
|
||||||
|
|
Loading…
Reference in a new issue