From 0aab1dffddfe2b6684ec05154cfc1ede695d4db2 Mon Sep 17 00:00:00 2001 From: insert Date: Sat, 19 Oct 2024 08:28:11 -0400 Subject: [PATCH] fix stats, add files to help with setup --- .env.example | 8 ++++++++ newbot.py | 6 ++++-- requirements.txt | 2 ++ shell.nix | 1 + wm.sh | 5 +++++ 5 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 .env.example create mode 100644 requirements.txt create mode 100755 wm.sh diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..e01f8d1 --- /dev/null +++ b/.env.example @@ -0,0 +1,8 @@ +TOKEN="" +GUILD_ID="" +MAX_MIN="8" +MAX_QUEUE="5" +ALLOW_SKIP="TRUE" +PERMANENT_MAX_QUEUE="FALSE" +LOCK_SHUFFLE="FALSE" +PROXY="socks5://your-proxy-here-or-comment-out-the-line-in-newbot.py" \ No newline at end of file diff --git a/newbot.py b/newbot.py index d0833f1..07546c9 100644 --- a/newbot.py +++ b/newbot.py @@ -228,7 +228,7 @@ async def stats(inter: disnake.AppCmdInter): message = message + f"Title: {nowplaying.input_settings['text']}\n" playing = obs.get_media_input_status("player") message = message + f"Video Duration: {str(datetime.timedelta(seconds=(round(playing.media_cursor/1000))))}/{str(datetime.timedelta(seconds=(round(playing.media_duration/1000))))}\n" - if inter.permissions.moderate_members and not os.getenv("PERMANENT_MAX_QUEUE",False): + if inter.permissions.moderate_members and not (os.getenv("PERMANENT_MAX_QUEUE","FALSE") == "TRUE"): message = message + f"Queued by <@{user_queue[0]}>" await inter.edit_original_response(message) @@ -530,6 +530,7 @@ async def ensurewaiting(): if playing.media_cursor == None: obs.set_current_program_scene("error") if len(os.listdir(full_dl_dir)) == 0 and len(queue) >= 1: #just in case + loop = asyncio.get_running_loop() await loop.run_in_executor(None, download_video, 0) @tasks.loop(seconds=5) @@ -548,4 +549,5 @@ async def titlehandler(): bot.run(os.getenv("TOKEN")) print("cleaning up tempdir") temp_dir.cleanup() -download_dir.cleanup() \ No newline at end of file +download_dir.cleanup() +obs.set_current_program_scene("nosignal") \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..731a58e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +disnake +obsws_python \ No newline at end of file diff --git a/shell.nix b/shell.nix index 798cc3f..6f714fd 100644 --- a/shell.nix +++ b/shell.nix @@ -10,6 +10,7 @@ pkgs.mkShell { pkgs.python311Packages.python-dotenv pkgs.python311Packages.venvShellHook pkgs.ffmpeg + pkgs.icewm pkgs.discord ]; venvDir = "./.venv"; diff --git a/wm.sh b/wm.sh new file mode 100755 index 0000000..bcfbb3d --- /dev/null +++ b/wm.sh @@ -0,0 +1,5 @@ +Xwayland -geometry 1920x1080 -fullscreen :12 & +sleep 2 +DISPLAY=:12 icewm --display=:12 & +env -u WAYLAND_DISPLAY DISPLAY=:12 obs --disable-shutdown-check --startstreaming --startvirtualcam --multi --disable-missing-files-check --scene nosignal & +env DISPLAY=:12 vlc -f srt://127.0.0.1:9999?transtype=live