Renamed some dumb variables, started wishlist
This commit is contained in:
parent
0034708091
commit
d72320aae4
2 changed files with 20 additions and 12 deletions
|
|
@ -11,7 +11,6 @@ parser.add_argument('-p','--port',help="Port to host on, not the same as the web
|
||||||
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="")
|
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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
portTheUserPicked=args.port
|
portTheUserPicked=args.port
|
||||||
# Just a note that the return code "401" as of now is used to mean "you don't have the password"
|
# 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
|
# This is not great design, and the whole "returning string codes" thing is something to add to the todo list
|
||||||
|
|
@ -59,8 +58,8 @@ songNext = None
|
||||||
skipNow = False
|
skipNow = False
|
||||||
playlist = []
|
playlist = []
|
||||||
playlistLock = threading.Lock()
|
playlistLock = threading.Lock()
|
||||||
fakeplayer = vlc.Instance()
|
vlcInstance = vlc.Instance()
|
||||||
player = fakeplayer.media_player_new()
|
player = vlcInstance.media_player_new()
|
||||||
# for client side volume to work as well as possible, set system volume to 100 and control in app
|
# for client side volume to work as well as possible, set system volume to 100 and control in app
|
||||||
player.audio_set_volume(100)
|
player.audio_set_volume(100)
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
@ -77,17 +76,17 @@ def playQueuedSongs():
|
||||||
global partyMode
|
global partyMode
|
||||||
while True:
|
while True:
|
||||||
with playlistLock:
|
with playlistLock:
|
||||||
z = str(player.get_state())
|
playerState = str(player.get_state())
|
||||||
|
endStates = ["State.Ended","State.Stopped","State.NothingSpecial"]
|
||||||
if playlist and (z == "State.Ended" or z== "State.Stopped" or z == "State.NothingSpecial" or skipNow == True):
|
if playlist and (playerState in endStates or skipNow == True):
|
||||||
# New song is in the queue and (the previous song is over or skip has been pressed)
|
# New song is in the queue and (the previous song is over or skip has been pressed)
|
||||||
player.stop()
|
player.stop()
|
||||||
skipNow = False
|
skipNow = False
|
||||||
songNext = playlist.pop(0)
|
songNext = playlist.pop(0)
|
||||||
media = fakeplayer.media_new(soundLocation+songNext)
|
media = vlcInstance.media_new(soundLocation+songNext)
|
||||||
player.set_media(media)
|
player.set_media(media)
|
||||||
player.play()
|
player.play()
|
||||||
elif (skipNow==True or (z == "State.Ended" or z == "State.NothingSpecial" or z=="State.Stopped")):
|
elif (skipNow==True or (playerState in endStates)):
|
||||||
# skip was pressed and there are no new songs
|
# skip was pressed and there are no new songs
|
||||||
skipNow=False
|
skipNow=False
|
||||||
songNext = None
|
songNext = None
|
||||||
|
|
@ -112,7 +111,6 @@ queueThread.start()
|
||||||
def playerControls():
|
def playerControls():
|
||||||
# recieve control inputs (play/pause and skip) from the webUI
|
# recieve control inputs (play/pause and skip) from the webUI
|
||||||
global skipNow
|
global skipNow
|
||||||
global media
|
|
||||||
global partyMode
|
global partyMode
|
||||||
recieveData=request.get_json(force=True)
|
recieveData=request.get_json(force=True)
|
||||||
if recieveData["control"] != None:
|
if recieveData["control"] != None:
|
||||||
|
|
@ -153,8 +151,6 @@ def settingsControl():
|
||||||
else:
|
else:
|
||||||
return ERR_NO_ADMIN
|
return ERR_NO_ADMIN
|
||||||
elif recieveData["setting"] == "perms":
|
elif recieveData["setting"] == "perms":
|
||||||
# print(ADMIN_PASS)
|
|
||||||
# print(recieveData["password"])
|
|
||||||
if ADMIN_PASS == recieveData["password"] and ADMIN_PASS:
|
if ADMIN_PASS == recieveData["password"] and ADMIN_PASS:
|
||||||
#if an adminpass doesn't exist these perms can never be changed
|
#if an adminpass doesn't exist these perms can never be changed
|
||||||
controlPerms = recieveData["admin"]
|
controlPerms = recieveData["admin"]
|
||||||
|
|
@ -201,7 +197,7 @@ def songadd():
|
||||||
queueSong(recieveData['song'])
|
queueSong(recieveData['song'])
|
||||||
return "200"
|
return "200"
|
||||||
else:
|
else:
|
||||||
# Pass exists, or this action isn't restricted
|
# Pass exists, and the action is restricted
|
||||||
return ERR_NO_ADMIN
|
return ERR_NO_ADMIN
|
||||||
|
|
||||||
@app.route("/playlist", methods=["POST"])
|
@app.route("/playlist", methods=["POST"])
|
||||||
|
|
|
||||||
12
wishlist.md
Normal file
12
wishlist.md
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
## Wishlist
|
||||||
|
*Features I would like to add, will be completed in any order*
|
||||||
|
- [x] Admin password
|
||||||
|
* Allows restricting certain features and changing permissions on the fly on the client
|
||||||
|
- [ ] Refactoring existing code
|
||||||
|
- [ ] Update the SQL -> Server -> Client pipeline when searching and building playlist
|
||||||
|
- [ ] Secure Password
|
||||||
|
* Actually use SSL for stuff that should be using it
|
||||||
|
- [ ] GUI update for client
|
||||||
|
- [ ] Google material design??
|
||||||
|
- [ ] Dark mode?
|
||||||
|
- [ ] New Icons
|
||||||
Loading…
Add table
Add a link
Reference in a new issue