Short modifications

This commit is contained in:
insert 2025-01-12 00:34:43 -05:00
parent 404328b07c
commit 35c9bda23f
Signed by: insert
GPG key ID: A70775C389ACF105
4 changed files with 10 additions and 5 deletions

View file

@ -1,5 +1,6 @@
TOKEN=""
GUILD_ID=""
QUEUE_PATH=""
MAX_MIN="8"
MAX_QUEUE="5"
ALLOW_SKIP="TRUE"

4
.gitignore vendored
View file

@ -32,6 +32,8 @@ share/python-wheels/
*.mp4
*.vtt
testing/
*.db
next*
MANIFEST
# PyInstaller
@ -129,7 +131,7 @@ celerybeat.pid
# Environments
.env
.venv
.*venv
env/
venv/
ENV/

View file

@ -19,7 +19,8 @@ import sqlite3
if len(sys.argv) > 1:
if sys.argv[1] == "--clear-queue":
os.remove("queue.db")
if os.path.isfile(os.getenv("QUEUE_PATH","queue.db")):
os.remove(os.getenv("QUEUE_PATH","queue.db"))
print("Queue cleared!")
load_dotenv()
@ -34,7 +35,7 @@ vid_dir = Path(temp_dir.name)
download_dir = TemporaryDirectory()
full_dl_dir = Path(download_dir.name)
vid_details = {"title": "", "channel": ""}
con = sqlite3.connect("queue.db", check_same_thread=False)
con = sqlite3.connect(os.getenv("QUEUE_PATH","queue.db"), check_same_thread=False)
cur = con.cursor()
def countuser(usrid):
@ -264,7 +265,7 @@ async def stats(inter: disnake.AppCmdInter):
message = message + f"Link: <{queue[0]}>\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") == "TRUE"):
if inter.permissions.moderate_members:
res = cur.execute(f"SELECT user FROM queue WHERE hasplayed = true AND link = '{queue[0]}'")
res = res.fetchall() #We can't gaurentee the result so just show likely possibilites
message = message + f"Users who have queued this video: "
@ -601,4 +602,5 @@ bot.run(os.getenv("TOKEN"))
print("cleaning up tempdir")
temp_dir.cleanup()
download_dir.cleanup()
con.close()
obs.set_current_program_scene("nosignal")

View file

@ -10,8 +10,8 @@ pkgs.mkShell {
pkgs.python311Packages.python-dotenv
pkgs.python311Packages.venvShellHook
pkgs.ffmpeg
pkgs.icewm
pkgs.discord
pkgs.mpv
];
venvDir = "./.venv";
}