mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #575] How to check if librespot is currently playing a song #366
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#366
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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!
@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
@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.@ashthespy commented on GitHub (Jan 27, 2021):
@petrkutalek Take a look at
Vollibrespota little daemon I strapped together. It exposes a udp socket that you can listen for status updates and other such things..