Automatic start of playlist on Pi

Raspberry Pi related support

Automatic start of playlist on Pi

Postby mhebert35 » 22 Apr 2016, 21:23

Hi,

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

Thank you
mhebert35
 
Posts: 5
Joined: 22 Apr 2016, 21:19

Re: Automatic start of playlist on Pi

Postby rastus » 22 Apr 2016, 22:10

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.
You are invited to participate in my new forum, Rastus' Rants: http://rastus.tk
Subjects covered: Hardware setup for the Raspberry Pi as a digital streamer. Digital music, artists and thier albums or CDs. More will be added in the coming weeks.
User avatar
rastus
 
Posts: 261
Joined: 21 Aug 2015, 10:29

Re: Automatic start of playlist on Pi

Postby hondagx35 » 22 Apr 2016, 22:42

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
User avatar
hondagx35
 
Posts: 2910
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Automatic start of playlist on Pi

Postby mhebert35 » 25 Apr 2016, 14:30

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
mhebert35
 
Posts: 5
Joined: 22 Apr 2016, 21:19

Re: Automatic start of playlist on Pi

Postby rastus » 25 Apr 2016, 14:51

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.
You are invited to participate in my new forum, Rastus' Rants: http://rastus.tk
Subjects covered: Hardware setup for the Raspberry Pi as a digital streamer. Digital music, artists and thier albums or CDs. More will be added in the coming weeks.
User avatar
rastus
 
Posts: 261
Joined: 21 Aug 2015, 10:29

Re: Automatic start of playlist on Pi

Postby hondagx35 » 25 Apr 2016, 17:05

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
User avatar
hondagx35
 
Posts: 2910
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Automatic start of playlist on Pi

Postby mhebert35 » 25 Apr 2016, 20:03

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
mhebert35
 
Posts: 5
Joined: 22 Apr 2016, 21:19

Re: Automatic start of playlist on Pi

Postby hondagx35 » 25 Apr 2016, 22:26

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
User avatar
hondagx35
 
Posts: 2910
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Automatic start of playlist on Pi

Postby mhebert35 » 05 May 2016, 18:32

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.
mhebert35
 
Posts: 5
Joined: 22 Apr 2016, 21:19

Re: Automatic start of playlist on Pi

Postby PeteB » 05 May 2016, 19:08

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.
PeteB
 
Posts: 421
Joined: 06 Feb 2016, 05:07

support RuneAudio Donate with PayPal


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 1 guest