others/musicplayer.sh

35 lines
863 B
Bash
Executable File

#!/bin/sh
## play music with mplayer ##
# musicplayer.sh by @root_informatica.
. $HOME/.config/wms/wms_var
# music dir.
MDIR="$HOME/Música/"
# playlist path.
PLIST="/tmp/playlist"
# define the menu according to the environment.
[ -t 0 ] && MENU="fzy" \
|| MENU="xmenu.sh"
# add album to playlist.
for album in $(find $MDIR -type d | $MENU); do
if [ -n "$album" ]; then
find $album -maxdepth 1 -type f |
grep -E ".mp3|.opus|.flac|.webm|.wav" > $PLIST
fi
done
# play it
[ -t 0 ] && mpv --no-video \
--playlist=$PLIST \
|| mpv --quiet \
--force-window=yes \
--lavfi-complex="[aid1]asplit[ao][a1];[a1]showwaves=mode=cline:colors=#$AC:rate=25,format=rgb0 [vo]" \
--playlist=$PLIST
# ffmpeg-filters showwaves
# --lavfi-complex='[aid1]asplit[ao][a1];[a1]showwaves=mode=cline:colors=white:rate=25,format=rgb0 [vo]' \