mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-06-06 15:12:42 +02:00
2018-12-18 Fred Gleason <fredg@paravelsystems.com>
* Added a 'pypad_urlwrite.py' PyPAD script. * Removed the 'rlm_urlwrite' RLM.
This commit is contained in:
parent
22f878eaae
commit
86716a1041
@ -18225,3 +18225,6 @@
|
|||||||
* Deleted the 'rlm_tagstation' RLM.
|
* Deleted the 'rlm_tagstation' RLM.
|
||||||
* Deleted the 'rlm_twitter' RLM.
|
* Deleted the 'rlm_twitter' RLM.
|
||||||
* Deleted the 'rlm_udp' RLM.
|
* Deleted the 'rlm_udp' RLM.
|
||||||
|
2018-12-18 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Added a 'pypad_urlwrite.py' PyPAD script.
|
||||||
|
* Removed the 'rlm_urlwrite' RLM.
|
||||||
|
@ -26,17 +26,23 @@ install-exec-am:
|
|||||||
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_udp.py $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_udp.py
|
../../../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
|
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
|
||||||
|
|
||||||
uninstall-local:
|
uninstall-local:
|
||||||
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_udp.exemplar
|
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_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
|
||||||
|
|
||||||
EXTRA_DIST = pypad_filewrite.exemplar\
|
EXTRA_DIST = pypad_filewrite.exemplar\
|
||||||
pypad_filewrite.py\
|
pypad_filewrite.py\
|
||||||
pypad_udp.exemplar\
|
pypad_udp.exemplar\
|
||||||
pypad_udp.py
|
pypad_udp.py\
|
||||||
|
pypad_urlwrite.exemplar\
|
||||||
|
pypad_urlwrite.py
|
||||||
|
|
||||||
CLEANFILES = *~\
|
CLEANFILES = *~\
|
||||||
*.idb\
|
*.idb\
|
||||||
|
113
apis/PyPAD/scripts/pypad_urlwrite.exemplar
Normal file
113
apis/PyPAD/scripts/pypad_urlwrite.exemplar
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
; This is the configuration for the 'pypad_urlwrite' script for
|
||||||
|
; Rivendell, which can be used to send one or more files to a local or
|
||||||
|
; remote system using Now & Next data.
|
||||||
|
|
||||||
|
; Section Header
|
||||||
|
;
|
||||||
|
; One section per file to be written should be configured, starting with
|
||||||
|
; 'Url1' and working up consecutively
|
||||||
|
[Url1]
|
||||||
|
|
||||||
|
; Url
|
||||||
|
;
|
||||||
|
; The URL to which to send the file, which may contain filepath
|
||||||
|
; wildcards as defined in Appendix C of the Rivendell Operations and
|
||||||
|
; Administration Guide.
|
||||||
|
;
|
||||||
|
; The following URL schemes are recognized:
|
||||||
|
; file://
|
||||||
|
; ftp://
|
||||||
|
; http:// (uses the PUT method)
|
||||||
|
; sftp://
|
||||||
|
;
|
||||||
|
Url=sftp://server.example.com/myfile.txt
|
||||||
|
|
||||||
|
; Username
|
||||||
|
;
|
||||||
|
; The username to be used when authenticating to the remote server.
|
||||||
|
;
|
||||||
|
Username=someuser
|
||||||
|
|
||||||
|
; Password
|
||||||
|
;
|
||||||
|
; The password to be used when authenticating to the remote server.
|
||||||
|
Password=hackme
|
||||||
|
|
||||||
|
; Format String. The string 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'
|
||||||
|
; appendix of the Rivendell Operations Guide.
|
||||||
|
;
|
||||||
|
FormatString=NOW: %d(ddd MMM d hh:mm:ss yyyy): %t - %a\nNEXT: %D(ddd MMM d hh:mm:ss yyyy): %T - %A\n
|
||||||
|
|
||||||
|
; Encoding. Defines the set of escapes to be applied to the PAD fields.
|
||||||
|
; The following options are available:
|
||||||
|
;
|
||||||
|
; 0 - Perform no character escaping.
|
||||||
|
; 1 - "XML" escaping: Escape reserved characters as per XML-v1.0
|
||||||
|
; 2 - "URL" escaping: Escape reserved characters as per RFC 2396 Section 2.4
|
||||||
|
; 3 - "JSON" escaping: Escape reserved characters as per ECMA-404
|
||||||
|
Encoding=0
|
||||||
|
|
||||||
|
; Log Selection
|
||||||
|
;
|
||||||
|
; Set the status for each log to 'Yes', 'No' or 'Onair' to indicate whether
|
||||||
|
; state changes on that log should be output. 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 files can be written by adding new sections...
|
||||||
|
;
|
||||||
|
;[Url2]
|
||||||
|
;Url=file:///home/rd/somefile.txt
|
||||||
|
;Username=janedoe
|
||||||
|
;Password=crackme
|
||||||
|
;FormatString=%t by %a\r\n
|
||||||
|
;Encoding=0
|
||||||
|
;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
|
69
apis/PyPAD/scripts/pypad_urlwrite.py
Executable file
69
apis/PyPAD/scripts/pypad_urlwrite.py
Executable file
@ -0,0 +1,69 @@
|
|||||||
|
#!%PYTHON_BANGPATH%
|
||||||
|
|
||||||
|
# pypad_urlwrite.py
|
||||||
|
#
|
||||||
|
# Write PAD updates to arbitrary URLs
|
||||||
|
#
|
||||||
|
# (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='Url'+str(n)
|
||||||
|
if update.shouldBeProcessed(section):
|
||||||
|
fmtstr=update.config().get(section,'FormatString')
|
||||||
|
buf=BytesIO(update.resolvePadFields(fmtstr,int(update.config().get(section,'Encoding'))).encode('utf-8'))
|
||||||
|
curl=pycurl.Curl()
|
||||||
|
curl.setopt(curl.URL,update.resolveFilepath(update.config().get(section,'Url'),update.dateTime()))
|
||||||
|
curl.setopt(curl.USERNAME,update.config().get(section,'Username'))
|
||||||
|
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_urlwrite.py: you must specify a configuration file')
|
||||||
|
sys.exit(1)
|
||||||
|
rcvr.setCallback(ProcessPad)
|
||||||
|
rcvr.start(sys.argv[1],int(sys.argv[2]))
|
@ -33,7 +33,6 @@ RLM_MODULES=rlm_ando.rlm\
|
|||||||
rlm_spottrap.rlm\
|
rlm_spottrap.rlm\
|
||||||
rlm_test.rlm\
|
rlm_test.rlm\
|
||||||
rlm_tunein.rlm\
|
rlm_tunein.rlm\
|
||||||
rlm_urlwrite.rlm\
|
|
||||||
rlm_walltime.rlm\
|
rlm_walltime.rlm\
|
||||||
rlm_xds.rlm\
|
rlm_xds.rlm\
|
||||||
rlm_xmpad.rlm
|
rlm_xmpad.rlm
|
||||||
@ -69,7 +68,6 @@ EXTRA_DIST = Makefile-example\
|
|||||||
rlm_spottrap.c\
|
rlm_spottrap.c\
|
||||||
rlm_test.c\
|
rlm_test.c\
|
||||||
rlm_tunein.c\
|
rlm_tunein.c\
|
||||||
rlm_urlwrite.c\
|
|
||||||
rlm_walltime.c\
|
rlm_walltime.c\
|
||||||
rlm_xds.c\
|
rlm_xds.c\
|
||||||
rlm_xmpad.c
|
rlm_xmpad.c
|
||||||
|
Loading…
x
Reference in New Issue
Block a user