mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-06-05 06:32:34 +02:00
2019-01-06 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in 'PyPAD.Receiver' that threw an exception when processing a PAD update with no active timer. * Added a 'pypad_spottrap.py' PyPAD script. * Removed the 'rlm_spottrap' RLM. * Removed the 'rlm_test' RLM.
This commit is contained in:
parent
5b240c0814
commit
1e3b1a6e0b
@ -18286,3 +18286,9 @@
|
||||
2019-01-05 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added keep-alive packet support to the 'pypad_ando.py' PyPAD
|
||||
script.
|
||||
2019-01-06 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Fixed a bug in 'PyPAD.Receiver' that threw an exception when
|
||||
processing a PAD update with no active timer.
|
||||
* Added a 'pypad_spottrap.py' PyPAD script.
|
||||
* Removed the 'rlm_spottrap' RLM.
|
||||
* Removed the 'rlm_test' RLM.
|
||||
|
@ -855,7 +855,8 @@ class Receiver(object):
|
||||
self.__PyPAD_Process(Update(json.loads(msg),self.__config_parser))
|
||||
msg=""
|
||||
line=bytes()
|
||||
timeout=(deadline-datetime.datetime.now()).total_seconds()
|
||||
if self.__timer_interval!=None:
|
||||
timeout=(deadline-datetime.datetime.now()).total_seconds()
|
||||
|
||||
|
||||
def SigHandler(signo,stack):
|
||||
|
@ -36,6 +36,8 @@ install-exec-am:
|
||||
cp pypad_serial.exemplar $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_serial.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_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
|
||||
@ -62,6 +64,8 @@ uninstall-local:
|
||||
rm -f $(DESTDIR)$(prefix)/@RD_LIB_PATH@/rivendell/PyPAD/pypad_serial.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_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
|
||||
@ -85,6 +89,8 @@ EXTRA_DIST = pypad_ando.exemplar\
|
||||
pypad_live365.py\
|
||||
pypad_spinitron.exemplar\
|
||||
pypad_spinitron.py\
|
||||
pypad_spottrap.exemplar\
|
||||
pypad_spottrap.py\
|
||||
pypad_udp.exemplar\
|
||||
pypad_udp.py\
|
||||
pypad_urlwrite.exemplar\
|
||||
|
123
apis/PyPAD/scripts/pypad_spottrap.exemplar
Normal file
123
apis/PyPAD/scripts/pypad_spottrap.exemplar
Normal file
@ -0,0 +1,123 @@
|
||||
; This is the configuration for the 'pypad_spottrap.script' script for
|
||||
; Rivendell, which can be used to output Now & Next data to one or more
|
||||
; remote UDP ports on the basis of Group and Length.
|
||||
;
|
||||
; Module configuration consists of a list of rules, each of which consists
|
||||
; in turn with a set of filter parameters and actions. Each PAD update is
|
||||
; compared against the filter parameters of each rule. If the filter matches,
|
||||
; then the rule actions are performed.
|
||||
;
|
||||
|
||||
; Rule Header
|
||||
;
|
||||
; One section per rule is configured, starting with 'Rule1' and
|
||||
; working up consecutively
|
||||
[Rule1]
|
||||
|
||||
; FILTER PARAMETERS
|
||||
;
|
||||
; Group Name
|
||||
;
|
||||
; The name of the Rivendell group to match.
|
||||
GroupName=BEDS
|
||||
|
||||
; Minimum Length
|
||||
;
|
||||
; The minimum length, in milliseconds. A PAD update with a Length of less
|
||||
; than this value will not be matched.
|
||||
MinimumLength=0
|
||||
|
||||
; Maximum Length
|
||||
; The maximum length, in milliseconds. A PAD update with a Length of more
|
||||
; than this value will not be matched.
|
||||
MaximumLength=10000000
|
||||
|
||||
; ACTION PARAMETERS
|
||||
;
|
||||
; IP Address
|
||||
;
|
||||
; The IP address of the remote UDP port, in dotted-quad notation.
|
||||
IpAddress=192.168.10.30
|
||||
|
||||
; UDP Port
|
||||
;
|
||||
; The UDP port number of the remote UDP port, in the range 0 - 65,535.
|
||||
UdpPort=5859
|
||||
|
||||
; Format String. The string to be output 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.
|
||||
;
|
||||
FormatString=DX 1 %h!
|
||||
|
||||
; Default Format String. Similar to the 'FormatString=' parameter described
|
||||
; above, but this string is output when the rule *doesn't* match. All of
|
||||
; the wildcards described in the 'FormatString=' section apply here as well.
|
||||
DefaultFormatString=DX 1 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 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 Rules can be configured by adding new sections...
|
||||
;[Rule2]
|
||||
;GroupName=TEST
|
||||
;MinimumLength=0
|
||||
;MaximumLength=1000000
|
||||
;FormatString=Artist: %a%r
|
||||
;DefaultFormatString=Artist: %a%r
|
||||
;IpAddress=192.168.10.30
|
||||
;UdpPort=6789
|
||||
;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
|
71
apis/PyPAD/scripts/pypad_spottrap.py
Executable file
71
apis/PyPAD/scripts/pypad_spottrap.py
Executable file
@ -0,0 +1,71 @@
|
||||
#!%PYTHON_BANGPATH%
|
||||
|
||||
# pypad_spottrap.py
|
||||
#
|
||||
# Output Now & Next data on the basis of Group and Length.
|
||||
#
|
||||
# (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
|
||||
|
||||
last_updates={}
|
||||
|
||||
def eprint(*args,**kwargs):
|
||||
print(*args,file=sys.stderr,**kwargs)
|
||||
|
||||
|
||||
def ProcessPad(update):
|
||||
try:
|
||||
last_updates[update.machine()]
|
||||
except KeyError:
|
||||
last_updates[update.machine()]=None
|
||||
|
||||
n=1
|
||||
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)
|
||||
else:
|
||||
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
|
||||
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_spottrap.py: you must specify a configuration file')
|
||||
sys.exit(1)
|
||||
rcvr.setCallback(ProcessPad)
|
||||
rcvr.start(sys.argv[1],int(sys.argv[2]))
|
@ -21,8 +21,6 @@
|
||||
OBJS =
|
||||
rlm_icecast2.rlm\
|
||||
rlm_shoutcast1.rlm\
|
||||
rlm_spottrap.rlm\
|
||||
rlm_test.rlm\
|
||||
rlm_tunein.rlm
|
||||
|
||||
%.rlm: %.c
|
||||
|
@ -23,8 +23,6 @@ AM_CFLAGS = -fPIC -Wall -I../
|
||||
|
||||
RLM_MODULES = rlm_icecast2.rlm\
|
||||
rlm_shoutcast1.rlm\
|
||||
rlm_spottrap.rlm\
|
||||
rlm_test.rlm\
|
||||
rlm_tunein.rlm
|
||||
|
||||
all: $(RLM_MODULES)
|
||||
@ -48,8 +46,6 @@ EXTRA_DIST = Makefile-example\
|
||||
rlm.h\
|
||||
rlm_icecast2.c\
|
||||
rlm_shoutcast1.c\
|
||||
rlm_spottrap.c\
|
||||
rlm_test.c\
|
||||
rlm_tunein.c
|
||||
|
||||
CLEANFILES = *~\
|
||||
|
@ -1,446 +0,0 @@
|
||||
/* rlm_spottrap.c
|
||||
*
|
||||
* (C) Copyright 2012-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.
|
||||
*
|
||||
* This is a Rivendell Loadable Module. It processes Now&Next PAD data
|
||||
* on the basis of Group and Length as specified in the configuration file
|
||||
* pointed to by the plugin argument.
|
||||
*
|
||||
* To compile this module, just do:
|
||||
*
|
||||
* gcc -shared -o rlm_spottrap.rlm rlm_spottrap.c
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <rlm/rlm.h>
|
||||
|
||||
int rlm_spottrap_devs;
|
||||
char *rlm_spottrap_groups;
|
||||
char *rlm_spottrap_addresses;
|
||||
int *rlm_spottrap_minimums;
|
||||
int *rlm_spottrap_maximums;
|
||||
uint16_t *rlm_spottrap_ports;
|
||||
char *rlm_spottrap_formats;
|
||||
char *rlm_spottrap_default_formats;
|
||||
int *rlm_spottrap_masters;
|
||||
int *rlm_spottrap_aux1s;
|
||||
int *rlm_spottrap_aux2s;
|
||||
int *rlm_spottrap_vlog101s;
|
||||
int *rlm_spottrap_vlog102s;
|
||||
int *rlm_spottrap_vlog103s;
|
||||
int *rlm_spottrap_vlog104s;
|
||||
int *rlm_spottrap_vlog105s;
|
||||
int *rlm_spottrap_vlog106s;
|
||||
int *rlm_spottrap_vlog107s;
|
||||
int *rlm_spottrap_vlog108s;
|
||||
int *rlm_spottrap_vlog109s;
|
||||
int *rlm_spottrap_vlog110s;
|
||||
int *rlm_spottrap_vlog111s;
|
||||
int *rlm_spottrap_vlog112s;
|
||||
int *rlm_spottrap_vlog113s;
|
||||
int *rlm_spottrap_vlog114s;
|
||||
int *rlm_spottrap_vlog115s;
|
||||
int *rlm_spottrap_vlog116s;
|
||||
int *rlm_spottrap_vlog117s;
|
||||
int *rlm_spottrap_vlog118s;
|
||||
int *rlm_spottrap_vlog119s;
|
||||
int *rlm_spottrap_vlog120s;
|
||||
|
||||
int rlm_spottrap_GetLogStatus(void *ptr,const char *arg,const char *section,
|
||||
const char *logname)
|
||||
{
|
||||
const char *tag=RLMGetStringValue(ptr,arg,section,logname,"");
|
||||
if(strcasecmp(tag,"yes")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"on")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"true")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"no")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"off")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"false")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"onair")==0) {
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void rlm_spottrap_RLMStart(void *ptr,const char *arg)
|
||||
{
|
||||
char address[17];
|
||||
char section[256];
|
||||
char errtext[256];
|
||||
int i=1;
|
||||
|
||||
rlm_spottrap_devs=0;
|
||||
rlm_spottrap_groups=NULL;
|
||||
rlm_spottrap_addresses=NULL;
|
||||
rlm_spottrap_minimums=NULL;
|
||||
rlm_spottrap_maximums=NULL;
|
||||
rlm_spottrap_ports=NULL;
|
||||
rlm_spottrap_formats=NULL;
|
||||
rlm_spottrap_default_formats=NULL;
|
||||
rlm_spottrap_masters=NULL;
|
||||
rlm_spottrap_aux1s=NULL;
|
||||
rlm_spottrap_aux2s=NULL;
|
||||
rlm_spottrap_vlog101s=NULL;
|
||||
rlm_spottrap_vlog102s=NULL;
|
||||
rlm_spottrap_vlog103s=NULL;
|
||||
rlm_spottrap_vlog104s=NULL;
|
||||
rlm_spottrap_vlog105s=NULL;
|
||||
rlm_spottrap_vlog106s=NULL;
|
||||
rlm_spottrap_vlog107s=NULL;
|
||||
rlm_spottrap_vlog108s=NULL;
|
||||
rlm_spottrap_vlog109s=NULL;
|
||||
rlm_spottrap_vlog110s=NULL;
|
||||
rlm_spottrap_vlog111s=NULL;
|
||||
rlm_spottrap_vlog112s=NULL;
|
||||
rlm_spottrap_vlog113s=NULL;
|
||||
rlm_spottrap_vlog114s=NULL;
|
||||
rlm_spottrap_vlog115s=NULL;
|
||||
rlm_spottrap_vlog116s=NULL;
|
||||
rlm_spottrap_vlog117s=NULL;
|
||||
rlm_spottrap_vlog118s=NULL;
|
||||
rlm_spottrap_vlog119s=NULL;
|
||||
rlm_spottrap_vlog120s=NULL;
|
||||
|
||||
sprintf(section,"Rule%d",i++);
|
||||
strncpy(address,RLMGetStringValue(ptr,arg,section,"IpAddress",""),15);
|
||||
if(strlen(address)==0) {
|
||||
RLMLog(ptr,LOG_WARNING,"rlm_spottrap: no rules specified");
|
||||
return;
|
||||
}
|
||||
while(strlen(address)>0) {
|
||||
rlm_spottrap_addresses=
|
||||
realloc(rlm_spottrap_addresses,(rlm_spottrap_devs+1)*(rlm_spottrap_devs+1)*16);
|
||||
strcpy(rlm_spottrap_addresses+16*rlm_spottrap_devs,address);
|
||||
rlm_spottrap_groups=realloc(rlm_spottrap_groups,(rlm_spottrap_devs+1)*16);
|
||||
strncpy(rlm_spottrap_groups+16*rlm_spottrap_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"GroupName",""),10);
|
||||
rlm_spottrap_minimums=realloc(rlm_spottrap_minimums,(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_minimums[rlm_spottrap_devs]=
|
||||
RLMGetIntegerValue(ptr,arg,section,"MinimumLength",0);
|
||||
rlm_spottrap_maximums=realloc(rlm_spottrap_maximums,(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_maximums[rlm_spottrap_devs]=
|
||||
RLMGetIntegerValue(ptr,arg,section,"MaximumLength",0);
|
||||
rlm_spottrap_ports=realloc(rlm_spottrap_ports,(rlm_spottrap_devs+1)*sizeof(uint16_t));
|
||||
rlm_spottrap_ports[rlm_spottrap_devs]=
|
||||
RLMGetIntegerValue(ptr,arg,section,"UdpPort",0);
|
||||
rlm_spottrap_formats=realloc(rlm_spottrap_formats,(rlm_spottrap_devs+1)*256);
|
||||
strncpy(rlm_spottrap_formats+256*rlm_spottrap_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"FormatString",""),256);
|
||||
rlm_spottrap_default_formats=realloc(rlm_spottrap_default_formats,
|
||||
(rlm_spottrap_devs+1)*256);
|
||||
strncpy(rlm_spottrap_default_formats+256*rlm_spottrap_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"DefaultFormatString",""),256);
|
||||
rlm_spottrap_masters=realloc(rlm_spottrap_masters,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_masters[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"MasterLog");
|
||||
rlm_spottrap_aux1s=realloc(rlm_spottrap_aux1s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_aux1s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"Aux1Log");
|
||||
rlm_spottrap_aux2s=realloc(rlm_spottrap_aux2s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_aux2s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"Aux2Log");
|
||||
|
||||
rlm_spottrap_vlog101s=realloc(rlm_spottrap_vlog101s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog101s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog101");
|
||||
|
||||
rlm_spottrap_vlog102s=realloc(rlm_spottrap_vlog102s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog102s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog102");
|
||||
|
||||
rlm_spottrap_vlog103s=realloc(rlm_spottrap_vlog103s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog103s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog103");
|
||||
|
||||
rlm_spottrap_vlog104s=realloc(rlm_spottrap_vlog104s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog104s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog104");
|
||||
|
||||
rlm_spottrap_vlog105s=realloc(rlm_spottrap_vlog105s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog105s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog105");
|
||||
|
||||
rlm_spottrap_vlog106s=realloc(rlm_spottrap_vlog106s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog106s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog106");
|
||||
|
||||
rlm_spottrap_vlog107s=realloc(rlm_spottrap_vlog107s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog107s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog107");
|
||||
|
||||
rlm_spottrap_vlog108s=realloc(rlm_spottrap_vlog108s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog108s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog108");
|
||||
|
||||
rlm_spottrap_vlog109s=realloc(rlm_spottrap_vlog109s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog109s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog109");
|
||||
|
||||
rlm_spottrap_vlog110s=realloc(rlm_spottrap_vlog110s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog110s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog110");
|
||||
|
||||
rlm_spottrap_vlog111s=realloc(rlm_spottrap_vlog111s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog111s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog111");
|
||||
|
||||
rlm_spottrap_vlog112s=realloc(rlm_spottrap_vlog112s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog112s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog112");
|
||||
|
||||
rlm_spottrap_vlog113s=realloc(rlm_spottrap_vlog113s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog113s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog113");
|
||||
|
||||
rlm_spottrap_vlog114s=realloc(rlm_spottrap_vlog114s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog114s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog114");
|
||||
|
||||
rlm_spottrap_vlog115s=realloc(rlm_spottrap_vlog115s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog115s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog115");
|
||||
|
||||
rlm_spottrap_vlog116s=realloc(rlm_spottrap_vlog116s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog116s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog116");
|
||||
|
||||
rlm_spottrap_vlog117s=realloc(rlm_spottrap_vlog117s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog117s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog117");
|
||||
|
||||
rlm_spottrap_vlog118s=realloc(rlm_spottrap_vlog118s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog118s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog118");
|
||||
|
||||
rlm_spottrap_vlog119s=realloc(rlm_spottrap_vlog119s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog119s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog119");
|
||||
|
||||
rlm_spottrap_vlog120s=realloc(rlm_spottrap_vlog120s,
|
||||
(rlm_spottrap_devs+1)*sizeof(int));
|
||||
rlm_spottrap_vlog120s[rlm_spottrap_devs]=
|
||||
rlm_spottrap_GetLogStatus(ptr,arg,section,"VLog120");
|
||||
|
||||
sprintf(errtext,"rlm_spottrap: configured rule for \"%s:%d\"",address,
|
||||
rlm_spottrap_ports[rlm_spottrap_devs]);
|
||||
rlm_spottrap_devs++;
|
||||
RLMLog(ptr,LOG_INFO,errtext);
|
||||
sprintf(section,"Rule%d",i++);
|
||||
strncpy(address,RLMGetStringValue(ptr,arg,section,"IpAddress",""),15);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void rlm_spottrap_RLMFree(void *ptr)
|
||||
{
|
||||
free(rlm_spottrap_addresses);
|
||||
free(rlm_spottrap_groups);
|
||||
free(rlm_spottrap_minimums);
|
||||
free(rlm_spottrap_maximums);
|
||||
free(rlm_spottrap_ports);
|
||||
free(rlm_spottrap_formats);
|
||||
free(rlm_spottrap_default_formats);
|
||||
free(rlm_spottrap_masters);
|
||||
free(rlm_spottrap_aux1s);
|
||||
free(rlm_spottrap_aux2s);
|
||||
free(rlm_spottrap_vlog101s);
|
||||
free(rlm_spottrap_vlog102s);
|
||||
free(rlm_spottrap_vlog103s);
|
||||
free(rlm_spottrap_vlog104s);
|
||||
free(rlm_spottrap_vlog105s);
|
||||
free(rlm_spottrap_vlog106s);
|
||||
free(rlm_spottrap_vlog107s);
|
||||
free(rlm_spottrap_vlog108s);
|
||||
free(rlm_spottrap_vlog109s);
|
||||
free(rlm_spottrap_vlog110s);
|
||||
free(rlm_spottrap_vlog111s);
|
||||
free(rlm_spottrap_vlog112s);
|
||||
free(rlm_spottrap_vlog113s);
|
||||
free(rlm_spottrap_vlog114s);
|
||||
free(rlm_spottrap_vlog115s);
|
||||
free(rlm_spottrap_vlog116s);
|
||||
free(rlm_spottrap_vlog117s);
|
||||
free(rlm_spottrap_vlog118s);
|
||||
free(rlm_spottrap_vlog119s);
|
||||
free(rlm_spottrap_vlog120s);
|
||||
}
|
||||
|
||||
|
||||
void rlm_spottrap_RLMPadDataSent(void *ptr,const struct rlm_svc *svc,
|
||||
const struct rlm_log *log,
|
||||
const struct rlm_pad *now,
|
||||
const struct rlm_pad *next)
|
||||
{
|
||||
int i;
|
||||
int flag=0;
|
||||
char msg[1500];
|
||||
|
||||
for(i=0;i<rlm_spottrap_devs;i++) {
|
||||
switch(log->log_mach) {
|
||||
case 0:
|
||||
flag=rlm_spottrap_masters[i];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
flag=rlm_spottrap_aux1s[i];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
flag=rlm_spottrap_aux2s[i];
|
||||
break;
|
||||
|
||||
case 100:
|
||||
flag=rlm_spottrap_vlog101s[i];
|
||||
break;
|
||||
|
||||
case 101:
|
||||
flag=rlm_spottrap_vlog102s[i];
|
||||
break;
|
||||
|
||||
case 102:
|
||||
flag=rlm_spottrap_vlog103s[i];
|
||||
break;
|
||||
|
||||
case 103:
|
||||
flag=rlm_spottrap_vlog104s[i];
|
||||
break;
|
||||
|
||||
case 104:
|
||||
flag=rlm_spottrap_vlog105s[i];
|
||||
break;
|
||||
|
||||
case 105:
|
||||
flag=rlm_spottrap_vlog106s[i];
|
||||
break;
|
||||
|
||||
case 106:
|
||||
flag=rlm_spottrap_vlog107s[i];
|
||||
break;
|
||||
|
||||
case 107:
|
||||
flag=rlm_spottrap_vlog108s[i];
|
||||
break;
|
||||
|
||||
case 108:
|
||||
flag=rlm_spottrap_vlog109s[i];
|
||||
break;
|
||||
|
||||
case 109:
|
||||
flag=rlm_spottrap_vlog110s[i];
|
||||
break;
|
||||
|
||||
case 110:
|
||||
flag=rlm_spottrap_vlog111s[i];
|
||||
break;
|
||||
|
||||
case 111:
|
||||
flag=rlm_spottrap_vlog112s[i];
|
||||
break;
|
||||
|
||||
case 112:
|
||||
flag=rlm_spottrap_vlog113s[i];
|
||||
break;
|
||||
|
||||
case 113:
|
||||
flag=rlm_spottrap_vlog114s[i];
|
||||
break;
|
||||
|
||||
case 114:
|
||||
flag=rlm_spottrap_vlog115s[i];
|
||||
break;
|
||||
|
||||
case 115:
|
||||
flag=rlm_spottrap_vlog116s[i];
|
||||
break;
|
||||
|
||||
case 116:
|
||||
flag=rlm_spottrap_vlog117s[i];
|
||||
break;
|
||||
|
||||
case 117:
|
||||
flag=rlm_spottrap_vlog118s[i];
|
||||
break;
|
||||
|
||||
case 118:
|
||||
flag=rlm_spottrap_vlog119s[i];
|
||||
break;
|
||||
|
||||
case 119:
|
||||
flag=rlm_spottrap_vlog120s[i];
|
||||
break;
|
||||
}
|
||||
if((flag==1)||((flag==2)&&(log->log_onair!=0))) {
|
||||
if((strcasecmp(now->rlm_group,rlm_spottrap_groups+16*i)==0)&&
|
||||
(now->rlm_len>=rlm_spottrap_minimums[i])&&
|
||||
(now->rlm_len<=rlm_spottrap_maximums[i])) {
|
||||
const char *str=
|
||||
RLMResolveNowNext(ptr,now,next,rlm_spottrap_formats+256*i);
|
||||
RLMSendUdp(ptr,rlm_spottrap_addresses+i*16,rlm_spottrap_ports[i],
|
||||
str,strlen(str));
|
||||
snprintf(msg,1500,"rlm_spottrap: sending pad update: \"%s\"",
|
||||
(const char *)str);
|
||||
RLMLog(ptr,LOG_INFO,msg);
|
||||
}
|
||||
else {
|
||||
const char *str=
|
||||
RLMResolveNowNext(ptr,now,next,rlm_spottrap_default_formats+256*i);
|
||||
RLMSendUdp(ptr,rlm_spottrap_addresses+i*16,rlm_spottrap_ports[i],
|
||||
str,strlen(str));
|
||||
snprintf(msg,1500,"rlm_spottrap: sending default pad update: \"%s\"",
|
||||
(const char *)str);
|
||||
RLMLog(ptr,LOG_INFO,msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,160 +0,0 @@
|
||||
/* rlm_test.c
|
||||
*
|
||||
* (C) Copyright 2008 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.
|
||||
*
|
||||
* This is a sample Rivendell Loadable Module. All it does is print
|
||||
* Now & Next data to standard output for each event transition.
|
||||
*
|
||||
* To compile this module, just do:
|
||||
*
|
||||
* gcc -shared -o rlm_test.rlm rlm_test.c
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <rlm/rlm.h>
|
||||
|
||||
|
||||
void rlm_test_RLMStart(void *ptr,const char *arg)
|
||||
{
|
||||
char str[1024];
|
||||
sprintf(str,"rlm_test: started on %s",
|
||||
RLMDateTime(ptr,0,"MM/dd/yyyy at hh:mm:ss"));
|
||||
RLMLog(ptr,LOG_NOTICE,str);
|
||||
}
|
||||
|
||||
|
||||
void rlm_test_RLMFree(void *ptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void rlm_test_print_carttype(int type)
|
||||
{
|
||||
switch(type) {
|
||||
case RLM_CARTTYPE_ALL:
|
||||
printf(" Type:\n");
|
||||
break;
|
||||
|
||||
case RLM_CARTTYPE_AUDIO:
|
||||
printf(" Type: AUDIO\n");
|
||||
break;
|
||||
|
||||
case RLM_CARTTYPE_MACRO:
|
||||
printf(" Type: MACRO\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rlm_test_RLMPadDataSent(void *ptr,const struct rlm_svc *svc,
|
||||
const struct rlm_log *log,
|
||||
const struct rlm_pad *now,
|
||||
const struct rlm_pad *next)
|
||||
{
|
||||
printf("Service: %s\n",svc->svc_name);
|
||||
printf("Program Code: %s\n",svc->svc_pgmcode);
|
||||
printf("Log Name: %s\n",log->log_name);
|
||||
if(log->log_onair==0) {
|
||||
printf(" OnAir = false\n");
|
||||
}
|
||||
else {
|
||||
printf(" OnAir = true\n");
|
||||
}
|
||||
switch(log->log_mode) {
|
||||
case RLM_LOGMODE_LIVEASSIST:
|
||||
printf(" Mode = Live Assist\n");
|
||||
break;
|
||||
|
||||
case RLM_LOGMODE_AUTOMATIC:
|
||||
printf(" Mode = Automatic\n");
|
||||
break;
|
||||
|
||||
case RLM_LOGMODE_MANUAL:
|
||||
printf(" Mode = Manual\n");
|
||||
break;
|
||||
}
|
||||
switch(log->log_mach) {
|
||||
case 0:
|
||||
printf(" -- On Main Log ---------------------------------------------\n");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
printf(" -- On Aux 1 Log --------------------------------------------\n");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
printf(" -- On Aux 2 Log --------------------------------------------\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" -- On vLog %d --------------------------------------------\n",
|
||||
log->log_mach+1);
|
||||
break;
|
||||
}
|
||||
printf("Playing NOW\n");
|
||||
printf(" Cart number: %06u\n",now->rlm_cartnum);
|
||||
rlm_test_print_carttype(now->rlm_carttype);
|
||||
printf("Start Date/Time: %04u-%02u-%02u %02u:%02u:%02u.%03u\n",
|
||||
now->rlm_start_year,now->rlm_start_mon,now->rlm_start_day,
|
||||
now->rlm_start_hour,now->rlm_start_min,now->rlm_start_sec,
|
||||
now->rlm_start_msec);
|
||||
printf(" Length: %u mS\n",now->rlm_len);
|
||||
printf(" Group: %s\n",now->rlm_group);
|
||||
printf(" Title: %s\n",now->rlm_title);
|
||||
printf(" Artist: %s\n",now->rlm_artist);
|
||||
printf(" Label: %s\n",now->rlm_label);
|
||||
printf(" Conductor: %s\n",now->rlm_conductor);
|
||||
printf(" SongId: %s\n",now->rlm_song_id);
|
||||
printf(" Client: %s\n",now->rlm_client);
|
||||
printf(" Agency: %s\n",now->rlm_agency);
|
||||
printf(" Composer: %s\n",now->rlm_comp);
|
||||
printf(" Publisher: %s\n",now->rlm_pub);
|
||||
printf(" UserDefined: %s\n",now->rlm_userdef);
|
||||
printf(" Outcue: %s\n",now->rlm_outcue);
|
||||
printf("Cut Description: %s\n",now->rlm_description);
|
||||
printf(" ISRC: %s\n",now->rlm_isrc);
|
||||
printf(" ISCI Code: %s\n",now->rlm_isci);
|
||||
printf(" Ext Data: %s\n",now->rlm_ext_data);
|
||||
printf(" Ext Event ID: %s\n",now->rlm_ext_eventid);
|
||||
printf(" Ext Annc Type: %s\n",now->rlm_ext_annctype);
|
||||
printf("\n");
|
||||
printf("Playing NEXT\n");
|
||||
printf(" Cart number: %06u\n",next->rlm_cartnum);
|
||||
rlm_test_print_carttype(next->rlm_carttype);
|
||||
printf("Start Date/Time: %04u-%02u-%02u %02u:%02u:%02u.%03u\n",
|
||||
next->rlm_start_year,next->rlm_start_mon,next->rlm_start_day,
|
||||
next->rlm_start_hour,next->rlm_start_min,next->rlm_start_sec,
|
||||
next->rlm_start_msec);
|
||||
printf(" Length: %u mS\n",next->rlm_len);
|
||||
printf(" Group: %s\n",now->rlm_group);
|
||||
printf(" Title: %s\n",next->rlm_title);
|
||||
printf(" Artist: %s\n",next->rlm_artist);
|
||||
printf(" Label: %s\n",next->rlm_label);
|
||||
printf(" Conductor: %s\n",next->rlm_conductor);
|
||||
printf(" SongId: %s\n",next->rlm_song_id);
|
||||
printf(" Client: %s\n",next->rlm_client);
|
||||
printf(" Agency: %s\n",next->rlm_agency);
|
||||
printf(" Composer: %s\n",next->rlm_comp);
|
||||
printf(" Publisher: %s\n",next->rlm_pub);
|
||||
printf(" UserDefined: %s\n",next->rlm_userdef);
|
||||
printf(" Outcue: %s\n",next->rlm_outcue);
|
||||
printf("Cut Description: %s\n",next->rlm_description);
|
||||
printf(" ISRC: %s\n",next->rlm_isrc);
|
||||
printf(" ISCI Code: %s\n",next->rlm_isci);
|
||||
printf(" Ext Data: %s\n",next->rlm_ext_data);
|
||||
printf(" Ext Event ID: %s\n",next->rlm_ext_eventid);
|
||||
printf(" Ext Annc Type: %s\n",next->rlm_ext_annctype);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user