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)

challenge:

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:

#!/bin/bash
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

https://dwaves.de/2020/09/05/gnu-debian-linux-install-and-autostart-play-music-from-command-line-with-mocp-mocplayer-musicplayer-music-on-console-play-music-without-gui-without-desktop-hotkeys-shortcuts/

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?