GithubHelp home page GithubHelp logo

vollibrespot's Introduction

Vollibrespot

Spotify Connect for Volumio2.

This is a Spotify connect implementation using librespot. This daemon is customised to work as the backend for the volspotconnect2 Spotify Connect plugin by:

  • Providing metadata in json
  • Keeping track of state changes (Play|Pause|Seek)
  • etc,

Usage

Installing volspotconnect2 via the Volumio Plugin Manager should automatically install vollibrespot

Disclaimer

Using this code to connect to Spotify's API is probably forbidden by them. Use at your own risk.

Note: vollibrespot only works with Spotify Premium

vollibrespot's People

Contributors

ashthespy avatar jnmcfly avatar volumio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vollibrespot's Issues

Listening activity not being reported

When I listen to music through volspotconnect2, my listening activity doesn't get updated. But as soon as I switch to using the mobile or desktop client, my friends can see what im listening to at the moment.
Is this a known missing feature or a bug?
I already tried totally reinstalling Volumio

Metadata for currently playing not sent on connect

I'm writing a simple "now playing" display script for a Raspberry Pi and after discovering Librespot didn't emit any playing information I found Vollibrespot. It was exactly what I wanted, so thank you, Ash, for the work you have put into adding this functionality.

I've only found one issue I wanted to raise here and that is when the Vollibrespot daemon starts streaming, no metadata for the currently playing track is emitted over UDP.
I see an event handler for PlaybackStarted

Event::PlaybackStarted { .. } => {

but the handle_track_id function call is commented out. Is that because the track data isn't available at that point? Do you have any plans for implementing a work around? If not, I should be able to use the emitted token to do a separate API call to get the initial track metadata from my script.

Logged in connection to Spotify disconnects after some inactive time

Using a username/password to login to Spotify specified in /etc/vollibrespot.conf.

After some inactive time the device disappears from Spotify clienst and the following error is in the logs:

Sep 13 09:37:24 hifiberry vollibrespot[771]: [Vollibrespot] : Connection to server closed.
Sep 13 09:37:24 hifiberry vollibrespot[771]: [Vollibrespot] : Spirc shut down unexpectedly
Sep 13 09:37:24 hifiberry vollibrespot[771]: [Vollibrespot] : EventSender disconnected

Restarting the service which runs volibrespot re-connects, but will disconnect again after some time.

This behavior does not exist in upstream librespot. I made a small attempt to rebase to latest upstream librespot, but it looks like they did some internals rework which does not make it straight forward.

Cannot connect to Hifiberry with Spotify connect

It will often connect fine, but half the time Spotify will say connecting, and then never connect. And from any device. I've soft restarted the Hifiberry, I've turned the Spotify source on and off, I've restarted Spotify on PC and phone, but to no avail. This will go on for a long time, and then suddenly it will decide to connect.
Issue

Device name from config file is ignored

Hi again, I've found another issue :)
I'm using a config.toml with this section:

[Authentication]
shared = true
device_name = "Webradio"

But the device_name is not used - instead always "Vollibrespot" is used as the device name. The other settings in the file work.

High cpu usage

Hi

I'm using vollibrespot, via volumio spotify connect 2, on rpi zero w. When nothing is playing there is constant cpu usage 80-90%. Is it normal ?

Panic after playing a few tracks in a playlists

Heya,

it seems there is an issue for some people trying to play Spotify playlists, including me, where vollibrespot first hangs not playing the next track in a playlist, when trying to skip the stuck track it then panics.

The issue was brought up over at the HiFiBerry Github, I also replied there with my log output: hifiberry/hifiberry-os#519

My journalctl output is as follows:

Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]: thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SendError("...")', /home/matuschd/buildroot-3/host/share/cargo/git/checkouts/librespot-e4d7c35a023053af/1a224a3/playback/src/player.rs:232:61
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]: stack backtrace:
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    0:   0x9d7b20 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    1:   0x9fefd8 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    2:   0x9d04c0 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    3:   0x9da120 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    4:   0x9d9b08 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    5:   0x9da80c - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    6:   0x9da2e4 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    7:   0x9d80d8 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    8:   0x9da22c - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    9:   0x4c28bc - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   10:   0x4c2990 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   11:   0x5da23c - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   12:   0x5a8d60 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   13:   0x5a6ab4 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   14:   0x4e5db0 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   15:   0x508250 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   16:   0x50aaf8 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   17:   0x4f76bc - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   18:   0x50a818 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   19:   0x532014 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   20:   0x4fcce8 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   21:   0x4e85e8 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   22:   0x520b18 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   23:   0x520ce4 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   24:   0x9dacfc - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   25:   0x4e9d28 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   26: 0x76ca46e0 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   27: 0x76ca47e4 - __libc_start_main
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]: [Vollibrespot] : Player thread panicked!
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]: [Vollibrespot] : EventSender disconnected
Apr 03 15:10:36 hifiberry-stefan-zimmer systemd[1]: spotify.service: Main process exited, code=exited, status=101/n/a
Apr 03 15:10:36 hifiberry-stefan-zimmer systemd[1]: spotify.service: Failed with result 'exit-code'.
Apr 03 15:10:36 hifiberry-stefan-zimmer python3[369]: INFO: powercontroller - Update LED state for state=paused
Apr 03 15:10:36 hifiberry-stefan-zimmer python3[369]: ERROR: powercontroller - Could not write to power controller: 121
Apr 03 15:10:36 hifiberry-stefan-zimmer node[747]: Source 'spotify' has deactivated.
Apr 03 15:10:36 hifiberry-stefan-zimmer python3[369]: INFO: http_post - posted metadata update to http://127.0.0.1:80/sources/metadata ({'artist': 'Da Tweekaz', 'title': 'Sunrise', 'albumArtist': None, 'albumTitle': 'Sunrise', 'artUrl': 'https://i.scdn.co/image/ab67616d0000b273cdab17d23a96e5a0d08d2f37', 'externalArtUrl': None, 'discNumber': None, 'tracknumber': None, 'playerName': 'spotify', 'playerState': 'paused', 'streamUrl': None, 'playCount': None, 'mbid': None, 'artistmbid': None, 'albummbid': None, 'loved': None, 'wiki': None, 'loveSupported': False, 'tags': [], 'skipped': False, 'host_uuid': None, 'releaseDate': None, 'trackid': None, 'hifiberry_cover_found': False, 'duration': 0, 'time': 0, 'position': 0, 'positionupdate': 1712148474.585062})
Apr 03 15:10:37 hifiberry-stefan-zimmer sshd[2160]: kex_exchange_identification: Connection closed by remote host
Apr 03 15:10:37 hifiberry-stefan-zimmer sshd[2160]: Connection closed by XXXXXX port 55987
Apr 03 15:10:41 hifiberry-stefan-zimmer node[747]: Checking MPD database update status...
Apr 03 15:10:41 hifiberry-stefan-zimmer systemd[1]: spotify.service: Scheduled restart job, restart counter is at 3.
Apr 03 15:10:41 hifiberry-stefan-zimmer systemd[1]: Stopped Vollibrespot.

Issues setting up snapcast

After upgrading volumio in May 2019, volspotconnect2 no longer played tracks through a custom alsa sink (even though the spotify app thought it was playing). Executing vollibrespot directly revealed the alsa error messages below. I've seen the same with all versions of vollibrespot including latest v0.1.6. Also seen with Raspotify 0.13.x, with the last good version of raspotify was 0.12, built with librespot daeeeaa (2019-02-22).

Linux volumio-bedroom 4.14.92-v7+ #1187 SMP Wed Jan 9 20:01:54 GMT 2019 armv7l GNU/Linux
volumio version: 2.587 (rasbian 8 on Pi 3B)
Plugins: snapcast + vollibrespot
Alsaconfig: snapcast device resample 48->44.1

volumio@volumio-bedroom:~$ ./vollibrespot -b 320 -c /tmp --disable-audio-cache --name Volumio-bedroom 70 --device snapcast
vollibrespot v0.1.6 cd3b133 2019-04-29 (librespot b5c80bf 2018-11-27) -- Built On 2019-04-29
[Vollibrespot] : Failed to register IPv6 receiver: Os { code: 19, kind: Other, message: "No such device" }
[Vollibrespot] : Connecting to AP "gew1-accesspoint-a-qjwc.ap.spotify.com:4070"
[Vollibrespot] : Authenticated as "foreveremain" !
[Vollibrespot] : Using alsa sink
[Vollibrespot] : Metadata pipe established
[Vollibrespot] : Country: "GB"
[Vollibrespot] : SessionActive!
[Vollibrespot] : Loading track "Altitude Dub" with Spotify URI "spotify:track:4JJ4zbQiFYGm6VzoTKyldy"
[Vollibrespot] : Track "Altitude Dub" loaded
[Vollibrespot] : Alsa error PCM open ALSA function 'snd_pcm_hw_params' failed with error 'EINVAL: Invalid argument'
[Vollibrespot] : Could not start audio: Alsa error: PCM open failed

Apologies to be the bearer of bad tidings ! Let me know if you'd like me to try anything..

Skipping every song, not playing for more than a second

We just recently discovered that ALL our devices with vollibrespot started with the exact same behavior listed here
https://community.spotify.com/t5/Desktop-Windows/Spotify-Skipping-every-song-not-playing-for-more-than-a-second/td-p/1197549/page/3

But unlike the solution restarting both the service and the actual device does not solve anything. If we in the web browser play the music, it is all fine - but as soon as we swap over to the device, it just starts skipping forever.

I went into the config and changed the bitrate from 320 to 160, as some people have suggested for when Chrome Cast presents similar behavior. But nothing works.
2022-03-01 13-43-26

Add additional scope

Hi,
first I wanted to thank you! This library was exactly what I searched for! Librespot Connect + the possibility to control the player and get the track information - perfect.

For my project I want to be able to add certain tracks to the users' favorites.
To do this, the scope "user-library-modify" is needed.
Would it be possible to add this to the hardcoded scopes?
Or even better: have the scopes configurable in the config file? That would be really cool :)

Thank you very much
Martin

Can't download Volibrespot when installing Volumio Spotify Connect2

(I hope this is the right place)

Hi,

I'm trying to install Volumio Spotify Connect2 and getting

Downloading plugin at http://volumio.github.io/volumio-plugins/plugins/volumio/armhf/music_service/volspotconnect2/volspotconnect2.zip
END DOWNLOAD: http://volumio.github.io/volumio-plugins/plugins/volumio/armhf/music_service/volspotconnect2/volspotconnect2.zip
Creating folder on disk
Unpacking plugin
Checking for duplicate plugin
Copying Plugin into location
Installing dependencies
Launching a bash shell
Installing Volspotconnect2 dependencies
Configuration file doesn't exist, nothing to do
Detected cpu architecture as armv7l
Supported device (arch = armv7l), downloading required packages for vollibrespot v0.1.6
Downloading from https://api.github.com/repos/ashthespy/vollibrespot/releases/tags/v0.1.6

Failed to download vollibrespot daemon. Stopping installation now. Check your internet connection, and check DNS settings in Volumio for possible cause Exitting now
The following error occurred when installing the plugin: Error

I also tried SSHing to the device and running:

curl https://gist.githubusercontent.com/ashthespy/8f86f1825acbd716fc4b78c63d7ce683/raw/54f3b32b0b80ee016a7545c6983a3592f644d304/getVollibrespot.sh | bash

The output is:

Failed to stop volspotconnect2.service: Unit volspotconnect2.service not loaded.
Detected cpu architecture as armv7l
bash: line 33: cd: /data/plugins/music_service/volspotconnect2: No such file or directory
jq: package.json: No such file or directory
Supported device (arch = armv7l), downloading required packages for vollibrespot v
bash: line 41: [: !=: unary operator expected
Downloading from https://api.github.com/repos/ashthespy/vollibrespot/releases/tags/v

curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
Failed to download vollibrespot daemon. Stopping installation now. Check your internet connection, and check DNS settings in Volumio for possible cause Exitting now

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.