dotfiles

<-- duh.
git clone https://hhvn.uk/dotfiles
git clone git://hhvn.uk/dotfiles
Log | Files | Refs | Submodules | LICENSE

dl (556B)


      1 #!/bin/sh
      2 #
      3 # bandcampdl.sh <url to album> [media player]
      4 #
      5 # Looks like youtube-dl won't be getting worked on for a while
      6 # Fuck the RIAA
      7 #
      8 # bandcamp seems to use mp3 exclusively.. but if that's not the case.. :)
      9 
     10 url="$1"
     11 [ ! -z $2 ] && out="xargs $2" || out="dl"
     12 
     13 dl(){
     14 	mkdir -p "$(basename "$url")"
     15 	num=0
     16 	while IFS= read -r input
     17 	do
     18 		num=$(($num+1))
     19 		curl "$input" > "$(basename "$url")/$(printf "%02d" "$num").mp3"
     20 	done
     21 }
     22 
     23 # this is criminally easy.
     24 curl "$url" | grep -o 'https://[^}]*/mp3-128/[^}]*' | sed 's~\&amp;~\&~g;s~\&quot;~~' | $out