import feedparser
import time
import datetime
import tempfile
import linecache
# temporary file used to store rss entries
filename = "/tmp/rsstimer.tmp"
# interval in seconds between rss updates
updateinterval = 60
# lcd4linux permits only 1 parameter passed to the function
# we send the rss title id with the ! spacer
def getfeed(rssfeed):
print rssfeed
idx = 0
feed = rssfeed.split('!')[0]
idx = int(rssfeed.split('!')[-1])
if (idx <= 0): idx = 1;
oldfeed = fgetfeed()
if (oldfeed != feed):
lastupdate = 0
print "Feed changed refresing"
else:
lastupdate = fgetseconds()
if (lastupdate <= 0):
saverss(feed)
else:
now = getseconds()
delta = now - lastupdate
if (delta > updateinterval):
print "Last update: " + str(delta) + " seconds ago. Updating the rss entries."
saverss(feed)
# first line in the file is the timestamp second is the feed url
output = linecache.getline(filename, idx + 2)
print output
return output
def getseconds():
ts = datetime.datetime.now()
return time.mktime(ts.timetuple())
def fgetseconds():
try:
f = open(filename, "r")
except IOError:
print "Cannot get timestamp from file"
return 0
else:
return float(f.readline())
def fgetfeed():
try:
f = open(filename, "r")
except IOError:
print "Cannot get feed from file"
return ' '
else:
# skip first line
f.readline()
return f.readline().rstrip("\n")
def saverss(rssfeed):
linecache.clearcache()
f = open(filename, "w")
# save timestamp
f.write(str(getseconds()))
f.write("\n")
# save feed url
f.write(rssfeed)
f.write("\n")
print "Downloading the rss feed from: " + rssfeed
feed = feedparser.parse(rssfeed)
for entry in feed.entries:
f.write(entry.title)
f.write("\n")
f.close
print "Done"
def printrss():
f = open(filename, "r")
f.readline()
for line in f:
print line
#print getfeed("http://slashdot.org/slashdot.rdf!5")
print getfeed("http://www.linux.com/feed?theme=rss!1")
dvb-t/uk-Saddleworth?h=debian/1.1.1%2brev1500-1&id=891c51ff368ed700dec6025eeb47ce4d96f76418'>diffstats
blob: dbd037c10b77faaff4730f3659d6b28a89edfd39 (
plain)
1
2
3
4
5
6
7
8
9
10
|
# UK, Saddleworth
# Auto-generated from http://www.dtg.org.uk/retailer/dtt_channels.html
# and http://www.ofcom.org.uk/static/reception_advice/index.asp.html
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
T 682000000 8MHz 3/4 NONE QAM16 2k 1/32 NONE
T 633833000 8MHz 2/3 NONE QAM64 2k 1/32 NONE
T 657833000 8MHz 2/3 NONE QAM64 2k 1/32 NONE
T 713833000 8MHz 3/4 NONE QAM16 2k 1/32 NONE
T 618167000 8MHz 3/4 NONE QAM16 2k 1/32 NONE
T 738000000 8MHz 3/4 NONE QAM16 2k 1/32 NONE
|