Radio restart serverside

This commit is contained in:
2024-06-19 17:46:38 +02:00
parent 8a99ee7c99
commit 0f49cb89a3
4 changed files with 61 additions and 11 deletions
+7
View File
@@ -0,0 +1,7 @@
enable=all
source-path=SCRIPTDIR
disable=SC2154
# If you're having issues with shellcheck following source, disable the errors via:
# disable=SC1090
# disable=SC1091
+15 -11
View File
@@ -2,34 +2,38 @@
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.20.1
version: 1.22.2
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.4.5
ref: v1.6.0
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- go@1.21.0
- node@18.12.1
- python@3.10.8
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
enabled:
- actionlint@1.6.27
- bandit@1.7.8
- black@24.3.0
- shellcheck@0.10.0
- shfmt@3.6.0
- taplo@0.8.1
- actionlint@1.7.1
- bandit@1.7.9
- black@24.4.2
- codespell
- checkov@3.2.48
- checkov@3.2.139
- git-diff-check
- isort@5.13.2
- pylint
- markdownlint@0.39.0
- prettier@3.2.5
- ruff@0.3.4
- trivy@0.50.1
- trufflehog@3.71.0
- markdownlint@0.41.0
- prettier@3.3.2
- ruff@0.4.9
- trivy@0.52.2
- trufflehog@3.78.1
- yamllint@1.35.1
actions:
disabled:
+32
View File
@@ -19,6 +19,7 @@ import shutil
import sys
import threading
import uuid
import subprocessS
from datetime import datetime
from logging import handlers
from pathlib import Path, PurePath
@@ -1345,6 +1346,37 @@ async def max_weight(lista):
# *=========================================== Define Commands
@client.hybrid_command(
name="skip_track",
description="Przeskocz kawałek w radiu",
guild=discord.Object(id=664789470779932693),
)
async def skip_track(ctx):
with ctx.typing():
allowed = False
for role in ctx.author.roles:
if role.name == "Thane":
allowed = True
if not allowed:
await ctx.send("Łapy precz od radia")
@client.hybrid_command(
name="zrestartuj_radio",
description="Komenda ktora uruchamia radio ponownie jakby się zawiesiło",
guild=discord.Object(id=664789470779932693),
)
async def zrestartuj_radio(ctx):
with ctx.typing():
allowed = False
for role in ctx.author.roles:
if role.name == "Thane":
allowed = True
if not allowed:
await ctx.send("Łapy precz od radia")
else:
subprocess.call(['sh', './restart_radio.sh'])
@client.hybrid_command(
name="dej_co_ze_spotifaja",
+7
View File
@@ -102,6 +102,13 @@ radio = fallback(id="switcher2", track_sensitive=false, [s, emergency])
# Set up an interactive control for skipping tracks
p = interactive.bool("Skip track", false)
def http_skip(_):
radio.skip()
http.response(data="Skipped")
end
harbor.http.register.simple(port=54321, "/skip", http_skip)
# Function to process the request queue and skip the current track if requested
def check_skip()
if p() then