Merge remote-tracking branch 'upstream/master'

Conflicts:
	ChangeLog
This commit is contained in:
Patrick Linstruth 2019-08-29 10:39:31 -07:00
commit 10d78c1a80
6 changed files with 175 additions and 1 deletions

View File

@ -19037,6 +19037,11 @@
* Fixed a bug in rdlogmanager(1) that caused newly added events * Fixed a bug in rdlogmanager(1) that caused newly added events
to be incorrectly sorted in the event list in the 'Edit Clock' to be incorrectly sorted in the event list in the 'Edit Clock'
dialog. dialog.
2019-08-28 Patrick Linstruth <patrick@deltecent.com>
* Added 'pypad_httpget.py' script.
2019-08-29 Patrick Linstruth <patrick@deltecent.com> 2019-08-29 Patrick Linstruth <patrick@deltecent.com>
* Modified caed(8) to skip JACK startup, rather than crash, if * Modified caed(8) to skip JACK startup, rather than crash, if
no command line is specified in rdadmin(1). no command line is specified in rdadmin(1).
2019-08-28 Fred Gleason <fredg@paravelsystems.com>
* Added the '%l' wildcard (unpadded month 1-12) to the filepath
wildcards.

View File

@ -26,6 +26,8 @@ install-exec-am:
cp pypad_ando.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_ando.exemplar 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 ../../../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 cp pypad_filewrite.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_filewrite.exemplar
../../../helpers/install_python.sh pypad_httpget.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_httpget.py
cp pypad_httpget.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_httpget.exemplar
../../../helpers/install_python.sh pypad_icecast2.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_icecast2.py ../../../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 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 ../../../helpers/install_python.sh pypad_inno713.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_inno713.py
@ -62,6 +64,8 @@ uninstall-local:
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_ando.py 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.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_filewrite.py rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_filewrite.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_httpget.exemplar
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_httpget.py
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/pypad/pypad_icecast2.exemplar 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_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.exemplar
@ -97,6 +101,8 @@ EXTRA_DIST = pypad_ando.exemplar\
pypad_ando.py\ pypad_ando.py\
pypad_filewrite.exemplar\ pypad_filewrite.exemplar\
pypad_filewrite.py\ pypad_filewrite.py\
pypad_httpget.exemplar\
pypad_httpget.py\
pypad_icecast2.exemplar\ pypad_icecast2.exemplar\
pypad_icecast2.py\ pypad_icecast2.py\
pypad_inno713.exemplar\ pypad_inno713.exemplar\

View File

@ -0,0 +1,77 @@
; This is the configuration for the 'pypad_httpget.py' script for
; Rivendell, which can be used to send an HTTP GET transaction.
; Section Header
;
; One section per HTTP GET URL station is configured, starting with
; 'Url1' and working up consecutively
[Url1]
; URL String. The URL to be sent 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.txt'
; file in the Rivendell documentation directory.
;
URL=https://someplace.com/metadata.php?key=somekey&artist=%a&title=%t
; Log Selection
;
; Set the status for each log to 'Yes', 'No' or 'Onair' to indicate whether
; state changes on that log should be output to this station. If set
; to 'Onair', then output will be generated only if RDAirPlays OnAir flag
; is active.
MasterLog=Yes
Aux1Log=Yes
Aux2Log=Yes
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 HTTPS GET URLs can be configured by adding new
; sections...
;
;[Url2]
;URL=https://some.otherplace.com/metadata.php?key=somekey&artist=%a&title=%t
;MasterLog=No
;Aux1Log=Yes
;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

View File

@ -0,0 +1,78 @@
#!%PYTHON_BANGPATH%
# pypad_httpget.py
#
# Write PAD updates to HTTP GET URL
#
# (C) Copyright 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 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 configparser
import pycurl
import pypad
import syslog
from io import BytesIO
def eprint(*args,**kwargs):
print(*args,file=sys.stderr,**kwargs)
def ProcessPad(update):
if update.hasPadType(pypad.TYPE_NOW):
n=1
while(True):
section='Url'+str(n)
try:
url=update.resolvePadFields(update.config().get(section,'URL'),pypad.ESCAPE_URL)
buf=BytesIO()
curl=pycurl.Curl()
curl.setopt(curl.URL,url)
curl.setopt(curl.WRITEDATA,buf)
curl.setopt(curl.FOLLOWLOCATION,True)
except configparser.NoSectionError:
if(n==1):
update.syslog(syslog.LOG_WARNING,'No httpget config found')
return
if update.shouldBeProcessed(section):
try:
curl.perform()
code=curl.getinfo(pycurl.RESPONSE_CODE)
if (code<200) or (code>=300):
update.syslog(syslog.LOG_WARNING,'['+section+'] returned response code '+str(code))
else:
update.syslog(syslog.LOG_NOTICE,'['+section+'] successful')
except pycurl.error:
update.syslog(syslog.LOG_WARNING,'['+section+'] failed: '+curl.errstr())
update.syslog(syslog.LOG_WARNING,'['+section+'] URL: '+url)
curl.close()
n=n+1
#
# 'Main' function
#
rcvr=pypad.Receiver()
try:
rcvr.setConfigFile(sys.argv[3])
except IndexError:
eprint('pypad_httpget.py: USAGE: cmd <hostname> <port> <config>')
sys.exit(1)
rcvr.setPadCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))

View File

@ -239,7 +239,7 @@
<term><userinput>l</userinput></term> <term><userinput>l</userinput></term>
<listitem> <listitem>
<para> <para>
[unassigned] Month, unpadded (1-12)
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -114,6 +114,10 @@ QString RDDateDecode(QString str,const QDate &date,RDStation *station,
field=QString().sprintf("%03d",date.dayOfYear()); field=QString().sprintf("%03d",date.dayOfYear());
break; break;
case 'l': // Unpadded Month (1 - 12)
field=QString().sprintf("%d",date.month());
break;
case 'm': // Month (01 - 12) case 'm': // Month (01 - 12)
field=QString().sprintf("%02d",date.month()); field=QString().sprintf("%02d",date.month());
break; break;
@ -292,6 +296,10 @@ QString RDDateTimeDecode(QString str,const QDateTime &datetime,
field=QString().sprintf("%2d",datetime.time().hour()); field=QString().sprintf("%2d",datetime.time().hour());
break; break;
case 'l': // Unpadded Month (1 - 12)
field=QString().sprintf("%d",datetime.date().month());
break;
case 'M': // Minute, zero padded case 'M': // Minute, zero padded
field=QString().sprintf("%02d",datetime.time().minute()); field=QString().sprintf("%02d",datetime.time().minute());
break; break;