Skip to content

Commit

Permalink
Finish off initial asciimatics intro video
Browse files Browse the repository at this point in the history
  • Loading branch information
doctorfree committed Mar 31, 2022
1 parent ce4db68 commit 5edc811
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 21 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Integration is provided for:
* [mpcplus](mpcplus/README.md), character based Music Player Plus MPD client
* [cantata](https://github.com/CDrummond/cantata), graphical MPD client
* [cava](https://github.com/karlstav/cava), an audio spectrum visualizer
* [ASCIImatics](https://github.com/peterbrittain/asciimatics) - automatically display a variety of character based animation effects
* [asciinema](https://asciinema.org/) - automatically create ascii character based video clips
* Enhanced key bindings for extended control of terminal windows
* Several terminal emulators
* xfce4-terminal
Expand Down
3 changes: 2 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Todo:
- Mirrir on gitlab
- v1.0.1r1 release
- Create asciinema casts and upload
- Add asciinema casts to website, README, Twitter, ...
- Create a fun splash screen with key bindings that control MPD (play, pause, next, prev, ...)

Done:
- Get the kill tmux session working
- Mirrir on gitlab
- Rename mpcava to mpplus
- Update asciimatics man pages with -a song argument
8 changes: 4 additions & 4 deletions bin/asciimpplus
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ def _mpplus(screen):
speed=1,
transparent=False),
Print(screen,
FigletText("Plus!", "banner"),
FigletText(" Plus! ", "banner"),
screen.height - 9, x=(screen.width - width) // 2 + 1,
colour=Screen.COLOUR_BLACK,
bg=Screen.COLOUR_BLACK,
speed=1),
Print(screen,
FigletText("Plus!", "banner"),
FigletText(" Plus! ", "banner"),
screen.height - 9,
colour=Screen.COLOUR_WHITE,
bg=Screen.COLOUR_WHITE,
Expand Down Expand Up @@ -93,7 +93,7 @@ def _mpplus(screen):
BannerText(
screen,
Rainbow(screen, FigletText(
"Reliving the 80s in glorious ASCII text...", font='slant')),
"ASCIImatics and ASCIInema Integration", font='slant')),
center[1] - 3,
Screen.COLOUR_GREEN)
]
Expand All @@ -108,7 +108,7 @@ def _mpplus(screen):
Screen.COLOUR_GREEN),
Mirage(
screen,
FigletText("written by:"),
FigletText("written by"),
screen.height + 8,
Screen.COLOUR_GREEN),
Mirage(
Expand Down
16 changes: 10 additions & 6 deletions bin/mpcplus-tmux
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

SSESSION=musicplayerplus

if [ -f ${HOME}/.config/mpcplus/config ]
then
MPCDIR=".config/mpcplus"
Expand Down Expand Up @@ -94,7 +96,7 @@ shift $(( OPTIND - 1 ))
COVER="${HOME}/${MPCDIR}/album_cover.png"
[ -f ${COVER} ] || cp ${HOME}/${MPCDIR}/default_cover.png ${COVER}

tmux new-session -d -x 256 -y 128 -s musicplayerplus
tmux new-session -d -x 256 -y 128 -s ${SESSION}
tmux set -g status off

tmux send-keys "stty -echo" C-m
Expand All @@ -105,7 +107,7 @@ tmux send-keys "clear" C-m

tmux split-window -v
tmux select-pane -t 1
tmux send-keys "mpcplus --config='${HOME}/${MPCDIR}/catalog.conf'" C-m
tmux send-keys "mpcplus --config=${HOME}/${MPCDIR}/catalog.conf; exit" C-m
tmux send-keys 1

tmux select-pane -t 0
Expand All @@ -114,9 +116,9 @@ if [ "${PYART}" ]
then
have_pyart=`type -p ascii${PYART}`
[ "${have_pyart}" ] && PYART="ascii${PYART}"
tmux send-keys "${PYART}" C-m
tmux send-keys "${PYART}; exit" C-m
else
tmux send-keys "cava -p ${HOME}/${MPCDIR}/config-cava" C-m
tmux send-keys "cava -p ${HOME}/${MPCDIR}/config-cava; exit" C-m
fi

tmux resize-pane -t 0 -x ${WIDTH} -y ${HEIGHT}
Expand All @@ -134,10 +136,12 @@ fi
if [ "${RECORD}" ]
then
tmux d
REC_DIR=$HOME/Videos
VID_DIR=$HOME/Videos
[ -d ${VID_DIR} ] || mkdir ${VID_DIR}
REC_DIR=${VID_DIR}/asciinema
[ -d ${REC_DIR} ] || mkdir ${REC_DIR}
echo "Recording this mpplus session with asciinema"
asciinema rec --command "tmux attach -t musicplayerplus" ${REC_DIR}/tmux-$(date +%F--%H%M).asciicast
asciinema rec --command "tmux attach -t ${SESSION}" ${REC_DIR}/${SESSION}-$(date +%F--%H%M).cast
else
tmux a #
fi
35 changes: 25 additions & 10 deletions bin/mppsplash-tmux
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
MUSEDIR=/usr/share/doc/musicplayerplus/music
SONG="${MUSEDIR}/Epic_Dramatic-Yuriy_Bespalov.wav"
ALTSONG="${MUSEDIR}/Kevin_MacLeod_-_Also_Sprach_Zarathustra.ogg"
export SESSION=mppsplash

usage() {
printf "\nUsage: mppsplash-tmux [-a] [-b] [-d] [-l script] [-r script] [-R] [-t] [-x width] [-y height] [-u]"
printf "\nUsage: mppsplash-tmux [-a] [-b] [-c num] [-d] [-l script] [-r script] [-R] [-t] [-x width] [-y height] [-u]"
printf "\nWhere:"
printf "\n\t-a indicates play audio during ASCIImatics display"
printf "\n\t-b indicates use backup song during ASCIImatics display"
printf "\n\t-c num specifies number of cycles ASCIImatics effects should run"
printf "\n\t-d indicates dual window panes, run two scripts"
printf "\n\t-l script specifies a python script to run in the left visualizer pane"
printf "\n\t-r script specifies a python script to run in the right visualizer pane"
Expand All @@ -34,15 +36,17 @@ usage() {
}

AUDIO=
CYCLE=
DUAL=
DUDE=
KILLME=
RECORD=
WIDTH=50
HEIGHT=100
PYLEFT=plasma
PYRIGHT=julia
USAGE=
while getopts "abdl:r:Rtx:y:u" flag; do
while getopts "abc:dl:r:Rtx:y:u" flag; do
case $flag in
a)
AUDIO=1
Expand All @@ -53,6 +57,9 @@ while getopts "abdl:r:Rtx:y:u" flag; do
SONG=${ALTSONG}
ALTSONG=${TMPSONG}
;;
c)
CYCLE="-c ${OPTARG}"
;;
d)
DUAL=1
;;
Expand Down Expand Up @@ -93,6 +100,7 @@ script_args="$*"
fi
fi
}
script_args="${script_args} ${CYCLE}"

[ "${DUDE}" ] && {
[ "${PYLEFT}" == "plasma" ] && PYLEFT="plasma -t"
Expand All @@ -106,7 +114,7 @@ have_right=`type -p ascii${PYRIGHT}`

[ "${USAGE}" ] && usage

tmux new-session -d -x 80 -y 28 -s mppsplash
tmux new-session -d -x 80 -y 28 -s ${SESSION}
tmux set -g status off

tmux send-keys "stty -echo" C-m
Expand All @@ -118,21 +126,25 @@ tmux send-keys "clear" C-m
tmux select-pane -t 0
have_left=`type -p ${PYLEFT}`
[ "${have_left}" ] || {
tmux kill-session -t mppsplash
tmux kill-session -t ${SESSION}
echo "${PYLEFT} not found. Exiting."
exit 1
}
tmux send-keys "${PYLEFT} ${script_args}" C-m

# Start the left pane script
tmux send-keys "${PYLEFT} ${script_args}; exit" C-m

[ "${DUAL}" ] && {
have_right=`type -p ${PYRIGHT}`
[ "${have_right}" ] || {
tmux kill-session -t mppsplash
tmux kill-session -t ${SESSION}
echo "${PYRIGHT} not found. Exiting."
exit 1
}
tmux select-pane -t 1
tmux send-keys "${PYRIGHT} ${script_args}" C-m

# Start the right pane script
tmux send-keys "${PYRIGHT} ${script_args}; exit" C-m
}

tmux resize-pane -t 0 -x ${WIDTH} -y ${HEIGHT}
Expand All @@ -142,10 +154,13 @@ tmux set-hook client-resized "resize-pane -t 0 -x ${WIDTH} -y ${HEIGHT}"
if [ "${RECORD}" ]
then
tmux d
REC_DIR=$HOME/Videos
VID_DIR=$HOME/Videos
[ -d ${VID_DIR} ] || mkdir ${VID_DIR}
REC_DIR=${VID_DIR}/asciinema
[ -d ${REC_DIR} ] || mkdir ${REC_DIR}
echo "Recording this mpplus session with asciinema"
asciinema rec --command "tmux attach -t mppsplash" ${REC_DIR}/tmux-$(date +%F--%H%M).asciicast
echo "Recording this ${SESSION} session with asciinema"
asciinema rec --command "tmux attach -t ${SESSION}" \
${REC_DIR}/${SESSION}-$(date +%F--%H%M).cast
else
tmux a #
fi

0 comments on commit 5edc811

Please sign in to comment.