]> git.example.dev Git - binbsis50-sm.git/commitdiff
updated: meh just some super basic stuff, can't focus rn
author2weiEmu <saalbach.robert@outlook.de>
Mon, 25 May 2026 21:42:26 +0000 (23:42 +0200)
committer2weiEmu <saalbach.robert@outlook.de>
Mon, 25 May 2026 21:42:26 +0000 (23:42 +0200)
public/index.html
public/js/index.js
songmanager

index 221578d0cdc77ffc7f6a47ed531b16a92624d491..d4de36d1c724518a1ea76dea73ed347025be443d 100644 (file)
                <div id="outerSongList">
                        <h1><u>Song List</u></h1>
 
-                       <input id="songFilterInput"></input>
-                       <input id="songFilterArtist"></input>
-                       <button id="" onclick="getSongList()">Update Songs</button>
+                       <div id="songFilterInputs">
+                               <input placeholder="Name of a song..." id="songFilterName"></input>
+                               <input placeholder="Name of an artist..." id="songFilterArtist"></input>
+                               <input id="songFilterInDB" type="checkbox">In DB</input>
+                               <input id="songFilterImageExist" type="checkbox">Image Exists</input>
+                               <button id="" onclick="getSongList()">Update Songs</button>
+                       </div>
                        <div id="innerSongList">
 
                        </div>
index 6c18802fd181a2c55dd73c14c3acf91b1f56ccd3..16bf3e575367003b7a6cf6ba0560a8be22ddd018 100644 (file)
@@ -1,3 +1,9 @@
+let songList = []
+
+/**
+ * SONG FILE LIST SECTION
+ */
+
 let songFileList = []
 /**
  * Get the list of all named song files (raw filenames) using the API
@@ -12,8 +18,6 @@ async function getSongFileList() {
 }
 
 getSongFileList()
-
-let songList = []
 let innerSongList = document.getElementById("innerSongList")
 
 /**
@@ -78,12 +82,30 @@ function NewSongElement(exists, songName, artistName, imageUrl, id) {
 
 /**
  * Check if the songs exists, withtout trying to download the full file
+ * @param {*} url - The URL that should be checked for in the song file list
  */
 function SongURLExists(url) {
        console.log(url)
        return songFileList.indexOf(url) != -1
 }
 
+/**
+ * Make the song list and append them to the elements, given the list of songs
+ * @param {*} listOfSongs - The list of songs, obviously should be a list of songs
+ * @param {*} appendElement - The element to which the list should be appended
+ **/
+function makeSongList(listOfSongs, appendElement) {
+       for (let i = 0; i < listOfSongs.length; i++) {
+               let song = listOfSongs[i]
+
+               let fileAvailable = SongURLExists(song.PreviewURL)
+
+               appendElement.appendChild(NewSongElement(
+                       fileAvailable, song.DisplayTrackName, song.DisplayArtistNames, song.ArtworkURL60, song.Key
+               ))
+       }
+}
+
 /**
  * Get all the songs
  **/
@@ -115,8 +137,32 @@ function getSongList() {
  **/
 let songFilterInput = document.getElementById("songFilterInput")
 
+/**
+ * FILTERING SECTION
+ **/
+let songFilterName = document.getElementById("songFilterName")
+let songFilterArtist = document.getElementById("songFilterArtist")
+let songFilterInDB = document.getElementById("songFilterInDB")
+let songFilterImageExist = document.getElementById("songFilterImageExist")
 
+/**
+ * Get the current state of filters, with fields NameFilter, ArtistFilter, DBFilter, ImageFilter
+ * @returns filterstates with fields mentioned above
+ **/
+function getFilterStates() {
+       let filterStates
 
+       filterStates.NameFilter = songFilterName.value.toLowerCase()
+       filterStates.ArtistFilter = songFilterArtist.value.toLowerCase()
+       filterStates.DBFilter = songFilterInDB.checked
+       filterStates.ImageExist = songFilterImageExist.checked
+
+       return filterStates
+}
+
+/**
+ * SETUP / RUN AT START SECTION
+ **/
 getSongList()
 
 // ==============================================================
index 635b639d702224facb2020d8d86a73a08b6d97ea..d2b0a64e37f80c50538b476c61348cadafdbacc4 100755 (executable)
Binary files a/songmanager and b/songmanager differ