Using dotenv, refactored some stuff, made making database slightly faster with art
This commit is contained in:
parent
0cd6b4ce2e
commit
5772edf88a
4 changed files with 30 additions and 26 deletions
|
|
@ -2,14 +2,14 @@ from flask import Flask
|
|||
from flask import request
|
||||
from flask_cors import CORS
|
||||
import sqlite3 as sql
|
||||
import vlc,threading,time,random, argparse
|
||||
import vlc,threading,time,random,argparse,dotenv,os
|
||||
# Argparse Stuff
|
||||
parser=argparse.ArgumentParser(description="Options for the Webby Bits")
|
||||
parser.add_argument('-p','--port',help="Port to host on, not the same as the web (client) port",default='19054')
|
||||
# parser.add_argument('-p','--port',help="Port to host on, not the same as the web (client) port",default='19054')
|
||||
parser.add_argument('-a','--admin',help="Add an admin password to be used in the client. DO NOT use a password you use elsewhere",default="")
|
||||
args = parser.parse_args()
|
||||
|
||||
portTheUserPicked=args.port
|
||||
dotenv.load_dotenv()
|
||||
portTheUserPicked=os.getenv("SERVER_PORT")
|
||||
# Just a note that the return code "401" as of now is used to mean "you don't have the password"
|
||||
# This is not great design, and the whole "returning string codes" thing is something to add to the todo list
|
||||
# I mean returning 200 when no return is necesary i think is fine but we'll see
|
||||
|
|
@ -20,11 +20,11 @@ if not(ADMIN_PASS):
|
|||
# True = everyone, False = admin only. Change in client while in use.
|
||||
# play-pause,skip,addsong,partymode,volume in order
|
||||
controlPerms = {
|
||||
"PP":True, #done
|
||||
"SK":True, #done
|
||||
"AS":True, #done
|
||||
"PM":True, #done
|
||||
"VOL":True #done
|
||||
"PP":True,
|
||||
"SK":True,
|
||||
"AS":True,
|
||||
"PM":True,
|
||||
"VOL":True
|
||||
}
|
||||
|
||||
fileofDB = sql.connect("songDatabase.db")
|
||||
|
|
@ -150,8 +150,7 @@ def settingsControl():
|
|||
return ERR_NO_ADMIN
|
||||
elif recieveData["setting"] == "getsettings":
|
||||
# probably should have made this a different request type or something but it works
|
||||
x = {"partymode":partyMode,"volume":player.audio_get_volume(),"admin":controlPerms}
|
||||
return x
|
||||
return {"partymode":partyMode,"volume":player.audio_get_volume(),"admin":controlPerms}
|
||||
else:
|
||||
return "400"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue