Now default music player = mocp

This commit is contained in:
inigoortega 2020-04-12 13:53:09 +02:00
parent 31da2d058a
commit 08271c0257
4 changed files with 84 additions and 10 deletions

View File

@ -14,8 +14,9 @@ export YTDL_FORMAT='bestvideo[height=1080]+bestaudio/bestvideo[height=1440]+best
export VIDEOPLAYER="mpv --ytdl-format=$YTDL_FORMAT"
export VIDEOPLAYER_SELECT_YTDLFORMAT="mpv --ytdl-format="
export AUDIOPLAYER="mpv"
export MUSICPLAYER="mpc"
export MUSICPLAYERUI="ncmpcpp"
export MUSICPLAYER="mocp"
export MUSICPLAYERUI="mocp"
export MUSICPLAYERSTATUS="mocp -i"
export TERMINAL="st"
export BROWSER="firefox-bin"
export MUSIC="$HOME/Music/music"
@ -40,5 +41,3 @@ export ROS_PACKAGE_PATH=/usr/share/ros_packages
export ROS_ROOT=/usr/share/ros
. "$HOME/.alias"
. "$HOME/.functions"

View File

@ -8,7 +8,7 @@ searchplayers() {
playerplay() {
case "$2" in
"mpv")
xdotool key --window "$1" p
xdotool key --window "$1" space
;;
"vlc")
xdotool key --window "$1" space
@ -49,12 +49,70 @@ playerprev() {
esac
}
if mpc | grep -q "\[\(playing\|paused\)\]" && [ "$1" = "play" ]; then
mpc toggle
else
mpc $1
fi
$MUSICPLAYERSTATUS 2>/dev/null && {
case "$1" in
"play")
case "$MUSICPLAYER" in
"mocp")
if [ "$(mocp -i)" = "State: STOP" ]; then
mocp -p
else
mocp -G
fi
;;
"mpc")
if mpc | grep -q "\[\(playing\|paused\)\]"; then
mpc toggle
else
mpc play
fi
;;
esac
;;
"toggle")
case "$MUSICPLAYER" in
"mocp")
mocp -G
;;
"mpc")
mpc toggle
;;
esac
;;
"stop")
case "$MUSICPLAYER" in
"mocp")
mocp -s
;;
"mpc")
mpc stop
;;
esac
;;
"next")
case "$MUSICPLAYER" in
"mocp")
mocp -f
;;
"mpc")
mpc next
;;
esac
;;
"prev")
case "$MUSICPLAYER" in
"mocp")
mocp -r
;;
"mpc")
mpc prev
;;
esac
;;
esac
}
searchplayers | while read -r line; do
echo "$line"
player$1 $line
done

10
scripts/musicplayerui.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env sh
if [ "$(ps -e | grep -c $MUSICPLAYERUI)" -eq "0" ]; then
if [ "$(command -v disown > /dev/null)" ]; then
st -c "Music Player" -e $MUSICPLAYERUI & disown
else
st -c "Music Player" -e $MUSICPLAYERUI &
fi
fi

View File

@ -24,4 +24,11 @@ case "$MUSICPLAYER" in
mpc shuffle
mpc play
;;
"mocp")
while ! mocp -o shuffle 2>/dev/null; do
sleep 1
done
mocp -a ~/Music/music
mocp -p
;;
esac