My home internet connection's been annoyingly broken recently. Until it gets fixed, I'm starting to appreciate that you can actually *download* music locally again (because spotify is forever stalling while the internet sorts itself out). This blogpost will probably be useful to basically no one, so I'm writing it for mostly myself. But if it helps someone else, that's great.
One place I download a bunch of music from is Ektoplazm.com. It's a site that's existed for ages and has mostly psytrance and related genres (psychill, downtempo, progressive, etc). Problem is, it offers the music as a zip file with no subfolders. I play music from my home server, with all music stored in
/storage/media/
. When I download music from Ektoplazm, I wanted to store them under some directory here, with the album name being a further subdirectory. So, I wrote two little bash functions that handle this, the main one being called `ektoget`.For example, take the following album: https://ektoplazm.com/free-music/globular-entangled-everything - on that page, you'll see an 'MP3 Download' button. Using my script, when SSH'd into my server, I simply type
ektoget https://ektoplazm.com/files/Globular%20-%20Entangled%20Everything%20-%202018%20-%20MP3.zip
and it'll download the album to /storage/media/music/ektoplazm/Globular - Entangled Everything - 2018 - MP3
, with each MP3 under that directory.To use
ektoget
, add the following to your ~/.bashrc
file. Then reload with source ~/.bashrc`
.EKTODIR="/storage/media/music/ektoplazm"
ektozip(){
file=$1
dirname="${file%.*}"
unzip "$file" -d "$dirname"
rm "$file"
}
ektoget(){
url="$1"
pushd "$EKTODIR" || exit 1
base="$(basename ${url})"
filename=$(printf '%b' ${base//%/\\x})
echo "base: $base"
echo "url: $url"
echo "filename: $filename"
wget "${url}"
ektozip "$filename"
popd || exit 1
}
You'll want to set EKTODIR to whatever location you want to save music.Sorry, I wrote all this in a hurry because I'm putting off doing my *actual* job. So if anything's unclear, just comment and I'll help you out.
Comments
Displaying 0 of 0 comments ( View all | Add Comment )