diff options
author | Nick White <git@njw.me.uk> | 2010-08-07 12:45:13 +0100 |
---|---|---|
committer | Nick White <git@njw.me.uk> | 2010-08-07 12:45:13 +0100 |
commit | 6f116ca59eef1fac8e16535cce3fad6c3b63ff69 (patch) | |
tree | 727f07944d9a974665a4a95021045e7acfc86225 /scripts/fetchdnow.sh | |
parent | 4a43cd79f1cd901f7988260b1872d1d306f2a848 (diff) | |
download | njw-website-6f116ca59eef1fac8e16535cce3fad6c3b63ff69.tar.bz2 njw-website-6f116ca59eef1fac8e16535cce3fad6c3b63ff69.zip |
Reorganise software section
Diffstat (limited to 'scripts/fetchdnow.sh')
-rw-r--r-- | scripts/fetchdnow.sh | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/scripts/fetchdnow.sh b/scripts/fetchdnow.sh deleted file mode 100644 index 990a2dc..0000000 --- a/scripts/fetchdnow.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/bash -# Copyright 2008 Nick White -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# See <http://www.gnu.org/licenses/> for a copy of the GNU General -# Public License. - -function usage -{ - echo "Usage: dnow [-c codec] [-f outfile]" - echo " codec may be ogg, flac or mp3" -} - -# Get Dates # -year=$(date +%Y) -month=$(date +%m) -monthname=$(date +%B) -day=$(date +%d) -dayunpadded=$(date +%-e) - -# Set Defaults # -title="Democracy Now!" -titleshort="Democracy_Now" -codec="ogg" -podcastdir=~/feeds - -while [ "$1" != "" ]; do - case $1 in - -c | --codec ) shift - codec=$1 - ;; - -f | --file ) shift - outfile=$1 - ;; - -h | --help ) usage - exit - ;; - * ) usage - exit - ;; - esac - shift -done - -downfile=dn$year-$month$day-1.$codec - -url=http://www.archive.org/download/dn$year-$month$day/$downfile - -downdir=$podcastdir/$year-$month-$dayunpadded - -# if the file already exists, exit -if [ -f "$downdir/$downfile" ]; then - echo "download file already exists" - exit 1 -fi - -echo "url is $url" - -mkdir -p "$downdir" -wget --quiet --directory-prefix="$downdir" $url - -# check that it's audio data, not a 404, & if necessary delete -if [ -f "$downdir/404.php" ]; then - find "$downdir" -iname "404.php*" -type f -exec rm -f {} \; - echo "404, sorry" - exit 1 -elif [ -z "$(file $downdir/$downfile|grep audio)" ]; then - rm "$downdir/$downfile" - echo "download wasn't audio" - exit 1 -fi - -# tag the newly downloaded file -vorbiscomment -w "$downdir/$downfile" -t "ARTIST=$title" -t "TITLE=$day $monthname $year" -t "GENRE=News" -t "DATE=$year" - -# create directories and links to integrate with GoldenPod's directory structure -catdir=$podcastdir/catalogue/$titleshort - -mkdir -p "$catdir" - -ln -s "$downdir/$downfile" "$podcastdir/catalogue/All/" -ln -s $downdir/$downfile "$catdir/" -ln -sf $downdir/$downfile "$catdir/latest.$codec" -ln -sfn $downdir "$podcastdir/latest" |