Created
October 25, 2022 11:30
-
-
Save luisadha/2441790963e27d1aac4fd8641cd8101d to your computer and use it in GitHub Desktop.
SCRIPT: Program Play simple music from your music player via terminal
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
#!/system/bin/sh | |
# Author: Luis Adha | |
# This code is released to the public domain. | |
# The author gave permission to use this code snippet in your script. | |
# Script name: playmusic.sh | |
# Version: v0.1 | |
# Build date: Teu Dec 21 13:59:21 WIB 2021 | |
GRAY='\e[1;30m' | |
WHITE='\e[1;37m' | |
DEFAULT='\e[0m' ; | |
BL='\e[0;33m' | |
Y='\e[1;33m' | |
B='\e[0;34m' | |
LB='\e[1;34m' | |
P='\e[0;35m' | |
LP='\e[1;35m' | |
CYAN='\e[0;36m' | |
id="$(id)"; id="${id#*=}"; id="${id%%\(*}"; id="${id%% *}" | |
if [ "$id" != "0" ] && [ "$id" != "root" ] | |
then | |
echo "Ketik su terlebih dahulu, lalu jalankan ulang skrip ini. "; sleep 2; | |
echo "${DEFAULT}$(basename $0): Terminated" $DEFAULT | |
exit 1 | |
else | |
hint="Pastikan aplikasi pemutar musik terinstall!" | |
hint2="Putar untuk 1 lagu" | |
hint3="Tekan CTRL+C untuk Keluar" | |
banner="Ketikan jalur berkas absolut mp3 kamu " | |
clear | |
echo -e "${hint} \n${banner}:" | |
echo -n "${GRAY}/sdcard/test.mp3 \r"${DEFAULT} | |
sleep 3; clear; | |
echo -e "${hint2} \n${banner}:" | |
echo -n "${GRAY}/sdcard/test.mp3 \r"${DEFAULT} | |
sleep 3; clear; | |
echo "${hint3}\n${banner}:" | |
echo -n "${GRAY}/sdcard/test.mp3 \r"${CYAN} | |
read MP3; | |
am start -a android.intent.action.VIEW -d file://"$MP3" -t audio/mp3 | |
clear | |
echo "${DEFAULT}$(basename $0): Terminated" $DEFAULT | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment