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")
ian/dtv-scan-tables.git/stats/isdb-t/br-rs-Itaqui?h=debian/0%2bgit20161227.ac7535a-1'>stats
blob: aba5a37aaf34a4befb6cd2ac6fafa2e3c1383966 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# Channel table for Itaqui - RS - Brazil
# Source: http://www.portalbsd.com.br/terrestres_channels.php?channels=685
# Physical channel 28
[TVE RS]
DELIVERY_SYSTEM = ISDBT
BANDWIDTH_HZ = 6000000
FREQUENCY = 557142857
INVERSION = AUTO
GUARD_INTERVAL = AUTO
TRANSMISSION_MODE = AUTO
INVERSION = AUTO
GUARD_INTERVAL = AUTO
TRANSMISSION_MODE = AUTO
ISDBT_LAYER_ENABLED = 7
ISDBT_SOUND_BROADCASTING = 0
ISDBT_SB_SUBCHANNEL_ID = 0
ISDBT_SB_SEGMENT_IDX = 0
ISDBT_SB_SEGMENT_COUNT = 0
ISDBT_LAYERA_FEC = AUTO
ISDBT_LAYERA_MODULATION = QAM/AUTO
ISDBT_LAYERA_SEGMENT_COUNT = 0
ISDBT_LAYERA_TIME_INTERLEAVING = 0
ISDBT_LAYERB_FEC = AUTO
ISDBT_LAYERB_MODULATION = QAM/AUTO
ISDBT_LAYERB_SEGMENT_COUNT = 0
ISDBT_LAYERB_TIME_INTERLEAVING = 0
ISDBT_LAYERC_FEC = AUTO
ISDBT_LAYERC_MODULATION = QAM/AUTO
ISDBT_LAYERC_SEGMENT_COUNT = 0
ISDBT_LAYERC_TIME_INTERLEAVING = 0
# Physical channel 33
[RBS TV]
DELIVERY_SYSTEM = ISDBT
BANDWIDTH_HZ = 6000000
FREQUENCY = 587142857
INVERSION = AUTO
GUARD_INTERVAL = AUTO
TRANSMISSION_MODE = AUTO
INVERSION = AUTO
GUARD_INTERVAL = AUTO
TRANSMISSION_MODE = AUTO
ISDBT_LAYER_ENABLED = 7
ISDBT_SOUND_BROADCASTING = 0
ISDBT_SB_SUBCHANNEL_ID = 0
ISDBT_SB_SEGMENT_IDX = 0
ISDBT_SB_SEGMENT_COUNT = 0
ISDBT_LAYERA_FEC = AUTO
ISDBT_LAYERA_MODULATION = QAM/AUTO
ISDBT_LAYERA_SEGMENT_COUNT = 0
ISDBT_LAYERA_TIME_INTERLEAVING = 0
ISDBT_LAYERB_FEC = AUTO
ISDBT_LAYERB_MODULATION = QAM/AUTO
ISDBT_LAYERB_SEGMENT_COUNT = 0
ISDBT_LAYERB_TIME_INTERLEAVING = 0
ISDBT_LAYERC_FEC = AUTO
ISDBT_LAYERC_MODULATION = QAM/AUTO
ISDBT_LAYERC_SEGMENT_COUNT = 0
ISDBT_LAYERC_TIME_INTERLEAVING = 0
|