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

* Added a 'pypad_walltime.py' PyPAD script.
	* Removed the 'rlm_walltime' RLM.
This commit is contained in:
Fred Gleason 2018-12-18 16:31:38 -05:00
parent 86716a1041
commit 441ecd3880
5 changed files with 168 additions and 3 deletions

View File

@ -18228,3 +18228,6 @@
2018-12-18 Fred Gleason <fredg@paravelsystems.com>
* Added a 'pypad_urlwrite.py' PyPAD script.
* Removed the 'rlm_urlwrite' RLM.
2018-12-18 Fred Gleason <fredg@paravelsystems.com>
* Added a 'pypad_walltime.py' PyPAD script.
* Removed the 'rlm_walltime' RLM.

View File

@ -28,6 +28,8 @@ install-exec-am:
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
uninstall-local:
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_filewrite.exemplar
@ -36,13 +38,17 @@ uninstall-local:
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
EXTRA_DIST = pypad_filewrite.exemplar\
pypad_filewrite.py\
pypad_udp.exemplar\
pypad_udp.py\
pypad_urlwrite.exemplar\
pypad_urlwrite.py
pypad_urlwrite.py\
pypad_walltime.exemplar\
pypad_walltime.py
CLEANFILES = *~\
*.idb\

View File

@ -0,0 +1,89 @@
; This is the configuration for the 'pypad_walltime.py' script for
; Rivendell, which can be used to output Now & Next data to one or more
; Walltime clocks.
; Section Header
;
; One section per WallTime unit is configured, starting with 'Walltime1' and
; working up consecutively
[Walltime1]
; IP Address
;
; The IP address of the Walltime clock, in dotted-quad notation.
IpAddress=192.168.21.100
; Password
;
; The password to use when sending HTML updates.
Password=crackme
; Format String. The template for the HTML sent to the Walltime web display
; each time RDAirPlay changes play state, including any wildcards as
; placeholders for metadata values.
;
; The list of available wildcards can be found in the 'Metadata Wildcards'
; appendix in the Rivendell Operations Guide.
;
FormatString=<body bgcolor="#000000"><table cellspacing="2" cellpadding="2" border="0"><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr><tr><td><font size="6" color="white">%t</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><font size="5" color="red">%a</font><td></tr></table></body>
; Log Selection
;
; Set the status for each log to 'Yes', 'No' or 'Onair' to indicate whether
; state changes on that log should be output on this udp port. If set
; to 'Onair', then output will be generated only if RDAirPlays OnAir flag
; is active.
;
MasterLog=Yes
Aux1Log=No
Aux2Log=No
VLog101=No
VLog102=No
VLog103=No
VLog104=No
VLog105=No
VLog106=No
VLog107=No
VLog108=No
VLog109=No
VLog110=No
VLog111=No
VLog112=No
VLog113=No
VLog114=No
VLog115=No
VLog116=No
VLog117=No
VLog118=No
VLog119=No
VLog120=No
; Additional WallTime units can be configured by adding new sections...
;[Walltime2]
;FormatString=Artist: %a
;IpAddress=192.168.10.22
;UdpPort=6060
;MasterLog=Yes
;Aux1Log=No
;Aux2Log=Onair
;VLog101=No
;VLog102=No
;VLog103=No
;VLog104=No
;VLog105=No
;VLog106=No
;VLog107=No
;VLog108=No
;VLog109=No
;VLog110=No
;VLog111=No
;VLog112=No
;VLog113=No
;VLog114=No
;VLog115=No
;VLog116=No
;VLog117=No
;VLog118=No
;VLog119=No
;VLog120=No

View File

@ -0,0 +1,69 @@
#!%PYTHON_BANGPATH%
# pypad_walltime.py
#
# Write PAD updates a WallTime text widget.
#
# (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 sys
import syslog
import configparser
import pycurl
import PyPAD
from io import BytesIO
def eprint(*args,**kwargs):
print(*args,file=sys.stderr,**kwargs)
def ProcessPad(update):
n=1
try:
while(True):
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'))
curl=pycurl.Curl()
curl.setopt(curl.URL,'http://'+update.config().get(section,'IpAddress')+'/webwidget');
curl.setopt(curl.USERNAME,'user')
curl.setopt(curl.PASSWORD,update.config().get(section,'Password'))
curl.setopt(curl.UPLOAD,True)
curl.setopt(curl.READDATA,buf)
try:
curl.perform()
except pycurl.error:
syslog.syslog(syslog.LOG_WARNING,'['+section+'] failed: '+curl.errstr())
curl.close()
n=n+1
except configparser.NoSectionError:
return
#
# 'Main' function
#
syslog.openlog(sys.argv[0].split('/')[-1])
rcvr=PyPAD.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_walltime.py: you must specify a configuration file')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -33,7 +33,6 @@ RLM_MODULES=rlm_ando.rlm\
rlm_spottrap.rlm\
rlm_test.rlm\
rlm_tunein.rlm\
rlm_walltime.rlm\
rlm_xds.rlm\
rlm_xmpad.rlm
@ -68,7 +67,6 @@ EXTRA_DIST = Makefile-example\
rlm_spottrap.c\
rlm_test.c\
rlm_tunein.c\
rlm_walltime.c\
rlm_xds.c\
rlm_xmpad.c