From 417c403ba8e46dd97ffe656fc8761cb8c6380652 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Sun, 26 Nov 2023 17:10:11 +0100 Subject: Updated 13 files and added app/studio.php (automated) --- app/.DS_Store | Bin 6148 -> 6148 bytes app/index.php | 68 ++++++-- app/studio.php | 445 ++++++++++++++++++++++++++++++++++++++++++++++++++++ app/ui/player.php | 6 +- app/ui/queue.php | 11 +- app/ui/settings.php | 7 +- 6 files changed, 524 insertions(+), 13 deletions(-) create mode 100644 app/studio.php (limited to 'app') diff --git a/app/.DS_Store b/app/.DS_Store index b01224a..60beba8 100644 Binary files a/app/.DS_Store and b/app/.DS_Store differ diff --git a/app/index.php b/app/index.php index 31ca9aa..82b4791 100644 --- a/app/index.php +++ b/app/index.php @@ -553,7 +553,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFI } } - function updateDisplay(initial) { + window.updateDisplay = (initial) => { if (initial) { if (playerDocument.getElementById("player-audio").paused) { document.title = "Mist"; @@ -740,6 +740,14 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFI window.library = await (await fetch("/api/getLibrary.php?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); } + window.redownloadMedia = async () => { + document.getElementById("loading-text").innerText = "Downloading list of songs..."; + 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?_=" + [...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?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); @@ -943,10 +951,12 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFI } if (stellaCompatible) { - window.preloaded[id] = await Stella.build("/assets/content/" + id + ".stella"); - window.preloadedGains[id] = await normalizeAudio(window.preloaded[id].stems.vocals.buffer, 0, true); - window.preloadedGainsBoosted1[id] = await normalizeAudio(window.preloaded[id].stems.vocals.buffer, .05, true); - window.preloadedGainsBoosted2[id] = await normalizeAudio(window.preloaded[id].stems.vocals.buffer, .1, true); + if (!window.preloaded[id]) { + window.preloaded[id] = await Stella.build("/assets/content/" + id + ".stella"); + window.preloadedGains[id] = await normalizeAudio(window.preloaded[id].stems.vocals.buffer, 0, true); + window.preloadedGainsBoosted1[id] = await normalizeAudio(window.preloaded[id].stems.vocals.buffer, .05, true); + window.preloadedGainsBoosted2[id] = await normalizeAudio(window.preloaded[id].stems.vocals.buffer, .1, true); + } } else { if (!window.preloaded[id]) { window.buffering = true; @@ -971,9 +981,45 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFI if (window.currentSongID !== id) return; + try { + window.currentNormalizationSource.disconnect(); + + if (playingStella) { + window.currentNormalizationSource2.disconnect(); + window.currentNormalizationSource3.disconnect(); + } + + window.preloadedGains[window.currentSongID].disconnect(); + } catch (e) { + console.error(e); + } + + if (playingStella) { + for (let player of [ + window.currentNormalizationSource2, + window.currentNormalizationSource3, + window.currentNormalizationSource4, + window.currentNormalizationSource5 + ]) { + try { + player.disconnect(); + window.preloadedGainsBoosted1[window.currentSongID].disconnect(); + } catch (e) { + console.error(e); + } + } + + try { + window.currentNormalizationSource1.disconnect(); + window.preloadedGainsBoosted2[window.currentSongID].disconnect(); + } catch (e) { + console.error(e); + } + } + if (!stellaCompatible) { if (!window.preloadedURLs[id]) { - window.preloadedURLs[id] = localStorage.getItem("data-saving") ? URL.createObjectURL(window.preloadedBlobs[id]) : URL.createObjectURL(window.preloadedBlobs[id]); + window.preloadedURLs[id] = URL.createObjectURL(window.preloadedBlobs[id]); } } else { window.playingStella = true; @@ -1079,10 +1125,12 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFI } if (stellaCompatible) { - window.preloaded[id] = await Stella.build("/assets/content/" + id + ".stella"); - window.preloadedGains[id] = await normalizeAudio(window.preloaded[id].stems.other.buffer, 0, true); - window.preloadedGainsBoosted1[id] = await normalizeAudio(window.preloaded[id].stems.other.buffer, .05, true); - window.preloadedGainsBoosted2[id] = await normalizeAudio(window.preloaded[id].stems.other.buffer, .1, true); + if (!window.preloaded[id]) { + window.preloaded[id] = await Stella.build("/assets/content/" + id + ".stella"); + window.preloadedGains[id] = await normalizeAudio(window.preloaded[id].stems.other.buffer, 0, true); + window.preloadedGainsBoosted1[id] = await normalizeAudio(window.preloaded[id].stems.other.buffer, .05, true); + window.preloadedGainsBoosted2[id] = await normalizeAudio(window.preloaded[id].stems.other.buffer, .1, true); + } } else { if (!window.preloaded[id]) { if (localStorage.getItem("data-saving") === "true") { diff --git a/app/studio.php b/app/studio.php new file mode 100644 index 0000000..4f002f7 --- /dev/null +++ b/app/studio.php @@ -0,0 +1,445 @@ + + + + + + + + + + Mist Studio + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/ui/player.php b/app/ui/player.php index 47526f5..3fcdec1 100644 --- a/app/ui/player.php +++ b/app/ui/player.php @@ -168,7 +168,11 @@ window.parent.redoNavigation("home"); } - function openAlbum() { + async function openAlbum() { + if (Object.entries(window.parent.albums).filter(i => i[1].tracks.includes(window.parent.currentSongID))) { + await window.parent.redownloadMedia(); + } + window.parent.location.hash = "#/albums/" + Object.entries(window.parent.albums).filter(i => i[1].tracks.includes(window.parent.currentSongID))[0][0]; window.parent.redoNavigation("albums"); } diff --git a/app/ui/queue.php b/app/ui/queue.php index 81a7079..7d38625 100644 --- a/app/ui/queue.php +++ b/app/ui/queue.php @@ -25,7 +25,10 @@

-

Queue

+

+ Queue + Clear queue +

-- cgit