mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-30 17:23:53 +01:00
2018-12-20 Fred Gleason <fredg@paravelsystems.com>
* Added a 'pypad_ando.py' PyPAD script. * Removed the 'rlm_ando' RLM.
This commit is contained in:
@@ -22,14 +22,14 @@
|
||||
|
||||
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_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_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_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
|
||||
@@ -38,6 +38,8 @@ install-exec-am:
|
||||
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_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_live365.exemplar
|
||||
@@ -51,7 +53,9 @@ uninstall-local:
|
||||
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\
|
||||
EXTRA_DIST = pypad_ando.exemplar\
|
||||
pypad_ando.py\
|
||||
pypad_filewrite.exemplar\
|
||||
pypad_filewrite.py\
|
||||
pypad_live365.exemplar\
|
||||
pypad_live365.py\
|
||||
|
||||
99
apis/PyPAD/scripts/pypad_ando.exemplar
Normal file
99
apis/PyPAD/scripts/pypad_ando.exemplar
Normal file
@@ -0,0 +1,99 @@
|
||||
; This is the configuration for the 'pypad_ando.py' script for
|
||||
; Rivendell, which can be used to output Now & Next data to one or more
|
||||
; ANDO Media Streaming systems, using one of the following formats:
|
||||
;
|
||||
; ^<artist>~<title>~<duration>~<group>~<album>~<cartnum>|
|
||||
; ^<artist>~<title>~<duration>~<group>~<cartnum>~<album>~<label>|
|
||||
|
||||
; Section Header
|
||||
;
|
||||
; One section per remote ANDO system is configured, starting with 'System1' and
|
||||
; working up consecutively
|
||||
[System1]
|
||||
|
||||
; IP Address
|
||||
;
|
||||
; The IP address of the remote ANDO port, in dotted-quad notation.
|
||||
IpAddress=192.168.10.29
|
||||
|
||||
; UDP Port
|
||||
;
|
||||
; The UDP port number of the remote ANDO system, in the range 0 - 65,535.
|
||||
UdpPort=5273
|
||||
|
||||
; Field Definitions. The string to use to populate the <title>, <artist>,
|
||||
; <album> and <label> fields sent to ANDO each time RDAirPlay changes play
|
||||
; state. These can include wildcards as placeholders for metadata values.
|
||||
; For the list of supported wildcards. see the 'Metadata Wildcards' section
|
||||
; of the Rivendell Operations Guide.
|
||||
;
|
||||
; The <label> field is optional, and should be left blank unless you know
|
||||
; that your specific ANDO configuration requires it.
|
||||
;
|
||||
Title=%t
|
||||
Artist=%a
|
||||
Album=%l
|
||||
Label=
|
||||
|
||||
; 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 RDAirPlay's 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 ANDO systems can be configured by adding new sections...
|
||||
;[System2]
|
||||
;IpAddress=192.168.10.22
|
||||
;UdpPort=6789
|
||||
;Title=%u
|
||||
;Artist=%a
|
||||
;Album=%p
|
||||
;Label=
|
||||
;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
|
||||
68
apis/PyPAD/scripts/pypad_ando.py
Executable file
68
apis/PyPAD/scripts/pypad_ando.py
Executable file
@@ -0,0 +1,68 @@
|
||||
#!%PYTHON_BANGPATH%
|
||||
|
||||
# pypad_ando.py
|
||||
#
|
||||
# Send PAD updates to an Ando AdInjector
|
||||
#
|
||||
# (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 socket
|
||||
import configparser
|
||||
import PyPAD
|
||||
|
||||
def eprint(*args,**kwargs):
|
||||
print(*args,file=sys.stderr,**kwargs)
|
||||
|
||||
def ProcessPad(update):
|
||||
n=1
|
||||
while(True):
|
||||
section='System'+str(n)
|
||||
try:
|
||||
if update.shouldBeProcessed(section) and update.hasPadType(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)
|
||||
if update.config().get(section,'Label')=='':
|
||||
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+'|'
|
||||
send_sock.sendto(msg.encode('utf-8'),
|
||||
(update.config().get(section,'IpAddress'),int(update.config().get(section,'UdpPort'))))
|
||||
n=n+1
|
||||
except configparser.NoSectionError:
|
||||
return
|
||||
|
||||
#
|
||||
# 'Main' function
|
||||
#
|
||||
# Create Send Socket
|
||||
#
|
||||
send_sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
|
||||
|
||||
rcvr=PyPAD.Receiver()
|
||||
try:
|
||||
rcvr.setConfigFile(sys.argv[3])
|
||||
except IndexError:
|
||||
eprint('pypad_ando.py: you must specify a configuration file')
|
||||
sys.exit(1)
|
||||
rcvr.setCallback(ProcessPad)
|
||||
rcvr.start(sys.argv[1],int(sys.argv[2]))
|
||||
Reference in New Issue
Block a user