From 42e78ca9777bf77fe5696af01ca90e9bf80bfb4c Mon Sep 17 00:00:00 2001 From: Kristy Fournier <124598538+kristy-fournier@users.noreply.github.com> Date: Thu, 6 Mar 2025 10:14:17 -0500 Subject: [PATCH 1/8] Empty search error displayed --- Client/scripts.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Client/scripts.js b/Client/scripts.js index fe09161..2aa73c7 100644 --- a/Client/scripts.js +++ b/Client/scripts.js @@ -95,7 +95,6 @@ function searchSongsEnter(e) { async function searchSongs(searchTerm){ let optionslist = [] - document.getElementById("songlist").innerHTML = "" searchResults = await getFromServer({search:searchTerm},"search").then() //generate the visual song list @@ -124,7 +123,7 @@ async function searchSongs(searchTerm){ document.getElementById("songlist").appendChild(newItem); } - if (searchResults.length == 0) { + if (JSON.stringify(searchResults)==JSON.stringify({})) { //display error if no results document.getElementById("songlist").innerHTML = "

We might not have that one...

"; } -- 2.49.1 From 48d4577c5305037ac1caaeda407c06f1756a66f0 Mon Sep 17 00:00:00 2001 From: Kristy Fournier <124598538+kristy-fournier@users.noreply.github.com> Date: Thu, 6 Mar 2025 10:22:12 -0500 Subject: [PATCH 2/8] made a few more items per line visible on desktop --- Client/styles.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Client/styles.css b/Client/styles.css index 8857c11..59ac410 100644 --- a/Client/styles.css +++ b/Client/styles.css @@ -74,7 +74,7 @@ h4 { /* Songlist stuff */ .songlist { - width: 60%; + width: 70%; min-width: 300px; margin:auto auto 150px; display: flex; @@ -84,7 +84,7 @@ h4 { .songlist > .item{ border: 1px solid #333333; width:30%; - max-width: 200px; + max-width: 150px; margin: 5px auto; min-width: 100px; background-color: inherit; -- 2.49.1 From 7505bc28d3df6598921661c50d68ca49b6c62f98 Mon Sep 17 00:00:00 2001 From: Kristy Fournier <124598538+kristy-fournier@users.noreply.github.com> Date: Thu, 6 Mar 2025 10:45:51 -0500 Subject: [PATCH 3/8] Volume cannot be changed when player isn't playing --- Client/scripts.js | 9 +++++++-- Client/styles.css | 4 ++-- Server/webbyBits.py | 24 ++++++++++++++---------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Client/scripts.js b/Client/scripts.js index 2aa73c7..bf0f463 100644 --- a/Client/scripts.js +++ b/Client/scripts.js @@ -170,6 +170,7 @@ function ipSetter(){ async function checkSettings(skipServer=false) { //check client stuff first so if the server doesn't exist it can still be changed and seen if (ip.slice(-5)=="19054") { + // don't show the port if it is the default document.getElementById("iptextbox").value = ip.slice(0,-6) } else { document.getElementById("iptextbox").value = ip; @@ -309,8 +310,12 @@ document.getElementById("playlist-mode").style.display = "none"; document.getElementById("settings-mode").style.display = "none"; //.ontouch for mobile?? document.getElementById("volumerange").onchange = function() { - getFromServer({setting:"volume",level:this.value}, "settings") - if (this.value == 0) { + let returnValue = getFromServer({setting:"volume",level:this.value}, "settings") + if (returnValue !=0) { + alertText("Nothing is playing") + document.getElementById("volumerange").value = -1 + } + else if (this.value == 0) { alertText("The volume is now set to 0 (Pause?)") } else { alertText("The volume is now set to " + this.value.toString()) diff --git a/Client/styles.css b/Client/styles.css index 59ac410..bfcd94d 100644 --- a/Client/styles.css +++ b/Client/styles.css @@ -74,7 +74,7 @@ h4 { /* Songlist stuff */ .songlist { - width: 70%; + width: 80%; min-width: 300px; margin:auto auto 150px; display: flex; @@ -86,7 +86,7 @@ h4 { width:30%; max-width: 150px; margin: 5px auto; - min-width: 100px; + min-width: 75px; background-color: inherit; } diff --git a/Server/webbyBits.py b/Server/webbyBits.py index d645bb2..3251649 100644 --- a/Server/webbyBits.py +++ b/Server/webbyBits.py @@ -97,10 +97,11 @@ def playerControls(): def settingsControl(): # set the volume and partymode global partyMode + global player recieveData = request.get_json(force=True) if recieveData["setting"] == "volume": - player.audio_set_volume(int(recieveData["level"])) - return "200" + volumePassed = player.audio_set_volume(int(recieveData["level"])) + return {"volumePassed":volumePassed} elif recieveData["setting"] == "partymode-toggle": partyMode = not(partyMode) return "200" @@ -117,15 +118,18 @@ def searchSongDB(): # the way i put the data in a list was really dumb looking back, i could and should have used a list of dictioaries like i was before # i might try to change it but this layout is embedded deep in the client tempData = {} - for i in songDatabaseList["songData"]: - if ((songDatabaseList["songData"][i]["title"].lower().find(recieveData['search'].lower())) > -1) or (recieveData['search'] == ""): - tempData[i] = songDatabaseList["songData"][i] - - try: - if (songDatabaseList["songData"][i]["artist"].lower().find(recieveData['search'].lower()) > -1): + if (recieveData['search'] == ""): + tempData = songDatabaseList["songData"].copy() + else: + for i in songDatabaseList["songData"]: + if ((songDatabaseList["songData"][i]["title"].lower().find(recieveData['search'].lower())) > -1): tempData[i] = songDatabaseList["songData"][i] - except: - pass + + try: + if (songDatabaseList["songData"][i]["artist"].lower().find(recieveData['search'].lower()) > -1): + tempData[i] = songDatabaseList["songData"][i] + except: + pass # print(tempData) return tempData -- 2.49.1 From 49d50462ab92a1000d674aaa34e4b49418bc8f24 Mon Sep 17 00:00:00 2001 From: Kristy Fournier <124598538+kristy-fournier@users.noreply.github.com> Date: Thu, 6 Mar 2025 11:24:06 -0500 Subject: [PATCH 4/8] made the qrcode generator a function its now called when the ip is changed too, so you don't need to refresh --- Client/index.html | 1 + Client/scripts.js | 31 ++++++++++++++----------------- Client/styles.css | 7 +++++++ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/Client/index.html b/Client/index.html index c2f2400..b56f759 100644 --- a/Client/index.html +++ b/Client/index.html @@ -86,6 +86,7 @@ changes visibility with JS-->

Hit settings icon to refresh the code

+

Version 1.0.0

diff --git a/Client/scripts.js b/Client/scripts.js index bf0f463..e543aa6 100644 --- a/Client/scripts.js +++ b/Client/scripts.js @@ -164,17 +164,11 @@ function ipSetter(){ alertText("Your IP is now set to "+ipBox+" at port 19054 (Default)") } } + qrCodeGenerate() } -async function checkSettings(skipServer=false) { - //check client stuff first so if the server doesn't exist it can still be changed and seen - if (ip.slice(-5)=="19054") { - // don't show the port if it is the default - document.getElementById("iptextbox").value = ip.slice(0,-6) - } else { - document.getElementById("iptextbox").value = ip; - } +function qrCodeGenerate() { let tempURL = "http://" + document.location.href.split("/")[2] + "/?ip=" + ip; document.getElementById("qrcode").innerHTML = "" new QRCode(document.getElementById("qrcode"), { @@ -185,6 +179,17 @@ async function checkSettings(skipServer=false) { colorLight : "#eeeeee", correctLevel : QRCode.CorrectLevel.H }); +} + +async function checkSettings(skipServer=false) { + //check client stuff first so if the server doesn't exist it can still be changed and seen + if (ip.slice(-5)=="19054") { + // don't show the port if it is the default + document.getElementById("iptextbox").value = ip.slice(0,-6) + } else { + document.getElementById("iptextbox").value = ip; + } + qrCodeGenerate() document.getElementById("alerttimetextbox").value = alertTime partyButtonState = document.getElementById("partymode-button").innerHTML; x = await getFromServer({setting: "getsettings"}, "settings"); @@ -361,12 +366,4 @@ if (alertTime == "") { document.cookie = "alertTime="+alertTime+"; path=/;" } // this is the code that makes the qr code at the very start -let tempURL = "http://" + document.location.href.split("/")[2] + "/?ip=" + ip; -new QRCode(document.getElementById("qrcode"), { -text: tempURL, -width: 256, -height: 256, -colorDark : "#000000", -colorLight : "#eeeeee", -correctLevel : QRCode.CorrectLevel.H -}); \ No newline at end of file +qrCodeGenerate() \ No newline at end of file diff --git a/Client/styles.css b/Client/styles.css index bfcd94d..a00db3b 100644 --- a/Client/styles.css +++ b/Client/styles.css @@ -172,6 +172,13 @@ h4 { border-bottom: 0; } +.versionNumber { + font-size: 8px; + font-style: italic; + text-align: left; + width: 80%; +} + #volumerange { background-color: #4477AA; color: #4477ff; -- 2.49.1 From 49c1b0bf25e4a77c9646efa5f6976da16800b356 Mon Sep 17 00:00:00 2001 From: Kristy Fournier <124598538+kristy-fournier@users.noreply.github.com> Date: Fri, 7 Mar 2025 21:33:05 -0500 Subject: [PATCH 5/8] trying to fix deleteymode, work in progress --- Server/databaseGenerator.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Server/databaseGenerator.py b/Server/databaseGenerator.py index 109ffbe..b04682c 100644 --- a/Server/databaseGenerator.py +++ b/Server/databaseGenerator.py @@ -30,11 +30,15 @@ if args.mode == "update": songDatabaseList={"songDirectory":soundLocation,'songData':{}} for i in songDatabaseList["songData"]: + deleteySongs = [] try: songFiles.index(i) != -1 except: - print("deleted: " + i + " from database") - songDatabaseList.remove(i) + deleteySongs.append(i) + if deleteySongs: + print("deleted: " + ", ".join(deleteySongs)+ " from database") + for i in deleteySongs: + songDatabaseList["songData"].pop(i) for i in songDatabaseList["songData"]: songFiles.remove(i) print("new songs: " + str(songFiles)) -- 2.49.1 From 247c684b58dbcdb81fb80f331a5560c3ade121fe Mon Sep 17 00:00:00 2001 From: Kristy Fournier <124598538+kristy-fournier@users.noreply.github.com> Date: Mon, 10 Mar 2025 10:01:40 -0400 Subject: [PATCH 6/8] bleh --- Server/databaseGenerator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Server/databaseGenerator.py b/Server/databaseGenerator.py index b04682c..465b96d 100644 --- a/Server/databaseGenerator.py +++ b/Server/databaseGenerator.py @@ -44,6 +44,7 @@ if args.mode == "update": print("new songs: " + str(songFiles)) elif args.mode=="new": songDatabaseList={"songDirectory":soundLocation,'songData':{}} + if args.art.lower() == "true": x = len(songFiles)*0.25 if x > 60: -- 2.49.1 From 44bd5dc481f3a7d79ef76d0fcde3822867929b8c Mon Sep 17 00:00:00 2001 From: Kristy Fournier <124598538+kristy-fournier@users.noreply.github.com> Date: Mon, 10 Mar 2025 10:05:07 -0400 Subject: [PATCH 7/8] Remove "update" database mode temporarily --- Server/databaseGenerator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Server/databaseGenerator.py b/Server/databaseGenerator.py index 109ffbe..05c3898 100644 --- a/Server/databaseGenerator.py +++ b/Server/databaseGenerator.py @@ -7,7 +7,8 @@ loading = ["-","\\","|","/"] parser=argparse.ArgumentParser(description="Options for the generation of the song database") parser.add_argument('-k','--apikey', help='String: LastFM api key', default="") -parser.add_argument('-m', '--mode', help='new/update: Remake database or update current', default= "update") +# parser.add_argument('-m', '--mode', help='new/update: Remake database or update current', default= "update") +parser.add_argument('-m', '--mode', help='new mode required temporarily', default= "new") parser.add_argument('-a', '--art', help="True/False: Add art to the database using LastFm (takes minimum 0.25s per song)", default="True") parser.add_argument('-d','--directory',help="Directory of the song files", default="./sound/") args = parser.parse_args() -- 2.49.1 From 83fbdc7658ea5bd2a4bea6e43844f81ec8251750 Mon Sep 17 00:00:00 2001 From: Kristy Fournier <124598538+kristy-fournier@users.noreply.github.com> Date: Mon, 10 Mar 2025 10:32:27 -0400 Subject: [PATCH 8/8] Update mode back to working, non mp3's are not added to the database --- Server/databaseGenerator.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Server/databaseGenerator.py b/Server/databaseGenerator.py index 465b96d..5494c3f 100644 --- a/Server/databaseGenerator.py +++ b/Server/databaseGenerator.py @@ -22,17 +22,17 @@ else: # apikeylastfm = "KeyHere" # soundLocation = "directoryHere" songFiles = os.listdir(soundLocation) -if args.mode == "update": +if args.mode.lower() == "update": try: with open('songDatabase.json', 'r') as handle: songDatabaseList = json.load(handle) except: songDatabaseList={"songDirectory":soundLocation,'songData':{}} - + deleteySongs = [] for i in songDatabaseList["songData"]: - deleteySongs = [] try: - songFiles.index(i) != -1 + if songFiles.index(i) == -1: + deleteySongs.append(i) except: deleteySongs.append(i) if deleteySongs: @@ -41,11 +41,12 @@ if args.mode == "update": songDatabaseList["songData"].pop(i) for i in songDatabaseList["songData"]: songFiles.remove(i) - print("new songs: " + str(songFiles)) -elif args.mode=="new": + print("new songs: " + ", ".join(songFiles)) +elif args.mode.lower()=="new": songDatabaseList={"songDirectory":soundLocation,'songData':{}} - -if args.art.lower() == "true": +else: + raise ValueError("Must be \"new\" or \"update\"") +if args.art.lower() == "true" and not(args.apikey == ""): x = len(songFiles)*0.25 if x > 60: print("ETA "+ str(x/60) + " minutes") @@ -53,6 +54,9 @@ if args.art.lower() == "true": print("ETA "+ str(x) + " seconds") for i in songFiles: + if i[-4].lower() != ".mp3": + # skip any non-mp3's (like directories or cover art) + continue try: # get the metadata song = EasyID3(soundLocation+i) -- 2.49.1