From 42c91a7cfdb3491ccde222b313233aab735f52f8 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 27 Aug 2019 17:51:35 -0400 Subject: [PATCH] 2019-08-26 Fred Gleason * Fixed a bug in the 'pypad_liqcomp.py' PyPAD script that caused an infinite loop. --- ChangeLog | 3 +++ apis/pypad/scripts/pypad_liqcomp.py | 30 ++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index dfc178b2..d56f3858 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 + * Fixed a bug in the 'pypad_liqcomp.py' PyPAD script that caused + an infinite loop. diff --git a/apis/pypad/scripts/pypad_liqcomp.py b/apis/pypad/scripts/pypad_liqcomp.py index 33ef4328..6e0f1825 100755 --- a/apis/pypad/scripts/pypad_liqcomp.py +++ b/apis/pypad/scripts/pypad_liqcomp.py @@ -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