This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import binascii | |
import struct | |
def pronto2lirc(pronto): | |
codes = [long(binascii.hexlify(pronto[i:i+2]), 16) for i in xrange(0, len(pronto), 2)] | |
if codes[0]: | |
raise ValueError('Pronto code should start with 0000') | |
if len(codes) != 4 + 2 * (codes[2] + codes[3]): | |
raise ValueError('Number of pulse widths does not match the preamble') |