summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2012-08-03 15:00:29 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2012-08-03 15:00:29 +0200
commit5e0af288656f1a0b41ed92124fd760b1ceeea6fd (patch)
tree8de908367e6d32d9c26e46a385e3ddf6fc8334f1
parent50d0bc170c2b7c783e09d81d38a824422712b6e5 (diff)
Add sfeed_opml_export script
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
-rwxr-xr-xsfeed_opml_export52
-rw-r--r--sfeed_opml_export.116
2 files changed, 68 insertions, 0 deletions
diff --git a/sfeed_opml_export b/sfeed_opml_export
new file mode 100755
index 0000000..870ae34
--- /dev/null
+++ b/sfeed_opml_export
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# load config (evaluate shellscript).
+# loadconfig(configfile)
+loadconfig() {
+ # allow to specify config via argv[1].
+ if [ ! "$1" = "" ]; then
+ # get absolute path of config file.
+ config=$(readlink -f "$1")
+ else
+ # default config location.
+ config="$HOME/.sfeed/sfeedrc"
+ fi
+
+ # load config: config is loaded here to be able to override above variables
+ # (sfeedpath, sfeedfile, etc).
+ if [ -r "$config" ]; then
+ . "$config"
+ else
+ echo "Configuration file \"$config\" does not exist or is not readable." >&2
+ exit 1
+ fi
+}
+
+# override feeds function to ouput opml XML.
+# feed(name, feedurl, basesiteurl, [encoding])
+feed() {
+ cat <<!
+ <outline
+ title="$1" text="$1"
+ xmlUrl="$2" htmlUrl="$3"/>
+!
+}
+
+# load config file.
+loadconfig "$1"
+
+cat <<!
+<?xml version="1.0" encoding="UTF-8"?>
+<opml version="1.0">
+ <head>
+ <title>opml export from sfeed</title>
+ </head>
+ <body>
+!
+
+feeds
+
+cat <<!
+ </body>
+</opml>
+!
diff --git a/sfeed_opml_export.1 b/sfeed_opml_export.1
new file mode 100644
index 0000000..a62ed62
--- /dev/null
+++ b/sfeed_opml_export.1
@@ -0,0 +1,16 @@
+.TH SFEED 1 sfeed\-VERSION
+.SH NAME
+sfeed_opml_export \- generate an opml file based on a sfeedrc config file
+.SH SYNOPSIS
+.B sfeed_opml_export
+.RB [configfile]
+.SH OPTIONS
+.TP
+.B [configfile]
+config file, if not specified uses the location $HOME/.sfeed/sfeedrc by default (see FILES READ section for more information).
+.SH DESCRIPTION
+Parse the specified config file and output opml XML data to stdout.
+.SH SEE ALSO
+.BR sfeed_update(1)
+.SH BUGS
+Please report them!