From c686ace36c3fa8eba2f23ce3e58a299827f68b9b Mon Sep 17 00:00:00 2001 From: IrosTheBeggar Date: Wed, 7 Feb 2024 00:46:41 -0500 Subject: [PATCH] live playlist mode --- webapp/alpha/m.js | 59 +++++++++++++++++++++++++---------------------- webapp/index.html | 41 +++++++++++++++++--------------- 2 files changed, 54 insertions(+), 46 deletions(-) diff --git a/webapp/alpha/m.js b/webapp/alpha/m.js index 8b219d5b..a80c10b0 100644 --- a/webapp/alpha/m.js +++ b/webapp/alpha/m.js @@ -473,6 +473,7 @@ async function init() { document.getElementById('set_live_playlist').classList.remove('green'); document.getElementById('set_live_playlist').classList.add('blue'); document.getElementById('set_live_playlist').value = 'Disable Live Playlist'; + document.getElementById('live-playlist-hide-these').hidden = true; } }catch(err) {} @@ -868,6 +869,16 @@ async function setLivePlaylist() { try{ document.getElementById('set_live_playlist').disabled = true; + if (VUEPLAYERCORE.livePlaylist.name !== false) { + VUEPLAYERCORE.livePlaylist.name = false; + document.getElementById('set_live_playlist').classList.remove('blue'); + document.getElementById('set_live_playlist').classList.add('green'); + document.getElementById('set_live_playlist').value = 'Enable Live Playlist'; + document.getElementById('live-playlist-hide-these').hidden = false; + myModal.close(); + return; + } + let livePlaylistName; if (document.getElementById('radio-use-existing').checked === true) { @@ -893,38 +904,32 @@ async function setLivePlaylist() { localStorage.removeItem('live-playlist-auto-start'); } - if (VUEPLAYERCORE.livePlaylist.name !== false) { - VUEPLAYERCORE.livePlaylist.name = false; - document.getElementById('set_live_playlist').classList.remove('blue'); - document.getElementById('set_live_playlist').classList.add('green'); - document.getElementById('set_live_playlist').value = 'Enable Live Playlist'; - } else { - // set live var - VUEPLAYERCORE.livePlaylist.name = livePlaylistName; + // set live var + VUEPLAYERCORE.livePlaylist.name = livePlaylistName; - // get current playlist - const response = await MSTREAMAPI.loadPlaylist(VUEPLAYERCORE.livePlaylist.name); + // get current playlist + const response = await MSTREAMAPI.loadPlaylist(VUEPLAYERCORE.livePlaylist.name); - // set the queue to the current playlist - if (response.length > 0) { - MSTREAMPLAYER.clearPlaylist(); - response.forEach(value => { - VUEPLAYERCORE.addSongWizard(value.filepath, value.metadata, false, undefined, false, true); - }); - } else { - // save current queue - const songs = []; - for (let i = 0; i < MSTREAMPLAYER.playlist.length; i++) { - songs.push(MSTREAMPLAYER.playlist[i].filepath); - } - MSTREAMAPI.savePlaylist(livePlaylistName, songs, true); + // set the queue to the current playlist + if (response.length > 0) { + MSTREAMPLAYER.clearPlaylist(); + response.forEach(value => { + VUEPLAYERCORE.addSongWizard(value.filepath, value.metadata, false, undefined, false, true); + }); + } else { + // save current queue + const songs = []; + for (let i = 0; i < MSTREAMPLAYER.playlist.length; i++) { + songs.push(MSTREAMPLAYER.playlist[i].filepath); } - - document.getElementById('set_live_playlist').classList.remove('green'); - document.getElementById('set_live_playlist').classList.add('blue'); - document.getElementById('set_live_playlist').value = 'Disable Live Playlist'; + MSTREAMAPI.savePlaylist(livePlaylistName, songs, true); } + document.getElementById('set_live_playlist').classList.remove('green'); + document.getElementById('set_live_playlist').classList.add('blue'); + document.getElementById('set_live_playlist').value = 'Disable Live Playlist'; + document.getElementById('live-playlist-hide-these').hidden = true; + // close modal myModal.close(); } catch(err) { diff --git a/webapp/index.html b/webapp/index.html index a7a62aa2..00f6d3c5 100644 --- a/webapp/index.html +++ b/webapp/index.html @@ -171,26 +171,29 @@
Live Playlist Mode

-

- - -

+
+

+ + +

+ +

+ +

+

+ + +

+
-

- -

-

- - -