This commit is contained in:
2023-12-20 16:14:39 +01:00
parent ab3cf72b69
commit c4c9ed3ec1
2 changed files with 39 additions and 4 deletions

View File

@@ -0,0 +1,30 @@
## Player Snacast da link YouTube
utilizza yt-dlp e ffmpeg per scaricare e riprodurre la musica su snapcast utilizzando il cat sul /tmp/snapfifo<br>
prevede l'utilizzo di uno snapserver (apt install snapserver) e di uno o piu client Andoid (snapcast) o desktop (snapclient).
-----------------------------------
## USA LO SCRIPT
Per utilizzare questo script non è necessario aver installato sulla stessa macchina un client o un server snapcast. Funzionando anche solo come riproduore.<br>
Scarica il git
```bash
#Scarica il git
git clone https://repo.esiliati.org/scossa/snaptube.git
#Entra nella cartella di scrapeje
cd snaptube
```
Installa requirement
```bash
#Concedi i permessi di esecuzione
chmod +x ./snaptube.sh
```
Lancia lo script
```bash
#Esegui snaptube
./snaptube.sh
```

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
#RIPRODUTTORE SNAPCAST DA LINK YOUTUBE #RIPRODUTTORE SNAPCAST DA LINK YOUTUBE
#set -xu #set -xu #per debug
cnt=0 cnt=0
trappola() { trappola() {
@@ -10,15 +10,17 @@ trappola() {
trap trappola SIGINT trap trappola SIGINT
#Crea dir 'songs' se non esiste #Crea dir 'songs' se non esiste
if [ ! -d "songs" ]; then if [ ! -d "songs" ]; then
mkdir songs mkdir songs
fi fi
#Inizializza playlist #Inizializza playlist
clear
rm /tmp/snapfifo
touch /tmp/snapfifo
echo -e "\nPlaylist riprodotta:" >> songs/playlist.txt echo -e "\nPlaylist riprodotta:" >> songs/playlist.txt
2
while : while :
do do
@@ -29,9 +31,12 @@ do
echo -e '\e[37m- Player YouTube snapcast -' echo -e '\e[37m- Player YouTube snapcast -'
echo -e "\033[90mDigita 'off' per chiudere" echo -e "\033[90mDigita 'off' per chiudere"
read -p $'\033[97mLink \033[0;31mYoutube\033[97m: ' userInput read -p $'\033[97mLink \033[0;31mYoutube\033[97m: ' userInput
#userInput='https://www.youtube.com/watch?v=jm56jeM2b_Y' #per debug
#Scarica audio da link YT #Scarica audio da link YT
if [ "$userInput" = "off" ]; then if [ "$userInput" = "off" ]; then
rm songs/play.wav rm songs/play.wav
rm /tmp/snapfifo; touch /tmp/snapfifo
pkill ffmpeg pkill ffmpeg
break break
else else