mirror of
https://github.com/The-Repo-Club/DotFiles.git
synced 2025-02-17 18:03:23 -05:00
update music script
This commit is contained in:
parent
0804da548a
commit
7688e1732e
@ -12,7 +12,7 @@
|
|||||||
# Created:
|
# Created:
|
||||||
# Wed 10 March 2021, 12:34:47 PM [GMT]
|
# Wed 10 March 2021, 12:34:47 PM [GMT]
|
||||||
# Modified:
|
# Modified:
|
||||||
# Sat 05 August 2023, 11:32:26 PM [GMT+1]
|
# Sat 05 August 2023, 11:57:57 PM [GMT+1]
|
||||||
#
|
#
|
||||||
# Description:
|
# Description:
|
||||||
# <Todo>
|
# <Todo>
|
||||||
@ -22,8 +22,9 @@
|
|||||||
MUSICPLAYER="mplayer"
|
MUSICPLAYER="mplayer"
|
||||||
CURRENT_SONG=$(lsof -c "$MUSICPLAYER" | grep -F ".mp3" | awk -F"/" '{ print $NF; }' | cut -d'.' -f1)
|
CURRENT_SONG=$(lsof -c "$MUSICPLAYER" | grep -F ".mp3" | awk -F"/" '{ print $NF; }' | cut -d'.' -f1)
|
||||||
PLAYING_MSG="Currently Playing :: ${CURRENT_SONG}"
|
PLAYING_MSG="Currently Playing :: ${CURRENT_SONG}"
|
||||||
|
MUSICDIR=$HOME/Music
|
||||||
|
|
||||||
for Song in "$HOME/Music/"*; do
|
for Song in "$MUSICDIR/"*; do
|
||||||
if [ -f "$Song" ]; then
|
if [ -f "$Song" ]; then
|
||||||
Name=${Song##*/}
|
Name=${Song##*/}
|
||||||
case $Name in
|
case $Name in
|
||||||
@ -43,9 +44,14 @@ ret=$?
|
|||||||
if [[ $ret -eq 0 ]]; then
|
if [[ $ret -eq 0 ]]; then
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
*.mp3 | *.flac | *.wav | *.ogg)
|
*.mp3 | *.flac | *.wav | *.ogg)
|
||||||
folder=$HOME/Music
|
if pgrep -f "$MUSICPLAYER" >/dev/null; then
|
||||||
pkill "$MUSICPLAYER"
|
killall -9 "$MUSICPLAYER"
|
||||||
$MUSICPLAYER "$folder/$CHOICE" &
|
fi
|
||||||
|
if [[ $MUSICPLAYER == "mplayer" ]]; then
|
||||||
|
$MUSICPLAYER -ao alsa "$MUSICDIR/$CHOICE" >> /dev/null &
|
||||||
|
else
|
||||||
|
$MUSICPLAYER "$MUSICDIR/$CHOICE" &
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Program terminated." && exit
|
echo "Program terminated." && exit
|
||||||
@ -53,6 +59,6 @@ if [[ $ret -eq 0 ]]; then
|
|||||||
esac
|
esac
|
||||||
elif [[ $ret -gt 1 ]]; then
|
elif [[ $ret -gt 1 ]]; then
|
||||||
if [[ $ret -eq 10 ]]; then
|
if [[ $ret -eq 10 ]]; then
|
||||||
pkill "$MUSICPLAYER"
|
killall -9 "$MUSICPLAYER"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
Loading…
x
Reference in New Issue
Block a user