Skip to content

Instantly share code, notes, and snippets.

@moodoki
Created November 27, 2017 22:25
Show Gist options
  • Save moodoki/654877be611ef63bb32d58c428d6e7ba to your computer and use it in GitHub Desktop.
Save moodoki/654877be611ef63bb32d58c428d6e7ba to your computer and use it in GitHub Desktop.
Beethoven Piano Sonatas found on archive.org
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Usage download_dataset <path_to_save>"
exit 1
fi
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
TEMP_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'`
echo $SCRIPT_PATH
# check if tmp dir was created
if [[ ! "$TEMP_DIR" || ! -d "$TEMP_DIR" ]]; then
echo "Could not create temp dir"
exit 1
fi
#Ensure removal of temp dir on exit
function cleanup {
rm -rf "$TEMP_DIR"
echo "Temp dir removed"
}
trap cleanup EXIT
if [[ $s == /* ]]; then
ABS_PATH=$1
else
ABS_PATH=`pwd`/$1
fi
mkdir -p $ABS_PATH
pushd "$TEMP_DIR"
# See: https://blog.archive.org/2012/04/26/downloading-in-bulk-using-wget/
wget -r -H -nc -nH --cut-dir=1 -A .ogg -R *_vbr.mp3 -e robots=off -l1 -i $SCRIPT_PATH/itemlist.txt -B 'http://archive.org/download/'
ls
mv */*.ogg $ABS_PATH/
rm -rf $DL
popd
BeethovenPianoSonataNo.1
BeethovenPianoSonataNo.2
BeethovenPianoSonataNo.3
BeethovenPianoSonataNo.4
BeethovenPianoSonataNo.5
BeethovenPianoSonataNo.6
BeethovenPianoSonataNo.7
BeethovenPianoSonataNo.8
BeethovenPianoSonataNo.9
BeethovenPianoSonataNo.10
BeethovenPianoSonataNo.11
BeethovenPianoSonataNo.12
BeethovenPianoSonata13
BeethovenPianoSonataNo.14moonlight
BeethovenPianoSonata15
BeethovenPianoSonata16
BeethovenPianoSonata17
BeethovenPianoSonataNo.18
BeethovenPianoSonataNo.19
BeethovenPianoSonataNo.20
BeethovenPianoSonataNo.21Waldstein
BeethovenPianoSonata22
BeethovenPianoSonataNo.23
BeethovenPianoSonataNo.24
BeethovenPianoSonataNo.25
BeethovenPianoSonataNo.26
BeethovenPianoSonataNo.27
BeethovenPianoSonataNo.28
BeethovenPianoSonataNo.29
BeethovenPianoSonataNo.30
BeethovenPianoSonataNo.31
BeethovenPianoSonataNo.32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment