Author: schwardt
Date: Sun Feb 11 12:13:46 2007
New Revision: 2481
Modified:
trunk/WIP/record/src/dvbconfigreader.py
trunk/WIP/record/src/dvbs.conf
Log:
- dvb config parser supports now vdr3 format
- fixed get_channel()
Modified: trunk/WIP/record/src/dvbconfigreader.py
==============================================================================
--- trunk/WIP/record/src/dvbconfigreader.py (original)
+++ trunk/WIP/record/src/dvbconfigreader.py Sun Feb 11 12:13:46 2007
@@ -47,7 +47,7 @@
#
# DVB-S
#ARD - Das Erste:11836:h:S19.2E:27500:101:102:104:0:28106:0:0:0
-#ARD - Bayerisches FS:11836:h:S19.2E:27500:201:202:204:0:28107:0:0:0
+#RTL World - RTL2:12187:h:S19.2E:27500:167:136=ger:71:0:12060:1:1089:0
#
# DVB-T
#Das Erste:706000:I999C23D23M16B8T8G4Y0:T:27500:257:258:260:0:224:0:0:0
@@ -110,32 +110,47 @@
'0': 'OFF',
'1': 'ON' }
+
+
def __init__(self, line):
- self.re_dvbt =
re.compile('^.*?:\d+:([ICDMBTGY]\d+)+:T:\d+:\d+:\d+(,\d+)?(;\d+(,\d+)?)*:\d+:\d+:\d+:\d+:\d+:\d+')
- self.re_dvbc =
re.compile('^.*?:\d+:([ICDMBTGY]\d+)+:C:\d+:\d+:\d+(,\d+)?(;\d+(,\d+)?)*:\d+:\d+:\d+:\d+:\d+:\d+')
- self.re_dvbs =
re.compile('^.*?:\d+:[HV]([ICDMBTGY]\d+)*:S\d+(\.\d+)?[EeWw]:\d+:\d+:\d+(,\d+)?(;\d+(,\d+)?)*:\d+:\d+:\d+:\d+:\d+:\d+',
re.IGNORECASE)
+ self.re_dvbt =
re.compile('^.*?:\d+:([ICDMBTGY]\d+)+:T:\d+:\d+:\d+(=\w+)?(,\d+(=\w+)?)?(;\d+(=\w+)?(,\d+(=\w+)?)?)*:\d+:\d+:\d+:\d+:\d+:\d+')
+ self.re_dvbc =
re.compile('^.*?:\d+:([ICDMBTGY]\d+)+:C:\d+:\d+:\d+(=\w+)?(,\d+(=\w+)?)?(;\d+(=\w+)?(,\d+(=\w+)?)?)*:\d+:\d+:\d+:\d+:\d+:\d+')
+ self.re_dvbs =
re.compile('^.*?:\d+:[HV]([ICDMBTGY]\d+)*:S\d+(\.\d+)?[EeWw]:\d+:\d+:\d+(=\w+)?(,\d+(=\w+)?)?(;\d+(=\w+)?(,\d+(=\w+)?)?)*:\d+:\d+:\d+:\d+:\d+:\d+',
re.IGNORECASE)
self.config = { }
self.line = line.strip('\n')
self.cfgtype = None
- if self.line[0] == '#':
+ if len(self.line) == 0:
+ self.cfgtype = 'COMMENT'
+ elif self.line[0] == '#':
self.cfgtype = 'COMMENT'
- if self.re_dvbt.match(line):
+ elif self.re_dvbt.match(line):
self.cfgtype = 'DVB-T'
- if self.re_dvbc.match(line):
+ elif self.re_dvbc.match(line):
self.cfgtype = 'DVB-C'
- if self.re_dvbs.match(line):
+ elif self.re_dvbs.match(line):
self.cfgtype = 'DVB-S'
if self.cfgtype == None:
log.error('failed to parse config line:\n%s' % self.line)
return None
+ if self.cfgtype == 'COMMENT':
+ return None
+
cells = self.line.split(':')
-
- self.config['name'] = cells[0]
+
+ if ';' in cells[0]:
+ self.config['name'] = cells[0].split(';')[0]
+ self.config['bouquet'] = cells[0].split(';')[1]
+ else:
+ self.config['name'] = cells[0]
+ self.config['bouquet'] = ''
+
+ self.config['name'] = self.config['name'].replace('|', ':')
+ self.config['bouquet'] = self.config['bouquet'].replace('|', ':')
self.config['frequency'] = cells[1]
# get params
@@ -177,7 +192,10 @@
for i in cells[6].split(';'):
lst = []
for t in i.split(','):
- lst.append(t)
+ if '=' in t:
+ lst.append( t.split('=') )
+ else:
+ lst.append( [ t, '' ] )
self.config['apids'].append(lst)
self.config['tpid'] = cells[7]
@@ -212,8 +230,9 @@
def __str__(self):
- return '%s channel: %s (vpid=%s apids=%s)\n' % (self.cfgtype,
-
self.config['name'].ljust(15),
+ return '%s channel: %s [%s] (vpid=%s apids=%s)\n' % (self.cfgtype,
+
self.config['name'].ljust(25),
+
self.config['bouquet'].ljust(25),
self.config['vpid'],
self.config['apids'])
@@ -289,14 +308,15 @@
self.cfgtype = channel.cfgtype
else:
if self.cfgtype is not channel.cfgtype:
- log.warn('Oops: mixed mode config file! Dropping this
line!\nline: %s' % line)
+ if channel.cfgtype != 'COMMENT':
+ log.warn('Oops: mixed mode config file! Dropping this
line!\nline: %s' % line)
channel = None
if channel:
for mplex in self.multiplexlist:
- log.info('added channel %s to mplex %s' %
(channel.config['name'], mplex.name))
added = mplex.add( channel )
if added:
+ log.info('added channel %s to mplex %s' %
(channel.config['name'], mplex.name))
break
else:
mplex = DVBMultiplex( channel.config['frequency'],
channel.config['frequency'], )
@@ -336,8 +356,9 @@
def get_channel(self, key):
for mplex in self.multiplexlist:
- if key in mplex:
+ if key in mplex.keys():
return mplex[key]
+ return None
def __str__(self):
s = 'MULTIPLEX LIST:\n'
@@ -348,5 +369,19 @@
if __name__ == '__main__':
- ccr = DVBChannelConfReader('./dvb.conf')
+ log = logging.getLogger()
+ for l in log.handlers:
+ log.removeHandler(l)
+ formatter = logging.Formatter('%(levelname)s %(module)s'+ \
+ '(%(lineno)s): %(message)s')
+ handler = logging.StreamHandler()
+ handler.setFormatter(formatter)
+ log.addHandler(handler)
+
+ logging.getLogger().setLevel(logging.DEBUG)
+ ccr = DVBChannelConfReader('./dvbs.conf')
print ccr
+ print '---'
+ print ccr.get_channel('n-tv')
+ print ccr.get_channel('n-tv').config
+
Modified: trunk/WIP/record/src/dvbs.conf
==============================================================================
--- trunk/WIP/record/src/dvbs.conf (original)
+++ trunk/WIP/record/src/dvbs.conf Sun Feb 11 12:13:46 2007
@@ -26,10 +26,92 @@
ARD - hr-fernsehen:11836:h:S19.2E:27500:301:302:304:0:28108:0:0:0
ARD - arte:11836:h:S19.2E:27500:401:402,403:404:0:28109:0:0:0
ARD - SR Fernsehen S�dwest:11836:h:S19.2E:27500:501:502:504:0:28110:0:0:0
-Das Erste;ARD:11837:hC34:S19.2E:27500:101:102=deu;106=deu:104:0:28106:1:1101:0
-ZDF;ZDFvision:11954:hC34:S19.2E:27500:110:120=deu,121=2ch;125=dd:130:0:28006:1:1079:0
-SAT.1;ProSiebenSat.1:12480:vC34:S19.2E:27500:1791:1792=deu;1795=deu:34:0:46:133:33:0
-RTL Television,RTL;RTL
World:12188:hC34:S19.2E:27500:163:104=deu;106=deu:105:0:12003:1:1089:0
-ProSieben;ProSiebenSat.1:12480:vC34:S19.2E:27500:255:256=deu;257=deu:32:0:898:133:33:0
-KABEL1;ProSiebenSat.1:12480:vC34:S19.2E:27500:511:512=deu:33:0:899:133:33:0
-RTL2;RTL World:12188:hC34:S19.2E:27500:166:128=deu:68:0:12020:1:1089:0
+# COMMENT
+RTL Television;RTL
World:12187:h:S19.2E:27500:163:104=ger;106=ger:105:0:12003:1:1089:0
+RTL2;RTL World:12187:h:S19.2E:27500:166:128=ger:68:0:12020:1:1089:0
+Super RTL;RTL World:12187:h:S19.2E:27500:165:120=ger:65:0:12040:1:1089:0
+VOX;RTL World:12187:h:S19.2E:27500:167:136=ger:71:0:12060:1:1089:0
+n-tv;RTL World:12187:h:S19.2E:27500:169:73=ger:80:0:12090:1:1089:0
+RTL Shop;RTL World:12187:h:S19.2E:27500:168:137:70:0:12080:1:1089:0
+Traumpartner TV;RTL World:12187:h:S19.2E:27500:170:144=ger:81:0:12095:1:1089:0
+#
+#
+TEST_CSD6;DIGITAL+:10847:v:S19.2E:22000:163:0:0:0:30179:1:1058:0
+TEST_CSD5;DIGITAL+:10847:v:S19.2E:22000:161:84=esl:0:0:30178:1:1058:0
+TEST_CSD4;DIGITAL+:10847:v:S19.2E:22000:161:84=esl:0:0:30177:1:1058:0
+TEST_CSD2;DIGITAL+:10847:v:S19.2E:22000:163:400=esl,239,240:0:0:30175:1:1058:0
+TEST_CSD1;DIGITAL+:10847:v:S19.2E:22000:163:0:0:0:30174:1:1058:0
+PLAYIN'TV;DIGITAL+:10847:v:S19.2E:22000:163:400=esl,254=dos:0:1:30197:1:1058:0
+COMPRA SMS;DIGITAL+:10847:v:S19.2E:22000:163:400=esl,254=dos:0:0:30172:1:1058:0
+[75d9];Digital +:10847:v:S19.2E:22000:163:400=esl,254=dos:0:0:30169:1:1058:0
+ORANGE;DIGITAL+:10847:v:S19.2E:22000:163:400=esl,254=dos:0:0:30166:1:1058:0
+[75d3];Digital +:10847:v:S19.2E:22000:163:400=spa,254=dos:0:0:30163:1:1058:0
+TAQUILLA F<DA>TBOL;DIGITAL+:10847:v:S19.2E:22000:175:0:0:0:30162:1:1058:0
+CARTELERA;DIGITAL+:10847:v:S19.2E:22000:160:0:0:0:30160:1:1058:0
+[75cf];Digital +:10847:v:S19.2E:22000:163:400=esl,254=dos:0:0:30159:1:1058:0
+IBERDROLA;DIGITAL+:10847:v:S19.2E:22000:163:400=esl,254=dos:0:0:30158:1:1058:0
+ONCEplus;DIGITAL+:10847:v:S19.2E:22000:163:400=esl,254=dos:0:0:30156:1:1058:0
+INFOBOLSA;DIGITAL+:10847:v:S19.2E:22000:163:400=esl,254=dos:0:0:30154:1:1058:0
+TIENDAS;DIGITAL+:10847:v:S19.2E:22000:163:400=esl,254=dos:0:0:30151:1:1058:0
+PORTADA;ESCAP:10847:v:S19.2E:22000:161:84=esl:0:0:30150:1:1058:0
+RADIOS
ESP;DIGITAL+:10847:v:S19.2E:22000:0:400=dos,262,257,260,256,258,259,261,268,269,263,267,265,266,264:0:0
+:30104:1:1058:0
+RADIOS;DIGITAL+:10847:v:S19.2E:22000:163:400=dos,262,257,260,256,258,259,261,268,269,263,267,265,266,264:0:0:3
+0102:1:1058:0
+C+ ACCI<D3>N 30;CMA:10817:v:S19.2E:22000:160:80=esl,81=dos:32:1:29950:1:1056:0
+MEZZO;MEZZO:10817:v:S19.2E:22000:4160:4161=fra:0:1:29960:1:1056:0
+SCI FI;DIGITAL +:10817:v:S19.2E:22000:171:124=spa,125=dos:65:1:29958:1:1056:0
+TVE 1;TVE 1:10817:v:S19.2E:22000:170:120=spa,121=dos:0:1:29957:1:1056:0
+TVV INT.;CCV:10817:v:S19.2E:22000:169:116=esl:0:0:29954:1:1056:0
+CANAL COCINA;CACOC:10817:v:S19.2E:22000:168:112=esl:0:1:29953:1:1056:0
+AXN;AXN:10817:v:S19.2E:22000:166:104=esl,105=dos:50:1:29956:1:1056:0
+FOX;FOXGE:10817:v:S19.2E:22000:165:100=esl,101=eng:47:1:29955:1:1056:0
+DCINE ESPA<D1>OL;DCESP:10817:v:S19.2E:22000:167:108=esl:0:1:29952:1:1056:0
+C+ COMEDIA 30;CMADOS:10817:v:S19.2E:22000:161:84=esl,85=dos:35:1:29951:1:1056:0
+TW1;ORF:12662:h:S19.2E:22000:1010:1011=ger:1013:0:13101:1:1115:0
+GoTV;GoTV:12662:h:S19.2E:22000:1020:1021=ger:179:0:13102:1:1115:0
+easy.TV Info;easy.tv:12662:h:S19.2E:22000:1030:1031=ger:1032:0:13103:1:1115:0
+easy.TV Nat Geo;easy.tv:12662:h:S19.2E:22000:1040:1041=ger:0:1:13104:1:1115:0
+easy.TV
Silverline;easy.tv:12662:h:S19.2E:22000:1050:1051=ger:0:1:13105:1:1115:0
+easy.TV AXN;easy.tv:12662:h:S19.2E:22000:1060:1061=ger:0:1:13106:1:1115:0
+easy.TV Extreme;easy.tv:12662:h:S19.2E:22000:1070:1071=ger:0:1:13107:1:1115:0
+easy.TV erofirst;easy.tv:12662:h:S19.2E:22000:1080:1081=ger:0:1:13108:1:1115:0
+NASN;arena:12662:h:S19.2E:22000:1090:1091=ger:0:1:13109:1:1115:0
+OE1;ORF:12662:h:S19.2E:22000:0:421=ger:0:0:13121:1:1115:0
+OE2 W;ORF:12662:h:S19.2E:22000:0:423=ger:0:0:13123:1:1115:0
+OE2 N;ORF:12662:h:S19.2E:22000:0:424=ger:0:0:13124:1:1115:0
+OE2 B;ORF:12662:h:S19.2E:22000:0:425=ger:0:0:13125:1:1115:0
+OE2 O;ORF:12662:h:S19.2E:22000:0:426=ger:0:0:13126:1:1115:0
+OE2 S;ORF:12662:h:S19.2E:22000:0:427=ger:0:0:13127:1:1115:0
+OE2 T;ORF:12662:h:S19.2E:22000:0:428=ger:0:0:13128:1:1115:0
+OE2 V;ORF:12662:h:S19.2E:22000:0:429=ger:0:0:13129:1:1115:0
+OE2 St;ORF:12662:h:S19.2E:22000:0:430=ger:0:0:13130:1:1115:0
+OE2 K;ORF:12662:h:S19.2E:22000:0:431=ger:0:0:13131:1:1115:0
+OE3;ORF:12662:h:S19.2E:22000:0:433=ger:0:0:13133:1:1115:0
+FM4;ORF:12662:h:S19.2E:22000:0:434=ger:0:0:13134:1:1115:0
+<D6>1 International;ORF:12662:h:S19.2E:22000:0:435=ger:0:0:13135:1:1115:0
+RADIO MARIA;Radio Maria
<D6>sterreich:12662:h:S19.2E:22000:0:440=ger:0:0:13140:1:1115:0
+TRUCKRADIO;TRUCKRADIO:12662:h:S19.2E:22000:0:442=ger:0:0:13142:1:1115:0
+Cartoon Network/TCM;UPC
Direct:10920:h:S19.2E:22000:101:110=hun,112=eng:120:1:20341:1:1063:0
+Viasat 3;UPC Direct:10920:h:S19.2E:22000:151:160=hun:0:1:20342:1:1063:0
+Boomerang;UPC
Direct:10920:h:S19.2E:22000:201:210=hun,212=eng,213=pol:220:1:20343:1:1063:0
+Viasat Explorer;UPC
Direct:10920:h:S19.2E:22000:251:260=hun,261=cze,262=eng:270:1:20344:1:1063:0
+Viasat History;UPC
Direct:10920:h:S19.2E:22000:301:310=hun,311=cze,312=eng:320:1:20345:1:1063:0
+STV1;UPC Direct:10920:h:S19.2E:22000:351:364=slo:370:1:20346:1:1063:0
+TA3;UPC Direct:10920:h:S19.2E:22000:401:414=slo:0:1:20347:1:1063:0
+Travel;UPC
Direct:10920:h:S19.2E:22000:451:459=eng,460=hun,461=cze:470:1:20348:1:1063:0
+MGM;UPC
Direct:10920:h:S19.2E:22000:501:510=hun,511=cze,512=eng:0:1:20349:1:1063:0
+BBC Prime;UPC Direct:10920:h:S19.2E:22000:601:612=eng:620:1:20351:1:1063:0
+Radio Gelderland;CANALDIGITAAL
Satelliet:11479:v:S19.2E:22000:0:230:0:0:20846:1:1018:0
+Radio Oost;CANALDIGITAAL
satelliet:11479:v:S19.2E:22000:0:228:0:0:20844:1:1018:0
+Radio Drenthe;CANALDIGITAAL
Satelliet:11479:v:S19.2E:22000:0:226:0:1:20842:1:1018:0
+Radio Noord;CANALDIGITAAL
Satelliet:11479:v:S19.2E:22000:0:224:0:0:20840:1:1018:0
+Omrop Fryslan Radio;CANALDIGITAAL
Satelliet:11479:v:S19.2E:22000:0:222:0:0:20838:1:1018:0
+Radio Noord-Holland;CANALDIGITAAL
Satelliet:11479:v:S19.2E:22000:0:220:0:0:20836:1:1018:0
+Radio Rijnmond;CANALDIGITAAL
Satelliet:11479:v:S19.2E:22000:0:218:0:0:20834:1:1018:0
+Omroep Brabant Televisie;CANALDIGITAAL
Satelliet:11479:v:S19.2E:22000:521+8190:98:50:0:20820:1:1018:0
+Omroep Zeeland Televisie;CANALDIGITAAL
Satelliet:11479:v:S19.2E:22000:520+8190:96:48:0:20818:1:1018:0
+TV Gelderland;CANALDIGITAAL
Satelliet:11479:v:S19.2E:22000:519+8190:94:46:0:20816:1:1018:0
+TV Oost;CANALDIGITAAL
Satelliet:11479:v:S19.2E:22000:518+8190:92:44:0:20814:1:1018:0
+TV Drenthe;CANALDIGITAAL
Satelliet:11479:v:S19.2E:22000:517+8190:90:42:0:20812:1:1018:0
+TV Noord;CANALDIGITAAL
Satelliet:11479:v:S19.2E:22000:516+8190:88:40:0:20810:1:1018:0
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog