~ $ type mp
mp is a function with definition
function mp
mpv --input-ipc-server=/tmp/mpvsocket --shuffle--no-video /home/xk/Music/
end
~ $ type trash
trash is a function with definition
function trash
kioclient move (echo$argv|sed's/^-\w\+//') trash:/
end
function nextSong
set song (echo'{ "command": ["get_property", "path"] }'| socat - /tmp/mpvsocket | jq .data |sed-e's/^"//'-e's/"$//')
echo'playlist_next'| socat - /tmp/mpvsocket
incrFileSuffix $songend
function incrFileSuffix
forfilein$argvset match (string match -e-r'(.+)\.(\d+)\.([^.]+)'$file)
iftest$status-eq 0
set root $match[-3]
set n (math$match[-2] + 1)
set ext $match[-1]
elseset match (string match -e-r'(.+)\.([^.]+)'$file)
iftest$status-ne 0
# file does not have a dot. what to do?returnendset root $match[-2]
set n 1
set ext $match[-1]
endiftest$n-gt 30
trash $fileelsemv-iv$file$root.$n.$extendendend
play specific
function playSomething -a genre manyMult
set many (default $manyMult 1)
cd ~/Music/
set files (filesDeep | fileTypeAudio | shuf -n (math"100*$many") | filterByGenre $genre)
mpv --input-ipc-server=/tmp/mpvsocket --shuffle--no-audio-display$filesend
function default
forvalin$argviftest"$val" != ""echo$valbreakendendend
function filesDeep
find . -not-type d -execdu-h {} + |sort-h$argv|cut-f2end
function filterByGenre
whilereadfileif ffprobe "$file"2>&1|sed-E-n's/^ *GENRE *: (.*)/\1/p'|grep-q"$argv"echo"$file"elseendendend
function fileTypeAudio
grep-E'flac$|mp3$|m4a$|wav$|ogg$|oga$|opus$'end
set up a custom shortcut such that alt-f will trigger nextSong. it will keep track how many times you skipped a song by renaming the file