aboutsummaryrefslogtreecommitdiffstats
path: root/util/scan/dvb-t/de-Bremen
blob: 3be3735de8d0c496ad7bb35322db42a9a5f094c8 (plain)
1
2
3
4
5
6
7
8
9
# DVB-T Bremen
# Created from http://www.ueberallfernsehen.de/data/senderliste.pdf
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
T 482000000 8MHz 2/3 NONE QAM16 8k 1/4 NONE # CH22: Das Erste (RB), RB TV (NDR NDS), arte, Phoenix
T 538000000 8MHz 2/3 NONE QAM16 8k 1/4 NONE # CH29: NDR NDS, WDR/NDR SH, MDR/NDR MVP, HR/NDR HH
T 562000000 8MHz 2/3 NONE QAM16 8k 1/4 NONE # CH32: ZDF, 3sat, KiKa / ZDFneo, ZDFinfo
T 642000000 8MHz 2/3 NONE QAM16 8k 1/4 NONE # CH42: RTL, RTL 2, Super RTL, VOX
T 666000000 8MHz 2/3 NONE QAM16 8k 1/4 NONE # CH45: Tele 5, SIXX, QVC, Mona/Das Vierte
T 698000000 8MHz 2/3 NONE QAM16 8k 1/4 NONE # CH49: ProSieben, Sat.1, Kabel1, N24
olor: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
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")