Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


[HOW-TO] Spotify Connect Web for Moode
Is the RPi in the same network as the wireless devices you are trying to connect from?
Reply
Also, what are you talking about 'it is not yet'? If you are using Pylast 3 and above, it won't work with Python 2, no matter what. That is not up to you, it's up to the coders!
Reply
Rafa,

I added a node in your node-red flow to write  into the currentsong.txt. This added a mechanism to wake up the Pi touchscreen LCD when it's blank due to inactivity. I have a lcd update python file just to turn on screen.

Now my setup is perfect :Smile The LCD goes blank when no music at some time. Then when I play either Moode or Spotify, the LCD would turn on and display the album art in cover view. 

Sharing my codes:

lcd_on.py
Code:
#!/usr/bin/python
import os, subprocess, time
os.environ['DISPLAY'] = ":0"
subprocess.call('xset s reset && xset dpms force on', shell=True)

Spotify Connect flow for Node Red
Code:
[{"id":"b574c915.994f78","type":"tab","label":"Spotify Connect Web","disabled":false,"info":"Quick and dirty interface to allow\nMoode Spotify Connect to report back\nto Moode and change the interface."},{"id":"898cb075.27c8f","type":"inject","z":"b574c915.994f78","name":"1 sec interval","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":380,"wires":[["93cd4f68.a21ab"]]},{"id":"93cd4f68.a21ab","type":"http request","z":"b574c915.994f78","name":"Spotify Status","method":"GET","ret":"obj","url":"http://localhost:4000/api/info/status","tls":"","x":380,"y":380,"wires":[["f9915bd3.344dc8"]]},{"id":"f9915bd3.344dc8","type":"function","z":"b574c915.994f78","name":"playStatus","func":"var previouslyPlaying = context.get('previouslyPlaying') || false;\nvar messages = [null, null, null];\n\nif (msg.payload.active) {\n    if ((flow.get('newClient') || !previouslyPlaying) && msg.payload.playing) {\n        flow.set('newClient', false);\n        context.set('previouslyPlaying', true);\n        messages[0] = {payload: '', action: 'start'};\n    }\n    \n    if (msg.payload.playing) {\n        messages[1] = {payload: '', action: 'playing'};\n    }\n    \n    \n    if (previouslyPlaying && !msg.payload.playing) {\n        context.set('previouslyPlaying', false);\n        messages[2] = {payload: '', action: 'stop'};\n    }\n}\n\nreturn messages;","outputs":3,"noerr":0,"x":550,"y":380,"wires":[["d7e04c5.b82e9b"],["f7eb964b.dbe888"],["e60b2be8.d67268"]],"outputLabels":["Start","Stop","Playing"]},{"id":"17d61a9f.7a4ee5","type":"http request","z":"b574c915.994f78","name":"Get Metadata","method":"GET","ret":"obj","url":"http://localhost:4000/api/info/metadata","tls":"","x":880,"y":360,"wires":[["66013ed4.6267e"]]},{"id":"66013ed4.6267e","type":"function","z":"b574c915.994f78","name":"isNewSong","func":"var previousTrack = flow.get('previousTrack') || '';\n\nif (previousTrack !== msg.payload.track_uri) {\n    flow.set('previousTrack', msg.payload.track_uri);\n    msg.action = 'newSong';\n    return msg;\n}\n\nreturn null;","outputs":1,"noerr":0,"x":1050,"y":360,"wires":[["269f4e32.46a112"]]},{"id":"13b40891.1e8bf7","type":"websocket out","z":"b574c915.994f78","name":"engine-spc-response","server":"2feef1d2.95f96e","client":"","x":1500,"y":420,"wires":[]},{"id":"d7e04c5.b82e9b","type":"function","z":"b574c915.994f78","name":"Start","func":"flow.set('previousTrack', '');\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":340,"wires":[["17d61a9f.7a4ee5"]]},{"id":"e60b2be8.d67268","type":"function","z":"b574c915.994f78","name":"Stop","func":"\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":420,"wires":[["269f4e32.46a112"]]},{"id":"f7eb964b.dbe888","type":"function","z":"b574c915.994f78","name":"Playing","func":"\nreturn msg;","outputs":1,"noerr":0,"x":720,"y":380,"wires":[["17d61a9f.7a4ee5"]]},{"id":"269f4e32.46a112","type":"function","z":"b574c915.994f78","name":"Format Output","func":"msg.payload = {\n    action: 'engineSpc:' + msg.action,\n    metadata: msg.payload\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":1260,"y":420,"wires":[["13b40891.1e8bf7","1304fbd3.c85b54","a0dd72c9.4bc6"]]},{"id":"1304fbd3.c85b54","type":"debug","z":"b574c915.994f78","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1470,"y":480,"wires":[]},{"id":"96d83b9.3c07dc8","type":"websocket in","z":"b574c915.994f78","name":"Client","server":"2feef1d2.95f96e","client":"","x":150,"y":460,"wires":[["4fa19d46.c08404"]]},{"id":"4fa19d46.c08404","type":"function","z":"b574c915.994f78","name":"newClient","func":"flow.set('newClient', true);\nreturn null;","outputs":1,"noerr":0,"x":320,"y":460,"wires":[[]]},{"id":"feff1650.047f18","type":"file","z":"b574c915.994f78","name":"lcdOutput","filename":"/var/local/www/currentsong.txt","appendNewline":true,"createDir":false,"overwriteFile":"true","x":1700,"y":540,"wires":[[]]},{"id":"a0dd72c9.4bc6","type":"function","z":"b574c915.994f78","name":"extractMetaData","func":"msg.payload = {\n    artist: msg.payload.metadata.artist_name,\n    album: msg.payload.metadata.album_name,\n    title: msg.payload.metadata.track_name,\n}\nreturn msg","outputs":1,"noerr":0,"x":1500,"y":540,"wires":[["feff1650.047f18"]]},{"id":"2feef1d2.95f96e","type":"websocket-listener","z":"","path":"/engine-spc","wholemsg":"false"}]
Reply
(09-08-2018, 08:59 PM)RafaPolit Wrote: Also, what are you talking about 'it is not yet'? If you are using Pylast 3 and above, it won't work with Python 2, no matter what. That is not up to you, it's up to the coders
I perfectly understand
The version is 2.4
And all the devices are on thé same network.
Il think thé problem IS on Spotify side.
Reply
Hello there!
I hope I am not hijacking this thread, but I feel like i could post here:
I tried the Spotify Connect Web with moode (not by this guide provided by Rafa, to be honest) and I see the same issue I have with all spotify services I tried (raspotify with moode, all plugins for volumio): After 2-4 songs, the connection is lost with "error 104, connection reset by peer". After that, the service needs to be restarted (either the device disappears from spotify device list on my android or it cannot connect)
I found plenty on the internet on this issue (on librespot and also people complaining on the genuine spotify board), but no solution... Anybody able to point me in the right direction?

Edit for some more information: Moode 4.2 (latest built), Pi2, connection via ethernet (cable), Spotify Connect running smoothly via Android Mobile to Chromecast or Amazon Fire TV stick
Reply
I compiled the latest librespot for upcoming moOde 4.3 and it plays all day long on my end, no issues. Client is iPhone.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
Any chance to get into the testing team for this feature? :-D
Reply
(09-13-2018, 12:19 PM)Tim Curtis Wrote: I compiled the latest librespot for upcoming moOde 4.3 and it plays all day long on my end, no issues. Client is iPhone.

I looked up the 104 error in the librespot issues log. Folks there seem to be pointing the finger at network connectivity. Issue #230 seems to describe @abrakadabra2k's situation. It was closed on May 31 but it isn't clear what was done to the code base. Your success with the latest librespot may not have any bearing on his problem.
Reply
I have never had that issue with Spotify Connect Web.

Not on my Moode RPi3 which is Ethernet connected, nor with my Raspbian RPi3 which is WiFi connected.

Sometimes a song would stop out of the blue, but pressing play and pause a couple of times unscrambles the Pi.

That has been my experience.
I'm using he avahi zero config though, maybe that is reconnecting on its own and the forced passwords installs aren't?

Rafa.
Reply
(09-13-2018, 04:48 PM)TheOldPresbyope Wrote:
(09-13-2018, 12:19 PM)Tim Curtis Wrote: I compiled the latest librespot for upcoming moOde 4.3 and it plays all day long on my end, no issues. Client is iPhone.

I looked up the 104 error in the librespot issues log. Folks there seem to be pointing the finger at network connectivity. Issue #230 seems to describe @abrakadabra2k's situation. It was closed on May 31 but it isn't clear what was done to the code base. Your success with the latest librespot may not have any bearing on his problem.

That's what I found, too. But my network is fine. Even the moode is streaming radio stations for hours without a glitch
Reply


Forum Jump: