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

* Changed the PyPAD namespace from 'PyPAD' to 'pypad'.
	* Changed the installation location of PyPAD scripts from
	'@libdir@/rivendell/PyPAD/' to '@libdir@/rivendell/pypad/'.
This commit is contained in:
Fred Gleason 2019-01-08 15:27:44 -05:00
parent 31596cbaca
commit 087f3b811b
46 changed files with 425 additions and 425 deletions

View File

@ -18306,7 +18306,7 @@
2019-01-07 Fred Gleason <fredg@paravelsystems.com>
* Added a 'pypad_shoutcast1.py' PyPAD script.
* Removed the 'rlm_shoutcast1' RLM.
2019-01-07 Fred Gleason <fredg@paravelsystems.com>
2019-01-08 Fred Gleason <fredg@paravelsystems.com>
* Removed 'apis/rlm/'.
* Removed the 'Edit Now & Next' button from the 'Configure RDAirPlay'
dialog in rdadmin(1).
@ -18320,3 +18320,7 @@
* Incremented the database version to 305.
2019-01-08 Fred Gleason <fredg@paravelsystems.com>
* Added a 'rivendell-pypad' RPM subpackage.
2019-01-08 Fred Gleason <fredg@paravelsystems.com>
* Changed the PyPAD namespace from 'PyPAD' to 'pypad'.
* Changed the installation location of PyPAD scripts from
'@libdir@/rivendell/PyPAD/' to '@libdir@/rivendell/pypad/'.

View File

@ -20,7 +20,7 @@
##
## Use automake to process this into a Makefile.in
SUBDIRS = PyPAD\
SUBDIRS = pypad\
rivwebcapi
CLEANFILES = *~\

View File

@ -1,151 +0,0 @@
#!%PYTHON_BANGPATH%
# pad_test.py
#
# PyPAD regression test script for Rivendell
#
# Exercise every PAD accessor method of 'PyPAD.Update' for each update.
#
# (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.
#
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
if update.hasLog():
print('** LOG INFO **')
print(' logName(): '+update.logName())
print()
else:
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()
else:
print('** NO SERVICE INFO PRESENT **')
print()
if update.hasPadType(PyPAD.TYPE_NOW):
print('** NOW PLAYING INFO **')
try:
print(' startDateTime(): '+update.startDateTime(PyPAD.TYPE_NOW).isoformat(' '))
except AttributeError:
print(' startDateTime(): None')
print(' lineNumber(): '+str(update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LINE_NUMBER))+'/'+update.resolvePadFields('%z',PyPAD.ESCAPE_NONE))
print(' lineId(): '+str(update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LINE_ID))+'/'+update.resolvePadFields('%x',PyPAD.ESCAPE_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))
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()
else:
print('** NO NOW PLAYING INFO **')
print()
if update.hasPadType(PyPAD.TYPE_NEXT):
print('** NEXT PLAYING INFO **')
try:
print(' startDateTime(): '+update.startDateTime(PyPAD.TYPE_NEXT).isoformat(' '))
except AttributeError:
print(' startDateTime(): None')
print(' lineNumber(): '+str(update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_LINE_NUMBER))+'/'+update.resolvePadFields('%Z',PyPAD.ESCAPE_NONE))
print(' lineId(): '+str(update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_LINE_ID))+'/'+update.resolvePadFields('%X',PyPAD.ESCAPE_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))
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()
else:
print('** NO NEXT PLAYING INFO **')
print()
print ('******************************************************************')
#
# Create an instance of 'PyPADReceiver'
#
rcvr=PyPAD.Receiver()
#
# Tell it to use the callback
#
rcvr.setCallback(ProcessPad)
#
# Start the receiver, giving it the hostname or IP address and TCP port of
# the target Rivendell system. Once started, all further processing can only
# be done in the callback method!
#
rcvr.start('localhost',PyPAD.PAD_TCP_PORT)

View File

@ -1,8 +1,8 @@
## automake.am
## Makefile.am
##
## Automake.am for Rivendell PyPAD/api
## Makefile.am for Rivendell pypad/api
##
## (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
## (C) Copyright 2018-2019 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 as
@ -21,11 +21,7 @@
## Use automake to process this into a Makefile.in
rivendelldir = $(pyexecdir)
rivendell_PYTHON = PyPAD.py
##install-exec-am:
## ../../../helpers/install_python.sh PyPAD.py $(pyexecdir)/PyPAD.py
##EXTRA_DIST = PyPAD.py
rivendell_PYTHON = pypad.py
CLEANFILES = *~\
*.idb\

View File

@ -1,4 +1,4 @@
# PyPAD.py
# pypad.py
#
# PAD processor for Rivendell
#
@ -234,7 +234,7 @@ class Update(object):
def config(self):
"""
If a valid configuration file was set in
'PyPAD.Receiver::setConfigFile()', this will return a
'pypad.Receiver::setConfigFile()', this will return a
parserconfig object created from it. If no configuration file
was specified, returns None.
"""
@ -262,12 +262,12 @@ class Update(object):
esc - The type of escaping to be applied. The following values
are valid:
PyPAD.ESCAPE_JSON - Escape for use in JSON string values
pypad.ESCAPE_JSON - Escape for use in JSON string values
(as per ECMA-404)
PyPAD.ESCAPE_NONE - String is passed through unchanged
PyPAD.ESCAPE_URL - Escape for use in URLs
pypad.ESCAPE_NONE - String is passed through unchanged
pypad.ESCAPE_URL - Escape for use in URLs
(as per RFC 2396)
PyPAD.ESCAPE_XML - Escape for use in XML
pypad.ESCAPE_XML - Escape for use in XML
(as per XML-v1.0)
"""
if(esc==0):
@ -418,8 +418,8 @@ class Update(object):
Takes one argument:
pad_type - The type of PAD value. Valid values are:
PyPAD.TYPE_NOW - Now playing data
PyPAD.TYPE_NEXT - Next to play data
pypad.TYPE_NOW - Now playing data
pypad.TYPE_NEXT - Next to play data
"""
try:
return self.__fields['padUpdate'][pad_type]!=None
@ -434,8 +434,8 @@ class Update(object):
Takes one argument:
pad_type - The type of PAD value. Valid values are:
PyPAD.TYPE_NOW - Now playing data
PyPAD.TYPE_NEXT - Next to play data
pypad.TYPE_NOW - Now playing data
pypad.TYPE_NEXT - Next to play data
"""
return self.__fields['padUpdate'][pad_type]['startDateTime']
@ -446,8 +446,8 @@ class Update(object):
Takes one argument:
pad_type - The type of PAD value. Valid values are:
PyPAD.TYPE_NOW - Now playing data
PyPAD.TYPE_NEXT - Next to play data
pypad.TYPE_NOW - Now playing data
pypad.TYPE_NEXT - Next to play data
"""
try:
return self.__fromIso8601(self.__fields['padUpdate'][pad_type]['startDateTime'])
@ -461,44 +461,44 @@ class Update(object):
Takes two arguments:
pad_type - The type of PAD value. Valid values are:
PyPAD.TYPE_NOW - Now playing data
PyPAD.TYPE_NEXT - Next to play data
pypad.TYPE_NOW - Now playing data
pypad.TYPE_NEXT - Next to play data
pad_field - The specific field. Valid values are:
PyPAD.FIELD_AGENCY - The 'Agency' field (string)
PyPAD.FIELD_ALBUM - The 'Album' field (string)
PyPAD.FIELD_ARTIST - The 'Artist' field (string)
PyPAD.FIELD_CART_NUMBER - The 'Cart Number' field
pypad.FIELD_AGENCY - The 'Agency' field (string)
pypad.FIELD_ALBUM - The 'Album' field (string)
pypad.FIELD_ARTIST - The 'Artist' field (string)
pypad.FIELD_CART_NUMBER - The 'Cart Number' field
(integer)
PyPAD.FIELD_CART_TYPE - 'The 'Cart Type' field (string)
PyPAD.FIELD_CLIENT - The 'Client' field (string)
PyPAD.FIELD_COMPOSER - The 'Composer' field (string)
PyPAD.FIELD_CONDUCTOR - The 'Conductor' field (string)
PyPAD.FIELD_CUT_NUMER - The 'Cut Number' field (integer)
PyPAD.FIELD_DESCRIPTION - The 'Description' field
pypad.FIELD_CART_TYPE - 'The 'Cart Type' field (string)
pypad.FIELD_CLIENT - The 'Client' field (string)
pypad.FIELD_COMPOSER - The 'Composer' field (string)
pypad.FIELD_CONDUCTOR - The 'Conductor' field (string)
pypad.FIELD_CUT_NUMER - The 'Cut Number' field (integer)
pypad.FIELD_DESCRIPTION - The 'Description' field
(string)
PyPAD.FIELD_EXTERNAL_ANNC_TYPE - The 'EXT_ANNC_TYPE'
pypad.FIELD_EXTERNAL_ANNC_TYPE - The 'EXT_ANNC_TYPE'
field (string)
PyPAD.FIELD_EXTERNAL_DATA - The 'EXT_DATA' field
pypad.FIELD_EXTERNAL_DATA - The 'EXT_DATA' field
(string)
PyPAD.FIELD_EXTERNAL_EVENT_ID - The 'EXT_EVENT_ID'
pypad.FIELD_EXTERNAL_EVENT_ID - The 'EXT_EVENT_ID'
field (string)
PyPAD.FIELD_GROUP_NAME - The 'GROUP_NAME' field (string)
PyPAD.FIELD_ISRC - The 'ISRC' field (string)
PyPAD.FIELD_ISCI - The 'ISCI' field (string)
PyPAD.FIELD_LABEL - The 'Label' field (string)
PyPAD.FIELD_LENGTH - The 'Length' field (integer)
PyPAD.FIELD_LINE_ID - The log line ID (integer)
PyPAD.FIELD_LINE_NUMBER - The log line number (integer)
PyPAD.FIELD_OUTCUE - The 'Outcue' field (string)
PyPAD.FIELD_PUBLISHER - The 'Publisher' field (string)
PyPAD.FIELD_SONG_ID - The 'Song ID' field (string)
PyPAD.FIELD_START_DATETIME - The 'Start DateTime field
pypad.FIELD_GROUP_NAME - The 'GROUP_NAME' field (string)
pypad.FIELD_ISRC - The 'ISRC' field (string)
pypad.FIELD_ISCI - The 'ISCI' field (string)
pypad.FIELD_LABEL - The 'Label' field (string)
pypad.FIELD_LENGTH - The 'Length' field (integer)
pypad.FIELD_LINE_ID - The log line ID (integer)
pypad.FIELD_LINE_NUMBER - The log line number (integer)
pypad.FIELD_OUTCUE - The 'Outcue' field (string)
pypad.FIELD_PUBLISHER - The 'Publisher' field (string)
pypad.FIELD_SONG_ID - The 'Song ID' field (string)
pypad.FIELD_START_DATETIME - The 'Start DateTime field
(string)
PyPAD.FIELD_TITLE - The 'Title' field (string)
PyPAD.FIELD_USER_DEFINED - 'The 'User Defined' field
pypad.FIELD_TITLE - The 'Title' field (string)
pypad.FIELD_USER_DEFINED - 'The 'User Defined' field
(string)
PyPAD.FIELD_YEAR - The 'Year' field (integer)
pypad.FIELD_YEAR - The 'Year' field (integer)
"""
return self.__fields['padUpdate'][pad_type][pad_field]
@ -709,11 +709,11 @@ class Update(object):
if self.__config.get(section,'ProcessNullUpdates')=='0':
return True
if self.__config.get(section,'ProcessNullUpdates')=='1':
return self.hasPadType(PyPAD.TYPE_NOW)
return self.hasPadType(pypad.TYPE_NOW)
if self.__config.get(section,'ProcessNullUpdates')=='2':
return self.hasPadType(PyPAD.TYPE_NEXT)
return self.hasPadType(pypad.TYPE_NEXT)
if self.__config.get(section,'ProcessNullUpdates')=='3':
return self.hasPadType(PyPAD.TYPE_NOW) and self.hasPadType(PyPAD.TYPE_NEXT)
return self.hasPadType(pypad.TYPE_NOW) and self.hasPadType(pypad.TYPE_NEXT)
except configparser.NoOptionError:
return True
@ -740,10 +740,10 @@ class Receiver(object):
self.__timer_interval=None
self.__config_parser=None
def __PyPAD_Process(self,pad):
def __pypad_Process(self,pad):
self.__callback(pad)
def __PyPAD_TimerProcess(self,config):
def __pypad_TimerProcess(self,config):
self.__timer_callback(config)
def __getDbCredentials(self):
@ -781,7 +781,7 @@ class Receiver(object):
def setConfigFile(self,filename):
"""
Set a file whence to get configuration information. If set,
the 'PyPAD.Update::config()' method will return a parserconfig
the 'pypad.Update::config()' method will return a parserconfig
object created from the specified file. The file must be in INI
format.
@ -816,7 +816,7 @@ class Receiver(object):
def start(self,hostname,port):
"""
Connect to a Rivendell system and begin processing PAD events.
Once started, a PyPAD object can be interacted with
Once started, a pypad object can be interacted with
only within its callback method.
Takes the following arguments:
@ -824,7 +824,7 @@ class Receiver(object):
hostname - The hostname or IP address of the Rivendell system.
port - The TCP port to connect to. For most cases, just use
'PyPAD.PAD_TCP_PORT'.
'pypad.PAD_TCP_PORT'.
"""
# So we exit cleanly when shutdown by rdpadengined(8)
signal.signal(signal.SIGTERM,SigHandler)
@ -847,7 +847,7 @@ class Receiver(object):
if now>=deadline:
timeout=self.__timer_interval
deadline=now+datetime.timedelta(seconds=timeout)
self.__PyPAD_TimerProcess(self.__config_parser)
self.__pypad_TimerProcess(self.__config_parser)
else:
timeout=(deadline-now).total_seconds()
else:
@ -856,7 +856,7 @@ class Receiver(object):
if c[0]==10:
msg+=line.decode('utf-8')
if line.decode('utf-8')=="\r\n":
self.__PyPAD_Process(Update(json.loads(msg),self.__config_parser))
self.__pypad_Process(Update(json.loads(msg),self.__config_parser))
msg=""
line=bytes()
if self.__timer_interval!=None:

View File

@ -1,6 +1,6 @@
## automake.am
## makefile.am
##
## Automake.am for Rivendell PyPAD/examples
## Makefile.am for Rivendell pypad/examples
##
## (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
##
@ -21,73 +21,73 @@
## Use automake to process this into a Makefile.in
install-exec-am:
mkdir -p $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD
../../../helpers/install_python.sh pypad_ando.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_ando.py
cp pypad_ando.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_ando.exemplar
../../../helpers/install_python.sh pypad_filewrite.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_filewrite.py
cp pypad_filewrite.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_filewrite.exemplar
../../../helpers/install_python.sh pypad_icecast2.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_icecast2.py
cp pypad_icecast2.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_icecast2.exemplar
../../../helpers/install_python.sh pypad_inno713.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_inno713.py
cp pypad_inno713.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_inno713.exemplar
../../../helpers/install_python.sh pypad_live365.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_live365.py
cp pypad_live365.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_live365.exemplar
../../../helpers/install_python.sh pypad_liqcomp.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_liqcomp.py
cp pypad_liqcomp.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_liqcomp.exemplar
../../../helpers/install_python.sh pypad_serial.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_serial.py
cp pypad_serial.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_serial.exemplar
../../../helpers/install_python.sh pypad_shoutcast1.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_shoutcast1.py
cp pypad_shoutcast1.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_shoutcast1.exemplar
../../../helpers/install_python.sh pypad_spinitron.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_spinitron.py
cp pypad_spinitron.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_spinitron.exemplar
../../../helpers/install_python.sh pypad_spottrap.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_spottrap.py
cp pypad_spottrap.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_spottrap.exemplar
../../../helpers/install_python.sh pypad_tunein.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_tunein.py
cp pypad_tunein.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_tunein.exemplar
../../../helpers/install_python.sh pypad_udp.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_udp.py
cp pypad_udp.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_udp.exemplar
../../../helpers/install_python.sh pypad_urlwrite.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_urlwrite.py
cp pypad_urlwrite.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_urlwrite.exemplar
../../../helpers/install_python.sh pypad_walltime.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_walltime.py
cp pypad_walltime.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_walltime.exemplar
../../../helpers/install_python.sh pypad_xds.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_xds.py
cp pypad_xds.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_xds.exemplar
../../../helpers/install_python.sh pypad_xmpad.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_xmpad.py
cp pypad_xmpad.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_xmpad.exemplar
mkdir -p $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad
../../../helpers/install_python.sh pypad_ando.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_ando.py
cp pypad_ando.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_ando.exemplar
../../../helpers/install_python.sh pypad_filewrite.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_filewrite.py
cp pypad_filewrite.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_filewrite.exemplar
../../../helpers/install_python.sh pypad_icecast2.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_icecast2.py
cp pypad_icecast2.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_icecast2.exemplar
../../../helpers/install_python.sh pypad_inno713.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_inno713.py
cp pypad_inno713.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_inno713.exemplar
../../../helpers/install_python.sh pypad_live365.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_live365.py
cp pypad_live365.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_live365.exemplar
../../../helpers/install_python.sh pypad_liqcomp.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_liqcomp.py
cp pypad_liqcomp.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_liqcomp.exemplar
../../../helpers/install_python.sh pypad_serial.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_serial.py
cp pypad_serial.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_serial.exemplar
../../../helpers/install_python.sh pypad_shoutcast1.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_shoutcast1.py
cp pypad_shoutcast1.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_shoutcast1.exemplar
../../../helpers/install_python.sh pypad_spinitron.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_spinitron.py
cp pypad_spinitron.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_spinitron.exemplar
../../../helpers/install_python.sh pypad_spottrap.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_spottrap.py
cp pypad_spottrap.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_spottrap.exemplar
../../../helpers/install_python.sh pypad_tunein.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_tunein.py
cp pypad_tunein.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_tunein.exemplar
../../../helpers/install_python.sh pypad_udp.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_udp.py
cp pypad_udp.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_udp.exemplar
../../../helpers/install_python.sh pypad_urlwrite.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_urlwrite.py
cp pypad_urlwrite.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_urlwrite.exemplar
../../../helpers/install_python.sh pypad_walltime.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_walltime.py
cp pypad_walltime.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_walltime.exemplar
../../../helpers/install_python.sh pypad_xds.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_xds.py
cp pypad_xds.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_xds.exemplar
../../../helpers/install_python.sh pypad_xmpad.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_xmpad.py
cp pypad_xmpad.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_xmpad.exemplar
uninstall-local:
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_ando.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_ando.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_filewrite.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_filewrite.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_icecast2.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_icecast2.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_inno713.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_inno713.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_live365.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_live365.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_liqcomp.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_liqcomp.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_serial.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_serial.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_shoutcast1.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_shoutcast1.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_spinitron.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_spinitron.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_spottrap.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_spottrap.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_tunein.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_tunein.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_udp.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_udp.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_urlwrite.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_urlwrite.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_walltime.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_walltime.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_xds.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_xds.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_xmpad.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_xmpad.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_ando.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_ando.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_filewrite.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_filewrite.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_icecast2.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_icecast2.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_inno713.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_inno713.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_live365.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_live365.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_liqcomp.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_liqcomp.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_serial.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_serial.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_shoutcast1.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_shoutcast1.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_spinitron.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_spinitron.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_spottrap.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_spottrap.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_tunein.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_tunein.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_udp.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_udp.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_urlwrite.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_urlwrite.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_walltime.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_walltime.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_xds.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_xds.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_xmpad.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_xmpad.py
EXTRA_DIST = pypad_ando.exemplar\
pypad_ando.py\

View File

@ -23,7 +23,7 @@
import sys
import socket
import configparser
import PyPAD
import pypad
last_updates={}
@ -51,19 +51,19 @@ def ProcessPad(update):
while(True):
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)
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)
duration=('%02d:' % (secs//60000))+('%02d' % ((secs%60000)//1000))
group=update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_GROUP_NAME)
group=update.padField(pypad.TYPE_NOW,pypad.FIELD_GROUP_NAME)
if update.config().get(section,'Label')=='':
msg='^'+artist+'~'+title+'~'+duration+'~'+group+'~'+album+'~'+str(update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CART_NUMBER))+'|'
msg='^'+artist+'~'+title+'~'+duration+'~'+group+'~'+album+'~'+str(update.padField(pypad.TYPE_NOW,pypad.FIELD_CART_NUMBER))+'|'
else:
msg='^'+artist+'~'+title+'~'+duration+'~'+group+'~'+str(update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CART_NUMBER))+'~'+album+'~'+label+'|'
msg='^'+artist+'~'+title+'~'+duration+'~'+group+'~'+str(update.padField(pypad.TYPE_NOW,pypad.FIELD_CART_NUMBER))+'~'+album+'~'+label+'|'
send_sock.sendto(msg.encode('utf-8'),
(update.config().get(section,'IpAddress'),int(update.config().get(section,'UdpPort'))))
n=n+1
@ -77,11 +77,11 @@ def ProcessPad(update):
#
send_sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_ando.py: you must specify a configuration file')
eprint('pypad_ando.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.setTimerCallback(30,ProcessTimer)

View File

@ -22,7 +22,7 @@
import sys
import configparser
import PyPAD
import pypad
def eprint(*args,**kwargs):
print(*args,file=sys.stderr,**kwargs)
@ -48,11 +48,11 @@ def ProcessPad(update):
#
# 'Main' function
#
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_filewrite.py: you must specify a configuration file')
eprint('pypad_filewrite.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -27,7 +27,7 @@ import requests
from requests.auth import HTTPBasicAuth
import xml.etree.ElementTree as ET
import syslog
import PyPAD
import pypad
import configparser
def eprint(*args,**kwargs):
@ -45,14 +45,14 @@ def isTrue(string):
return string.lower() in map(str.lower,l)
def ProcessPad(update):
if update.hasPadType(PyPAD.TYPE_NOW):
if update.hasPadType(pypad.TYPE_NOW):
n=1
while(True):
section='Icecast'+str(n)
try:
values={}
values['mount']=update.config().get(section,'Mountpoint')
values['song']=update.resolvePadFields(update.config().get(section,'FormatString'),PyPAD.ESCAPE_NONE)
values['song']=update.resolvePadFields(update.config().get(section,'FormatString'),pypad.ESCAPE_NONE)
values['mode']='updinfo'
iprint('Updating '+update.config().get(section,'Hostname')+': song='+values['song'])
url="http://%s:%s/admin/metadata" % (update.config().get(section,'Hostname'),update.config().get(section,'Tcpport'))
@ -86,11 +86,11 @@ send_sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
#
# Start Receiver
#
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('You must specify a configuration file')
eprint('pypad_icecast2: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
iprint('Started')

View File

@ -24,7 +24,7 @@ import sys
import socket
import configparser
import serial
import PyPAD
import pypad
def eprint(*args,**kwargs):
print(*args,file=sys.stderr,**kwargs)
@ -35,16 +35,16 @@ def ProcessPad(update):
while(True):
section='Rds'+str(n)
try:
if update.shouldBeProcessed(section) and update.hasPadType(PyPAD.TYPE_NOW):
if update.shouldBeProcessed(section) and update.hasPadType(pypad.TYPE_NOW):
dps=''
if(len(update.config().get(section,'DynamicPsString'))!=0):
dps='DPS='+update.resolvePadFields(update.config().get(section,'DynamicPsString'),PyPAD.ESCAPE_NONE)+'\r\n'
dps='DPS='+update.resolvePadFields(update.config().get(section,'DynamicPsString'),pypad.ESCAPE_NONE)+'\r\n'
ps=''
if(len(update.config().get(section,'PsString'))!=0):
ps='PS='+update.resolvePadFields(update.config().get(section,'PsString'),PyPAD.ESCAPE_NONE)+'\r\n'
ps='PS='+update.resolvePadFields(update.config().get(section,'PsString'),pypad.ESCAPE_NONE)+'\r\n'
text=''
if(len(update.config().get(section,'RadiotextString'))!=0):
text='TEXT='+update.resolvePadFields(update.config().get(section,'RadiotextString'),PyPAD.ESCAPE_NONE)+'\r\n'
text='TEXT='+update.resolvePadFields(update.config().get(section,'RadiotextString'),pypad.ESCAPE_NONE)+'\r\n'
try:
#
# Use serial output
@ -89,11 +89,11 @@ def ProcessPad(update):
#
send_sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_inno713.py: you must specify a configuration file')
eprint('pypad_inno713.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -23,7 +23,7 @@
import sys
import socket
import configparser
import PyPAD
import pypad
last_updates={}
@ -40,15 +40,15 @@ def ProcessPad(update):
while(True):
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'
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
@ -62,11 +62,11 @@ def ProcessPad(update):
#
send_sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_liqcomp.py: you must specify a configuration file')
eprint('pypad_liqcomp.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -24,7 +24,7 @@ import sys
import syslog
import configparser
import pycurl
import PyPAD
import pypad
from io import BytesIO
def eprint(*args,**kwargs):
@ -35,13 +35,13 @@ def ProcessPad(update):
try:
while(True):
section='Station'+str(n)
if update.shouldBeProcessed(section) and update.hasPadType(PyPAD.TYPE_NOW):
member=update.escape(update.config().get(section,'MemberName'),PyPAD.ESCAPE_URL)
password=update.escape(update.config().get(section,'Password'),PyPAD.ESCAPE_URL)
title=update.resolvePadFields(update.config().get(section,'TitleString'),PyPAD.ESCAPE_URL)
artist=update.resolvePadFields(update.config().get(section,'ArtistString'),PyPAD.ESCAPE_URL)
album=update.resolvePadFields(update.config().get(section,'AlbumString'),PyPAD.ESCAPE_URL)
seconds=str(update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LENGTH)//1000)
if update.shouldBeProcessed(section) and update.hasPadType(pypad.TYPE_NOW):
member=update.escape(update.config().get(section,'MemberName'),pypad.ESCAPE_URL)
password=update.escape(update.config().get(section,'Password'),pypad.ESCAPE_URL)
title=update.resolvePadFields(update.config().get(section,'TitleString'),pypad.ESCAPE_URL)
artist=update.resolvePadFields(update.config().get(section,'ArtistString'),pypad.ESCAPE_URL)
album=update.resolvePadFields(update.config().get(section,'AlbumString'),pypad.ESCAPE_URL)
seconds=str(update.padField(pypad.TYPE_NOW,pypad.FIELD_LENGTH)//1000)
buf=BytesIO()
curl=pycurl.Curl()
url='http://www.live365.com/cgi-bin/add_song.cgi?member_name='+member+'&password='+password+'&version=2&filename=Rivendell&seconds='+seconds+'&title='+title+'&artist='+artist+'&album='+album
@ -66,11 +66,11 @@ def ProcessPad(update):
#
syslog.openlog(sys.argv[0].split('/')[-1])
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_live365.py: you must specify a configuration file')
eprint('pypad_live365.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -23,7 +23,7 @@
import sys
import syslog
import configparser
import PyPAD
import pypad
import serial
from io import BytesIO
@ -59,11 +59,11 @@ def ProcessPad(update):
#
syslog.openlog(sys.argv[0].split('/')[-1])
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_serial.py: you must specify a configuration file')
eprint('pypad_serial.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -24,7 +24,7 @@ import sys
import syslog
import configparser
import pycurl
import PyPAD
import pypad
from io import BytesIO
last_updates={}
@ -42,10 +42,10 @@ def ProcessPad(update):
try:
while(True):
section='Shoutcast'+str(n)
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)
song=update.resolvePadFields(update.config().get(section,'FormatString'),PyPAD.ESCAPE_URL)
url='http://'+update.config().get(section,'Hostname')+':'+str(update.config().get(section,'Tcpport'))+'/admin.cgi?pass='+update.escape(update.config().get(section,'Password'),PyPAD.ESCAPE_URL)+'&mode=updinfo&song='+song
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)
song=update.resolvePadFields(update.config().get(section,'FormatString'),pypad.ESCAPE_URL)
url='http://'+update.config().get(section,'Hostname')+':'+str(update.config().get(section,'Tcpport'))+'/admin.cgi?pass='+update.escape(update.config().get(section,'Password'),pypad.ESCAPE_URL)+'&mode=updinfo&song='+song
curl=pycurl.Curl()
curl.setopt(curl.URL,url)
headers=[]
@ -73,11 +73,11 @@ def ProcessPad(update):
#
syslog.openlog(sys.argv[0].split('/')[-1])
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_shoutcast1.py: you must specify a configuration file')
eprint('pypad_shoutcast1.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -24,7 +24,7 @@ import sys
import syslog
import configparser
import pycurl
import PyPAD
import pypad
from io import BytesIO
last_updates={}
@ -36,7 +36,7 @@ def JsonField(update,tag,value,is_last=False):
if (value==None) or (value==''):
ret=' "'+tag+'": null'
else:
ret=' "'+tag+'": "'+update.escape(value,PyPAD.ESCAPE_JSON)+'"'
ret=' "'+tag+'": "'+update.escape(value,pypad.ESCAPE_JSON)+'"'
if not is_last:
ret+=','
return ret+'\r\n'
@ -51,15 +51,15 @@ def ProcessPad(update):
try:
while(True):
section='Spinitron'+str(n)
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_JSON)
artist=update.resolvePadFields(update.config().get(section,'Artist'),PyPAD.ESCAPE_JSON)
album=update.resolvePadFields(update.config().get(section,'Album'),PyPAD.ESCAPE_JSON)
label=update.resolvePadFields(update.config().get(section,'Label'),PyPAD.ESCAPE_JSON)
composer=update.resolvePadFields(update.config().get(section,'Composer'),PyPAD.ESCAPE_JSON)
conductor=update.resolvePadFields(update.config().get(section,'Conductor'),PyPAD.ESCAPE_JSON)
notes=update.resolvePadFields(update.config().get(section,'Notes'),PyPAD.ESCAPE_JSON)
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_JSON)
artist=update.resolvePadFields(update.config().get(section,'Artist'),pypad.ESCAPE_JSON)
album=update.resolvePadFields(update.config().get(section,'Album'),pypad.ESCAPE_JSON)
label=update.resolvePadFields(update.config().get(section,'Label'),pypad.ESCAPE_JSON)
composer=update.resolvePadFields(update.config().get(section,'Composer'),pypad.ESCAPE_JSON)
conductor=update.resolvePadFields(update.config().get(section,'Conductor'),pypad.ESCAPE_JSON)
notes=update.resolvePadFields(update.config().get(section,'Notes'),pypad.ESCAPE_JSON)
json='{\r\n'
pmode=update.config().get(section,'PlaylistMode')
@ -72,8 +72,8 @@ def ProcessPad(update):
json+=' "live": false,\r\n'
else:
json+=' "live": true,\r\n'
duration=str(update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LENGTH)//1000)
year=update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_YEAR)
duration=str(update.padField(pypad.TYPE_NOW,pypad.FIELD_LENGTH)//1000)
year=update.padField(pypad.TYPE_NOW,pypad.FIELD_YEAR)
if year==None:
json+=' "released": null,\r\n'
else:
@ -86,7 +86,7 @@ def ProcessPad(update):
json+=JsonField(update,'composer',composer)
json+=JsonField(update,'conductor',conductor)
json+=JsonField(update,'note',notes)
json+=JsonField(update,'isrc',update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_ISRC),True)
json+=JsonField(update,'isrc',update.padField(pypad.TYPE_NOW,pypad.FIELD_ISRC),True)
json+='}\r\n'
send_buf=BytesIO(json.encode('utf-8'))
recv_buf=BytesIO()
@ -118,11 +118,11 @@ def ProcessPad(update):
#
syslog.openlog(sys.argv[0].split('/')[-1])
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_spinitron.py: you must specify a configuration file')
eprint('pypad_spinitron.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -23,7 +23,7 @@
import sys
import socket
import configparser
import PyPAD
import pypad
last_updates={}
@ -41,13 +41,13 @@ def ProcessPad(update):
while(True):
section='Rule'+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)
length=update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LENGTH)
if update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_GROUP_NAME)==update.config().get(section,'GroupName') and length>=int(update.config().get(section,'MinimumLength')) and length<=int(update.config().get(section,'MaximumLength')):
msg=update.resolvePadFields(update.config().get(section,'FormatString'),PyPAD.ESCAPE_NONE)
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)
length=update.padField(pypad.TYPE_NOW,pypad.FIELD_LENGTH)
if update.padField(pypad.TYPE_NOW,pypad.FIELD_GROUP_NAME)==update.config().get(section,'GroupName') and length>=int(update.config().get(section,'MinimumLength')) and length<=int(update.config().get(section,'MaximumLength')):
msg=update.resolvePadFields(update.config().get(section,'FormatString'),pypad.ESCAPE_NONE)
else:
msg=update.resolvePadFields(update.config().get(section,'DefaultFormatString'),PyPAD.ESCAPE_NONE)
msg=update.resolvePadFields(update.config().get(section,'DefaultFormatString'),pypad.ESCAPE_NONE)
send_sock.sendto(msg.encode('utf-8'),
(update.config().get(section,'IpAddress'),int(update.config().get(section,'UdpPort'))))
n=n+1
@ -61,11 +61,11 @@ def ProcessPad(update):
#
send_sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_spottrap.py: you must specify a configuration file')
eprint('pypad_spottrap.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -26,7 +26,7 @@ import socket
import requests
import xml.etree.ElementTree as ET
import syslog
import PyPAD
import pypad
import configparser
def eprint(*args,**kwargs):
@ -44,7 +44,7 @@ def isTrue(string):
return string.lower() in map(str.lower,l)
def ProcessPad(update):
if update.hasPadType(PyPAD.TYPE_NOW):
if update.hasPadType(pypad.TYPE_NOW):
n=1
while(True):
section='Station'+str(n)
@ -53,9 +53,9 @@ def ProcessPad(update):
values['id']=update.config().get(section,'StationID')
values['partnerId']=update.config().get(section,'PartnerID')
values['partnerKey']=update.config().get(section,'PartnerKey')
values['title']=update.resolvePadFields(update.config().get(section,'TitleString'),PyPAD.ESCAPE_NONE)
values['artist']=update.resolvePadFields(update.config().get(section,'ArtistString'),PyPAD.ESCAPE_NONE)
values['album']=update.resolvePadFields(update.config().get(section,'AlbumString'),PyPAD.ESCAPE_NONE)
values['title']=update.resolvePadFields(update.config().get(section,'TitleString'),pypad.ESCAPE_NONE)
values['artist']=update.resolvePadFields(update.config().get(section,'ArtistString'),pypad.ESCAPE_NONE)
values['album']=update.resolvePadFields(update.config().get(section,'AlbumString'),pypad.ESCAPE_NONE)
iprint('Updating TuneIn: artist='+values['artist']+' title='+values['title']+' album='+values['album'])
try:
response=requests.get('http://air.radiotime.com/Playing.ashx',params=values)
@ -92,11 +92,11 @@ send_sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
#
# Start Receiver
#
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('You must specify a configuration file')
eprint('pypad_tunein.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
iprint('Started')

View File

@ -23,7 +23,7 @@
import sys
import socket
import configparser
import PyPAD
import pypad
def eprint(*args,**kwargs):
print(*args,file=sys.stderr,**kwargs)
@ -48,11 +48,11 @@ def ProcessPad(update):
#
send_sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_udp.py: you must specify a configuration file')
eprint('pypad_udp.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -24,7 +24,7 @@ import sys
import syslog
import configparser
import pycurl
import PyPAD
import pypad
from io import BytesIO
def eprint(*args,**kwargs):
@ -59,11 +59,11 @@ def ProcessPad(update):
#
syslog.openlog(sys.argv[0].split('/')[-1])
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_urlwrite.py: you must specify a configuration file')
eprint('pypad_urlwrite.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -24,7 +24,7 @@ import sys
import syslog
import configparser
import pycurl
import PyPAD
import pypad
from io import BytesIO
def eprint(*args,**kwargs):
@ -37,7 +37,7 @@ def ProcessPad(update):
section='Walltime'+str(n)
if update.shouldBeProcessed(section):
fmtstr=update.config().get(section,'FormatString')
buf=BytesIO(update.resolvePadFields(fmtstr,PyPAD.ESCAPE_NONE).encode('utf-8'))
buf=BytesIO(update.resolvePadFields(fmtstr,pypad.ESCAPE_NONE).encode('utf-8'))
curl=pycurl.Curl()
curl.setopt(curl.URL,'http://'+update.config().get(section,'IpAddress')+'/webwidget');
curl.setopt(curl.USERNAME,'user')
@ -59,11 +59,11 @@ def ProcessPad(update):
#
syslog.openlog(sys.argv[0].split('/')[-1])
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_walltime.py: you must specify a configuration file')
eprint('pypad_walltime.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -24,7 +24,7 @@ import sys
import socket
import configparser
import serial
import PyPAD
import pypad
def eprint(*args,**kwargs):
print(*args,file=sys.stderr,**kwargs)
@ -64,8 +64,8 @@ def ProcessPad(update):
while(True):
section='Udp'+str(n)
try:
if update.shouldBeProcessed(section) and update.hasPadType(PyPAD.TYPE_NOW):
packet='0:'+update.serviceProgramCode()+':'+update.config().get(section,'IsciPrefix')+FilterField(update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_EXTERNAL_EVENT_ID))+':*'
if update.shouldBeProcessed(section) and update.hasPadType(pypad.TYPE_NOW):
packet='0:'+update.serviceProgramCode()+':'+update.config().get(section,'IsciPrefix')+FilterField(update.padField(pypad.TYPE_NOW,pypad.FIELD_EXTERNAL_EVENT_ID))+':*'
try:
#
# Use serial output
@ -94,11 +94,11 @@ def ProcessPad(update):
#
send_sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_udp.py: you must specify a configuration file')
eprint('pypad_xds.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -24,7 +24,7 @@ import sys
import syslog
import configparser
import serial
import PyPAD
import pypad
XMPAD_DELIMITER='\02'
# XMPAD_DELIMITER='\x7c' #(|)
@ -39,7 +39,7 @@ def MakeA4(update,section):
a4+=XMPAD_DELIMITER+'1'
field1=update.resolvePadFields(update.config().get(section,'FormatString1'),
PyPAD.ESCAPE_NONE)
pypad.ESCAPE_NONE)
a4+=XMPAD_DELIMITER+field1[0:16]
a4+='\n'
@ -52,7 +52,7 @@ def MakeA5(update,section):
a5+=XMPAD_DELIMITER+'1'
field2=update.resolvePadFields(update.config().get(section,'FormatString2'),
PyPAD.ESCAPE_NONE)
pypad.ESCAPE_NONE)
a5+=XMPAD_DELIMITER+field2[0:16]
a5+='\n'
@ -76,7 +76,7 @@ def MakeB4(update,section):
#
# Event duration
#
b4+=XMPAD_DELIMITER+str(update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LENGTH)//432)
b4+=XMPAD_DELIMITER+str(update.padField(pypad.TYPE_NOW,pypad.FIELD_LENGTH)//432)
b4+=XMPAD_DELIMITER+'0'
@ -101,9 +101,9 @@ def MakeB4(update,section):
# Display field values
#
field1=update.resolvePadFields(update.config().get(section,'FormatString1'),
PyPAD.ESCAPE_NONE)
pypad.ESCAPE_NONE)
field2=update.resolvePadFields(update.config().get(section,'FormatString2'),
PyPAD.ESCAPE_NONE)
pypad.ESCAPE_NONE)
b4+=XMPAD_DELIMITER+field2[0:16]
b4+=XMPAD_DELIMITER+mask1
b4+=XMPAD_DELIMITER+mask2
@ -152,7 +152,7 @@ def ProcessPad(update):
try:
while(True):
section='Serial'+str(n)
if update.shouldBeProcessed(section) and update.hasPadType(PyPAD.TYPE_NOW):
if update.shouldBeProcessed(section) and update.hasPadType(pypad.TYPE_NOW):
dev=OpenSerialDevice(update.config(),section)
b4=MakeB4(update,section)
a4=MakeA4(update,section)
@ -173,11 +173,11 @@ def ProcessPad(update):
#
syslog.openlog(sys.argv[0].split('/')[-1])
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_xmpad.py: you must specify a configuration file')
eprint('pypad_xmpad.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.setTimerCallback(30,ProcessTimer)

View File

@ -1,6 +1,6 @@
## automake.am
##
## Automake.am for Rivendell PyPAD/tests
## Automake.am for Rivendell pypad/tests
##
## (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
##

View File

@ -2,9 +2,9 @@
# filepath_test.py
#
# PyPAD regression test script for Rivendell
# pypad regression test script for Rivendell
#
# Exercise every filepath wildcard in 'PyPAD.Update::resolveFilepath()'
# Exercise every filepath wildcard in 'pypad.Update::resolveFilepath()'
#
# (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
#
@ -22,7 +22,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
import PyPAD
import pypad
def ProcessPad(update):
print()
@ -61,9 +61,9 @@ def ProcessPad(update):
print("Literal '%' [%%]: "+update.resolveFilepath('%%',update.dateTime()))
#
# Create an instance of 'PyPADReceiver'
# Create an instance of 'pypad.Receiver'
#
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
#
# Tell it to use the callback
@ -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

@ -2,7 +2,7 @@
# now_and_next.py
#
# Barebones example PyPAD script for Rivendell
# Barebones example pypad script for Rivendell
#
# (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
#
@ -24,37 +24,37 @@
# To see the full documentation of these classes, enter the following at
# a python interactive prompt:
#
# import PyPAD
# help(PyPAD)
# import pypad
# help(pypad)
#
import PyPAD
import pypad
#
# First, we create a callback method, that will be called every time a
# log machine updates its PAD. An instance of 'PyPAD.Update' that contains
# log machine updates its PAD. An instance of 'pypad.Update' that contains
# the PAD information is supplied as the single argument.
#
def ProcessPad(update):
print()
if update.hasPadType(PyPAD.TYPE_NOW):
if update.hasPadType(pypad.TYPE_NOW):
msg='%03d:' % update.machine()
msg+='%04d ' % update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LINE_NUMBER)
msg+='NOW: '+update.resolvePadFields('%a - %t',PyPAD.ESCAPE_NONE)
msg+='%04d ' % update.padField(pypad.TYPE_NOW,pypad.FIELD_LINE_NUMBER)
msg+='NOW: '+update.resolvePadFields('%a - %t',pypad.ESCAPE_NONE)
print(msg)
else:
print("%03d:xxxx NOW: [none]" % update.machine())
if update.hasPadType(PyPAD.TYPE_NEXT):
if update.hasPadType(pypad.TYPE_NEXT):
msg='%03d:' % update.machine()
msg+='%04d ' % update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_LINE_NUMBER)
msg+='NEXT: '+update.resolvePadFields('%A - %T',PyPAD.ESCAPE_NONE)
msg+='%04d ' % update.padField(pypad.TYPE_NEXT,pypad.FIELD_LINE_NUMBER)
msg+='NEXT: '+update.resolvePadFields('%A - %T',pypad.ESCAPE_NONE)
print(msg)
else:
print("%03d:xxxx NEXT: [none]" % update.machine())
#
# Create an instance of 'PyPADReceiver'
# Create an instance of 'pypadReceiver'
#
rcvr=PyPAD.Receiver()
rcvr=pypad.Receiver()
#
# Tell it to use the callback
@ -66,4 +66,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)

151
apis/pypad/tests/pad_test.py Executable file
View File

@ -0,0 +1,151 @@
#!%PYTHON_BANGPATH%
# pad_test.py
#
# pypad regression test script for Rivendell
#
# Exercise every PAD accessor method of 'pypad.Update' for each update.
#
# (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.
#
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
if update.hasLog():
print('** LOG INFO **')
print(' logName(): '+update.logName())
print()
else:
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()
else:
print('** NO SERVICE INFO PRESENT **')
print()
if update.hasPadType(pypad.TYPE_NOW):
print('** NOW PLAYING INFO **')
try:
print(' startDateTime(): '+update.startDateTime(pypad.TYPE_NOW).isoformat(' '))
except AttributeError:
print(' startDateTime(): None')
print(' lineNumber(): '+str(update.padField(pypad.TYPE_NOW,pypad.FIELD_LINE_NUMBER))+'/'+update.resolvePadFields('%z',pypad.ESCAPE_NONE))
print(' lineId(): '+str(update.padField(pypad.TYPE_NOW,pypad.FIELD_LINE_ID))+'/'+update.resolvePadFields('%x',pypad.ESCAPE_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))
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()
else:
print('** NO NOW PLAYING INFO **')
print()
if update.hasPadType(pypad.TYPE_NEXT):
print('** NEXT PLAYING INFO **')
try:
print(' startDateTime(): '+update.startDateTime(pypad.TYPE_NEXT).isoformat(' '))
except AttributeError:
print(' startDateTime(): None')
print(' lineNumber(): '+str(update.padField(pypad.TYPE_NEXT,pypad.FIELD_LINE_NUMBER))+'/'+update.resolvePadFields('%Z',pypad.ESCAPE_NONE))
print(' lineId(): '+str(update.padField(pypad.TYPE_NEXT,pypad.FIELD_LINE_ID))+'/'+update.resolvePadFields('%X',pypad.ESCAPE_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))
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()
else:
print('** NO NEXT PLAYING INFO **')
print()
print ('******************************************************************')
#
# Create an instance of 'pypad.Receiver'
#
rcvr=pypad.Receiver()
#
# Tell it to use the callback
#
rcvr.setCallback(ProcessPad)
#
# Start the receiver, giving it the hostname or IP address and TCP port of
# the target Rivendell system. Once started, all further processing can only
# be done in the callback method!
#
rcvr.start('localhost',pypad.PAD_TCP_PORT)

View File

@ -468,10 +468,10 @@ AC_CONFIG_FILES([rivendell.spec \
helpers/Makefile \
helpers/install_python.sh \
apis/Makefile \
apis/PyPAD/Makefile \
apis/PyPAD/api/Makefile \
apis/PyPAD/scripts/Makefile \
apis/PyPAD/tests/Makefile \
apis/pypad/Makefile \
apis/pypad/api/Makefile \
apis/pypad/scripts/Makefile \
apis/pypad/tests/Makefile \
apis/rivwebcapi/Makefile \
apis/rivwebcapi/rivwebcapi.pc \
apis/rivwebcapi/rivwebcapi/Makefile \

View File

@ -48,7 +48,7 @@ extern "C" {
* PyPAD
*/
#define RD_PYPAD_PYTHON_PATH "@PYTHON@"
#define RD_PYPAD_SCRIPT_DIR "@libdir@/rivendell/PyPAD"
#define RD_PYPAD_SCRIPT_DIR "@libdir@/rivendell/pypad"
#endif // RDPATHS_H

View File

@ -155,7 +155,7 @@ cp scripts/rd_restore_system.sh $RPM_BUILD_ROOT/@DOC_PATH@/scripts/
cp scripts/engine_conv.py $RPM_BUILD_ROOT/@DOC_PATH@
cp scripts/init_template_host.py $RPM_BUILD_ROOT/@DOC_PATH@
rm -f $RPM_BUILD_ROOT/etc/auto.rd.audiostore
rm -rf $RPM_BUILD_ROOT%{_libdir}/rivendell/PyPAD/__pycache__
rm -rf $RPM_BUILD_ROOT%{_libdir}/rivendell/pypad/__pycache__
rm -rf $RPM_BUILD_ROOT%{_libdir}/python3.4/site-packages/__pycache__
%post
@ -482,9 +482,9 @@ rm -rf $RPM_BUILD_ROOT
%files pypad
%{_libdir}/rivendell/PyPAD/*
%{_libdir}/python3.4/site-packages/PyPAD*
%{_libdir}/python3.4/site-packages/__pycache__/PyPAD*
%{_libdir}/rivendell/pypad/*
%{_libdir}/python3.4/site-packages/pypad*
%{_libdir}/python3.4/site-packages/__pycache__/pypad*
%files select