Page 1 of 1

Automatic start of playlist on Pi

PostPosted: 22 Apr 2016, 21:23
by mhebert35
Hi,

How can I configure automatic start of playlist when booting my Pi?

Thank you

Re: Automatic start of playlist on Pi

PostPosted: 22 Apr 2016, 22:10
by rastus
I was of the opinion that Rune 'remembers' my play list after a reboot.... all I have to do is press 'play' and off she goes. The difference between auto start and manual play is one button press.

Re: Automatic start of playlist on Pi

PostPosted: 22 Apr 2016, 22:42
by hondagx35
Hi mhebert35,

sorry but this is not possible at the moment.

If you have a RP2 or RP3 and the latest version is installed you can try the "global random" feature (MENU->MPD).
Maybe this is what you are searching for.

Frank

Re: Automatic start of playlist on Pi

PostPosted: 25 Apr 2016, 14:30
by mhebert35
Hi,

Thanks for the answers.

I know, we only have to do a click to start the playlist, but I want it to start the playlist playing as soon as the RP3 boot up.
Is there a way to start the service automatically?

Thank you

Re: Automatic start of playlist on Pi

PostPosted: 25 Apr 2016, 14:51
by rastus
hondagx35 wrote:Hi mhebert35,

sorry but this is not possible at the moment.


mhebert35 > I don't know, but it sounds like your question's already been answered. Maybe I'm wrong.

Re: Automatic start of playlist on Pi

PostPosted: 25 Apr 2016, 17:05
by hondagx35
Hi mhebert35,

Is there a way to start the service automatically?

Which service do you mean?

Did you try the global random i mentioned earlier?

Frank

Re: Automatic start of playlist on Pi

PostPosted: 25 Apr 2016, 20:03
by mhebert35
Hi Frank,

Sorry, I just tested the Global Random and yes, the playlist is starting automatcally at bootup.
But it adds a random song to the current playlist everytime and songs are twice on the playlist after that.

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.

Thank you

Re: Automatic start of playlist on Pi

PostPosted: 25 Apr 2016, 22:26
by hondagx35
Hi,

But it adds a random song to the current playlist everytime and songs are twice on the playlist after that.

This is exactly what it is made for (see here).

A very dirty but working hack:
Edit "/srv/http/command/rune_SY_wrk"
Code: Select all
    // 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);
        }
    }

to
Code: Select all
    // 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);
        }
    }


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.
This is hard to do, because you have to wait until all is up and running (e.g. shares have to be mounted).

Frank

Re: Automatic start of playlist on Pi

PostPosted: 05 May 2016, 18:32
by mhebert35
For your information, I enabled CRON with these command line :
Code: Select all
systemctl enable cronie
systemctl start cronie


I created a CRON job to run at bootup. Here is the script :
Code: Select all
# 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


Thanks to PeteB for the help.

Re: Automatic start of playlist on Pi

PostPosted: 05 May 2016, 19:08
by PeteB
Great! I am glad you have that working. Sounds like we are doing something similar.
I am slowly making one of my two Pi/DAC sets to work like an old receiver :mrgreen:

  1. On boot it loads a playlist of radio stations, and starts to play.
  2. Previous/Next buttons on my remote "tune" to the next or previous station in the list.
  3. Numeric keys 1 - 9 are programmed to favorite stations.
  4. The display will show the name of the station playing (still working on the display h/w)
I also noticed that Play/Pause will actually play and resume a stream, which is a bonus.