rohrpost

A commandline mail client to change the world as we see it.
git clone git://r-36.net/rohrpost
Log | Files | Refs | LICENSE

commit 0ac6460464c949ccc9aa711651ceaa4b9512f120
parent 7af39f6d1c4402ff037e189c5fc9a4f50b1a8b69
Author: Christoph Lohmann <20h@r-36.net>
Date:   Wed, 26 Dec 2012 17:45:21 +0100

Add the rppoddl command and simply rppodplay.

Diffstat:
bin/rppoddl | 19+++++++++++++++++++
bin/rppodplay | 49++-----------------------------------------------
2 files changed, 21 insertions(+), 47 deletions(-)

diff --git a/bin/rppoddl b/bin/rppoddl @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ -z "$DOWNLOADER" ] || [ -z "$DOWNLOADDIR" ]; +then + echo "You need to set \$DOWNLOADER and \$DOWNLOADDIR" \ + " for downloading the podcast." + exit 1 +fi + +url=$(rpview "$@" | awk '/Enclosure:/ {print $2}' | tr -d '\r') +for i in $url +do + echo $i + cd $DOWNLOADDIR + $DOWNLOADER "$i" +done + +echo "The files have been downloaded to $DOWNLOADDIR." + diff --git a/bin/rppodplay b/bin/rppodplay @@ -1,37 +1,5 @@ #!/bin/sh -usage() { - printf "usage: %s [-d] msgid\n" "$(basename $1)" 2>&1 - exit 1 -} - -dodownload=0 -folder="" - -while getopts "dh:" opt; -do - case $opt in - d) - dodownload=1 - ;; - - *) - usage $0 - ;; - esac -done -shift $(($OPTIND - 1)) - -if [ $dodownload -gt 0 ]; -then - if [ -z "$DOWNLOADER" ] || [ -z "$DOWNLOADDIR" ]; - then - echo "You need to set \$DOWNLOADER and \$DOWNLOADDIR" \ - " for downloading the podcast." - exit 1 - fi -fi - if [ -z "$AUDIOPLAYER" ]; then if [ -z "$MEDIAPLAYER" ]; @@ -45,23 +13,10 @@ else player="$AUDIOPLAYER" fi -msgid="$*" - -url=$(rpview -- $msgid | awk '/Enclosure:/ {print $2}' | tr -d '\r') +url=$(rpview "$@" | awk '/Enclosure:/ {print $2}' | tr -d '\r') for i in $url do echo $i - if [ $dodownload -gt 0 ]; - then - cd $DOWNLOADDIR - $DOWNLOADER "$i" - else - $player "$i" - fi + $player "$i" done -if [ $dodownload -gt 0 ]; -then - echo "The files have been downloaded to $DOWNLOADDIR." -fi -