-
-
Save ftrvxmtrx/1e756f11c2ac90670d4bb1258ad55305 to your computer and use it in GitHub Desktop.
download a bandcamp album, pass it a link to the album
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/rc | |
hget $1 | grep '^[ ]*(current:|trackinfo:|.*image_src)' | sed 's/","/\n/g;s/":"/ /g;s/":{"/\n/g;s/"},"/\n/g;s/,"/\n/g;s/":/ /g' | awk -F ' ' ' | |
/image_src/ { | |
split($0, image_src, /[ ">]+/) | |
image = image_src[6] | |
} | |
/^artist / { | |
artist = $2 | |
} | |
/^release_date / { | |
split($2, date, " ") | |
year = date[3] | |
} | |
/^title / { | |
if(album == "") | |
album = $2 | |
else | |
title = $2 | |
} | |
/^track_num / { | |
num = $2 | |
} | |
/^mp3/ { | |
printf "mkdir -p ''%s/%s - %s''\n", artist, year, album | |
if(image != "") | |
printf "test -f ''%s/%s - %s/cover.jpg'' || hget ''%s'' > ''%s/%s - %s/cover.jpg''\n", artist, year, album, image, artist, year, album | |
printf "hget ''%s'' > ''%s/%s - %s/%02d - %s.mp3''\n", $2, artist, year, album, num, title | |
} | |
' | rc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment