From 264b0ecb4292119778f8d753ce8cd22fac8a6bb9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 20 Dec 2013 13:16:30 -0500 Subject: [PATCH] Use new .prowl-rss dotfiles for prowl script --- bin/prowl-rss | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bin/prowl-rss b/bin/prowl-rss index 8845885d..ba92c202 100755 --- a/bin/prowl-rss +++ b/bin/prowl-rss @@ -1,8 +1,10 @@ #!/usr/bin/env python -# Python script to send prowl notifications when RSS feeds are updated. -# Stores a temp file in ~/.prowl-rss with RSS guids. Intended to be run -# via a cron job or on-demand, standalone. +# Checks to see if certain RSS feeds (listed in ~/.prowl-rss/feeds) have been +# updated recently, and if so, send a prowl notification. +# It stores read guids in ~/.prowl-rss/guids. +# +# Intended to be run via cron or on-demand. from __future__ import print_function @@ -15,8 +17,9 @@ import os ### -GUID_FILE = os.path.expanduser("~") + "/.prowl-rss" -CONF_FILE = os.path.expanduser("~") + "/.prowl-rss-conf" +API_FILE = os.path.expanduser("~") + "/.prowl-apikey" +GUID_FILE = os.path.expanduser("~") + "/.prowl-rss/guids" +FEEDS_FILE = os.path.expanduser("~") + "/.prowl-rss/feeds" API_DOMAIN = 'https://prowl.weks.net/publicapi' @@ -51,9 +54,10 @@ def prowl_post(api, app=None, event=None, desc=None, priority=0): try: guids = [line.strip() for line in open(GUID_FILE)] - conf = [line.strip() for line in open(CONF_FILE)] + conf = [line.strip() for line in open(FEEDS_FILE)] - apikey = conf[0] + with open(API_FILE) as f: + apikey = f.read().strip() feeds = conf[1:] ##