diff --git a/www/LOVELand/_CopyLaRadio/copy.sh b/www/LOVELand/_CopyLaRadio/copy.sh index 6474fab..bbc405a 100755 --- a/www/LOVELand/_CopyLaRadio/copy.sh +++ b/www/LOVELand/_CopyLaRadio/copy.sh @@ -7,6 +7,8 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized # Clean /tmp/ytdl.list #echo > /tmp/ytdl.list +export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) || er+=" ipfs daemon not running" +[[ $er ]] && echo $er ## Accents and different languages needed to create encodings. on 8, 16, 32, 64 bits ... # it is a big mess/// so we remove accent until someone take care of making it better. TODO??? @@ -21,7 +23,7 @@ noa=('S' 'e' 'e' 'e' 'A' 'A' 'A' 'A' 'A' 'A' 'AE' 'C' 'E' 'E' 'E' 'E' 'I' 'I' 'I OUTPUT="" i=0 length=${#INPUT} -while [[ $i -lt $length ]]; do./zen/_CopyLaRadio/copy.sh: +while [[ $i -lt $length ]]; do char=${INPUT:$i:1}; #echo $i:$char j=0 @@ -55,7 +57,7 @@ do ################################################# # YOUTUBE-DL SEARCH & COPY : "radio|artist|song" if [[ "$artist" != "" && "$song" != "" && "$radio" != "" && "$radio" != "$song" && "$radio" != "undefined" && "$artist" != "$song" ]]; then - mkdir -p "/home/pi/.zen/music/${artist}/${song}" + mkdir -p "/home/$YOU/.zen/audio/${artist}/${song}" $MY_PATH/parle.sh "Démarrage Enregistrement $radio." $MY_PATH/parle.sh "$artist" "en-US" $MY_PATH/parle.sh "$song" "en-US" @@ -65,7 +67,7 @@ if [[ "$artist" != "" && "$song" != "" && "$radio" != "" && "$radio" != "$song" if [[ "$mysearch" == "" ]]; then ~/parle.sh "Aucune recherche reçue!"; continue; fi # Search & Download bestaudio from 1st video result (ogg / opus / m4a): MEDIUM CPU # OPTION: --embed-thumbnail --metadata-from-title "%(artist)s - %(title)s" --add-metadata - youtube-dl --default-search ytsearch1: --download-archive /home/pi/.ytdl.list --continue --no-overwrites --metadata-from-title "$artist - %(title)s" --add-metadata --embed-thumbnail --ignore-errors -f m4a --extract-audio -o "/home/pi/music/${artist}/${song}/%(id)s.%(title)s.%(uploader_id)s.%(ext)s" "$mysearch" >> /tmp/youtube-dl.log 2>&1 + youtube-dl --default-search ytsearch1: --download-archive /home/$YOU/.ytdl.list --continue --no-overwrites --metadata-from-title "$artist - %(title)s" --add-metadata --embed-thumbnail --ignore-errors -f m4a --extract-audio -o "/home/$YOU/audio/${artist}/${song}/%(id)s.%(title)s.%(uploader_id)s.%(ext)s" "$mysearch" >> /tmp/youtube-dl.log 2>&1 # TODO: CHOOSE --metadata-from-title "$artist - %(title)s" or --metadata-from-title %(title)s" # Update mpd playlist curl -b "currenthost=Default;player_backend=mpd" http://localhost/albums.php?rebuild=yes > /dev/null @@ -76,8 +78,8 @@ elif [[ "$radio" != "" && "$artist" == "" && "$song" != "" ]]; then # LINK COPY $MY_PATH/parle.sh "Copie du lien!" echo "Copy LINK: $song" >> /tmp/youtube-dl.log 2>&1 - mkdir -p /home/pi/download/ - youtube-dl --download-archive /home/pi/.ytdl.list --continue --no-overwrites --embed-thumbnail --metadata-from-title "%(artist)s - %(title)s" --add-metadata -o "/home/pi/download/%(title)s.%(ext)s" "$song" >> /tmp/youtube-dl.log 2>&1 + mkdir -p /home/$YOU/download/ + youtube-dl --download-archive /home/$YOU/.ytdl.list --continue --no-overwrites --embed-thumbnail --metadata-from-title "%(artist)s - %(title)s" --add-metadata -o "/home/$YOU/download/%(title)s.%(ext)s" "$song" >> /tmp/youtube-dl.log 2>&1 $MY_PATH/parle.sh "Enregistrement du lien terminé!" ###################################################### #### COPY LINK : "radio||"