Posts: 13,442
Threads: 305
Joined: Mar 2018
Reputation:
545
Oops that function only exists in the moOde 4.5 code base which is currently under development.
Here is the equivalent code from the current 4.4 codebase.
Code: sysCmd('killall librespot');
sysCmd('/var/www/vol.sh -restore'); // r44d
// reset to inactive
playerSession('write', 'spotactive', '0');
$GLOBALS['spotactive'] = '0';
sendEngCmd('spotactive0');
So just replace stopSpotify() with the lines above and you should be all set :-)
Posts: 23
Threads: 3
Joined: Apr 2018
Reputation:
0
Great! This works fine, thnx. Although I had to hardcode the name and card number, otherwise they'll show up empty. For me this is not a problem, since I never change these.
For future reference and others wanting to do something similar, here is the final script:
Code: #!/usr/bin/php
<?php
set_include_path('/var/www/inc');
require_once 'playerlib.php';
$_SESSION[cardnum]=0;
$_SESSION['spotifyname']="Librespot blackbox";
sysCmd('killall librespot');
sysCmd('/var/www/vol.sh -restore'); // r44d
// reset to inactive
playerSession('write', 'spotactive', '0');
$GLOBALS['spotactive'] = '0';
sendEngCmd('spotactive0');
startSpotify();
?>
Posts: 13,442
Threads: 305
Joined: Mar 2018
Reputation:
545
Oops, forgot to read in the session vars.
Replace the two $_SESSION lines with below.
Code: playerSession('open', '' ,'');
session_write_close();
Posts: 2
Threads: 0
Joined: Dec 2018
Reputation:
0
01-08-2019, 07:09 PM
(This post was last modified: 01-08-2019, 07:15 PM by andyc.)
(01-04-2019, 09:50 PM)Tim Curtis Wrote: Hi Andy,
Good analysis :-)
If you still have the original cache intact, try the following:
1. If u modified the launch params in playerlib.php then revert to original launch params and reboot
2. Save the credentials file
Code: sudo mv /var/local/www/spotify_cache/files/credentials.json ./
3. Turn on librespot from moOde UI to launch it
If it launches ok then i might have to add a "Clear cache" option.
-Tim Hi Tim,
Sorry for the delay, but I have only just got round to trying this now. Here my notes of the results:
Check Spotify running OK.
Change playerlib.php from
Code: ' --disable-audio-cache --backend alsa --device "' . $device . '"' . // r44d audio file cache eats disk space
to
Code: ' --cache /var/local/www/spotify_cache --disable-audio-cache --backend alsa --device "' . $device . '"' . // r44d audio file cache eats disk space
reboot
spotify fails to start.
log from librespot.
Code: INFO:librespot: librespot (). Built on 2018-10-31. Build ID: No392Ult
DEBUG:librespot_connect::discovery: Zeroconf server listening on 0.0.0.0:0
INFO:librespot_core::session: Connecting to AP "gew1-accesspoint-b-vjv8.ap.spotify.com:4070"
thread 'main' panicked at 'Authentication failed with reason: BadCredentials', core/src/connection/mod.rs:93:21
stack backtrace:
move the cache file to clear it
Code: sudo mv /var/local/www/spotify_cache/credentials.json /home/pi/
reboot
log from librespot:
Code: INFO:librespot: librespot (). Built on 2018-10-31. Build ID: No392Ult
DEBUG:librespot_connect::discovery: Zeroconf server listening on 0.0.0.0:0
so all OK, pi is showing up as a spotify connect device from my tablet and i can play songs on moode using spotify connect.
So clearing out the cached credentials worked a treat.
Thanks
Andy
Posts: 13,442
Threads: 305
Joined: Mar 2018
Reputation:
545
Nice :-)
That would suggest that adding a "Clear credential cache" option to the Spotify renderer section in Audio config would be beneficial. Should be an easy one,
Posts: 23
Threads: 3
Joined: Apr 2018
Reputation:
0
(01-08-2019, 04:04 PM)Tim Curtis Wrote: Oops, forgot to read in the session vars.
Replace the two $_SESSION lines with below.
Code: playerSession('open', '' ,'');
session_write_close();
Great, thnx, even better.
I'm happy to report that I had no further crashes on the latest librespot version, I've been using it quite a lot the last three days, switching between devices. I also remember this version being more stable. I had it before, but recently upgraded from Moode 4.0 with a self compiled librespot, to 4.4 and noticed the difference. But of course it's not very hard evidence, haha.
Thnx for the great job, Tim!
Posts: 13,442
Threads: 305
Joined: Mar 2018
Reputation:
545
Let me know if it seems more stable and I'll look at including the particular commit that you are testing in upcoming moOde 4.5 :-)
-Tim
Posts: 23
Threads: 3
Joined: Apr 2018
Reputation:
0
Yes, I think it's more stable. Wether this is because of an update to the decoder or the EOF fix of 19 nov, I do not know. Maybe a combination. I even think it sounds a bit better. I checked the changelog of the Lewton decoder and I am not sure why this could be, so it's probably my imagination. I’m not an expert in these matters either... My setup (driade 70b/Brio-R/Mamboberry/Kali/IfI power) is quite sensitive though, especially for high notes and bad recordings/mixes, maybe it was this bug: https://github.com/RustAudio/lewton/issues/26.
I use librespot every day for several hours (morning/evening), switching between my Mac and iPhone or iPad, skipping tracks and playlists. There were no crashes in the last four days.
Posts: 6,029
Threads: 177
Joined: Apr 2018
Reputation:
235
I wasn't experiencing the problems described by others but I'm not a heavy user of Spotify (at least not yet!).
To confirm @ sjoerdju's findings, though, I pulled the librespot master branch from github and built it on a copy of the latest moOde r4.5 test image (with kernel 4.13.0-45-generic). Seems to be working without issue.
I haven't tried an A-B comparison of sound quality of this version vs the version in moOde r4.4. I don't believe I have the equipment, listening space, or ears to make it a fair test. That said, the jazz album I'm listening to right now sounds fine.
Regards,
Kent
Posts: 13,442
Threads: 305
Joined: Mar 2018
Reputation:
545
01-14-2019, 02:57 PM
(This post was last modified: 01-14-2019, 02:59 PM by Tim Curtis.
Edit Reason: formatting
)
Hi Kent,
What procedure are u using to build librespot?
I tried below and keep getting permission error. I downloaded zip from master branch rather than git clone the repo.
Code: pi@rp2:~/librespot-master $ cargo build --release --features alsa-backend
Updating crates.io index
Updating git repository `https://github.com/awmath/rust-crypto.git`
Updating git repository `https://github.com/plietar/rust-tremor`
Updating git repository `https://github.com/plietar/rust-mdns`
Updating git repository `https://github.com/plietar/rust-alsa`
Updating git repository `https://github.com/plietar/dns-parser`
error: failed to open: /home/pi/librespot-master/target/release/.cargo-lock
Caused by:
Permission denied (os error 13)
pi@rp2:~/librespot-master $
-Tim
|