2018-12-11 Fred Gleason <fredg@paravelsystems.com>

* Renamed 'apis/PyPAD/examples/pypad_test.py' to
	'apisPyPAD/tests/pad_test.py'.
	* Added a 'hostName' field to the JSON PAD 'padUpdate' object.
	* Added a 'PyPAD.Update::hostName()' method.
	* Added a 'shortHostName' field to the JSON PAD 'padUpdate' object.
	* Added a 'PyPAD.Update::shortHostName()' method.
	* Added a 'PyPAD.Update::resolveFilepath()' method.
	* Added 'apis/PyPAD/tests/filepath_test.py.
	* Added 'api/PyPAD/examples/pypad_filewrite.py'.
This commit is contained in:
Fred Gleason 2018-12-12 13:20:24 -05:00
parent e6b46cca76
commit 0302445c0b
12 changed files with 184 additions and 154 deletions

1
.gitignore vendored
View File

@ -52,6 +52,7 @@ docs/rivwebcapi/*.html
docs/rivwebcapi/*.pdf
helpers/cwrap
helpers/docbook
helpers/install_python.sh
helpers/jsmin
importers/nexgen_filter
importers/panel_copy

View File

@ -18172,3 +18172,5 @@
* Added a 'PyPAD.Update::resolveFilepath()' method.
* Added 'apis/PyPAD/tests/filepath_test.py.
* Added 'api/PyPAD/examples/pypad_filewrite.py'.
2018-12-12 Fred Gleason <fredg@paravelsystems.com>
* Updated the PyPAD classes and scripts to use Python 3.

View File

@ -23,6 +23,10 @@
rivendelldir = $(pyexecdir)
rivendell_PYTHON = PyPAD.py
##install-exec-am:
## ../../../helpers/install_python.sh PyPAD.py $(pyexecdir)/PyPAD.py
##EXTRA_DIST = PyPAD.py
CLEANFILES = *~\
*.idb\
*ilk\

View File

@ -1,5 +1,3 @@
#!/usr/bin/python
# PyPAD.py
#
# PAD processor for Rivendell
@ -129,7 +127,7 @@ class Update(object):
def __replaceWildcard(self,wildcard,sfield,stype,string,esc):
try:
if isinstance(self.__fields['padUpdate'][stype][sfield],unicode):
if isinstance(self.__fields['padUpdate'][stype][sfield],str):
string=string.replace('%'+wildcard,self.escape(self.__fields['padUpdate'][stype][sfield],esc))
else:
string=string.replace('%'+wildcard,str(self.__fields['padUpdate'][stype][sfield]))
@ -687,18 +685,18 @@ class Receiver(object):
"""
sock=socket.socket(socket.AF_INET)
conn=sock.connect((hostname,port))
c=""
line=""
c=bytes()
line=bytes()
msg=""
while 1<2:
c=sock.recv(1)
line+=c
if c[0]=="\n":
msg+=line
if line=="\r\n":
if c[0]==10:
msg+=line.decode('utf-8')
if line.decode('utf-8')=="\r\n":
self.__PyPAD_Process(Update(json.loads(msg)))
msg=""
line=""
line=bytes()

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#%PYTHON_BANGPATH%
# now_and_next.py
#
@ -36,16 +36,16 @@ import PyPAD
#
def ProcessPad(update):
print
print 'Filepath: '+update.resolveFilepath('string %$a',update.dateTime())
print('Filepath: '+update.resolveFilepath('string %$a',update.dateTime()))
if update.hasPadType(PyPAD.TYPE_NOW):
print "Log %03d NOW: " % update.machine()+update.resolvePadFields("%a - %t",PyPAD.ESCAPE_NONE)
print("Log %03d NOW: " % update.machine()+update.resolvePadFields("%a - %t",PyPAD.ESCAPE_NONE))
else:
print "Log %03d NOW: [none]" % update.machine()
print("Log %03d NOW: [none]" % update.machine())
if update.hasPadType(PyPAD.TYPE_NEXT):
print "Log %03d NEXT: " % update.machine()+update.resolvePadFields("%A - %T",PyPAD.ESCAPE_NONE)
print("Log %03d NEXT: " % update.machine()+update.resolvePadFields("%A - %T",PyPAD.ESCAPE_NONE))
else:
print "Log %03d NEXT: [none]" % update.machine()
print("Log %03d NEXT: [none]" % update.machine())
#
# Create an instance of 'PyPADReceiver'

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#%PYTHON_BANGPATH%
# pypad_filewrite.py
#
@ -20,14 +20,12 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#from __future__ import print_function
import sys
import ConfigParser
import configparser
import PyPAD
#def eprint(*args,**kwargs):
# print(*args,file=sys.stderr,**kwargs)
def eprint(*args,**kwargs):
print(*args,file=sys.stderr,**kwargs)
def processUpdate(update,section):
try:
@ -39,7 +37,7 @@ def processUpdate(update,section):
return update.hasPadType(PyPAD.TYPE_NEXT)
if config.get(section,'ProcessNullUpdates')=='3':
return update.hasPadType(PyPAD.TYPE_NOW) and update.hasPadType(PyPAD.TYPE_NEXT)
except ConfigParser.NoOptionError:
except configparser.NoOptionError:
return True
log_dict={1: 'MasterLog',2: 'Aux1Log',3: 'Aux2Log',
@ -66,11 +64,11 @@ def ProcessPad(update):
if config.get(section,'Append')=='1':
mode='a'
f=open(update.resolveFilepath(config.get(section,'Filename'),update.dateTime()),mode)
f.write(update.resolvePadFields(fmtstr,int(config.get(section,'Encoding'))).encode('utf-8'))
f.write(update.resolvePadFields(fmtstr,int(config.get(section,'Encoding'))))
f.close()
n=n+1
except ConfigParser.NoSectionError:
except configparser.NoSectionError:
return
#
@ -78,7 +76,7 @@ def ProcessPad(update):
#
if len(sys.argv)>=2:
fp=open(sys.argv[1])
config=ConfigParser.ConfigParser()
config=configparser.ConfigParser(interpolation=None)
config.readfp(fp)
fp.close()
else:
@ -87,4 +85,4 @@ else:
rcvr=PyPAD.Receiver()
rcvr.setCallback(ProcessPad)
rcvr.start("localhost",PyPAD.PAD_TCP_PORT)
rcvr.start('localhost',PyPAD.PAD_TCP_PORT)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#%PYTHON_BANGPATH%
# pypad_udp.py
#
@ -20,15 +20,13 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#from __future__ import print_function
import sys
import socket
import ConfigParser
import configparser
import PyPAD
#def eprint(*args,**kwargs):
# print(*args,file=sys.stderr,**kwargs)
def eprint(*args,**kwargs):
print(*args,file=sys.stderr,**kwargs)
def processUpdate(update,section):
if config.get(section,'ProcessNullUpdates')=='0':
@ -63,7 +61,7 @@ def ProcessPad(update):
send_sock.sendto(update.resolvePadFields(fmtstr,int(config.get(section,'Encoding'))).encode('utf-8'),
(config.get(section,'IpAddress'),int(config.get(section,'UdpPort'))))
n=n+1
except ConfigParser.NoSectionError:
except configparser.NoSectionError:
return
#
@ -71,7 +69,7 @@ def ProcessPad(update):
#
if len(sys.argv)>=2:
fp=open(sys.argv[1])
config=ConfigParser.ConfigParser()
config=configparser.ConfigParser(interpolation=None)
config.readfp(fp)
fp.close()
else:

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#%PYTHON_BANGPATH%
# filepath_test.py
#
@ -25,40 +25,40 @@
import PyPAD
def ProcessPad(update):
print
print 'DateTime: '+update.dateTime().isoformat(' ')
print
print 'Abbreviated weekday name [%a | %$a | %^a]: '+update.resolveFilepath('%a | %$a | %^a',update.dateTime())
print 'Full weekday name [%A | %$A | %^A]: '+update.resolveFilepath('%A | %$A | %^A',update.dateTime())
print 'Abbreviated month name [%b | %$b | %^b]: '+update.resolveFilepath('%b | %$b | %^b',update.dateTime())
print 'Full month name [%B | %$B | %^B]: '+update.resolveFilepath('%B | %$B | %^B',update.dateTime())
print 'Century [%C | %$C | %^C]: '+update.resolveFilepath('%C | %$C | %^C',update.dateTime())
print 'Day of the month, zero padded [01 - 31] [%d | %$d | %^d]: '+update.resolveFilepath('%d | %$d | %^d',update.dateTime())
print 'Date (mm-dd-yy) [%D | %$D | %^D]: '+update.resolveFilepath('%D | %$D | %^D',update.dateTime())
print 'Day of the month, space padded [ 1 - 31] [%e | %$e | %^e]: '+update.resolveFilepath('%e | %$e | %^e',update.dateTime())
print 'Day of the month, unpadded [ 1 - 31] [%E | %$E | %^E]: '+update.resolveFilepath('%E | %$E | %^E',update.dateTime())
print 'Date (yyyy-mm-dd) [%F | %$F | %^F]: '+update.resolveFilepath('%F | %$F | %^F',update.dateTime())
print 'Two digit year [%g | %$g | %^g]: '+update.resolveFilepath('%g | %$g | %^g',update.dateTime())
print 'Four digit year [%G | %$G | %^G]: '+update.resolveFilepath('%G | %$G | %^G',update.dateTime())
print 'Abbreviated month name [%h | %$h | %^h]: '+update.resolveFilepath('%h | %$h | %^h',update.dateTime())
print 'Hour, 24 hour, zero padded [00 - 23] [%H | %$H | %^H]: '+update.resolveFilepath('%H | %$H | %^H',update.dateTime())
print 'Hour, 12 hour, space padded [00 - 23] [%i | %$i | %^i]: '+update.resolveFilepath('%i | %$i | %^i',update.dateTime())
print 'Hour, 12 hour, zero padded [00 - 23] [%I | %$I | %^I]: '+update.resolveFilepath('%I | %$I | %^I',update.dateTime())
print 'Day of year, zero padded [%j | %$j | %^j]: '+update.resolveFilepath('%j | %$j | %^j',update.dateTime())
print 'Hour, 12 hour, unpadded [00 - 23] [%J | %$J | %^J]: '+update.resolveFilepath('%J | %$J | %^J',update.dateTime())
print 'Hour, 24 hour, space padded [%k | %$k | %^k]: '+update.resolveFilepath('%k | %$k | %^k',update.dateTime())
print 'Month, zero padded (01 - 12) [%m | %$m | %^m]: '+update.resolveFilepath('%m | %$m | %^m',update.dateTime())
print 'Minute, zero padded (00 - 59) [%M | %$M | %^M]: '+update.resolveFilepath('%M | %$M | %^M',update.dateTime())
print 'AM/PM string [%p | %$p | %^p]: '+update.resolveFilepath('%p | %$p | %^p',update.dateTime())
print 'Rivendell host name [%r | %$r | %^r]: '+update.resolveFilepath('%r | %$r | %^r',update.dateTime())
print 'Rivendell short host name [%R | %$R | %^R]: '+update.resolveFilepath('%R | %$R | %^R',update.dateTime())
print 'Rivendell service name [%s | %$s | %^s]: '+update.resolveFilepath('%s | %$s | %^s',update.dateTime())
print 'Seconds, zero padded (SS) [%S | %$S | %^S]: '+update.resolveFilepath('%S | %$S | %^S',update.dateTime())
print 'Day of the week, numeric, 1=Monday, 7=Sunday [%u | %$u | %^u]: '+update.resolveFilepath('%u | %$u | %^u',update.dateTime())
print 'Week number, as per ISO 8601 [00 - 23] [%V | %$V | %^V]: '+update.resolveFilepath('%V | %$V | %^V',update.dateTime())
print 'Two digit year [%y | %$y | %^y]: '+update.resolveFilepath('%y | %$y | %^y',update.dateTime())
print 'Four digit year [00 - 23] [%Y | %$Y | %^Y]: '+update.resolveFilepath('%Y | %$Y | %^Y',update.dateTime())
print "Literal '%' [%%]: "+update.resolveFilepath('%%',update.dateTime())
print()
print('DateTime: '+update.dateTime().isoformat(' '))
print()
print('Abbreviated weekday name [%a | %$a | %^a]: '+update.resolveFilepath('%a | %$a | %^a',update.dateTime()))
print('Full weekday name [%A | %$A | %^A]: '+update.resolveFilepath('%A | %$A | %^A',update.dateTime()))
print('Abbreviated month name [%b | %$b | %^b]: '+update.resolveFilepath('%b | %$b | %^b',update.dateTime()))
print('Full month name [%B | %$B | %^B]: '+update.resolveFilepath('%B | %$B | %^B',update.dateTime()))
print('Century [%C | %$C | %^C]: '+update.resolveFilepath('%C | %$C | %^C',update.dateTime()))
print('Day of the month, zero padded [01 - 31] [%d | %$d | %^d]: '+update.resolveFilepath('%d | %$d | %^d',update.dateTime()))
print('Date (mm-dd-yy) [%D | %$D | %^D]: '+update.resolveFilepath('%D | %$D | %^D',update.dateTime()))
print('Day of the month, space padded [ 1 - 31] [%e | %$e | %^e]: '+update.resolveFilepath('%e | %$e | %^e',update.dateTime()))
print('Day of the month, unpadded [ 1 - 31] [%E | %$E | %^E]: '+update.resolveFilepath('%E | %$E | %^E',update.dateTime()))
print('Date (yyyy-mm-dd) [%F | %$F | %^F]: '+update.resolveFilepath('%F | %$F | %^F',update.dateTime()))
print('Two digit year [%g | %$g | %^g]: '+update.resolveFilepath('%g | %$g | %^g',update.dateTime()))
print('Four digit year [%G | %$G | %^G]: '+update.resolveFilepath('%G | %$G | %^G',update.dateTime()))
print('Abbreviated month name [%h | %$h | %^h]: '+update.resolveFilepath('%h | %$h | %^h',update.dateTime()))
print('Hour, 24 hour, zero padded [00 - 23] [%H | %$H | %^H]: '+update.resolveFilepath('%H | %$H | %^H',update.dateTime()))
print('Hour, 12 hour, space padded [00 - 23] [%i | %$i | %^i]: '+update.resolveFilepath('%i | %$i | %^i',update.dateTime()))
print('Hour, 12 hour, zero padded [00 - 23] [%I | %$I | %^I]: '+update.resolveFilepath('%I | %$I | %^I',update.dateTime()))
print('Day of year, zero padded [%j | %$j | %^j]: '+update.resolveFilepath('%j | %$j | %^j',update.dateTime()))
print('Hour, 12 hour, unpadded [00 - 23] [%J | %$J | %^J]: '+update.resolveFilepath('%J | %$J | %^J',update.dateTime()))
print('Hour, 24 hour, space padded [%k | %$k | %^k]: '+update.resolveFilepath('%k | %$k | %^k',update.dateTime()))
print('Month, zero padded (01 - 12) [%m | %$m | %^m]: '+update.resolveFilepath('%m | %$m | %^m',update.dateTime()))
print('Minute, zero padded (00 - 59) [%M | %$M | %^M]: '+update.resolveFilepath('%M | %$M | %^M',update.dateTime()))
print('AM/PM string [%p | %$p | %^p]: '+update.resolveFilepath('%p | %$p | %^p',update.dateTime()))
print('Rivendell host name [%r | %$r | %^r]: '+update.resolveFilepath('%r | %$r | %^r',update.dateTime()))
print('Rivendell short host name [%R | %$R | %^R]: '+update.resolveFilepath('%R | %$R | %^R',update.dateTime()))
print('Rivendell service name [%s | %$s | %^s]: '+update.resolveFilepath('%s | %$s | %^s',update.dateTime()))
print('Seconds, zero padded (SS) [%S | %$S | %^S]: '+update.resolveFilepath('%S | %$S | %^S',update.dateTime()))
print('Day of the week, numeric, 1=Monday, 7=Sunday [%u | %$u | %^u]: '+update.resolveFilepath('%u | %$u | %^u',update.dateTime()))
print('Week number, as per ISO 8601 [00 - 23] [%V | %$V | %^V]: '+update.resolveFilepath('%V | %$V | %^V',update.dateTime()))
print('Two digit year [%y | %$y | %^y]: '+update.resolveFilepath('%y | %$y | %^y',update.dateTime()))
print('Four digit year [00 - 23] [%Y | %$Y | %^Y]: '+update.resolveFilepath('%Y | %$Y | %^Y',update.dateTime()))
print("Literal '%' [%%]: "+update.resolveFilepath('%%',update.dateTime()))
#
# Create an instance of 'PyPADReceiver'
@ -75,4 +75,4 @@ rcvr.setCallback(ProcessPad)
# the target Rivendell system. Once started, all further processing can only
# be done in the callback method!
#
rcvr.start("localhost",PyPAD.PAD_TCP_PORT)
rcvr.start(localhost',PyPAD.PAD_TCP_PORT)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#%PYTHON_BANGPATH%
# pad_test.py
#
@ -26,108 +26,108 @@ import PyPAD
def ProcessPad(update):
print
print '*** Log %03d Update ***********************************************' % update.machine()
print '** HEADER INFO **'
print ' dateTime(): '+update.dateTime().isoformat(' ')
print ' hostName(): '+update.hostName()
print ' shortHostName(): '+update.shortHostName()
print ' machine(): %d' % update.machine()
print ' mode(): '+update.mode()
print ' onairFlag(): '+str(update.onairFlag())
print('*** Log %03d Update ***********************************************' % update.machine())
print('** HEADER INFO **')
print(' dateTime(): '+update.dateTime().isoformat(' '))
print(' hostName(): '+update.hostName())
print(' shortHostName(): '+update.shortHostName())
print(' machine(): %d' % update.machine())
print( ' mode(): '+update.mode())
print(' onairFlag(): '+str(update.onairFlag()))
print
if update.hasLog():
print '** LOG INFO **'
print ' logName(): '+update.logName()
print
print('** LOG INFO **')
print(' logName(): '+update.logName())
print()
else:
print '**NO LOG INFO PRESENT**'
print
print('**NO LOG INFO PRESENT**')
print()
if update.hasService():
print '** SERVICE INFO **'
print ' serviceName(): '+update.serviceName()
print 'serviceDescription(): '+update.serviceDescription()
print 'serviceProgramCode(): '+update.serviceProgramCode()
print
print('** SERVICE INFO **')
print(' serviceName(): '+update.serviceName())
print('serviceDescription(): '+update.serviceDescription())
print('serviceProgramCode(): '+update.serviceProgramCode())
print()
else:
print '** NO SERVICE INFO PRESENT **'
print
print('** NO SERVICE INFO PRESENT **')
print()
if update.hasPadType(PyPAD.TYPE_NOW):
print '** NOW PLAYING INFO **'
print('** NOW PLAYING INFO **')
try:
print ' startDateTime(): '+update.startDateTime(PyPAD.TYPE_NOW).isoformat(' ')
print(' startDateTime(): '+update.startDateTime(PyPAD.TYPE_NOW).isoformat(' '))
except AttributeError:
print ' startDateTime(): None'
print ' cartType(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CART_TYPE)
print ' cartNumber(): %u / ' % update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CART_NUMBER)+update.resolvePadFields("%n",PyPAD.ESCAPE_NONE)
print ' cutNumber(): %u / ' % update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CUT_NUMBER)+update.resolvePadFields("%j",PyPAD.ESCAPE_NONE)
print ' length(): %u / ' % update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LENGTH)+update.resolvePadFields("%h",PyPAD.ESCAPE_NONE)
print(' startDateTime(): None')
print(' cartType(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CART_TYPE))
print(' cartNumber(): %u / ' % update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CART_NUMBER)+update.resolvePadFields("%n",PyPAD.ESCAPE_NONE))
print(' cutNumber(): %u / ' % update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CUT_NUMBER)+update.resolvePadFields("%j",PyPAD.ESCAPE_NONE))
print(' length(): %u / ' % update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LENGTH)+update.resolvePadFields("%h",PyPAD.ESCAPE_NONE))
try:
print ' year(): %u / ' % update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_YEAR)+update.resolvePadFields("%y",PyPAD.ESCAPE_NONE)
print(' year(): %u / ' % update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_YEAR)+update.resolvePadFields("%y",PyPAD.ESCAPE_NONE))
except TypeError:
print ' year(): None / '+update.resolvePadFields("%Y",PyPAD.ESCAPE_NONE)
print ' groupName(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_GROUP_NAME)+' / '+update.resolvePadFields('%g',PyPAD.ESCAPE_NONE)
print ' title(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_TITLE)+' / '+update.resolvePadFields('%t',PyPAD.ESCAPE_NONE)
print ' artist(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_ARTIST)+' / '+update.resolvePadFields('%a',PyPAD.ESCAPE_NONE)
print ' publisher(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_PUBLISHER)+' / '+update.resolvePadFields('%p',PyPAD.ESCAPE_NONE)
print ' composer(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_COMPOSER)+' / '+update.resolvePadFields('%m',PyPAD.ESCAPE_NONE)
print ' album(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_ALBUM)+' / '+update.resolvePadFields('%l',PyPAD.ESCAPE_NONE)
print ' label(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LABEL)+' / '+update.resolvePadFields('%b',PyPAD.ESCAPE_NONE)
print ' client(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CLIENT)+' / '+update.resolvePadFields('%c',PyPAD.ESCAPE_NONE)
print ' agency(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_AGENCY)+' / '+update.resolvePadFields('%e',PyPAD.ESCAPE_NONE)
print ' conductor(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CONDUCTOR)+' / '+update.resolvePadFields('%r',PyPAD.ESCAPE_NONE)
print ' userDefined(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_USER_DEFINED)+' / '+update.resolvePadFields('%u',PyPAD.ESCAPE_NONE)
print ' songId(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_SONG_ID)+' / '+update.resolvePadFields('%s',PyPAD.ESCAPE_NONE)
print ' outcue(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_OUTCUE)+' / '+update.resolvePadFields('%o',PyPAD.ESCAPE_NONE)
print ' description(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_DESCRIPTION)+' / '+update.resolvePadFields('%i',PyPAD.ESCAPE_NONE)
print ' externalEventId(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_EXTERNAL_EVENT_ID)
print ' externalData(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_EXTERNAL_DATA)
print ' externalAnncType(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_EXTERNAL_EVENT_ID)
print
print(' year(): None / '+update.resolvePadFields("%Y",PyPAD.ESCAPE_NONE))
print(' groupName(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_GROUP_NAME)+' / '+update.resolvePadFields('%g',PyPAD.ESCAPE_NONE))
print(' title(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_TITLE)+' / '+update.resolvePadFields('%t',PyPAD.ESCAPE_NONE))
print(' artist(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_ARTIST)+' / '+update.resolvePadFields('%a',PyPAD.ESCAPE_NONE))
print(' publisher(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_PUBLISHER)+' / '+update.resolvePadFields('%p',PyPAD.ESCAPE_NONE))
print(' composer(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_COMPOSER)+' / '+update.resolvePadFields('%m',PyPAD.ESCAPE_NONE))
print(' album(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_ALBUM)+' / '+update.resolvePadFields('%l',PyPAD.ESCAPE_NONE))
print(' label(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LABEL)+' / '+update.resolvePadFields('%b',PyPAD.ESCAPE_NONE))
print(' client(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CLIENT)+' / '+update.resolvePadFields('%c',PyPAD.ESCAPE_NONE))
print(' agency(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_AGENCY)+' / '+update.resolvePadFields('%e',PyPAD.ESCAPE_NONE))
print(' conductor(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CONDUCTOR)+' / '+update.resolvePadFields('%r',PyPAD.ESCAPE_NONE))
print(' userDefined(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_USER_DEFINED)+' / '+update.resolvePadFields('%u',PyPAD.ESCAPE_NONE))
print(' songId(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_SONG_ID)+' / '+update.resolvePadFields('%s',PyPAD.ESCAPE_NONE))
print(' outcue(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_OUTCUE)+' / '+update.resolvePadFields('%o',PyPAD.ESCAPE_NONE))
print(' description(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_DESCRIPTION)+' / '+update.resolvePadFields('%i',PyPAD.ESCAPE_NONE))
print(' externalEventId(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_EXTERNAL_EVENT_ID))
print(' externalData(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_EXTERNAL_DATA))
print(' externalAnncType(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_EXTERNAL_EVENT_ID))
print()
else:
print '** NO NOW PLAYING INFO **'
print
print('** NO NOW PLAYING INFO **')
print()
if update.hasPadType(PyPAD.TYPE_NEXT):
print '** NEXT PLAYING INFO **'
print('** NEXT PLAYING INFO **')
try:
print ' startDateTime(): '+update.startDateTime(PyPAD.TYPE_NEXT).isoformat(' ')
print(' startDateTime(): '+update.startDateTime(PyPAD.TYPE_NEXT).isoformat(' '))
except AttributeError:
print ' startDateTime(): None'
print ' cartType(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CART_TYPE)
print ' cartNumber(): %u / ' % update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CART_NUMBER)+update.resolvePadFields("%N",PyPAD.ESCAPE_NONE)
print ' cutNumber(): %u / ' % update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CUT_NUMBER)+update.resolvePadFields("%J",PyPAD.ESCAPE_NONE)
print ' length(): %u / ' % update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_LENGTH)+update.resolvePadFields("%H",PyPAD.ESCAPE_NONE)
print(' startDateTime(): None')
print(' cartType(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CART_TYPE))
print(' cartNumber(): %u / ' % update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CART_NUMBER)+update.resolvePadFields("%N",PyPAD.ESCAPE_NONE))
print(' cutNumber(): %u / ' % update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CUT_NUMBER)+update.resolvePadFields("%J",PyPAD.ESCAPE_NONE))
print(' length(): %u / ' % update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_LENGTH)+update.resolvePadFields("%H",PyPAD.ESCAPE_NONE))
try:
print ' year(): %u / ' % update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_YEAR)+update.resolvePadFields("%Y",PyPAD.ESCAPE_NONE)
print(' year(): %u / ' % update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_YEAR)+update.resolvePadFields("%Y",PyPAD.ESCAPE_NONE))
except TypeError:
print ' year(): None / '+update.resolvePadFields("%Y",PyPAD.ESCAPE_NONE)
print ' groupName(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_GROUP_NAME)+' / '+update.resolvePadFields('%G',PyPAD.ESCAPE_NONE)
print ' title(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_TITLE)+' / '+update.resolvePadFields('%T',PyPAD.ESCAPE_NONE)
print ' artist(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_ARTIST)+' / '+update.resolvePadFields('%A',PyPAD.ESCAPE_NONE)
print ' publisher(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_PUBLISHER)+' / '+update.resolvePadFields('%P',PyPAD.ESCAPE_NONE)
print ' composer(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_COMPOSER)+' / '+update.resolvePadFields('%M',PyPAD.ESCAPE_NONE)
print ' album(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_ALBUM)+' / '+update.resolvePadFields('%L',PyPAD.ESCAPE_NONE)
print ' label(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_LABEL)+' / '+update.resolvePadFields('%B',PyPAD.ESCAPE_NONE)
print ' client(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CLIENT)+' / '+update.resolvePadFields('%C',PyPAD.ESCAPE_NONE)
print ' agency(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_AGENCY)+' / '+update.resolvePadFields('%E',PyPAD.ESCAPE_NONE)
print ' conductor(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CONDUCTOR)+' / '+update.resolvePadFields('%R',PyPAD.ESCAPE_NONE)
print ' userDefined(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_USER_DEFINED)+' / '+update.resolvePadFields('%U',PyPAD.ESCAPE_NONE)
print ' songId(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_SONG_ID)+' / '+update.resolvePadFields('%S',PyPAD.ESCAPE_NONE)
print ' outcue(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_OUTCUE)+' / '+update.resolvePadFields('%O',PyPAD.ESCAPE_NONE)
print ' description(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_DESCRIPTION)+' / '+update.resolvePadFields('%I',PyPAD.ESCAPE_NONE)
print ' externalEventId(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_EXTERNAL_EVENT_ID)
print ' externalData(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_EXTERNAL_DATA)
print ' externalAnncType(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_EXTERNAL_EVENT_ID)
print
print(' year(): None / '+update.resolvePadFields("%Y",PyPAD.ESCAPE_NONE))
print(' groupName(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_GROUP_NAME)+' / '+update.resolvePadFields('%G',PyPAD.ESCAPE_NONE))
print(' title(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_TITLE)+' / '+update.resolvePadFields('%T',PyPAD.ESCAPE_NONE))
print(' artist(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_ARTIST)+' / '+update.resolvePadFields('%A',PyPAD.ESCAPE_NONE))
print(' publisher(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_PUBLISHER)+' / '+update.resolvePadFields('%P',PyPAD.ESCAPE_NONE))
print(' composer(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_COMPOSER)+' / '+update.resolvePadFields('%M',PyPAD.ESCAPE_NONE))
print(' album(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_ALBUM)+' / '+update.resolvePadFields('%L',PyPAD.ESCAPE_NONE))
print(' label(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_LABEL)+' / '+update.resolvePadFields('%B',PyPAD.ESCAPE_NONE))
print(' client(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CLIENT)+' / '+update.resolvePadFields('%C',PyPAD.ESCAPE_NONE))
print(' agency(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_AGENCY)+' / '+update.resolvePadFields('%E',PyPAD.ESCAPE_NONE))
print(' conductor(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CONDUCTOR)+' / '+update.resolvePadFields('%R',PyPAD.ESCAPE_NONE))
print(' userDefined(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_USER_DEFINED)+' / '+update.resolvePadFields('%U',PyPAD.ESCAPE_NONE))
print(' songId(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_SONG_ID)+' / '+update.resolvePadFields('%S',PyPAD.ESCAPE_NONE))
print(' outcue(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_OUTCUE)+' / '+update.resolvePadFields('%O',PyPAD.ESCAPE_NONE))
print(' description(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_DESCRIPTION)+' / '+update.resolvePadFields('%I',PyPAD.ESCAPE_NONE))
print(' externalEventId(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_EXTERNAL_EVENT_ID))
print(' externalData(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_EXTERNAL_DATA))
print(' externalAnncType(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_EXTERNAL_EVENT_ID))
print()
else:
print '** NO NEXT PLAYING INFO **'
print
print('** NO NEXT PLAYING INFO **')
print()
print '******************************************************************'
print ('******************************************************************')
#
# Create an instance of 'PyPADReceiver'
@ -144,4 +144,4 @@ rcvr.setCallback(ProcessPad)
# the target Rivendell system. Once started, all further processing can only
# be done in the callback method!
#
rcvr.start("localhost",PyPAD.PAD_TCP_PORT)
rcvr.start('localhost',PyPAD.PAD_TCP_PORT)

View File

@ -250,7 +250,7 @@ AC_CHECK_HEADER(soundtouch/SoundTouch.h,[],[AC_MSG_ERROR([*** SoundTouch not fou
#
# Check for Python
#
AM_PATH_PYTHON([2.7])
AM_PATH_PYTHON([3])
#
# Check for FLAC
@ -466,6 +466,7 @@ AC_CONFIG_FILES([rivendell.spec \
conf/rd-bin.conf \
icons/Makefile \
helpers/Makefile \
helpers/install_python.sh \
apis/Makefile \
apis/PyPAD/Makefile \
apis/PyPAD/api/Makefile \
@ -553,6 +554,8 @@ AC_CONFIG_FILES([rivendell.spec \
])
AC_OUTPUT()
chmod 755 helpers/install_python.sh
#
# Create symlinks in 'utils/rdselect_helper/'
#

View File

@ -33,7 +33,8 @@ dist_cwrap_SOURCES = cwrap.cpp cwrap.h
dist_jsmin_SOURCES = jsmin.c
EXTRA_DIST = rdpack.sh\
EXTRA_DIST = install_python.sh.in\
rdpack.sh\
rdtrans.sh\
rdtransgui.sh\
setenvvar.sh
@ -42,7 +43,8 @@ CLEANFILES = *~\
*.tar.gz\
moc_*
DISTCLEANFILES = docbook
DISTCLEANFILES = docbook\
install_python.sh
MAINTAINERCLEANFILES = *~\
*.tar.gz\

View File

@ -0,0 +1,24 @@
#!/bin/sh
# install_python.sh
#
# (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
cat $1 | sed -e s^%PYTHON_BANGPATH%^@PYTHON@^ > $2
chmod 755 $2