Stable: 2.5.2
Development: 2.6-alpha3
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
tomaszg
Fri, 2020-09-11 09:25
Permalink
Why not prepare a fitting
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?
canoodle
Sun, 2020-10-18 18:32
Permalink
ok let's try again
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?
jcf
Sun, 2020-10-18 20:13
Permalink
So, Let's Try This
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.
canoodle
Tue, 2020-10-20 10:04
Permalink
tried ur approach
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)
canoodle
Tue, 2020-10-20 10:07
Permalink
btw
delted the config folder before trying ur one liner rm -rf ~/.moc/
jcf
Tue, 2020-10-20 20:04
Permalink
Some Retrofitting Required
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
canoodle
Wed, 2020-10-28 15:22
Permalink
THANKS!
that works nicely :)
will update the blog post
canoodle
Wed, 2020-10-28 15:26
Permalink
almost
shuffle ain't active when using this one line
jcf
Sun, 2020-11-01 02:38
Permalink
Hmmm...
It works for me (and that's genuine, not just a scripted corporate response).
When you say "not active", do you mean not toggled on or toggled on but not actually shuffling?
I also thought you might run into another problem if you have a large number of files and/or long filenames. There is a limit to the length of a command line and you may exceed it.
canoodle
Sun, 2020-11-01 16:53
Permalink
exactly!
first of all: absolutely LOVIN' MOCP!
it is now my default (replaced vlc)
exactly! shuffle ain't toggled on when started like this:
it shuffles great, when it shuffles (properly searches and shuffles all music files in all sub directories (which vlc ain't))
lovely piece of open source software!
even when the automated startup is a little complicated :)
jcf
Sun, 2020-11-01 18:29
Permalink
Maybe A Timing Issue?
Try adding a sleep(1) between the first and second '
mocp
', like this:mocp -S && sleep 5s && mocp -o r,s,n && mocp -l $1/*; mocp
My thinking here is that the server may not have fully started before the settings toggling is attempted.
canoodle
Thu, 2020-11-05 07:50
Permalink
thanks for support
canoodle
Thu, 2020-11-05 07:50
Permalink
thanks for support
just tested the one-liner
mocp -S && sleep 5s && mocp -o r,s,n && mocp -l $1/*; mocp
strange enough, repeat and auto next are now toggled on
but shuffle is off? :-O
jcf
Thu, 2020-11-05 09:00
Permalink
That's Strange
Okay, this is going to require a little more digging.
What happens if you try this:
mocp -S && mocp -o r,n && mocp -o s && mocp -l $1/*; mocp
canoodle
Mon, 2020-11-09 07:02
Permalink
scripted it
when doing
shuffle repeat and next are toggled on but when scripted
it ain't workin hm...
jcf
Tue, 2020-11-10 22:54
Permalink
More Scripting Than MOC Itself
Try changing the '
$1
' to '$@
' in your script.If that works, try returning to a single '
mocp -o r,s,n
'.If it doesn't work, try removing the quotes around the music script parameter when you invoke it: '
/scripts/music.sh /home/user/Music/*
'.If it still doesn't work, add the option '
--echo-args
' to the 'mocp -l ...
' (second to last) in the script and let us know the result (from which you can delete the filenames and replace them with a count of filenames shown to save post length and provide privacy).