You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have trunk-recorder running with an upload-liquidsoap.py, but liquidsoap isn't doing anything with the wav file being sent. I am not getting any audio on my broadcastify feed even though it is connected and online. If there is any additional information needed, please let me know.
#!/usr/bin/python3
#
# for docker trunk recorder user root to run/execute this, set permissions on this file to 744
#
import socket
import sys
import os
import time
import re
import json
import shutil
delete = False #delete files after stream or not
filepath = sys.argv[1]
jsonpath = os.path.splitext(filepath)[0] + ".json"
#while tr v4+ does pass json path as arg, will still generate it this way for v3 compat
with open(jsonpath, 'r') as f:
jsonData = json.load(f)
talkgroup = jsonData['talkgroup']
##############################
#archive unknown TG json/wav for later research, check /app/media/UNKNOWN/ exists, requires import shutil
#could just set delete = False, but its easier to check if all put in one folder
if jsonData['talkgroup_tag'] == '-':
shutil.copy(filepath, '/app/media/UNKNOWN/'+ os.path.basename(filepath))
jsonData['talkgroup_tag'] = str(talkgroup)+' Unknown'
##############################
# Create a UDS socket
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
# Connect the socket to the port where the server is listening
# The following is example login to determine which stream to choose, customise as need
if 'SYSTEM_NAME' in filepath:
with open('TALKGROUPS.list') as file:
talkgroups= file.readlines()
if talkgroup in talkgroups:
server_address = '/var/run/liquidsoap/hcps.sock'
else:
server_address = '/var/run/liquidsoap/hcps.sock'
else:
server_address = '/var/run/liquidsoap/hcps.sock'
print ('connecting to %s' % server_address)
try:
sock.connect(server_address)
except socket.error as msg:
print('socket error')
print(msg)
sys.exit(1)
try:
# Send data
metaCommand = "annotate:title='"+jsonData['talkgroup_tag']+"':"
if(delete):
deleteCommand = "tmp:"
else:
deleteCommand = ""
message = 'request.queue_0.push {0}{1}{2}\n\r'.format(metaCommand,deleteCommand,filepath)
#annotate: manually sets meta alpha tags from talkgroups csv and tmp: sets LS to delete after stream
print('sending "%s"' % message.strip())
sock.sendall(message.encode())
# useful for debugging by print liquidsoap socket response messages
# while True:
# data = sock.recv(16)
# if (re.search('END', data.decode())):
# break
# print(data.decode())
finally:
print('closing socket')
quit = "exit\r\n"
sock.send(quit.encode()) #to avoid disconnect without goodbye message, though not necessary :)
time.sleep(0.5) #to avoid disconnect without goodbye message, though not necessary :)
sock.close()
os.remove(jsonpath)
if delete:
os.remove(jsonpath)
Problem
This is running in Docker
I have trunk-recorder running with an upload-liquidsoap.py, but liquidsoap isn't doing anything with the wav file being sent. I am not getting any audio on my broadcastify feed even though it is connected and online. If there is any additional information needed, please let me know.
Logs
upload-liquidsoap.py
docker-compose.yaml
The text was updated successfully, but these errors were encountered: