A tool for quickly adding the backlog of a podcast to mpc.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pod2mpd/pod2mpd

44 lines
725 B

#!/bin/sh
myname="$0"
fetchcmd=curl
hostarg=""
eval cast=\${$#}
if tail -r /dev/null > /dev/null 2>&1; then
filter="tail -r"
elif tac /dev/null > /dev/null 2>&1; then
filter=tac
else
>&2 echo "Don't know how to reverse feed! Defaulting to feed order"
fi
args=$(getopt fih $*)
if [ $? -ne 0 ]; then
echo "Usage: $myname [-fih] linktorss" >& 2
exit 1
fi
set -- $args
while [ "$1" != -- ]; do
case "$1" in
-f) fetchcmd=cat ;;
-i)
filter=cat
;;
-h)
hostarg="--host=$3"
;;
esac
shift
done
shift
if [ $# -lt 3 ]; then
$fetchcmd $cast|grep "<enclosure.*url"|sed "s/^.*url=//"|cut -d'"' -f2|$filter|mpc $hostarg add
else
echo $0 $1 $2 $3 $4 $5
echo "Usage: $myname [-fih] linktorss" >&2
exit 1
fi