mirror of
https://github.com/IrosTheBeggar/mStream.git
synced 2025-10-27 07:31:02 +00:00
live playlist mode
This commit is contained in:
parent
b66c6d5be3
commit
c686ace36c
@ -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';
|
||||
// set live var
|
||||
VUEPLAYERCORE.livePlaylist.name = livePlaylistName;
|
||||
|
||||
// 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 {
|
||||
// set live var
|
||||
VUEPLAYERCORE.livePlaylist.name = livePlaylistName;
|
||||
|
||||
// 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);
|
||||
// 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) {
|
||||
|
||||
@ -171,26 +171,29 @@
|
||||
</label>
|
||||
<br>
|
||||
|
||||
<p>
|
||||
<label>
|
||||
<input class="with-gap" name="group1" type="radio" checked />
|
||||
<span>Make a new playlist</span>
|
||||
</label>
|
||||
<input id="new-live-playlist-name" type="text" name="live-queue-name" placeholder="Playlist Name" autocomplete="off" class="make-white">
|
||||
</p>
|
||||
<div id="live-playlist-hide-these">
|
||||
<p>
|
||||
<label>
|
||||
<input class="with-gap" name="group1" type="radio" checked />
|
||||
<span>Make a new playlist</span>
|
||||
</label>
|
||||
<input id="new-live-playlist-name" type="text" name="live-queue-name" placeholder="Playlist Name" autocomplete="off" class="make-white">
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label>
|
||||
<input class="with-gap" name="group1" type="radio" id="radio-use-existing" />
|
||||
<span>Use an existing playlist</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<select id="live-playlist-select" class="browser-default">
|
||||
<option value="" disabled selected>Select Playlist</option>
|
||||
</select>
|
||||
<!-- <label>Materialize Select</label> -->
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<label>
|
||||
<input class="with-gap" name="group1" type="radio" id="radio-use-existing" />
|
||||
<span>Use an existing playlist</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<select id="live-playlist-select" class="browser-default">
|
||||
<option value="" disabled selected>Select Playlist</option>
|
||||
</select>
|
||||
<!-- <label>Materialize Select</label> -->
|
||||
</p>
|
||||
|
||||
<input id="set_live_playlist" type="submit" class="btn green" value="Enable Live Playlist">
|
||||
</form>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user