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",
|
"name": "Deflax Records",
|
||||||
"start_at": "now",
|
"start_at": "now",
|
||||||
"prio": 2
|
"prio": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Deflax Mobile",
|
"name": "Deflax Mobile",
|
||||||
"start_at": "now",
|
"start_at": "now",
|
||||||
"prio": 2
|
"prio": 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -261,7 +261,7 @@ def hls_converter():
|
||||||
if entry.lower().endswith('.mp4'):
|
if entry.lower().endswith('.mp4'):
|
||||||
input_file = file_path
|
input_file = file_path
|
||||||
break
|
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:
|
except Exception as e:
|
||||||
logger_job.error(e)
|
logger_job.error(e)
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import asyncio
|
|
||||||
import os
|
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
import os
|
||||||
|
import asyncio
|
||||||
|
import logging
|
||||||
|
import subprocess
|
||||||
import requests
|
import requests
|
||||||
import discord
|
import discord
|
||||||
from discord.ext.commands import Bot, has_permissions, CheckFailure, has_role, MissingRole
|
from discord.ext.commands import Bot, has_permissions, CheckFailure, has_role, MissingRole
|
||||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||||
import logging
|
|
||||||
|
|
||||||
# Read env variables
|
# Read env variables
|
||||||
bot_token = os.environ.get('DISCORDBOT_TOKEN', 'token')
|
bot_token = os.environ.get('DISCORDBOT_TOKEN', 'token')
|
||||||
|
@ -25,6 +26,7 @@ intents.message_content = True
|
||||||
# Discord client
|
# Discord client
|
||||||
bot = Bot(command_prefix=".", intents=intents)
|
bot = Bot(command_prefix=".", intents=intents)
|
||||||
worshipper_role_name = "worshipper"
|
worshipper_role_name = "worshipper"
|
||||||
|
boss_role_name = "bosmang"
|
||||||
|
|
||||||
# Scheduler
|
# Scheduler
|
||||||
scheduler = AsyncIOScheduler()
|
scheduler = AsyncIOScheduler()
|
||||||
|
@ -56,6 +58,10 @@ async def hello_error(ctx, error):
|
||||||
author_name = ctx.author.name
|
author_name = ctx.author.name
|
||||||
await ctx.channel.send(f'do I know you, `{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')
|
@bot.command(name='epg', help='Lists scheduled streams')
|
||||||
async def epg(ctx):
|
async def epg(ctx):
|
||||||
global database
|
global database
|
||||||
|
@ -75,15 +81,23 @@ async def epg(ctx):
|
||||||
else:
|
else:
|
||||||
await ctx.channel.send('```Empty.```')
|
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')
|
@bot.command(name='now', help='Displays whats playing right now')
|
||||||
async def now(ctx):
|
async def now(ctx):
|
||||||
head = await query_playhead()
|
head = await query_playhead()
|
||||||
await ctx.channel.send(head)
|
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():
|
async def query_playhead():
|
||||||
head_url = f'https://{scheduler_hostname}/playhead'
|
head_url = f'https://{scheduler_hostname}/playhead'
|
||||||
if requests.get(head_url).status_code == 200:
|
if requests.get(head_url).status_code == 200:
|
||||||
|
|
Loading…
Add table
Reference in a new issue