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

37 lines
605 B

#!/bin/sh
myname="$0"
fetchcmd=curl
filter=cat
args=$(getopt fi $*)
if [ $? -ne 0 ]; then
echo "Usage: $myname [-fi] linktorss" >& 2
exit 1
fi
set -- $args
while [ "$1" != -- ]; do
case "$1" in
-f) fetchcmd=cat ;;
-i)
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
echo "Don't know how to reverse order!"
exit 1
fi
;;
esac
shift
done
shift
if [ "$#" -eq 1 ]; then
$fetchcmd $1|grep "<enclosure url"|cut -d'"' -f2|$filter|mpc add
else
echo "Usage: $myname [-fi] linktorss" >&2
exit 1
fi