commit 21669af

hovercats  ·  2026-08-19 21:15:31 +0000 UTC
parent fd66618
add option to add the playing song to a default playlist
1 files changed,  +5, -0
M ampv
M ampv
+5, -0
 1@@ -2,11 +2,16 @@
 2 
 3 musicdir=$HOME/usr/Music
 4 socket=/tmp/.mpvsocket
 5+playlist=$home/usr/ampv-playlist
 6 
 7 fn player {mpv '--input-ipc-server='$socket $*}
 8 fn njetcat {nc -UN $socket}
 9 
10 switch($1) {
11+	case add
12+		file=`{printf '{ "command": ["get_property", "path"] }\n' | \
13+			njetcat | awk -F '"' '{print $4}'}
14+		printf '%s\n' $"file >> $playlist
15 	case next
16 		printf 'playlist-next\n' | njetcat
17 	case pause