# MusicBox Playlist Schedule

**URL:** <https://discourse.mopidy.com/t/musicbox-playlist-schedule/1512>\
**Category:** Pi MusicBox (archive)\
**Created:** [February 21, 2017, 4:24pm UTC](https://discourse.mopidy.com/t/musicbox-playlist-schedule/1512 "2017-02-21T16:24:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Jensen](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@Dan\_Jensen](https://discourse.mopidy.com/u/Dan_Jensen)\
**Post date:** [February 21, 2017, 4:24pm UTC](https://discourse.mopidy.com/t/musicbox-playlist-schedule/1512/1 "2017-02-21T16:24:08Z")

</div>

I’m using MusicBox as a player for a large venue. I’m hoping to create a schedule to change playlists regularly throughout the week. We have different people that use our building on Wednesday and Sunday nights and they need to change the music. Right now we have them signing into MusicBox and changing playlists.

Is there a way via crontab or MusicBox itself that would allow me to set a schedule to change playlists automatically?

---

<div class="post-metadata">

**Author:** ![serialdie](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@serialdie](https://discourse.mopidy.com/u/serialdie)\
**Post date:** [February 21, 2017, 6:22pm UTC](https://discourse.mopidy.com/t/musicbox-playlist-schedule/1512/2 "2017-02-21T18:22:22Z")

</div>

You can do a script like this which was made by somebody else:

> [@](#):
>
> #!/bin/bash  
> rm -f /var/lib/mopidy/playlists/_.m3u  
> find “$1” -type d |  
> while read subdir  
> do  
> for filename in “$subdir”/_.mp3  
> do  
> if [-e “$filename”]  
> then  
> echo $filename \>\> /var/lib/mopidy/playlists/“${subdir##\*/}.m3u”  
> fi  
> done  
> done

and put it in a cron job.

---

<div class="post-metadata">

**Author:** ![Dan\_Jensen](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@Dan\_Jensen](https://discourse.mopidy.com/u/Dan_Jensen)\
**Post date:** [February 21, 2017, 7:29pm UTC](https://discourse.mopidy.com/t/musicbox-playlist-schedule/1512/3 "2017-02-21T19:29:19Z")

</div>

How can I specify which playlist to start/stop? I’m embarrassingly and admittedly not great in bash.

---

<div class="post-metadata">

**Author:** ![serialdie](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@serialdie](https://discourse.mopidy.com/u/serialdie)\
**Post date:** [February 21, 2017, 7:37pm UTC](https://discourse.mopidy.com/t/musicbox-playlist-schedule/1512/4 "2017-02-21T19:37:40Z")

</div>

> [@Dan\_Jensen](#):
>
> How can I specify which playlist to start/stop? I’m embarrassingly and admittedly not great in bash.

OPS!  
Well I read your thread wrong. That script will generate your play list.  
But if you are trying to load a playlist you can use the MPD back end to load playlists via cron.  
There is quite a few examples on google on how to script it and crontab it…

Good luck!

---

<div class="post-metadata">

**Author:** ![Steve\_Lambert](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/steve_lambert/32/1149_2.png) [@Steve\_Lambert](https://discourse.mopidy.com/u/Steve_Lambert)\
**Post date:** [February 21, 2017, 9:50pm UTC](https://discourse.mopidy.com/t/musicbox-playlist-schedule/1512/5 "2017-02-21T21:50:57Z")

</div>

You could try crontab and mpc

use crontab -e

m h dom mon dow command  
05 10 \* \* 0 mpc stop;mpc clear;mpc load “The Dark Side Of The Moon”; mpc play  
This would (hopefully) stop and clear existing playlist, at 5 past 10 on Sunday then load The Dark side of the Moon and start it playing until the end

So if you want to start another one on at 25 past 3 pm on Tuesday you would use

25 15 \* \* 2 mpc stop;mpc clear;mpc load “Put your playlist here”; mpc play

Have a look [here](http://stackoverflow.com/questions/18919151/crontab-day-of-the-week-syntax) for more on the crontab syntax.  
Try [here](https://linux.die.net/man/1/mpc) for more commands from mpc

I have found that a - in the playlist name sometimes isn’t recognised so practice first with simple playlist names.

I guess a bash script will be neater but the above may get you underway.

---

<div class="post-metadata">

**Author:** ![Dan\_Jensen](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@Dan\_Jensen](https://discourse.mopidy.com/u/Dan_Jensen)\
**Post date:** [February 21, 2017, 10:09pm UTC](https://discourse.mopidy.com/t/musicbox-playlist-schedule/1512/6 "2017-02-21T22:09:13Z")

</div>

Thanks for the reply. I actually started down this path a little bit ago and was about to post the solution. I ended up going with crontab and a simple script. All it needs is

`mpc clear; mpc load 'playlist name'; mpc play`

---

<div class="post-metadata">

**Author:** ![jodal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/jodal/32/2564_2.png) [@jodal](https://discourse.mopidy.com/u/jodal)\
**Post date:** [February 19, 2026, 11:47am UTC](https://discourse.mopidy.com/t/musicbox-playlist-schedule/1512/7 "2026-02-19T11:47:22Z")

</div>


