#!/bin/sh


# This script can be used to automatically add 
# subscriptions to Liferea. Just supply a valid
# and correctly escaped feed URL as parameter.

if [ $# -ne 1 ]; then
	echo "Wrong parameter count!"
	echo ""
	echo "Syntax: $0 <feed URL>"
	echo ""
	exit 1
fi

URL=$1

if ! pgrep -x liferea >/dev/null 2>&1; then
	echo "Liferea is not running! You need to start it first."
	exit 1
fi

NEWURL=`echo "$URL" | sed 's/feed\:https/https/'`

/usr/local/bin/liferea --add-feed "$NEWURL"
