Thank you for your donation!


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


[HOW-TO] Spotify Connect Web for Moode
(11-07-2018, 12:57 AM)TheOldPresbyope Wrote:
(11-06-2018, 08:51 PM)abigor Wrote: Hi. During long listening spotify the cache size (/var/local/www/spotify_cache/files) increases and takes up all the free space on the memory card, because of this, the system stops working stably, is there any solution to limit the cache size ? I try to clean this folder on my own through cron, it looks like it works.

P.S. Moode 4.3 (with native Spotify support)

@abigor

Looking through the issues log on the librespot github repo, I see that this same problem was addressed by the maintainer last year with the addition of a new run-time option "--disable-audio-cache". It isn't clear, at least to me, what side effects this option may have so we'll likely have to test it before adding it in moOde.

@abigor

I make the change to playerlib.php and have been listening to Spotify tracks for the past three hours. So far it seems to be working for me. I can't say this is an exhaustive test but it is at least a proof of concept. With the change and a reboot there is no caching of files to /var/local/www/spotify_cache/files directory. I cleared it once and it remains empty.

You apparently listen to Spotify a lot more than I do so how about testing this change too to see if I've overlooked a side effect? Since you have been mucking with cron I'm confident you can deal with the edit involved. 

In /var/www/inc/playerlib.php, there's a long string-concatenation statement beginning at line 1752 (in moOde r43)

Code:
    $cmd = 'librespot' .
        ' --name "' . $_SESSION['spotifyname'] . '"' .
        ' --bitrate ' . $cfg_spotify['bitrate'] .
        ' --initial-volume ' . $cfg_spotify['initial_volume'] .
        $linear_volume .
        $volume_normalization .
        ' --cache /var/local/www/spotify_cache --backend alsa --device "' . $device . '"' .
        ' --onevent /var/local/www/commandw/spotevent.sh' .
        ' > /dev/null 2>&1 &';

Insert a new line "' --disable-audio-cache' ." so the statement reads something like

Code:
       $cmd = 'librespot' .
               ' --name "' . $_SESSION['spotifyname'] . '"' .
               ' --bitrate ' . $cfg_spotify['bitrate'] .
               ' --initial-volume ' . $cfg_spotify['initial_volume'] .
               $linear_volume .
               $volume_normalization .
               ' --disable-audio-cache' .
               ' --cache /var/local/www/spotify_cache --backend alsa --device "' . $device . '"' .
               ' --onevent /var/local/www/commandw/spotevent.sh' .
               ' > /dev/null 2>&1 &';

and reboot (executing "sudo /home/pi/srestart.sh" might be enough).

Listen to the music.

Regards,
Kent
Reply
(11-06-2018, 10:41 PM)RafaPolit Wrote: This is really the wrong place to ask this question.  Here we are discussing a non-native installation of a different package which takes care of Spotify with Spotify Connect Web.

For the native Spotify support, please address this question in the support forum, probably starting a new thread.  It will get Tim's attention much quicker!

I apologize for writing the wrong topic.

Quote:TheOldPresbyope


I make the change to playerlib.php and have been listening to Spotify tracks for the past three hours. So far it seems to be working for me. I can't say this is an exhaustive test but it is at least a proof of concept. With the change and a reboot there is no caching of files to /var/local/www/spotify_cache/files directory. I cleared it once and it remains empty.

You apparently listen to Spotify a lot more than I do so how about testing this change too to see if I've overlooked a side effect? Since you have been mucking with cron I'm confident you can deal with the edit involved. 

In /var/www/inc/playerlib.php, there's a long string-concatenation statement beginning at line 1752 (in moOde r43)

Thank you so much for your answer, everything works fine.
Reply
(04-29-2018, 10:26 AM)grasshopper Wrote: My first post here.  Good morning Big Grin 
Anyway, just to say I followed the instructions on Git to install this in V4.1 & it worked flawlessly.  Thank you to all involved.
Using an IQaudIO DAC Pro I just changed the reference from hw:1 to hw:0 in asound.conf.
Replying to my own post here I know.
I followed RafaPolit's instructions again in MoOde 4.4 using the same IQaudIO DAC Pro combo & it worked flawlessly, just needing to change hw:1 to hw:0 in asound.conf again.
I have a question though, in MoOde Audio Config, the ALSA volume is set to 100%, if it is, the volume when connecting Spotify is distorted badly.  Reducing the ALSA volume to 90% results in loss of distortion & excellent sound.
If MoOde is restarted, the ALSA volume reverts to 100%.
Is there a way of ensuring the ALSA volume stays at 90% or should I be adjusting the volume elsewhere?  In the Spotify app, the volume for MoOde is shown at about 80% or 90% depending on how loud the source recording is.
Reply
For audio devices that have a hardware volume controller, moOde sets hardware (ALSA) volume to 0dB (100%) prior to beginning the stream sent from the client to the renderer.

Volume level is always set by the client.

What do you have volume set in in the Spotify app?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
(05-03-2018, 03:05 AM)JonPike Wrote:
(04-29-2018, 10:26 AM)grasshopper Wrote: My first post here.  Good morning Big Grin 
Anyway, just to say I followed the instructions on Git to install this in V4.1 & it worked flawlessly.  Thank you to all involved.
Using an IQaudIO DAC Pro I just changed the reference from hw:1 to hw:0 in asound.conf.
I have a 2nd MoOde audio player, one in a bedroom for headphone use only & I will want it to have a different spotify-connect name, looking at the instructions it will just be a case of amending "spotify-connect.sh" accordingly:

Code:
spotify-connect.sh
Code:
#!/bin/sh

cd /
cd home/pi/spotify/spotify-connect-web
LD_LIBRARY_PATH=/home/pi/spotify/spotify-connect-web python main.py --playback_device softvol -m Master --mixer_device_index 0 --bitrate 320 --name "ENTERNAMEHERE" --key /home/pi/spotify/spotify-connect-web/spotify_appkey.key
cd /

Hmmm...  with the simple Raspotify method,  I haven't had to do any naming changes.  Without any editing, it ends up looking like this:
raspotify (name) ,  with the name being the moode player device (network?) name.   I have a couple different players with different names,  and it seems handy enough.
Did you have to do the above for it to work at all,  or does doing that give you a better name?

I will be looking into Ravi's method here soon.  For the gapless play goodness alone,  it sounds like a better solution.  But,  I imagine a simpler method is still pretty attractive to the masses who have never typed on a Linux command line before.

Other changes I make are the selecting of the BITRATE=320 audio quality shown earlier,  and setting the starting volume level to something lower than 100%:
Code:
# By default, the volume normalization is enabled, add alternative volume
# arguments here if you'd like, but these should be fine.
#VOLUME_ARGS="--enable-volume-normalisation --linear-volume --initial-volume=100"

Maybe I could write this all up in a procedure for Raspotify,  for those who want simple solutions.

Hi Jon or anyone else that can kindly help.

If I want to disable volume normalisation, how do I do this?

Do I need to use the line:

VOLUME_ARGS="--disable-volume-normalisation --linear-volume --initial-volume=100"

This doesn't seem to work for me.

Appreciate your advice
Reply
No question any way :-)
Reply
Hi, has anyone tried Rafa's excellent solution for gapless Spotify on v5 Mo0de yet please?
Reply
No, unfortunately not.

Perhaps one of the worst downsides of this approach is that it will not survive well between updates and you could end up with half-working implementations. So, this is an obstacle in the way of normal upgrades and... to prevent the need of repeating all these steps... I'm still running 4.3 o even something earlier. Sad

Since I mostly listen just to Spotify and I am using MoOde more as an OS than a player, I'm mostly OK with this. But those looking to mostly use the MoOde player should probably not invest a lot of time in this and live with the included librespot solution. Sad

Please let me know if someone tries this on V5 and if there is something to update in the instructions.

Best regards,
Rafa.
Reply
Hi, yes I listen mainly to Spotify so I will stick with v4.4. Thanks again. If I get hold of a spare pi I will run through the steps to see if it works but don't want to mess with either of my 2 existing set up pi's.
Reply
Hallo,

ich habe heute MoOde auf 5.0 geupgrated und danach RafaPolites Schritte zum Spotify-Connect aufgespielt.
Leider ohne Erfolg. Es kam die Meldung:

main PID: 2264 (code=exited, status=203/EXEC)
spotify-connect-web.service: Unit entered failed state
spotify-connect-web.service: Failed with result 'exit-code'

Geht das überhaupt schon mit 5.0 oder nur bis 4.4 ?

Danke und Gruß

Reinhard
Reply


Forum Jump: