Skip to content

Instantly share code, notes, and snippets.

@simlun
Created November 5, 2012 00:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simlun/4014494 to your computer and use it in GitHub Desktop.
Save simlun/4014494 to your computer and use it in GitHub Desktop.
Download script for the SICP videos
#!/bin/bash
set -e
#DOWNLOAD_COMMAND='curl -s -S -C - -L -O'
DOWNLOAD_COMMAND='wget --quiet --continue'
SIMULTANEOUS_DOWNLOADS=3
one-word-per-line() {
xargs -n 1 echo $@
}
urlify() {
awk '{ print "http://archive.org/download/MIT_Structure_of_Computer_Programs_1986/lec" $1 ".mp4" }'
}
special-cases-urlify() {
awk '{ print "http://archive.org/download/MIT_Structure_of_Computer_Programs_1986/Lec" $1 ".mp4" }'
}
list() {
echo {1..9}a {1..5}b {7..10}b | one-word-per-line | sort -n | urlify
echo 6b 10a | one-word-per-line | special-cases-urlify
}
download() {
xargs -n 1 -P $SIMULTANEOUS_DOWNLOADS $DOWNLOAD_COMMAND $1
}
list | download
@simlun
Copy link
Author

simlun commented Nov 5, 2012

Hm.. Resuming downloads using cURL wasn't exactly flawless...

@simlun
Copy link
Author

simlun commented Nov 5, 2012

Crap. It does not work with lecture 10a (That one is apparently named Lec10a.mp4 and not lec10a.mp4...). The same goes for Lec6b.mp4. Now the script isn't as elegant... =/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment