Created
May 25, 2021 16:54
-
-
Save Javinator9889/54f9237f4daa37daf908214243f0fa36 to your computer and use it in GitHub Desktop.
Simple MP3 player using "select" - won't work with files with spaces (must fix)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
# Limpiamos el terminal | |
clear | |
# Instalación de la aplicación si no existe | |
if [[ ! $(command -v mpg321) ]]; then | |
CORRECT=1 | |
while [[ $CORRECT -ne 0 ]]; do | |
read -n1 -p "La aplicación \"mpg321\" no está instalada. ¿Instalar? [Y/n] " INSTALL | |
echo | |
case $INSTALL in | |
Y|y) | |
sudo apt install -y mpg321 | |
CORRECT=$?;; | |
N|n) | |
echo "No se instalará. Saliendo" | |
exit 1;; | |
*) | |
echo "Opción no reconocida '$INSTALL'" | |
CORRECT=1;; | |
esac | |
done | |
fi | |
MP3_FILES=$(find . -iname "*.mp3" 2> /dev/null) | |
MP3_FILES=$MP3_FILES" Salir" | |
select MP3 in $MP3_FILES; do | |
if [[ $MP3 = "Salir" ]]; then | |
break | |
fi | |
echo "Reproduciendo \"$MP3\"..." | |
mpg321 "$MP3" &> /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment