Created
November 5, 2012 00:11
-
-
Save simlun/4014494 to your computer and use it in GitHub Desktop.
Download script for the SICP videos
This file contains hidden or 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/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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... =/