expose rechead json
This commit is contained in:
parent
6b36db48aa
commit
19271fe016
|
@ -86,7 +86,7 @@ async def query_playhead():
|
||||||
logger_discord.error('Cannot connect to the playhead!')
|
logger_discord.error('Cannot connect to the playhead!')
|
||||||
head_name = playhead['name']
|
head_name = playhead['name']
|
||||||
head_prio = playhead['prio']
|
head_prio = playhead['prio']
|
||||||
return f'```Now playing {head_name}. Priority={head_prio}```'
|
return f'```Now playing {head_name}. priority={head_prio}```'
|
||||||
|
|
||||||
async def query_database():
|
async def query_database():
|
||||||
global database
|
global database
|
||||||
|
|
|
@ -30,9 +30,9 @@ enable_delay = 24
|
||||||
|
|
||||||
# Init
|
# Init
|
||||||
database = {}
|
database = {}
|
||||||
prio = 0
|
|
||||||
playhead = {}
|
playhead = {}
|
||||||
rechead = ""
|
rechead = {}
|
||||||
|
prio = 0
|
||||||
|
|
||||||
with open('/config/epg.json', 'r') as epg_json:
|
with open('/config/epg.json', 'r') as epg_json:
|
||||||
epg = json.load(epg_json)
|
epg = json.load(epg_json)
|
||||||
|
@ -165,11 +165,12 @@ def exec_recorder(stream_id, stream_hls_url):
|
||||||
global rechead
|
global rechead
|
||||||
current_datetime = datetime.now().strftime("%Y-%m-%d_%H-%M-%S-%f")
|
current_datetime = datetime.now().strftime("%Y-%m-%d_%H-%M-%S-%f")
|
||||||
output_file = current_datetime + ".mp4"
|
output_file = current_datetime + ".mp4"
|
||||||
if rechead != "":
|
if rechead != {}:
|
||||||
logger_job.error('Recorder is already started. Refusing to start another job.')
|
logger_job.error('Recorder is already started. Refusing to start another job.')
|
||||||
else:
|
else:
|
||||||
logger_job.warning(f'Recording {output_file} started.')
|
logger_job.warning(f'Recording {output_file} started.')
|
||||||
rechead = stream_id
|
rechead = { 'id': stream_id,
|
||||||
|
'file': output_file }
|
||||||
output = f'{rec_path}/live/{output_file}'
|
output = f'{rec_path}/live/{output_file}'
|
||||||
ffmpeg = (
|
ffmpeg = (
|
||||||
FFmpeg()
|
FFmpeg()
|
||||||
|
@ -186,7 +187,7 @@ def exec_recorder(stream_id, stream_hls_url):
|
||||||
ffmpeg.execute()
|
ffmpeg.execute()
|
||||||
logger_job.warning(f'Recording {output_file} finished. Moving file to {rec_path}/vod')
|
logger_job.warning(f'Recording {output_file} finished. Moving file to {rec_path}/vod')
|
||||||
os.rename(f'{rec_path}/live/{output_file}', f'{rec_path}/vod/{output_file}')
|
os.rename(f'{rec_path}/live/{output_file}', f'{rec_path}/vod/{output_file}')
|
||||||
rechead = ""
|
rechead = {}
|
||||||
|
|
||||||
# Datarhei CORE API sync
|
# Datarhei CORE API sync
|
||||||
def core_api_sync():
|
def core_api_sync():
|
||||||
|
@ -261,6 +262,11 @@ def playhead_route():
|
||||||
global playhead
|
global playhead
|
||||||
return jsonify(playhead)
|
return jsonify(playhead)
|
||||||
|
|
||||||
|
@app.route('/rechead', methods=['GET'])
|
||||||
|
def rechead_route():
|
||||||
|
global rechead
|
||||||
|
return jsonify(rechead)
|
||||||
|
|
||||||
@app.route('/database', methods=['GET'])
|
@app.route('/database', methods=['GET'])
|
||||||
def database_route():
|
def database_route():
|
||||||
global database
|
global database
|
||||||
|
|
Loading…
Reference in a new issue