autostart script and how to toggle autonext via script

MOC version: 
2.6-alpha3, Debian 10

Hello all,

first of: praise: NICE JOB! :)

thanks for this nice no gui needed music player :)

the random shuffle function of mocp works perfectly

searching recursively through all subdirs and then playing all songs randomly from all subdirs :)

(VLC has an issue here... it seems not to really to recurse and shuffle, but starts playing with all songs it the top directory)


trying to put together a script, that can auto start with the computer (under gnome2 mate desktop this can be nicely done via the gui)

the script used is this:

echo "=== mocp autostart script v1 ==="
echo "quit mocplayer gui with: Shift+Q"
echo "to stop mocp background server: mocp -x"

echo "===== # start background server"
mocp -S

echo "===== # clear the playlist"
mocp -c

echo "===== # modify play settings (shuffle on (jump to next song randomly, autonext (automatically play next song on playlist))"
mocp -t s
mocp -t n <- DOES NOT TOGGLE autonext!?

echo "===== # add first argument to script as music dir"
echo "(depending on the amount of music this could take a while)"
echo "adding dir:" $1 " to playlist"
mocp -a $1

echo "===== # autostart playback"
mocp --play

echo "===== # show gui in xterm (Quit with Shift+Q)"
echo "and change dir to: "$1
xterm -e "mocp -O AutoNext=yes -m $1"

# stop everything
# mocp -x

can not get "autonext" to be on when starting via this script.

also: the songs do not seem to get added to the playlist...

they are on the left side, but not on the right side?

best regards

Why not prepare a fitting config file and just use it with with mocp -C?

AutoNext is by default on, maybe your toggle just disables it? You can also use mocp -O AutoNext=yes

As to the playlist, didn't you by some chance disable SyncPlaylist?

all the user wants is

1) play all songs in directory X

2) start play on startup

3) shuffle on

4) auto next on

5) repeat all on

how would this be done in a one-liner?

How about:

mocp -S && mocp -o r,s,n && mocp -l X/*

Here I've started the MOC Server in background; if you want the Client as well, you can start that separately by appending a '; mocp'. If you do want to start the Client separately, then you may (or may not) want to synchronise the playlist with the Server (the '-y' option). If you start the Server in background, then you will either need to stop it via the commpand line ('mocp -x') or using a started Client keypress ('Q').

It all depends on what it is you're trying to achieve.

thanks for ur reply

so the one-liner in question would be:

mocp -S && mocp -o r,s,n && mocp -l X/* /home/user/Music; mocp;

1) it does not autostart playback

2) shuffle is off? (can be activated manually via Shift+S)

delted the config folder before trying ur one liner rm -rf ~/.moc/

The example I posted would need some tweaking to fit your particular directory layout. Now we know a little more, we can do some of that tweaking:

mocp -S && mocp -o r,s,n && mocp -l /home/user/Music/*; mocp

that works nicely :)

will update the blog post

shuffle ain't active when using this one line