Lircrc builder
From MythTV Official Wiki
Introduction
This is a simple python script I made to convert shorthand lirc config to full config. Remeber this is in beta and may have problems use at your own risk.
Howto
For an example create this file
Then run
# python lrc.py
That will output this
#Generated by: t0ny's lircrc builder begin prog = mythtv button = Play-button repeat = 3 config = p end begin prog = mythtv button = Vol-up repeat = 3 config = F11 end begin prog = mythtv button = Vol-down repeat = 3 config = F10 end begin prog = mplayer button = Play-button repeat = 3 config = p end
Source code
#!/usr/bin/python import sys #By Tony Speer 2007 under GPL v2 #USE AT YOUR OWN RISK! #Version 0.1 Beta #defaults prog = "mythtv" repeat = 3 fn = "lrc.txt" for x,arg in enumerate(sys.argv): if arg == "--file": fn = sys.argv[x + 1] f = open(fn, "r") print "#Generated by: t0ny's lircrc builder\n" for line in f: if "#" in line: #check for comment line = line.split("#")[1] # remove comments line = line.replace("\n", "") if line.startswith("prog"): prog = line.split(" ")[1] elif line.startswith("repeat"): repeat = int(line.split(" ")[1]) else: b = line.split(" ") if len(b) > 1: print """begin prog = %s button = %s repeat = %s config = %s end\n""" % (prog, b[0], repeat, b[1]) f.close()