From 9f9d66afebc59c6c265c4424f7b8fb36d8876541 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Thu, 26 Oct 2023 16:39:03 +0200 Subject: Updated 34 files and added 146 files (automated) --- app/index.php | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index e6d93ff..0f22e2f 100644 --- a/app/index.php +++ b/app/index.php @@ -23,12 +23,12 @@ - +class="web"> @@ -182,8 +182,8 @@ } if (playlist[currentPlaylistPosition + 1]) { - playSong(playlist[currentPlaylistPosition + 1], "keep"); currentPlaylistPosition++; + playSong(playlist[currentPlaylistPosition], "keep", false); } else { stop(); } @@ -307,18 +307,18 @@ playerDocument.getElementById("badge-lossy").style.display = "none"; playerDocument.getElementById("badge-cd").style.display = "none"; playerDocument.getElementById("badge-hires").style.display = "inline"; - playerDocument.getElementById("badge-hires").innerHTML = "Hi-Res Lossless" + window.currentSong.bitDepth + "-bit " + (window.currentSong.sampleRate / 1000).toFixed(1) + " kHz"; + playerDocument.getElementById("badge-hires").innerHTML = "Hi-Res Lossless" + window.currentSong.bitDepth + "-bit " + (window.currentSong.sampleRate / 1000) + " kHz"; playerDocumentMobile.getElementById("badge-lossy").style.display = "none"; playerDocumentMobile.getElementById("badge-cd").style.display = "none"; playerDocumentMobile.getElementById("badge-hires").style.display = "inline"; } else if (window.currentSong) { - playerDocument.getElementById("badge-lossy").style.display = "inline"; + playerDocument.getElementById("badge-lossy").style.display = "none"; playerDocument.getElementById("badge-cd").style.display = "inline"; playerDocument.getElementById("badge-hires").style.display = "none"; - playerDocumentMobile.getElementById("badge-lossy").style.display = "inline"; + playerDocumentMobile.getElementById("badge-lossy").style.display = "none"; playerDocumentMobile.getElementById("badge-cd").style.display = "inline"; playerDocumentMobile.getElementById("badge-hires").style.display = "none"; - playerDocument.getElementById("badge-cd").innerHTML = "'>Lossless" + window.currentSong.bitDepth + "-bit " + (window.currentSong.sampleRate / 1000).toFixed(1) + " kHz"; + playerDocument.getElementById("badge-cd").innerHTML = "Lossless" + window.currentSong.bitDepth + "-bit " + (window.currentSong.sampleRate / 1000) + " kHz"; } } @@ -347,30 +347,34 @@ } } - window.redownloadFavorite = async () => { + window.redownloadFavorites = async () => { document.getElementById("loading-text").innerText = "Downloading favorites..."; - window.favorites = await (await fetch("/api/getFavorites.php")).json(); + window.favorites = await (await fetch("/api/getFavorites.php?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); } window.redownloadLibrary = async () => { document.getElementById("loading-text").innerText = "Downloading library..."; - window.favorites = await (await fetch("/api/getLibrary.php")).json(); + window.library = await (await fetch("/api/getLibrary.php?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); } (async () => { document.getElementById("loading-text").innerText = "Downloading list of songs..."; - window.songs = await (await fetch("/assets/content/songs.json")).json(); + window.songs = await (await fetch("/assets/content/songs.json?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); document.getElementById("loading-text").innerText = "Downloading list of albums..."; - window.albums = await (await fetch("/assets/content/albums.json")).json(); + window.albums = await (await fetch("/assets/content/albums.json?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); document.getElementById("loading-text").innerText = "Downloading favorites..."; - window.favorites = await (await fetch("/api/getFavorites.php")).json(); + window.favorites = await (await fetch("/api/getFavorites.php?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); + + document.getElementById("loading-text").innerText = "Downloading library..."; + window.library = await (await fetch("/api/getLibrary.php?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); document.getElementById("loading-text").innerText = "Saving database..."; await localforage.setItem("albums", window.albums); await localforage.setItem("songs", window.songs); await localforage.setItem("favorites", window.favorites); + await localforage.setItem("library", window.library); document.getElementById("loading-text").innerText = "Done loading."; document.getElementById("loading").style.display = "none"; @@ -455,7 +459,7 @@ window.currentPlaylistID = null; - window.playSong = async (id, playlistID) => { + window.playSong = async (id, playlistID, updatePosition) => { playerDocument.getElementById("player-audio").pause(); playerDocument.getElementById("player-audio").currentTime = 0; @@ -471,6 +475,8 @@ } else if (playlistID !== "keep") { window.playlist = [id]; window.currentPlaylistPosition = 0; + } else if (typeof updatePosition !== "boolean" || updatePosition) { + window.currentPlaylistPosition = window.playlist.indexOf(id) ?? 0; } } else { window.currentPlaylistID = null; @@ -481,6 +487,7 @@ window.currentSong = songs[id]; window.currentSongID = id; updateDisplay(); + if (document.getElementById("ui").contentWindow.refreshQueue) document.getElementById("ui").contentWindow.refreshQueue(); if (!window.preloaded[id]) { if (localStorage.getItem("data-saving") === "true") { @@ -547,5 +554,16 @@ } } + + + \ No newline at end of file -- cgit