More changed for mpc/mpd

This commit is contained in:
inigoortega 2020-04-11 18:47:51 +02:00
parent e87b48defc
commit d93c3650d3
3 changed files with 34 additions and 32 deletions

View File

@ -6,10 +6,10 @@ usage() {
printf "
-f <format> Sets the format the audio will be downloaded on.
Default: ogg opus when possible, otherwise vorbis ogg.
-d <directory> Sets the directory where downloaded audio will be stored.
Default: \$HOME/Downloads/youtube-dl/
" >&2
exit 1
}
@ -50,7 +50,7 @@ if [ "$format" = "opus" ]; then
youtube-dl -x --audio-quality 0 --audio-format opus "$link"
size="$(stat --printf="%s" "$filename")"
if [ "$size" < 500000 ]; then
if [ "$size" -lt 500000 ]; then
youtube-dl -x --audio-quality 0 --audio-format vorbis "$link"
rm "$filename"
fi

View File

@ -1,7 +1,5 @@
#!/usr/bin/env sh
player="$AUDIOPLAYER"
if [ -f "$1" ] && [ -n "$(printf "%b\n" "$1" | sed -r "s|\\.[^\\.]+$||")" ]; then
media="$1"
else
@ -24,18 +22,10 @@ else
media="$HOME/$media"
fi
if [ "$media" != "$HOME/" ]; then
dash $HOME/bin/cmusd.sh > /dev/null 2>&1
sleep 1
dash -c "$player -C 'view tree'"
dash -c "$player -C clear"
dash -c "$player -C \"view queue\""
dash -c "$player -C clear"
# sleep 1
dash -c "$player -C \"add $media\""
sleep 1
dash -c "$player -C player-next"
dash -c "$player -C player-play"
# dash -c "$player -C win-remove"
fi
[ "$media" != "$HOME/" ] && {
if [ "$(command -v disown > /dev/null)" ]; then
st -c "Music Player" -e "$AUDIOPLAYER" "$media" 2>/dev/null & disown
else
st -c "Music Player" -e "$AUDIOPLAYER" "$media" 2>/dev/null &
fi
}

View File

@ -1,15 +1,27 @@
#!/usr/bin/env sh
dash $HOME/bin/cmusd.sh
dash $SCRIPTS/musicplayerui.sh
case "$MUSICPLAYER" in
"cmus-remote")
dash -c "$AUDIOPLAYER -C 'view tree'"
dash -c "$AUDIOPLAYER -C clear"
dash -c "$AUDIOPLAYER -C \"view queue\""
dash -c "$AUDIOPLAYER -C clear"
sleep 1
dash -c "$AUDIOPLAYER -C \"view sorted\""
dash -c "$AUDIOPLAYER -C clear"
dash -c "$AUDIOPLAYER -C \"add $MUSIC\""
sleep 1
dash -c "$AUDIOPLAYER -C player-next"
dash -c "$AUDIOPLAYER -C player-play"
dash -c "cmus-remote -C 'view tree'"
dash -c "cmus-remote -C clear"
dash -c "cmus-remote -C \"view queue\""
dash -c "cmus-remote -C clear"
sleep 1
dash -c "cmus-remote -C \"view sorted\""
dash -c "cmus-remote -C clear"
dash -c "cmus-remote -C \"add $MUSIC\""
sleep 1
dash -c "cmus-remote -C player-next"
dash -c "cmus-remote -C player-play"
;;
"mpc")
mpc clear
mpc update
mpc ls | mpc add
mpc shuffle
mpc play
;;
esac