Automatic start of playlist on Pi
Posted: 22 Apr 2016, 21:23
Hi,
How can I configure automatic start of playlist when booting my Pi?
Thank you
How can I configure automatic start of playlist when booting my Pi?
Thank you
Embedded hi-fi music player
https://www.runeaudio.com/forum/
https://www.runeaudio.com/forum/automatic-start-of-playlist-on-pi-t3510.html
hondagx35 wrote:Hi mhebert35,
sorry but this is not possible at the moment.
Is there a way to start the service automatically?
But it adds a random song to the current playlist everytime and songs are twice on the playlist after that.
// mount all sources
if ($all_mounted === 0) {
runelog('wrk_SY: try to mount all shares!');
$all_mounted = wrk_sourcemount($redis, 'mountall');
if ($all_mounted === 1) {
runelog('wrk_SY: all shares mounted successfully!');
} else {
$retries_mounting++;
runelog('wrk_SY: error mounting shares, try it again! Count: '.$retries_mounting);
if ($retries_mounting > 20) {
$all_mounted = 1;
runelog('wrk_SY: mounting: tried it 20 times (10 seconds) => capitulating!');
ui_notify_async('ERROR','Failed to mount network shares');
}
usleep(500000);
}
}
// mount all sources
if ($all_mounted === 0) {
runelog('wrk_SY: try to mount all shares!');
$all_mounted = wrk_sourcemount($redis, 'mountall');
if ($all_mounted === 1) {
runelog('wrk_SY: all shares mounted successfully!');
sysCmdAsync("mpc load your-playlist-name; mpc play");
} else {
$retries_mounting++;
runelog('wrk_SY: error mounting shares, try it again! Count: '.$retries_mounting);
if ($retries_mounting > 20) {
$all_mounted = 1;
runelog('wrk_SY: mounting: tried it 20 times (10 seconds) => capitulating!');
ui_notify_async('ERROR','Failed to mount network shares');
}
usleep(500000);
}
}
This is hard to do, because you have to wait until all is up and running (e.g. shares have to be mounted).The best would have been to get a script started with crontab to start the playlist, but don't know to start the playlist with a script.
systemctl enable cronie
systemctl start cronie
# clear whatever is in the playlist
mpc clear
# load a saved playlist or radio station into the queue
mpc load <any_saved__playlist>
# play the queue from the top
mpc play