aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-07-07 08:25:51 +0200
committerneodarz <neodarz@neodarz.net>2019-07-07 08:25:51 +0200
commitc3caba049861149611be6de5059ef2801bdc3916 (patch)
treecb6666226d8dfc78093d5740bb2fbf0eeccaeaa6
downloadbandcamp-dl_script-c3caba049861149611be6de5059ef2801bdc3916.tar.xz
bandcamp-dl_script-c3caba049861149611be6de5059ef2801bdc3916.zip
Initial commit
-rw-r--r--README.md7
-rwxr-xr-xbandcamp-dl.sh24
2 files changed, 31 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..d116058
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+# bandcamp-dl_script
+
+This is a simple script to download an artist discography on bandcamp.
+
+This use iheany's [bandcamp-dl script](https://github.com/iheanyi/bandcamp-dl)
+
+So you need to install it.
diff --git a/bandcamp-dl.sh b/bandcamp-dl.sh
new file mode 100755
index 0000000..b79c43d
--- /dev/null
+++ b/bandcamp-dl.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+if [ -z "$1" ]; then
+ echo "usage:"
+ echo " $0 <url>"
+ echo ""
+ echo "<url> can be domain.tld or domaine.tld/music"
+ exit
+fi
+
+base=$(echo $1 | sed -e "s/\/$//")
+
+urls=$(curl $base -o /tmp/bandcamp_out &> /dev/null ; cat /tmp/bandcamp_out | grep "href=\"/album" | cut -d"\"" -f2)
+
+base=$(echo $base | sed -e "s/\/music//")
+
+for url in $urls; do
+ echo "Downloading $(echo $url | sed -e "s/^\/album\///g") album..."
+ bandcamp-dl $base$url
+ if [ $? -ne 0 ]; then
+ echo "Are you sure that $base$url is a valid album url?"
+ exit
+ fi
+done