Define the rec command
This commit is contained in:
parent
246de32ee9
commit
98efbdb0fd
6 changed files with 26 additions and 12 deletions
|
@ -17,11 +17,11 @@
|
|||
{
|
||||
"name": "Deflax Records",
|
||||
"start_at": "now",
|
||||
"prio": 2
|
||||
"prio": 1
|
||||
},
|
||||
{
|
||||
"name": "Deflax Mobile",
|
||||
"start_at": "now",
|
||||
"prio": 2
|
||||
"prio": 1
|
||||
}
|
||||
]
|
||||
|
|
|
@ -261,7 +261,7 @@ def hls_converter():
|
|||
if entry.lower().endswith('.mp4'):
|
||||
input_file = file_path
|
||||
break
|
||||
logger_job.warning(f'{input_file} found. Converting to HLS...')
|
||||
#logger_job.warning(f'{input_file} found. Converting to HLS...')
|
||||
|
||||
except Exception as e:
|
||||
logger_job.error(e)
|
||||
|
|
|
@ -8,4 +8,4 @@ Jinja2==3.1.5
|
|||
MarkupSafe==3.0.2
|
||||
waitress==3.0.2
|
||||
Werkzeug==3.1.3
|
||||
python-ffmpeg==2.0.12
|
||||
python-ffmpeg==2.0.12
|
|
@ -1,11 +1,12 @@
|
|||
import asyncio
|
||||
import os
|
||||
from datetime import datetime, timezone
|
||||
import os
|
||||
import asyncio
|
||||
import logging
|
||||
import subprocess
|
||||
import requests
|
||||
import discord
|
||||
from discord.ext.commands import Bot, has_permissions, CheckFailure, has_role, MissingRole
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
import logging
|
||||
|
||||
# Read env variables
|
||||
bot_token = os.environ.get('DISCORDBOT_TOKEN', 'token')
|
||||
|
@ -25,6 +26,7 @@ intents.message_content = True
|
|||
# Discord client
|
||||
bot = Bot(command_prefix=".", intents=intents)
|
||||
worshipper_role_name = "worshipper"
|
||||
boss_role_name = "bosmang"
|
||||
|
||||
# Scheduler
|
||||
scheduler = AsyncIOScheduler()
|
||||
|
@ -56,6 +58,10 @@ async def hello_error(ctx, error):
|
|||
author_name = ctx.author.name
|
||||
await ctx.channel.send(f'do I know you, `{author_name}`?')
|
||||
|
||||
@bot.command(name='time', help='Show current time')
|
||||
async def time(ctx):
|
||||
await ctx.channel.send(f'The time is: `{datetime.now(timezone.utc)} UTC`')
|
||||
|
||||
@bot.command(name='epg', help='Lists scheduled streams')
|
||||
async def epg(ctx):
|
||||
global database
|
||||
|
@ -74,16 +80,24 @@ async def epg(ctx):
|
|||
await ctx.channel.send(f'```{live_list}```')
|
||||
else:
|
||||
await ctx.channel.send('```Empty.```')
|
||||
|
||||
@bot.command(name='time', help='Show current time')
|
||||
async def time(ctx):
|
||||
await ctx.channel.send(f'The time is: `{datetime.now(timezone.utc)} UTC`')
|
||||
|
||||
@bot.command(name='now', help='Displays whats playing right now')
|
||||
async def now(ctx):
|
||||
head = await query_playhead()
|
||||
await ctx.channel.send(head)
|
||||
|
||||
@bot.command(name='rec', help='Start the recorder')
|
||||
@has_role(boss_role_name)
|
||||
async def rec(ctx):
|
||||
await ctx.channel.send(f'soon...')
|
||||
|
||||
@rec.error
|
||||
async def rec_error(ctx, error):
|
||||
if isinstance(error, CheckFailure):
|
||||
author_name = ctx.author.name
|
||||
await ctx.channel.send(f'{author_name} access denied')
|
||||
|
||||
# Helper functions
|
||||
async def query_playhead():
|
||||
head_url = f'https://{scheduler_hostname}/playhead'
|
||||
if requests.get(head_url).status_code == 200:
|
||||
|
|
|
@ -13,4 +13,4 @@ RUN useradd radio ;\
|
|||
|
||||
ADD ./start.sh /start.sh
|
||||
|
||||
CMD ["/start.sh"]
|
||||
CMD ["/start.sh"]
|
Loading…
Add table
Reference in a new issue