87 lines
3.4 KiB
Bash
87 lines
3.4 KiB
Bash
|
#!/bin/zsh
|
||
|
|
||
|
#Default settings
|
||
|
DLART="0"
|
||
|
DLPRE="0"
|
||
|
DLSRC="0"
|
||
|
DLVID="1"
|
||
|
RATE="800K"
|
||
|
|
||
|
# My environment settings
|
||
|
SRCDIR="${HOME}/Software/src/Handmade Hero" # the directory to save Casey's files
|
||
|
VIDDIR="${HOME}/Media/Videos/YouTube/Handmade Hero" # the direct to save the videos
|
||
|
OWLURL="" # the url in the email from Molly@sendowl.com
|
||
|
|
||
|
# Casey's files
|
||
|
HMHSRC_001_099="file?product_id=168514"
|
||
|
HMHSRC_100_199="file?product_id=79802"
|
||
|
HMHART="file?product_id=93897"
|
||
|
|
||
|
usage()
|
||
|
{
|
||
|
echo "usage: dlhmh [option]"
|
||
|
echo
|
||
|
echo " -art - disable art"
|
||
|
echo " +art - enable art"
|
||
|
echo " -pre - disable pre-stream video"
|
||
|
echo " +pre - enable pre-stream video"
|
||
|
echo " -src - disable source"
|
||
|
echo " +src - enable source"
|
||
|
echo " -vid - disable main stream"
|
||
|
echo " +vid - enable main stream"
|
||
|
echo
|
||
|
echo " -fs - download at full-speed"
|
||
|
echo " -h|--help - outputs this message"
|
||
|
exit
|
||
|
}
|
||
|
|
||
|
# Argument parsing
|
||
|
while [[ $1 ]]; do
|
||
|
case "$1" in
|
||
|
'-art') DLART='0';;
|
||
|
'+art') DLART='1';;
|
||
|
'-pre') DLPRE='0';;
|
||
|
'+pre') DLPRE='1' ; echo "Downloading the pre-stream video is not yet implemented\nExiting..." ; exit;;
|
||
|
'-src') DLSRC='0';;
|
||
|
'+src') DLSRC='1';;
|
||
|
'-vid') DLVID='0';;
|
||
|
'+vid') DLVID='1';;
|
||
|
'-fs') RATE="9G";;
|
||
|
'-h'|'--help') usage ;;
|
||
|
*) echo "${0##*/}: No such option, mate!\n" ; usage ; exit 127 ;;
|
||
|
esac
|
||
|
shift
|
||
|
done
|
||
|
|
||
|
# Downloading the art assets
|
||
|
if [[ "$DLART" == "1" ]]; then
|
||
|
wget -O "${SRCDIR}/handmade_hero_assets.zip" "${OWLURL}/${HMHART}"
|
||
|
fi
|
||
|
|
||
|
# Downloading the pre-stream video
|
||
|
if [[ "$DLPRE" == "1" ]]; then
|
||
|
#NOTE(matt): This is where the pre-stream downloading code will go
|
||
|
fi
|
||
|
|
||
|
# Downloading the source code
|
||
|
if [[ "$DLSRC" == "1" ]]; then
|
||
|
if [[ ! -e "${SRCDIR}/handmade_hero_source_001-099.zip" ]]; then
|
||
|
wget -O "${SRCDIR}/handmade_hero_source_001-099.zip" "${OWLURL}/${HMHSRC_001_099}"
|
||
|
fi
|
||
|
wget -O "${SRCDIR}/handmade_hero_source_100-199.zip" "${OWLURL}/${HMHSRC_100_199}"
|
||
|
fi
|
||
|
|
||
|
# YouTube playlists:
|
||
|
# https://www.youtube.com/user/handmadeheroarchive/playlists
|
||
|
|
||
|
#youtube-dl -o "${VIDDIR}/04. Game Architecture/%(title)s-%(id)s.%(ext)s" "https://www.youtube.com/playlist?list=PLEMXAbCVnmY6v0eFYcyiH7twEh1UF2Lxw"
|
||
|
#youtube-dl -o "${VIDDIR}/05. Asset Pipeline/%(title)s-%(id)s.%(ext)s" "https://www.youtube.com/playlist?list=PLEMXAbCVnmY6JVkAI8elXUJ-83HY706AQ"
|
||
|
#youtube-dl -o "${VIDDIR}/06. Rendering/%(title)s-%(id)s.%(ext)s" "https://www.youtube.com/playlist?list=PLEMXAbCVnmY40lfaaowTqIs_dKNgOXR5Q"
|
||
|
|
||
|
# Download all of the videos from the last 4 days ago into the HMH base directory
|
||
|
# NOTE(matt): Maybe figure out a way to download them to playlists while still
|
||
|
# keeping the '4 days ago' thing
|
||
|
if [[ "$DLVID" == "1" ]]; then
|
||
|
youtube-dl -i -r $RATE -f 137+140 --download-archive "${VIDDIR}/.dlarchive" -o "${VIDDIR}/%(title)s-%(id)s.%(ext)s" --dateafter "$(date +%Y%m%d -d'8 days ago')" "https://www.youtube.com/user/handmadeheroarchive"
|
||
|
fi
|