Thank you for your donation!


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


Spotify playing now
#11
Sorry if I'm hijacking this thread, but from its title, it looks like the right one to me.

I've further investigated this possible feature and I got some promising results. This is what I've done so far:

0. Open a SSH session to your moode raspberry pi IP.
1. Stop librespot (included with moOde and started if you activate a Spotify renderer). F.i.: using htop.
2. Install vollibrespot. This is a small wrapper around the librespot core library that broadcasts Spotify song metadata through udp:
wget https://github.com/ashthespy/Vollibrespo...v7l.tar.xz
tar -xf vollibrespot-armv7l.tar.xz

3. The parameters that moOde uses for librespot can be seen in /www/inc/playerlib.php (line 2633). Some of them are gathered from the moOde configuration parameters you complete from the web UI. The exact parameters used to launch last session could be seen in htop (before killing librespot), for instance.
4. Vollibrespot doesn't use the same command line args as librespot. You need to create and edit a toml file (config.toml). Most of the parameters are the same; only the onevent argument doesn't exist. More on that later.
5. You can start now vollibrespot, and you will see your "moOde Spotify connect renderer" from a Spotify app on another device, and you can play some music through moOde:
sudo ./vollibrespot -c ./config.toml --verbose
6. I've created a small simple php script (udpclient.php) that reads Spotify song metadata from UDP port 5030 and sends commands (play, stop,...) to UDP port 5031. When I launch it, I can see the song metadata in the terminal.
7. Since librespot no longer starts this shell script: /var/local/www/commandw/spotevent.sh (no onevent command line parameter, as seen in 4), moOde does not show the usual "dark gray cover modal" (in header.php: inpsrc-msg "INPUT SOURCE INDICATOR").

I would say that the proof of concept was successful.

Of course, many other things would be needed to fully support this feature. At least:

1. Wanting to swap the librespot daemon for vollibrespot. (:-)) = introducing a new piece in the puzzle = risking reliability. I perfectly understand that.
2. Modifying the startSpotify function in /www/inc/playerlib.php to launch vollibrespot instead of librespot.
3. Creating a config.toml template for vollibrespot, and updating some parameters with $cfg_spotify variables (coming from moOde UI Spotify configuration). 
4. Starting a thread that reads from UDP 5030 and writes to UDP 5031 (like my sample udpclient.php does), and stores the song metadata in some global variables/sqlite3/whatever.
5. Update spotevent.sh to the new way of getting metadata and Spotify events.
6. Modifying header.php / INPUT SOURCE INDICATOR to autorefresh (every couple of seconds) and show song/artist/... from the aforementioned global variables/sqlite3/...
7. Modifying the install procedure to additionally download and untar vollibrespot.
8. Testing, testing and testing to see if there are reliability issues.

I'd be happy to help here, but as a moOde newcomer (and not a pro php prog.) there are many things I don't now how to do.
Reply


Messages In This Thread
Spotify playing now - by Alaini93 - 11-05-2020, 08:39 PM
RE: Spotify playing now - by gregvds - 02-26-2021, 09:08 AM
RE: Spotify playing now - by Tim Curtis - 02-26-2021, 03:09 PM
RE: Spotify playing now - by m_g_s_g - 03-24-2021, 04:50 PM
RE: Spotify playing now - by Alaini93 - 02-26-2021, 12:59 PM
RE: Spotify playing now - by gregvds - 02-26-2021, 09:55 PM
RE: Spotify playing now - by Tim Curtis - 02-26-2021, 10:03 PM
RE: Spotify playing now - by gregvds - 02-27-2021, 04:54 AM
RE: Spotify playing now - by m_g_s_g - 03-21-2021, 01:08 PM
RE: Spotify playing now - by Tim Curtis - 03-21-2021, 01:50 PM
RE: Spotify playing now - by m_g_s_g - 03-21-2021, 02:52 PM
RE: Spotify playing now - by m_g_s_g - 03-22-2021, 02:34 PM
RE: Spotify playing now - by Alaini93 - 03-22-2021, 03:35 PM
RE: Spotify playing now - by m_g_s_g - 03-24-2021, 04:38 PM
RE: Spotify playing now - by Alaini93 - 03-24-2021, 04:56 PM
RE: Spotify playing now - by TheOldPresbyope - 03-24-2021, 05:02 PM
RE: Spotify playing now - by m_g_s_g - 03-24-2021, 05:48 PM
RE: Spotify playing now - by Tim Curtis - 03-24-2021, 06:45 PM
RE: Spotify playing now - by m_g_s_g - 03-25-2021, 12:53 AM
RE: Spotify playing now - by Tim Curtis - 03-25-2021, 11:45 AM
RE: Spotify playing now - by m_g_s_g - 03-26-2021, 06:31 PM
RE: Spotify playing now - by barefootnative - 04-19-2021, 05:28 AM

Forum Jump: