From 66028aeacf9e3c71397fac8d995f84ba8a598a35 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Sat, 20 Sep 2003 17:01:32 +0000 Subject: [PATCH] Use new option syntax. Generate template differently depending on the options (rather than making template parameters be empty or not depending on the options, which is less useful). --- NEWS | 13 ++++--- README | 30 ++++++++------- rawdoglib/rawdog.py | 91 ++++++++++++++++++++++++++++++--------------- 3 files changed, 84 insertions(+), 50 deletions(-) diff --git a/NEWS b/NEWS index 183c656..ffeb07c 100644 --- a/NEWS +++ b/NEWS @@ -1,12 +1,15 @@ - rawdog 1.3 -Reverted the "retry immediately" behaviour from 1.2, since it causes denied or -broken feeds to get checked every time rawdog is run. +Reverted the "retry immediately" behaviour from 1.2, since it causes +denied or broken feeds to get checked every time rawdog is run. Updated feedparser to 2.5.3, which now returns the XML encoding used. -rawdog uses this information to convert all incoming items into UTF-8, so -multiple encodings are now handled correctly (and the HTML output is now -encoded in UTF-8 rather than ISO-8859-1 as before). +rawdog uses this information to convert all incoming items into UTF-8, +so multiple encodings are now handled correctly (and the HTML output is +now encoded in UTF-8 rather than ISO-8859-1 as before). + +Use standard option syntax (i.e. "--update --write" instead of "update +write"). The old syntax will be supported until 2.0. - rawdog 1.2 diff --git a/README b/README index eafb966..b86f6aa 100644 --- a/README +++ b/README @@ -28,26 +28,28 @@ be usable from a browser that doesn't support CSS, but it won't be very pretty.) When you invoke rawdog from the command line, you give it a series of actions -to perform -- for instance, "rawdog update write" tells it to do the "update" -action, then the "write" action. The actions supported are as follows: +to perform -- for instance, "rawdog --update --write" tells it to do the +"--update" action, then the "--write" action. The actions supported are +as follows: -"update": Fetch data from the feeds and store it. This could take some time -if you've got lots of feeds. +"--update" (or "-u"): Fetch data from the feeds and store it. This could +take some time if you've got lots of feeds. -"write": Write out the HTML output file. +"--write" (or "-w"): Write out the HTML output file. -"list": List brief information about each of the feeds that was known about -when "update" was last done. +"--list" (or "-l"): List brief information about each of the feeds that +was known about when "--update" was last done. -Any other action will be assumed to be the URL of a known feed; that feed will -be updated immediately (even if its period hasn't elapsed since it was last -updated). This is useful if you're trying to debug your own feed. +"--update-feed SOMEURL" (or "-f SOMEURL"), where SOMEURL is the URL of a +known feed: Update that feed immediately, even if its period hasn't +elapsed since it was last updated. This is useful if you're trying to +debug your own feed. -You will want to run "rawdog update write" periodically to fetch data and write -the output file. The easiest way to do this is to add a crontab entry that -looks something like this: +You will want to run "rawdog -uw" periodically to fetch data and write +the output file. The easiest way to do this is to add a crontab entry +that looks something like this: -0,10,20,30,40,50 * * * * /path/to/rawdog update write +0,10,20,30,40,50 * * * * /path/to/rawdog -uw (If you don't know how to use cron, then "man crontab" is probably a good start.) This will run rawdog every ten minutes. diff --git a/rawdoglib/rawdog.py b/rawdoglib/rawdog.py index 0e7f318..192d352 100644 --- a/rawdoglib/rawdog.py +++ b/rawdoglib/rawdog.py @@ -19,7 +19,7 @@ VERSION = "1.3" import feedparser from persister import Persistable, Persister -import os, time, sha +import os, time, sha, getopt from StringIO import StringIO import timeoutsocket @@ -367,8 +367,11 @@ class Rawdog(Persistable): - __refresh__ - +""" + if config["userefresh"]: + template += """__refresh__ +""" + template += """ rawdog @@ -378,20 +381,21 @@ class Rawdog(Persistable):
__items__
+""" + if config["showfeeds"]: + template += """

Feeds

__feeds__
-