7
# temporary file used to store rss entries
8
filename = "/tmp/rsstimer.tmp"
9
# interval in seconds between rss updates
12
# lcd4linux permits only 1 parameter passed to the function
13
# we send the rss title id with the ! spacer
17
feed = rssfeed.split('!')[0]
18
idx = int(rssfeed.split('!')[-1])
19
if (idx <= 0): idx = 1;
25
print "Feed changed refresing"
27
lastupdate = fgetseconds()
33
delta = now - lastupdate
34
if (delta > updateinterval):
35
print "Last update: " + str(delta) + " seconds ago. Updating the rss entries."
37
# first line in the file is the timestamp second is the feed url
38
output = linecache.getline(filename, idx + 2)
43
ts = datetime.datetime.now()
44
return time.mktime(ts.timetuple())
48
f = open(filename, "r")
50
print "Cannot get timestamp from file"
53
return float(f.readline())
57
f = open(filename, "r")
59
print "Cannot get feed from file"
64
return f.readline().rstrip("\n")
68
linecache.clearcache()
69
f = open(filename, "w")
71
f.write(str(getseconds()))
76
print "Downloading the rss feed from: " + rssfeed
77
feed = feedparser.parse(rssfeed)
78
for entry in feed.entries:
85
f = open(filename, "r")
90
#print getfeed("http://slashdot.org/slashdot.rdf!5")
91
print getfeed("http://www.linux.com/feed?theme=rss!1")