Skip to content

Commit

Permalink
Add Asciiville animation and MusicPlayerPlus splash screen to animati…
Browse files Browse the repository at this point in the history
…ons menu
  • Loading branch information
ron.record committed Jul 1, 2024
1 parent 3a72d9a commit 24e51ab
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 53 deletions.
8 changes: 4 additions & 4 deletions bin/mppanim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# asciifetch - display, animate, zoom MusicPlayerPlus splash screen using Kitty
# mppanim - display, animate, zoom MusicPlayerPlus splash screen using Kitty
#
# Written by Ronald Joe Record <ronaldrecord@gmail.com>
#
Expand Down Expand Up @@ -31,7 +31,7 @@ else
fi

usage() {
printf "\nUsage: asciifetch [-a] [-f] [-k] [-q] [-z] [-u]"
printf "\nUsage: mppanim [-a] [-f] [-k] [-q] [-z] [-u]"
printf "\nWhere:"
printf "\n\t-a indicates animate display"
printf "\n\t-f indicates fullscreen mode"
Expand Down Expand Up @@ -74,7 +74,7 @@ cleanup() {
tput cnorm
tput cup ${terminal_height} 0
parent_name=$(ps -p ${PPID} -o comm=)
if [ "${parent_name}" == "asciifetch" ]
if [ "${parent_name}" == "mppanim" ]
then
exit 2
else
Expand Down Expand Up @@ -151,7 +151,7 @@ zoom() {
--override startup_session=none \
${KITTY_QUIT_OPT} \
--listen-on unix:${sock_name} \
asciifetch -k 2> /dev/null &
mppanim -k 2> /dev/null &
kitty_pid=$!
trap 'cleanup' USR1
wait_for_pid ${kitty_pid} > /dev/null 2>&1 &
Expand Down
96 changes: 56 additions & 40 deletions bin/mpplus
Original file line number Diff line number Diff line change
Expand Up @@ -2023,13 +2023,10 @@ show_system_status() {
}

show_about() {
[ "${have_gum}" ] && [ "${have_figlet}" ] && {
have_mppanim=$(type -p mppanim)
[ "${have_mppanim}" ] && {
mppanim -a -q
[ $? -eq 0 ] || tput cup 0 0 2>/dev/null
sleep 3
}
[ "${have_gum}" ] && [ "${have_figlet}" ] && [ "${have_mppanim}" ] && {
mppanim -a -q
[ $? -eq 0 ] || tput cup 0 0 2>/dev/null
sleep 3
}
if [ -f "${MPP_DIR}/VERSION" ]; then
. "${MPP_DIR}/VERSION"
Expand Down Expand Up @@ -2932,34 +2929,37 @@ show_ascii_menu() {
SPLASH=1
if [ "${AUDIO}" ]
then
audiostat="(ON) "
audiostat="[ON] "
else
audiostat="(OFF)"
audiostat="[OFF]"
fi
if [ "${RECORD}" ]
then
recordstat="(ON) "
recordstat="[ON] "
else
recordstat="(OFF)"
recordstat="[OFF]"
fi
if [ "${USE_TMUX}" ]
then
usetmux="(ON) "
usetmux="[ON] "
else
usetmux="(OFF)"
usetmux="[OFF]"
fi
skip_it_so=
save_it_so=
PS3="${BOLD}${PLEASE} command choice (numeric or text, 'h' for help): ${NORM}"
options=("Julia Set ASCIImatics Animation [j]")
options+=("MPPlus ASCIImatics Animation [s]")
options+=("Plasma ASCIImatics Animation [p]")
options=("Julia Set ASCIImatics Animation [J]")
options+=("MPPlus ASCIImatics Animation [M]")
options+=("Plasma ASCIImatics Animation [P]")
[ "${have_asciiart}" ] && options+=("Asciiville Animation [A]")
[ "${have_gum}" ] && [ "${have_figlet}" ] && [ "${have_mppanim}" ] && {
options+=("MusicPlayerPlus Splashscreen [S]")
}
options+=("Toggle Audio ${audiostat} [a]")
[ "${have_nema}" ] && options+=("Toggle Record Tmux ${recordstat} [r]")
options+=("Toggle Use Tmux ${usetmux} [t]")
[ "${have_ascii}" ] && options+=("Asciiville Menu [A]")
options+=("Main menu [m]")
options+=("Quit [q]")
options+=("Toggle Use Tmux ${usetmux} [t]")
options+=("Main menu [m]")
options+=("Quit [q]")
select opt in "${options[@]}"
do
case "$opt,$REPLY" in
Expand All @@ -2977,17 +2977,33 @@ show_ascii_menu() {
show_main_menu
break 2
;;
"Julia Set ASCIImatics Animation"*,*|*,"Julia Set ASCIImatics Animation"*|"j",*|*,"j")
"MusicPlayerPlus Splash"*,* | *,"MusicPlayerPlus Splash"* | "S",* | *,"S")
tput clear
mppanim -a
[ $? -eq 0 ] || tput cup 0 0 2>/dev/null
mppanim -a -z
[ $? -eq 0 ] || tput cup 0 0 2>/dev/null
mppanim -a
[ $? -eq 0 ] || tput cup 0 0 2>/dev/null
skip_it_so=1
break
;;
"Asciiville Anim"*,* | *,"Asciiville Anim"* | "A",* | *,"A")
MPPSPLASH="${MPPSPLASH} -i"
MPPSPLASH_TMUX="${MPPSPLASH_TMUX} -l art"
break
;;
"Julia Set ASCIImatics Animation"*,*|*,"Julia Set ASCIImatics Animation"*|"J",*|*,"J")
MPPSPLASH="${MPPSPLASH} -j"
MPPSPLASH_TMUX="${MPPSPLASH_TMUX} -l julia"
break
;;
"MPPlus ASCIImatics Animation"*,*|*,"MPPlus ASCIImatics Animation"*|"s",*|*,"s")
"MPPlus ASCIImatics Animation"*,*|*,"MPPlus ASCIImatics Animation"*|"M",*|*,"M")
MPPSPLASH="${MPPSPLASH} -m"
MPPSPLASH_TMUX="${MPPSPLASH_TMUX} -l rocks"
break
;;
"Plasma ASCIImatics Animation"*,*|*,"Plasma ASCIImatics Animation"*|"p",*|*,"p")
"Plasma ASCIImatics Animation"*,*|*,"Plasma ASCIImatics Animation"*|"P",*|*,"P")
MPPSPLASH="${MPPSPLASH} -p"
MPPSPLASH_TMUX="${MPPSPLASH_TMUX} -l plasma"
break
Expand Down Expand Up @@ -3040,13 +3056,6 @@ show_ascii_menu() {
skip_it_so=1
break
;;
"Asciiville"*,*|*,"Asciiville"*|"A",*|*,"A")
clear_screen
asciiville
clear_screen
skip_it_so=1
break
;;
"Quit"*,*|*,"Quit"*|"quit",*|*,"quit"|"q",*|*,"q")
farewell_exit "Exiting MusicPlayerPlus"
;;
Expand Down Expand Up @@ -3222,8 +3231,9 @@ show_main_menu() {
[ "${have_cantata}" ] || options+=("Install Cantata MPD client [ic]")
[ "${have_ymuse}" ] || options+=("Install YMuse MPD client [im]")
[ "${have_ytm}" ] || options+=("Install YouTubeMusic Player [iy]")
[ "${have_mirror}" ] && options+=("MagicMirror Command Menu [m]")
[ "${have_roon}" ] && options+=("RoonCommandLine Menu [r]")
[ "${have_ascii}" ] && options+=("Asciiville Menu [am]")
[ "${have_mirror}" ] && options+=("MagicMirror Command Menu [mm]")
[ "${have_roon}" ] && options+=("RoonCommandLine Menu [rm]")
options+=("About [A]")
options+=("Info [i]")
options+=("Quit [q]")
Expand Down Expand Up @@ -3517,14 +3527,21 @@ show_main_menu() {
skip_it_so=1
break
;;
"MagicMirror"*,*|*,"MagicMirror"*|"m",*|*,"m")
"Asciiville"*,*|*,"Asciiville"*|"am",*|*,"am")
clear_screen
asciiville
clear_screen
skip_it_so=1
break
;;
"MagicMirror"*,*|*,"MagicMirror"*|"mm",*|*,"mm")
clear_screen
mirror
clear_screen
skip_it_so=1
break
;;
"RoonCommandLine"*,*|*,"RoonCommandLine"*|"r",*|*,"r")
"RoonCommandLine"*,*|*,"RoonCommandLine"*|"rm",*|*,"rm")
clear_screen
roon
clear_screen
Expand Down Expand Up @@ -4117,6 +4134,7 @@ have_w3m=$(type -p w3m)
have_ranger=$(type -p ranger)
have_rich=$(type -p rich)
have_ascii=$(type -p asciiville)
have_asciiart=$(type -p asciiart)
if [ -d /usr/local/Roon ]
then
have_roon=$(type -p roon)
Expand Down Expand Up @@ -4595,12 +4613,10 @@ then
clear
have_gum=$(type -p gum)
have_figlet=$(type -p figlet)
[ "${have_gum}" ] && [ "${have_figlet}" ] && {
have_mppanim=$(type -p mppanim)
[ "${have_mppanim}" ] && {
mppanim -a -q
[ $? -eq 0 ] || tput cup 0 0 2>/dev/null
}
have_mppanim=$(type -p mppanim)
[ "${have_gum}" ] && [ "${have_figlet}" ] && [ "${have_mppanim}" ] && {
mppanim -a -q
[ $? -eq 0 ] || tput cup 0 0 2>/dev/null
}
show_main_menu
else
Expand Down
24 changes: 21 additions & 3 deletions bin/mppsplash
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,23 @@ SONG="${MUSEDIR}/Epic_Dramatic-Yuriy_Bespalov.wav"
PLASMA_SONG="${MUSEDIR}/Chronos.mp3"
ALTSONG="${MUSEDIR}/Kevin_MacLeod_-_Also_Sprach_Zarathustra.ogg"
MPDCONF=~/.config/mpd/mpd.conf
have_ascii=$(type -p asciiart)

usage() {
printf "\nUsage: mppsplash [-A] [-a] [-b] [-C] [-c num] [-d] [-jJ] "
printf "[-m] [-p] [-s song] [-u]"
if [ "${have_ascii}" ]; then
printf "[-i] [-m] [-p] [-s song] [-u]"
else
printf "[-m] [-p] [-s song] [-u]"
fi
printf "\nWhere:"
printf "\n\t-A indicates use all effects"
printf "\n\t-a indicates play audio during ASCIImatics display"
printf "\n\t-b indicates use backup audio during ASCIImatics display"
printf "\n\t-C indicates use alternate comments in Plasma effect"
printf "\n\t-c num specifies the number of times to cycle"
printf "\n\t-d indicates enable debug mode"
[ "${have_ascii}" ] && printf "\n\t-i indicates use Ascii Art effect"
printf "\n\t-j indicates use Julia Set effect"
printf "\n\t-J indicates Julia Set with several runs using different parameters"
printf "\n\t-m indicates use MusicPlayerPlus effect"
Expand All @@ -33,6 +39,10 @@ usage() {
exit 1
}

mppart() {
[ "${have_ascii}" ] && asciiart $*
}

set_cycles() {
case $1 in
julia)
Expand Down Expand Up @@ -65,7 +75,7 @@ debug=
longjulia=
script="rocks"
switch_comments=
while getopts "AabCc:djJmps:u" flag; do
while getopts "AabCc:dijJmps:u" flag; do
case $flag in
A)
all=1
Expand All @@ -88,6 +98,9 @@ while getopts "AabCc:djJmps:u" flag; do
d)
debug="--debug"
;;
i)
script="art"
;;
j)
script="julia"
;;
Expand Down Expand Up @@ -172,7 +185,12 @@ if [ "${all}" ]
then
[ "${cycle}" ] || cycle="-c 1"
numcycles=`echo ${cycle} | awk ' { print $2 } '`
for script in julia rocks plasma
if [ "${have_ascii}" ]; then
anims="art julia rocks plasma"
else
anims="julia rocks plasma"
fi
for script in ${anims}
do
set_cycles ${script} ${numcycles}
mpp${script} -c ${usecycle} ${script_args}
Expand Down
11 changes: 9 additions & 2 deletions bin/mppsplash-tmux
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,24 @@ script_args="${script_args} ${CYCLE}"

if [ "${DUDE}" ]
then
[ "${PYLEFT}" == "art" ] && left_script_args="${left_script_args} -i -C"
[ "${PYLEFT}" == "rocks" ] && left_script_args="${left_script_args} -m -C"
[ "${PYLEFT}" == "plasma" ] && left_script_args="${left_script_args} -p -C"
[ "${PYLEFT}" == "julia" ] && left_script_args="${left_script_args} -j -C"
else
[ "${PYLEFT}" == "art" ] && left_script_args="${left_script_args} -i"
[ "${PYLEFT}" == "rocks" ] && left_script_args="${left_script_args} -m"
[ "${PYLEFT}" == "plasma" ] && left_script_args="${left_script_args} -p"
[ "${PYLEFT}" == "julia" ] && left_script_args="${left_script_args} -j"
fi

have_left=`type -p mpp${PYLEFT}`
[ "${have_left}" ] && PYLEFT="mpp${PYLEFT}"
if [ "${PYLEFT}" == "art" ]; then
have_left=`type -p asciiart`
[ "${have_left}" ] && PYLEFT="asciiart"
else
have_left=`type -p mpp${PYLEFT}`
[ "${have_left}" ] && PYLEFT="mpp${PYLEFT}"
fi

[ "${USAGE}" ] && usage

Expand Down
23 changes: 19 additions & 4 deletions share/scripts/mppsplash-dual.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,17 @@ script_args="${script_args} ${CYCLE}"

if [ "${DUDE}" ]
then
[ "${PYLEFT}" == "art" ] && left_script_args="${left_script_args} -i -C"
[ "${PYRIGHT}" == "art" ] && right_script_args="${right_script_args} -i -C"
[ "${PYLEFT}" == "rocks" ] && left_script_args="${left_script_args} -m -C"
[ "${PYRIGHT}" == "rocks" ] && right_script_args="${right_script_args} -m -C"
[ "${PYLEFT}" == "plasma" ] && left_script_args="${left_script_args} -p -C"
[ "${PYRIGHT}" == "plasma" ] && right_script_args="${right_script_args} -p -C"
[ "${PYLEFT}" == "julia" ] && left_script_args="${left_script_args} -j -C"
[ "${PYRIGHT}" == "julia" ] && right_script_args="${right_script_args} -j -C"
else
[ "${PYLEFT}" == "art" ] && left_script_args="${left_script_args} -i"
[ "${PYRIGHT}" == "art" ] && right_script_args="${right_script_args} -i"
[ "${PYLEFT}" == "rocks" ] && left_script_args="${left_script_args} -m"
[ "${PYRIGHT}" == "rocks" ] && right_script_args="${right_script_args} -m"
[ "${PYLEFT}" == "plasma" ] && left_script_args="${left_script_args} -p"
Expand All @@ -155,10 +159,21 @@ else
[ "${PYRIGHT}" == "julia" ] && right_script_args="${right_script_args} -j"
fi

have_left=`type -p mpp${PYLEFT}`
[ "${have_left}" ] && PYLEFT="mpp${PYLEFT}"
have_right=`type -p mpp${PYRIGHT}`
[ "${have_right}" ] && PYRIGHT="mpp${PYRIGHT}"
if [ "${PYLEFT}" == "art" ]; then
have_left=`type -p asciiart`
[ "${have_left}" ] && PYLEFT="asciiart"
else
have_left=`type -p mpp${PYLEFT}`
[ "${have_left}" ] && PYLEFT="mpp${PYLEFT}"
fi

if [ "${PYRIGHT}" == "art" ]; then
have_right=`type -p asciiart`
[ "${have_right}" ] && PYRIGHT="asciiart"
else
have_right=`type -p mpp${PYRIGHT}`
[ "${have_right}" ] && PYRIGHT="mpp${PYRIGHT}"
fi

[ "${USAGE}" ] && usage

Expand Down

0 comments on commit 24e51ab

Please sign in to comment.