commit ab3cf72b69f32755877175cd610c4840030afee4 Author: scossa Date: Tue Dec 19 09:55:30 2023 +0100 up diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/script.sh b/script.sh new file mode 100755 index 0000000..7212d2a --- /dev/null +++ b/script.sh @@ -0,0 +1,56 @@ +#!/bin/bash +#RIPRODUTTORE SNAPCAST DA LINK YOUTUBE +#set -xu +cnt=0 + +trappola() { + stat=1 +} + +trap trappola SIGINT + + + +#Crea dir 'songs' se non esiste +if [ ! -d "songs" ]; then + mkdir songs +fi + +#Inizializza playlist +echo -e "\nPlaylist riprodotta:" >> songs/playlist.txt + +while : +do + + #Input + ((cnt++)) + stat=0 + + echo -e '\e[37m- Player YouTube snapcast -' + echo -e "\033[90mDigita 'off' per chiudere" + read -p $'\033[97mLink \033[0;31mYoutube\033[97m: ' userInput + #Scarica audio da link YT + if [ "$userInput" = "off" ]; then + rm songs/play.wav + pkill ffmpeg + break + else + title=$(yt-dlp --get-title $userInput) + yt-dlp --extract-audio --audio-format wav -o songs/"${title}".wav $userInput > /dev/null + fi + + + #Sposta e Suona + echo -e "\033[90mIn riproduzione:"; echo -e "\033[97m$title\n\n"; echo $title >> songs/playlist.txt + clear; echo -e "\033[90mIn riproduzione:"; echo -e "\033[97m$title\n\n"; echo $title >> songs/playlist.txt + ffmpeg -y -loglevel error -hide_banner -i songs/"${title}".wav -f u16le -acodec pcm_s16le -ac 2 -ar 48000 /tmp/snapfifo + clear; echo -e "\033[90mIn riproduzione:"; echo -e "\033[97m$title\n\n"; echo $title >> songs/playlist.txt + + + +done + + + + +