powerdl (1523B)
1 #!/usr/bin/env bash 2 3 mixcloud_url="https://www.mixcloud.com/Gentlemanofmetal/" 4 mixcloud_show_prefix="powerzone-show-" 5 powerzone_url="https://powerzonemetal.uk/" 6 powerzone_show_prefix="" 7 powerzone_dir="$HOME/lib/music/powerzone" 8 9 #latest_show=$(curl -s ${powerzone_url} | grep "/shows/" | head -n1 | sed -n 's/.*href="\([^"]*\).*/\1/p' | awk -F/ '{print $3}') 10 11 latest_show=$(curl -s "${powerzone_url}shows/" | grep "/shows/" | head -n1 | tail -n1 | sed -n 's/.*href="\([^"]*\).*/\1/p' | awk -F/ '{print $3}') 12 #show_num=$(curl -s ${powerzone_url} | grep "<h4>Show #" | head -n1 | awk -F\# '$2>0 {print substr($2,1,3)}') 13 14 if [[ ! $(find ${powerzone_dir} -name "powerzone-*${latest_show}-*.mp3" | wc -l) -eq 0 ]] ; then 15 echo "file exists" 16 exit 0 17 fi 18 19 #if [[ ${show_num} =~ ^[0-9]+([.][0-9]+)?$ ]] ; then 20 # powerzone_show_prefix="shows/show-" 21 #else 22 # powerzone_show_prefix="shows/" 23 #fi 24 mixcloud_show_url=$(curl -Ls "${powerzone_url}shows/${latest_show}/" | grep mixcloud | grep feed | awk -F\= '{print $5}' | awk -F\& '{print $1}' | sed 's/%3A/\:/' | sed 's&%2F&/&g') 25 download_filename=$(echo ${mixcloud_show_url} | awk -F\/ '{print $5}') 26 27 youtube-dl -q -o "${powerzone_dir}/${download_filename}" "${mixcloud_show_url}" 28 ffmpeg -loglevel quiet -i ${powerzone_dir}/${download_filename} -metadata title="${download_filename}" -metadata artist="powerzone" -metadata album="powerzone" -metadata track="${latest_show}" -metadata genre="metal" "${powerzone_dir}/${download_filename}.mp3" 29 rm -f "${powerzone_dir}/${download_filename}"