-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfeed-execute.py
More file actions
23 lines (20 loc) · 828 Bytes
/
feed-execute.py
File metadata and controls
23 lines (20 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Add a feed option to execute a command before or after updating the feed.
# Copyright 2005 Adam Sampson <ats@offog.org>
#
# This is useful if, for example, you have a file: feed that's generated on the
# fly by a screen-scraping program.
# Usage example:
# feed 3h file:/tmp/scraped.rss
# pre-execute scrape http://somewhere/ >/tmp/scraped.rss
# post-execute rm /tmp/scraped.rss
import rawdoglib.plugins, os
def pre_update_feed(rawdog, config, feed):
if feed.args.has_key("pre-execute"):
os.system(feed.args["pre-execute"])
return True
rawdoglib.plugins.attach_hook("pre_update_feed", pre_update_feed)
def post_update_feed(rawdog, config, feed, seen):
if feed.args.has_key("post-execute"):
os.system(feed.args["post-execute"])
return True
rawdoglib.plugins.attach_hook("post_update_feed", post_update_feed)