From: Rob S. <rs...@us...> - 2005-12-19 22:12:38
|
Author: rshortt Date: Mon Dec 19 22:12:35 2005 New Revision: 1002 Added: trunk/record/test/vdr2urlconf (contents, props changed) Log: -This will create a chanels.conf for url0 based on a VDR channels.conf with URLs for vdr-streamdev. Added: trunk/record/test/vdr2urlconf ============================================================================== --- (empty file) +++ trunk/record/test/vdr2urlconf Mon Dec 19 22:12:35 2005 @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +import os +import sys +from time import strftime, localtime + +if len(sys.argv) < 2: + print 'usage: vdr2urlconf </path/to/vdr/channels.conf>' + sys.exit(0) + +vdrconf = sys.argv[1] +channels = [] +base_url = 'http://localhost:3080/PS/' + +if not os.path.exists(vdrconf): + print '%s does not exist' % vdrconf + sys.exit(0) + +vdrfile = open(vdrconf, 'r') +for line in vdrfile.readlines(): + good = line.split('#', 1)[0].rstrip('\n') + if good.count(':') < 12: continue + channels.append(good) + +vdrfile.close() + + +print '##' +print '## Generated by vdr2urlconf on %s.' % strftime("%a, %d %b %Y %H:%M:%S %Z", localtime()) +print '## Format is:' +print '## name:id:bouquet:url' +print '##\n' + +for chan in channels: + c = chan.split(':', 12) + if c[12] == 0: + id = c[9] + else: + id = c[12] + + print '%s:%s:%s-%s:%s%s' % (c[0].split(';', 1)[0], id, c[3], c[11], base_url, id) |