From: 2weiEmu Date: Mon, 25 May 2026 21:42:26 +0000 (+0200) Subject: updated: meh just some super basic stuff, can't focus rn X-Git-Url: https://git.saalbach.dev/?a=commitdiff_plain;h=2b345938c1182a794fb47e1c0a1a95fb957ed914;p=binbsis50-sm.git updated: meh just some super basic stuff, can't focus rn --- diff --git a/public/index.html b/public/index.html index 221578d..d4de36d 100644 --- a/public/index.html +++ b/public/index.html @@ -13,9 +13,13 @@

Song List

- - - +
+ + + In DB + Image Exists + +
diff --git a/public/js/index.js b/public/js/index.js index 6c18802..16bf3e5 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -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() // ============================================================== diff --git a/songmanager b/songmanager index 635b639..d2b0a64 100755 Binary files a/songmanager and b/songmanager differ