2019-08-26 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in the 'pypad_liqcomp.py' PyPAD script that caused
	an infinite loop.
This commit is contained in:
Fred Gleason 2019-08-27 17:51:35 -04:00
parent 533b760cd1
commit 42c91a7cfd
2 changed files with 17 additions and 16 deletions

View File

@ -18991,3 +18991,6 @@
* Fixed a bug in rdadmin(1) that allowed more than one PyPAD
instance to be selected at a time in the 'List PyPAD Instances'
dialog.
2019-08-26 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in the 'pypad_liqcomp.py' PyPAD script that caused
an infinite loop.

View File

@ -37,23 +37,21 @@ def ProcessPad(update):
last_updates[update.machine()]=None
n=1
while(True):
section='System'+str(n)
while(update.config().has_section(section)):
if update.shouldBeProcessed(section) and update.hasPadType(pypad.TYPE_NOW) and (last_updates[update.machine()] != update.startDateTimeString(pypad.TYPE_NOW)):
last_updates[update.machine()]=update.startDateTimeString(pypad.TYPE_NOW)
title=update.resolvePadFields(update.config().get(section,'Title'),pypad.ESCAPE_NONE)
artist=update.resolvePadFields(update.config().get(section,'Artist'),pypad.ESCAPE_NONE)
album=update.resolvePadFields(update.config().get(section,'Album'),pypad.ESCAPE_NONE)
label=update.resolvePadFields(update.config().get(section,'Label'),pypad.ESCAPE_NONE)
secs=update.padField(pypad.TYPE_NOW,pypad.FIELD_LENGTH)
group=update.padField(pypad.TYPE_NOW,pypad.FIELD_GROUP_NAME)
msg='|'+title+'|'+artist+'|'+str(update.padField(pypad.TYPE_NOW,pypad.FIELD_CART_NUMBER))+'|'+str(secs)+'|'+group+'|'+album+'|'+label+'|\n'
send_sock.sendto(msg.encode('utf-8'),
(update.config().get(section,'IpAddress'),int(update.config().get(section,'UdpPort'))))
n=n+1
section='System'+str(n)
try:
if update.shouldBeProcessed(section) and update.hasPadType(pypad.TYPE_NOW) and (last_updates[update.machine()] != update.startDateTimeString(pypad.TYPE_NOW)):
last_updates[update.machine()]=update.startDateTimeString(pypad.TYPE_NOW)
title=update.resolvePadFields(update.config().get(section,'Title'),pypad.ESCAPE_NONE)
artist=update.resolvePadFields(update.config().get(section,'Artist'),pypad.ESCAPE_NONE)
album=update.resolvePadFields(update.config().get(section,'Album'),pypad.ESCAPE_NONE)
label=update.resolvePadFields(update.config().get(section,'Label'),pypad.ESCAPE_NONE)
secs=update.padField(pypad.TYPE_NOW,pypad.FIELD_LENGTH)
group=update.padField(pypad.TYPE_NOW,pypad.FIELD_GROUP_NAME)
msg='|'+title+'|'+artist+'|'+str(update.padField(pypad.TYPE_NOW,pypad.FIELD_CART_NUMBER))+'|'+str(secs)+'|'+group+'|'+album+'|'+label+'|\n'
send_sock.sendto(msg.encode('utf-8'),
(update.config().get(section,'IpAddress'),int(update.config().get(section,'UdpPort'))))
n=n+1
except configparser.NoSectionError:
return
#
# 'Main' function