dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit aa851d893cfc6791f0197ca3e2da88d65e758a3c
parent 0f86d6f8b20214c36f00c150fd1b4e0c3f80b068
Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date:   Thu, 15 Jan 2015 12:39:19 +0100

add democracy now download script

Diffstat:
Abin/democracy-now-dl | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+), 0 deletions(-)

diff --git a/bin/democracy-now-dl b/bin/democracy-now-dl @@ -0,0 +1,53 @@ +#!/bin/bash +#set -e + +# get today's show if nothing else is specified +DATE=$(date +%Y-%m%d) + +function help { + echo "Democracy Now! downloader." + echo "When called without any options, this script downloads today's " + echo "episode of the daily independent news program 'Democracy Now!'." + echo "Please consider donating to the show at http://democracynow.org." + echo "" + echo "Usage: $0 [OPTION]" + echo "" + echo "Options:" + echo " -y Download the episode from yesterday instead of today" + echo " -h Show this help" + echo "" + echo "Author: Anders Damsgaard, andersd@riseup.net" + + exit +} + +while getopts ":yh" opt; do + case $opt in + y) + DATE=$(date -v -1d +%Y-%m%d) + ;; + h) + help + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + help + ;; + esac +done + + +BASEURL=http://publish.dvlabs.com/democracynow/ipod/dn +SUFFIX=.mp4 +OUTNAME=democracy_now + +echo "Downloading Democracy Now! episode for `date +'%a %b %d, %Y'`" +wget --quiet --output-document="$OUTNAME$SUFFIX" "$BASEURL$DATE$SUFFIX" +if [ $? == 0 ]; then + echo "Saved as $OUTNAME$SUFFIX" +else + echo "Download failed." + echo "Try downloading the episode from yesterday by invoking:" + echo " $0 -y" + exit 1 +fi