[GH-ISSUE #575] How to check if librespot is currently playing a song #366

Closed
opened 2026-02-27 19:30:14 +03:00 by kerem · 3 comments
Owner

Originally created by @petrkutalek on GitHub (Jan 22, 2021).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/575

I would like to ask you if there is any way how I can check via any API if librespot is currently playing a song. I would like to put my PC into sleep in the evening, but only if and only if it is not currently playing. I plan to use systemd timer with Condition check.

Thanks!

Originally created by @petrkutalek on GitHub (Jan 22, 2021). Original GitHub issue: https://github.com/librespot-org/librespot/issues/575 I would like to ask you if there is any way how I can check via any API if librespot is currently playing a song. _I would like to put my PC into sleep in the evening, but only if and only if it is not currently playing. I plan to use systemd timer with Condition check._ Thanks!
kerem closed this issue 2026-02-27 19:30:14 +03:00
Author
Owner

@FrancisHGR commented on GitHub (Jan 27, 2021):

You can check via the Spotify Web API, e.g.

curl -s -X GET "https://api.spotify.com/v1/me/player" -H "Accept: application/json" -H "Authorization: Bearer $token" where token is a token you need to get from the Spotify Web API website that links to your Spotify account.

Please refer to an implemented example in the following repo (file controlspotify): https://github.com/FrancisHGR/forked-daapd-raspotify

<!-- gh-comment-id:768452677 --> @FrancisHGR commented on GitHub (Jan 27, 2021): You can check via the Spotify Web API, e.g. curl -s -X GET "https://api.spotify.com/v1/me/player" -H "Accept: application/json" -H "Authorization: Bearer $token" where token is a token you need to get from the Spotify Web API website that links to your Spotify account. Please refer to an implemented example in the following repo (file controlspotify): https://github.com/FrancisHGR/forked-daapd-raspotify
Author
Owner

@petrkutalek commented on GitHub (Jan 27, 2021):

Thank you @FrancisHGR , I appreciate that. Nevertheless, it is too complicated and it does not worth my while. I was wondering if data coming from curl http://10.2.1.6:4370/?action=getInfo | jq . could be used in some way.. Probably not. Nevermind.

<!-- gh-comment-id:768529232 --> @petrkutalek commented on GitHub (Jan 27, 2021): Thank you @FrancisHGR , I appreciate that. Nevertheless, it is too complicated and it does not worth my while. I was wondering if data coming from `curl http://10.2.1.6:4370/?action=getInfo | jq .` could be used in some way.. Probably not. Nevermind.
Author
Owner

@ashthespy commented on GitHub (Jan 27, 2021):

@petrkutalek Take a look at Vollibrespot a little daemon I strapped together. It exposes a udp socket that you can listen for status updates and other such things..

<!-- gh-comment-id:768575333 --> @ashthespy commented on GitHub (Jan 27, 2021): @petrkutalek Take a look at [`Vollibrespot`](https://github.com/ashthespy/Vollibrespot) a little daemon I strapped together. It exposes a udp socket that you can listen for status updates and other such things..
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#366
No description provided.