2021-09-10 Fred Gleason <fredg@paravelsystems.com>

* Fixed bugs in the 'pypad_nautel.py' plug-in that broke TCP
	transmission.
	* Added error logging to the 'pypad_nautel.py' plug-in.
	* Changed the default 'TcpPort=' directive in 'pypad_nautel.exemplar'
	to 7005.
	* Removed support for the (broken) 'Delay=' directive from
	'pypad_nautel.py'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-09-10 16:34:37 -04:00
parent 74d738d33c
commit 1cc4b5b6dd
3 changed files with 68 additions and 66 deletions

View File

@ -22383,3 +22383,11 @@
* Fixed a bug in rdlogmanager(1) that caused leading event * Fixed a bug in rdlogmanager(1) that caused leading event
attributes to fail to be preserved when suppressing Music of attributes to fail to be preserved when suppressing Music of
Traffic import markers. Traffic import markers.
2021-09-10 Fred Gleason <fredg@paravelsystems.com>
* Fixed bugs in the 'pypad_nautel.py' plug-in that broke TCP
transmission.
* Added error logging to the 'pypad_nautel.py' plug-in.
* Changed the default 'TcpPort=' directive in 'pypad_nautel.exemplar'
to 7005.
* Removed support for the (broken) 'Delay=' directive from
'pypad_nautel.py'.

View File

@ -4,8 +4,6 @@
; Section Header ; Section Header
; ;
; One section per remote transmitter unit is configured, starting with 'Rds1' and
; working up consecutively
[Rds1] [Rds1]
; ***************************************************************************** ; *****************************************************************************
@ -19,12 +17,7 @@ IpAddress=127.0.0.1
; TCP Port ; TCP Port
; ;
; The TCP port number to send updates to, in the range 0 - 65,535. ; The TCP port number to send updates to, in the range 0 - 65,535.
TcpPort=10001 TcpPort=7005
; *****************************************************************************
; Delay in seconds before sending the update
Delay=30
; ***************************************************************************** ; *****************************************************************************
@ -95,9 +88,9 @@ RadioText=%t - %a
; state changes on that log should be output on this udp port. If set ; 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 ; to 'Onair', then output will be generated only if RDAirPlays OnAir flag
; is active. ; is active.
MasterLog=Onair MasterLog=Yes
Aux1Log=No Aux1Log=Yes
Aux2Log=No Aux2Log=Yes
VLog101=No VLog101=No
VLog102=No VLog102=No
VLog103=No VLog103=No

View File

@ -4,7 +4,7 @@
# #
# Send Now & Next updates to an Nautel FM Transmitter as TCP for RDS # Send Now & Next updates to an Nautel FM Transmitter as TCP for RDS
# #
# (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com> # (C) Copyright 2018-2021 Fred Gleason <fredg@paravelsystems.com>
# 2020 Eric Adler <eric@whrwfm.org> # 2020 Eric Adler <eric@whrwfm.org>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -23,6 +23,7 @@
import sys import sys
import socket import socket
import syslog
import configparser import configparser
import pypad import pypad
import time import time
@ -31,12 +32,20 @@ def eprint(*args,**kwargs):
print(*args,file=sys.stderr,**kwargs) print(*args,file=sys.stderr,**kwargs)
def sendvar(var): def sendvar(update,var,err_sent):
if(len(var)!=0): if(len(var)!=0):
send_sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) send_sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
send_sock.connect((ipaddr,port)) ipaddr=update.config().get('Rds1','IpAddress')
send_sock.sendall(var.encode('utf-8')) port=int(update.config().get('Rds1','TcpPort'))
send_sock.close() try:
send_sock.connect((ipaddr,port))
send_sock.sendall(var.encode('utf-8'))
send_sock.close()
return False
except ConnectionRefusedError:
if(not err_sent):
update.syslog(syslog.LOG_WARNING,'RDS update to '+ipaddr+':'+str(port)+' failed: connection refused')
return True
def getval(val, update, section): def getval(val, update, section):
try: try:
@ -60,6 +69,7 @@ def ProcessPad(update):
section='Rds'+str(n) section='Rds'+str(n)
while(update.config().has_section(section)): while(update.config().has_section(section)):
if update.shouldBeProcessed(section) and update.hasPadType(pypad.TYPE_NOW): if update.shouldBeProcessed(section) and update.hasPadType(pypad.TYPE_NOW):
err=False
dps='' dps=''
dps=getval_encode('DynamicPS',"DPS",update,section) dps=getval_encode('DynamicPS',"DPS",update,section)
ps=getval_encode('ProgramService',"PS",update,section) ps=getval_encode('ProgramService',"PS",update,section)
@ -103,59 +113,50 @@ def ProcessPad(update):
dpsr=getval_encode('DPSRate',"DPSR",update,section) dpsr=getval_encode('DPSRate',"DPSR",update,section)
dpsm=getval_encode('DPSMode',"DPSM",update,section) dpsm=getval_encode('DPSMode',"DPSM",update,section)
# #
# Use TCP output # Use TCP output
# #
waittime=int(update.config().get(section,'Delay')) err=sendvar(update,dps,err)
time.sleep(waittime) err=sendvar(update,ps,err)
ipaddr=update.config().get(section,'IpAddress') err=sendvar(update,text,err)
port=int(update.config().get(section,'TcpPort')) err=sendvar(update,picode,err)
sendvar(dps) err=sendvar(update,pty,err)
sendvar(ps) err=sendvar(update,ptyn,err)
sendvar(text) err=sendvar(update,trp,err)
err=sendvar(update,tra,err)
sendvar(picode) err=sendvar(update,af1,err)
sendvar(pty) err=sendvar(update,af2,err)
sendvar(ptyn) err=sendvar(update,af3,err)
sendvar(trp) err=sendvar(update,af4,err)
sendvar(tra) err=sendvar(update,af5,err)
sendvar(af1) err=sendvar(update,af6,err)
sendvar(af2) err=sendvar(update,af7,err)
sendvar(af3) err=sendvar(update,af8,err)
sendvar(af4) err=sendvar(update,af9,err)
sendvar(af5) err=sendvar(update,af10,err)
sendvar(af6) err=sendvar(update,af11,err)
sendvar(af7) err=sendvar(update,af12,err)
sendvar(af8) err=sendvar(update,af13,err)
sendvar(af9) err=sendvar(update,af14,err)
sendvar(af10) err=sendvar(update,af15,err)
sendvar(af11) err=sendvar(update,af16,err)
sendvar(af12) err=sendvar(update,af17,err)
sendvar(af13) err=sendvar(update,af18,err)
sendvar(af14) err=sendvar(update,af19,err)
sendvar(af15) err=sendvar(update,af20,err)
sendvar(af16) err=sendvar(update,af21,err)
sendvar(af17) err=sendvar(update,af22,err)
sendvar(af18) err=sendvar(update,af23,err)
sendvar(af19) err=sendvar(update,af24,err)
sendvar(af20) err=sendvar(update,af25,err)
sendvar(af21) err=sendvar(update,di,err)
sendvar(af22) err=sendvar(update,mus,err)
sendvar(af23) err=sendvar(update,dat,err)
sendvar(af24) err=sendvar(update,tim,err)
sendvar(af25) err=sendvar(update,utco,err)
sendvar(di) err=sendvar(update,cont,err)
sendvar(mus) err=sendvar(update,dpsr,err)
sendvar(dat) err=sendvar(update,dpsm,err)
sendvar(tim)
sendvar(utco)
sendvar(cont)
sendvar(dpsr)
sendvar(dpsm)
n=n+1 n=n+1
section='Rds'+str(n) section='Rds'+str(n)