record if prio = 2

This commit is contained in:
deflax 2024-01-17 03:13:45 +02:00
parent be3b09d3a3
commit b887707450
3 changed files with 19 additions and 9 deletions

View file

@ -10,6 +10,10 @@ Multi channel stream setup with Flask REST API for scheduling channels.
5. Access the admin panel at `https://stream.example.com/ui` 5. Access the admin panel at `https://stream.example.com/ui`
6. Access the recordings gallery at `https://vod.example.com/` 6. Access the recordings gallery at `https://vod.example.com/`
## purge vod database ### stream priorities
prio = 0 - scheduled
prio = 1 - live
prio = 2 - live and vod recording
### purge vod database
`docker exec -ti television_archive_1 /app/gallery.js storage --storage /data/storage --database /data/config/database.db -l debug purge` `docker exec -ti television_archive_1 /app/gallery.js storage --storage /data/storage --database /data/config/database.db -l debug purge`

View file

@ -46,8 +46,10 @@ async def epg(ctx):
await ctx.channel.send('epg:') await ctx.channel.send('epg:')
if database != {}: if database != {}:
for key, value in database.items(): for key, value in database.items():
if value['start_at'] != 'now' and value['start_at'] != 'never': item_name = value['name']
await ctx.channel.send(f'{value['name']} starts at {value['start_at']}h UTC') item_start = value['start_at']
if item_start != 'now' and item_start != 'never':
await ctx.channel.send(f'{item_name} starts at {item_start}h UTC')
else: else:
await ctx.channel.send('Empty database!') await ctx.channel.send('Empty database!')
@ -67,7 +69,10 @@ async def update_database():
for key, value in database.items(): for key, value in database.items():
if value['start_at'] == 'now': if value['start_at'] == 'now':
scheduler.add_job(func=announce_live_channel, seconds=60, id='announce_live_channel') scheduler.add_job(func=announce_live_channel, seconds=60, id='announce_live_channel')
return
scheduler.remove_job('announce_live_channel')
live_channel = bot.get_channel(announce_channel_id)
await live_channel.send(f'{announce_channel_id} removed')
async def announce_live_channel(): async def announce_live_channel():
if announce_channel_id == 'disabled': if announce_channel_id == 'disabled':

View file

@ -76,6 +76,7 @@ def process_running_channel(database, scheduler, stream_id, stream_name, stream_
logger_job.error(f'Stream {stream_name} cancelled after {req_counter} attempts.') logger_job.error(f'Stream {stream_name} cancelled after {req_counter} attempts.')
return return
scheduler.add_job(func=exec_stream, id=stream_id, args=(stream_id, stream_name, stream_prio, stream_hls_url)) scheduler.add_job(func=exec_stream, id=stream_id, args=(stream_id, stream_name, stream_prio, stream_hls_url))
if stream_prio == 2:
rec_id = f'rec_{stream_id}' rec_id = f'rec_{stream_id}'
scheduler.add_job(func=exec_recorder, id=rec_id, args=(stream_id, stream_hls_url)) scheduler.add_job(func=exec_recorder, id=rec_id, args=(stream_id, stream_hls_url))
else: else: