add live channels in EPG

This commit is contained in:
deflax 2024-01-17 05:56:11 +02:00
parent 1ae4482092
commit f4dc5c9c95

View file

@ -52,12 +52,16 @@ async def epg(ctx):
global database global database
await ctx.channel.send('epg:') await ctx.channel.send('epg:')
if database != {}: if database != {}:
epg_list = "" scheduled_list = ""
live_list = ""
for key, value in database.items(): for key, value in database.items():
item_name = value['name'] item_name = value['name']
item_start = value['start_at'] item_start = value['start_at']
if item_start != 'now' and item_start != 'never': if item_start != 'now' and item_start != 'never':
epg_list += f'- {item_name} starts at {item_start}:00 UTC\n' scheduled += f'- {item_name} starts at {item_start}:00 UTC\n'
else:
live_list += f'- {item_name} is LIVE\n'
epg_list = live_list + scheduled_list
await ctx.channel.send(f'```{epg_list}```') await ctx.channel.send(f'```{epg_list}```')
else: else:
await ctx.channel.send('Empty database!') await ctx.channel.send('Empty database!')