Skip to content

Commit

Permalink
Fixes for Ueberzug and tmux sessions in a Python virtual environment
Browse files Browse the repository at this point in the history
  • Loading branch information
ron.record committed Jun 2, 2024
1 parent b8d42f0 commit b469beb
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 37 deletions.
3 changes: 3 additions & 0 deletions bin/mpcplus-tmux
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ start_tmux_session() {
tmux set -g status off
tmux send-keys "stty -echo" C-m
tmux send-keys "tput civis -- invisible" C-m
[ -f ${HOME}/.venv/bin/activate ] && {
tmux send-keys "source ${HOME}/.venv/bin/activate" C-m
}
tmux send-keys "export PS1=''" C-m
tmux send-keys "clear" C-m
tmux send-keys "${MPPCOMM}; exit" C-m
Expand Down
18 changes: 9 additions & 9 deletions bin/mppinit
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ install_ueberzug() {
TEMP_WHL="/tmp/${TEMP_WHL}"
wget --quiet -O "${TEMP_WHL}" "${DL_URL}" >/dev/null 2>&1
chmod 644 "${TEMP_WHL}"
${PYTHON} -m pip install --user --upgrade "${TEMP_WHL}" >/dev/null 2>&1
# rm -f "${TEMP_WHL}"
${PYTHON} -m pip install --upgrade "${TEMP_WHL}" >/dev/null 2>&1
rm -f "${TEMP_WHL}"
}
}
}
Expand Down Expand Up @@ -383,7 +383,7 @@ init_mopidy() {

for extension in ${EXT_MOPIDY}; do
printf "\n\tInstalling Mopidy extension ${extension}"
${PYTHON} -m pip install --user --upgrade ${extension} >/dev/null 2>&1
${PYTHON} -m pip install --upgrade ${extension} >/dev/null 2>&1
done
printf "\n"

Expand Down Expand Up @@ -2064,9 +2064,9 @@ install_mpc() {
git clone https://github.com/MusicPlayerDaemon/mpc.git
cd mpc
have_meson=$(type -p meson)
[ "${have_meson}" ] || ${PYTHON} -m pip install --user meson
[ "${have_meson}" ] || ${PYTHON} -m pip install --upgrade meson
have_ninja=$(type -p ninja)
[ "${have_ninja}" ] || ${PYTHON} -m pip install --user ninja
[ "${have_ninja}" ] || ${PYTHON} -m pip install --upgrade ninja
meson . output
ninja -C output
[ -x output/mpc ] && sudo cp output/mpc /usr/bin/mpc
Expand Down Expand Up @@ -3087,7 +3087,7 @@ if [ "${PIP}" ]; then
# - Uninstall Beets (python -m pip uninstall beets)
# - pip install https://github.com/beetbox/beets/tarball/master
${PYTHON} -m pip uninstall beets >/dev/null 2>&1
${PYTHON} -m pip install --user \
${PYTHON} -m pip install --upgrade \
https://github.com/beetbox/beets/tarball/master >/dev/null 2>&1
BEETS=
else
Expand Down Expand Up @@ -3117,19 +3117,19 @@ if [ "${PIP}" ]; then
YSCV=${YSCV:0:3}
${SCPTDIR}/vercomp.sh "${YSCV}" "${YMIN}" >/dev/null
[ $? -eq 2 ] && {
${PYTHON} -m pip install --user ${SCRB}==0.7.3 >/dev/null 2>&1
${PYTHON} -m pip install --upgrade ${SCRB}==0.7.3 >/dev/null 2>&1
}
}
else
${PYTHON} -m pip install --user ${SCRB}==0.7.3 >/dev/null 2>&1
${PYTHON} -m pip install --upgrade ${SCRB}==0.7.3 >/dev/null 2>&1
fi
[ "${quiet}" ] || printf "\n\tModules:"
for pkg in unidecode six PySocks asciimatics beautifulsoup4 ${BEETS} \
iniparse pylast beets-describe beets-yearfixer beetcamp beets-xtractor \
PyYAML python-mpd2 requests sacad tmuxp ${YT_DLP} setuptools \
calliope-music bandcamp-downloader scdl flask-cors click; do
printf " ${pkg}"
${PYTHON} -m pip install --user --upgrade ${pkg} >/dev/null 2>&1
${PYTHON} -m pip install --upgrade ${pkg} >/dev/null 2>&1
done
# Install fixed cpe script
[ -f ${CCPTDIR}/cpe ] && {
Expand Down
83 changes: 55 additions & 28 deletions bin/mpplus
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,7 @@ show_help_menu() {
MTITLE="MusicPlayerPlus Help"
while true
do
clear
FIG_TEXT="Help Menu"
if [ "${use_figlet}" ]
then
Expand Down Expand Up @@ -1453,11 +1454,11 @@ show_help_menu() {
[ "${have_kitty}" ] && options+=("Kitty Terminal Man Page")
[ "${have_simple}" ] && options+=("Simple Terminal Man Page")
[ "${have_tilix}" ] && options+=("Tilix Terminal Man Page")
options+=("Done / Back" "Quit")
options+=("Done / Back [b]" "Quit [q]")
select opt in "${options[@]}"
do
case "$opt,$REPLY" in
"Done"*,*|*,"Done"*|"done"*,*|*,"done"*|"Back"*,*|*,"Back"*|"back"*,*|*,"back"*)
"Done"*,*|*,"Done"*|"done"*,*|*,"done"*|"Back"*,*|*,"Back"*|"back"*,*|*,"back"*|"b",*|*,"b")
clear
printf "\n"
break 2
Expand Down Expand Up @@ -1612,7 +1613,7 @@ show_help_menu() {
man tilix
break
;;
"Quit",*|*,"Quit"|"quit",*|*,"quit")
"Quit",*|*,"Quit"|"quit",*|*,"quit"|"q",*|*,"q")
printf "\nExiting MusicPlayerPlus\n"
exit 0
;;
Expand All @@ -1631,6 +1632,7 @@ show_help_menu() {
show_downloads_menu() {
while true
do
clear
FIG_TEXT="Downloads"
if [ "${use_figlet}" ]
then
Expand Down Expand Up @@ -1662,7 +1664,7 @@ show_downloads_menu() {
}
options+=("Toggle Dry Run (${usedrun})")
}
options+=("Main menu" "Quit")
options+=("Main menu [m]" "Quit [q]")
select opt in "${options[@]}"
do
case "$opt,$REPLY" in
Expand All @@ -1672,7 +1674,7 @@ show_downloads_menu() {
show_help_menu
break
;;
"Main menu",*|*,"Main menu"|"Back",*|*,"Back"|"back",*|*,"back")
"Main menu"*,*|*,"Main menu"*|"Back",*|*,"Back"|"back",*|*,"back"|"m",*|*,"m")
clear
printf "\n"
init_vars
Expand Down Expand Up @@ -1733,10 +1735,14 @@ show_downloads_menu() {
skip_it_so=1
break
;;
"Quit",*|*,"Quit"|"quit",*|*,"quit")
"Quit"*,*|*,"Quit"*|"quit",*|*,"quit"|"q",*|*,"q")
printf "\nExiting\n"
exit 0
;;
*,*|*,*)
skip_it_so=1
break
;;
esac
REPLY=
done
Expand Down Expand Up @@ -1823,6 +1829,7 @@ show_logs_menu() {
have_alsa=`type -p alsa-info`
while true
do
clear
show_system_status
FIG_TEXT="Service Logs Menu"
if [ "${use_figlet}" ]
Expand Down Expand Up @@ -1860,7 +1867,7 @@ show_logs_menu() {
options+=("View Last.FM Scrobbler Log")
}
options+=("Manage Services")
options+=("Main menu" "Quit")
options+=("Main menu [m]" "Quit [q]")
select opt in "${options[@]}"
do
case "$opt,$REPLY" in
Expand All @@ -1870,7 +1877,7 @@ show_logs_menu() {
show_help_menu
break
;;
"Main menu",*|*,"Main menu"|"Back",*|*,"Back"|"back",*|*,"back")
"Main menu"*,*|*,"Main menu"*|"Back",*|*,"Back"|"back",*|*,"back"|"m",*|*,"m")
clear
printf "\n"
init_vars
Expand Down Expand Up @@ -1919,10 +1926,13 @@ show_logs_menu() {
show_services_menu
break
;;
"Quit",*|*,"Quit"|"quit",*|*,"quit")
"Quit"*,*|*,"Quit"*|"quit",*|*,"quit"|"q",*|*,"q")
printf "\nExiting\n"
exit 0
;;
*,*|*,*)
break
;;
esac
REPLY=
done
Expand All @@ -1933,6 +1943,7 @@ show_logs_menu() {
show_services_menu() {
while true
do
clear
show_system_status
FIG_TEXT="Services Menu"
if [ "${use_figlet}" ]
Expand Down Expand Up @@ -2090,7 +2101,7 @@ show_services_menu() {
options+=("Update/scan MPD music library")
}
options+=("View Music Service Logs")
options+=("Main menu" "Quit")
options+=("Main menu [m]" "Quit [q]")
select opt in "${options[@]}"
do
case "$opt,$REPLY" in
Expand All @@ -2100,7 +2111,7 @@ show_services_menu() {
show_help_menu
break
;;
"Main menu",*|*,"Main menu"|"Back",*|*,"Back"|"back",*|*,"back")
"Main menu"*,*|*,"Main menu"*|"Back",*|*,"Back"|"back",*|*,"back"|"m",*|*,"m")
clear
printf "\n"
init_vars
Expand Down Expand Up @@ -2442,10 +2453,13 @@ show_services_menu() {
show_logs_menu
break
;;
"Quit",*|*,"Quit"|"quit",*|*,"quit")
"Quit"*,*|*,"Quit"*|"quit",*|*,"quit"|"q",*|*,"q")
printf "\nExiting\n"
exit 0
;;
*,*|*,*)
break
;;
esac
REPLY=
done
Expand All @@ -2456,6 +2470,7 @@ show_services_menu() {
show_fzmp_menu() {
while true
do
clear
FIG_TEXT="Fuzzy Search"
if [ "${use_figlet}" ]
then
Expand All @@ -2472,7 +2487,7 @@ show_fzmp_menu() {
[ "${have_fzf}" ] && options+=("List genres in library")
[ "${have_fzf}" ] && options+=("Search current playlist")
[ "${have_fzf}" ] && options+=("List saved playlists")
options+=("Main menu" "Quit")
options+=("Main menu [m]" "Quit [q]")
select opt in "${options[@]}"
do
case "$opt,$REPLY" in
Expand All @@ -2482,7 +2497,7 @@ show_fzmp_menu() {
show_help_menu
break
;;
"Main menu",*|*,"Main menu"|"Back",*|*,"Back"|"back",*|*,"back")
"Main menu"*,*|*,"Main menu"*|"Back",*|*,"Back"|"back",*|*,"back"|"m",*|*,"m")
clear
printf "\n"
init_vars
Expand Down Expand Up @@ -2513,10 +2528,13 @@ show_fzmp_menu() {
fzmp -P
break
;;
"Quit",*|*,"Quit"|"quit",*|*,"quit")
"Quit"*,*|*,"Quit"*|"quit",*|*,"quit"|"q",*|*,"q")
printf "\nExiting\n"
exit 0
;;
*,*|*,*)
break
;;
esac
done
done
Expand All @@ -2525,6 +2543,7 @@ show_fzmp_menu() {
show_ascii_menu() {
while true
do
clear
FIG_TEXT="Asciimatics"
if [ "${use_figlet}" ]
then
Expand Down Expand Up @@ -2558,8 +2577,8 @@ show_ascii_menu() {
options=("Julia Set ASCIImatics Animation" "MPPlus ASCIImatics Animation" "Plasma ASCIImatics Animation" "Toggle Audio (${audiostat})")
[ "${have_nema}" ] && options+=("Toggle Record Tmux Session (${recordstat})")
options+=("Toggle Use Tmux (${usetmux})")
[ "${have_ascii}" ] && options+=("Asciiville Menu")
options+=("Main menu" "Quit")
[ "${have_ascii}" ] && options+=("Asciiville Menu [a]")
options+=("Main menu [m]" "Quit [q]")
select opt in "${options[@]}"
do
case "$opt,$REPLY" in
Expand All @@ -2570,7 +2589,7 @@ show_ascii_menu() {
skip_it_so=1
break
;;
"Main menu",*|*,"Main menu"|"Back",*|*,"Back"|"back",*|*,"back")
"Main menu"*,*|*,"Main menu"*|"Back",*|*,"Back"|"back",*|*,"back"|"m",*|*,"m")
clear
printf "\n"
init_vars
Expand Down Expand Up @@ -2640,17 +2659,21 @@ show_ascii_menu() {
skip_it_so=1
break
;;
"Asciiville"*,*|*,"Asciiville"*)
"Asciiville"*,*|*,"Asciiville"*|"a",*|*,"a")
clear
asciiville
clear
skip_it_so=1
break
;;
"Quit",*|*,"Quit"|"quit",*|*,"quit")
"Quit"*,*|*,"Quit"*|"quit",*|*,"quit"|"q",*|*,"q")
printf "\nExiting\n"
exit 0
;;
*,*|*,*)
skip_it_so=1
break
;;
esac
REPLY=
done
Expand Down Expand Up @@ -2755,10 +2778,10 @@ select_music_dir() {
}

show_main_menu() {
clear
printf "\n"
while true
do
clear
printf "\n"
if [ "${FULLSCREEN}" ]
then
fullstat="ON"
Expand Down Expand Up @@ -2816,9 +2839,9 @@ show_main_menu() {
options+=("Toggle Use Tmux (${usetmux})")
[ "${have_nema}" ] && options+=("Toggle Record Tmux Session (${recordstat})")
options+=("Toggle Fullscreen (${fullstat})")
[ "${have_mirror}" ] && options+=("MagicMirror Command Menu")
[ "${have_roon}" ] && options+=("RoonCommandLine Menu")
options+=("Quit")
[ "${have_mirror}" ] && options+=("MagicMirror Command Menu [m]")
[ "${have_roon}" ] && options+=("RoonCommandLine Menu [r]")
options+=("Quit [q]")
select opt in "${options[@]}"
do
case "$opt,$REPLY" in
Expand Down Expand Up @@ -3032,7 +3055,7 @@ show_main_menu() {
skip_it_so=1
break
;;
"MagicMirror"*,*|*,"MagicMirror"*)
"MagicMirror"*,*|*,"MagicMirror"*|"m",*|*,"m")
clear
FIG_TEXT="Mirror Command"
if [ "${use_figlet}" ]
Expand All @@ -3047,7 +3070,7 @@ show_main_menu() {
skip_it_so=1
break
;;
"RoonCommandLine"*,*|*,"RoonCommandLine"*)
"RoonCommandLine"*,*|*,"RoonCommandLine"*|"r",*|*,"r")
clear
FIG_TEXT="Roon Command"
if [ "${use_figlet}" ]
Expand All @@ -3062,10 +3085,14 @@ show_main_menu() {
skip_it_so=1
break
;;
"Quit",*|*,"Quit"|"quit",*|*,"quit")
"Quit"*,*|*,"Quit"*|"quit",*|*,"quit"|"q",*|*,"q")
printf "\nExiting\n"
exit 0
;;
*,*|*,*)
skip_it_so=1
break
;;
esac
REPLY=
done
Expand Down
2 changes: 2 additions & 0 deletions config/ueberzug/mpcplus-ueberzug
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ cleanup() {
pkill mpcplus_cover_art.sh
}

[ -f ${HOME}/.venv/bin/activate ] && source ${HOME}/.venv/bin/activate

USE_MPCPLUS=1
USE_NCMPCPP=
CLIENT_COMM="mpcplus"
Expand Down
Loading

0 comments on commit b469beb

Please sign in to comment.