From: 2weiEmu Date: Fri, 12 Jun 2026 10:51:59 +0000 (+0200) Subject: updated: more song creation X-Git-Url: https://git.saalbach.dev/?a=commitdiff_plain;h=b6ff8bb50d82f68494af6a84458eb1ceeee9e402;p=binbsis50-sm.git updated: more song creation --- diff --git a/main.go b/main.go index 4822cca..81e0af9 100644 --- a/main.go +++ b/main.go @@ -32,11 +32,11 @@ func main() { mainLogger := log.New(logFile, "", log.LstdFlags | log.Lshortfile | log.Ldate | log.Ltime) mainLogger.Println("=== Logging has begun. === ") - mainLogger.Println("Given port:", *paramPort) - mainLogger.Println("Given binb_location:", *paramBinbLocation) - mainLogger.Println("Given songs_location:", *paramSongsLocation) - mainLogger.Println("Given redis_location:", *paramRedisLocation) - mainLogger.Println("Given container_name:", *paramContainerName) + mainLogger.Println("Given port:", *paramPort) // eg: 8000 + mainLogger.Println("Given binb_location:", *paramBinbLocation) // eg: ~/Documents/binb + mainLogger.Println("Given songs_location:", *paramSongsLocation) // eg: ~/Documents/binb/public/songs + mainLogger.Println("Given redis_location:", *paramRedisLocation) // eg: localhost:6379 + mainLogger.Println("Given container_name:", *paramContainerName) // eg: binbsis50 DBwrapper := dbhandling.NewDbWrapper(*paramRedisLocation, *paramSongsLocation, *paramContainerName, *paramBinbLocation) diff --git a/public/index.html b/public/index.html index 97901fa..5b4185d 100644 --- a/public/index.html +++ b/public/index.html @@ -38,6 +38,15 @@

Song Creation Menu


Create a New Song

+ + + + + + + + +

Upload a New File with a Link (no YT Links)

diff --git a/public/js/index.js b/public/js/index.js index ac65c74..76825fa 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -360,6 +360,48 @@ function openCreationMenu() { songCreationMenu.style.display = "block" } +let createSongArtistName = document.getElementById("createSongArtistName") +let createSongTrackName = document.getElementById("createSongTrackName") +let createSongTrackViewURL = document.getElementById("createSongTrackViewURL") +let createSongPreviewURL = document.getElementById("createSongPreviewURL") +let createSongArtworkURL60 = document.getElementById("createSongArtworkURL60") +let createSongArtworkURL100 = document.getElementById("createSongArtworkURL100") +let createSongDisplayArtistNames = document.getElementById("createSongDisplayArtistNames") +let createSongDisplayTrackName = document.getElementById("createSongDisplayTrackName") +let createSongCreateButton = document.getElementById("createSongCreateButton") + +// making a song -> I want to make clear that there is a strong lack of formatting checking anywhere +async function createNewSong() { + + let song = { + Key: 0, + ArtistName: createSongArtistName.value, + TrackName: createSongTrackName.value, + TrackViewURL: createSongTrackViewURL.value, + PreviewURL: createSongPreviewURL.value, + ArtworkURL60: createSongArtworkURL60.value, + ArtworkURL100: createSongArtworkURL100.value, + DisplayArtistNames: createSongDisplayArtistNames.value, + DisplayTrackName: createSongDisplayTrackName.value, + } + + let response = await fetch("/api/songs/create", { + method: "POST", + body: song + }) + + if (response.status != 200) { + alert("Something went wrong creating the song... harass admin") + } + else { + createSongCreateButton.classList = "success" + + await sleep(500) + + createSongCreateButton.classList = "" + } +} + let fileUploadLinkLink = document.getElementById("fileUploadLinkLink") let fileUploadLinkName = document.getElementById("fileUploadLinkName") let fileUploadLinkUploadButton = document.getElementById("fileUploadLinkUploadButton")