mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
separate playFolder and playAlbum
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
let base_uri = "http://127.0.0.1:9876";
|
||||
|
||||
const getAlbum = async (name, artist) => {
|
||||
const res = await fetch(base_uri + "/albums/" + name.replaceAll("/", "|") + "::" + artist.replaceAll("/", "|"));
|
||||
const res = await fetch(base_uri + "/albums/" + encodeURIComponent(name.replaceAll("/", "|")) + "::" + encodeURIComponent(artist.replaceAll("/", "|")));
|
||||
|
||||
if (!res.ok) {
|
||||
const message = `An error has occured: ${res.status}`;
|
||||
|
||||
@@ -80,11 +80,21 @@ const readQueue = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const updateQueue = async (song) => {
|
||||
const updateQueue = async (song, type) => {
|
||||
playAudio.playAudio(song.filepath)
|
||||
let list;
|
||||
|
||||
if (state.queue.value[0]._id.$oid !== state.song_list.value[0]._id.$oid) {
|
||||
const new_queue = state.song_list.value;
|
||||
switch (type) {
|
||||
case "folder":
|
||||
list = state.folder_song_list.value;
|
||||
break;
|
||||
case "album":
|
||||
list = state.album_song_list.value;
|
||||
break;
|
||||
}
|
||||
|
||||
if (state.queue.value[0]._id.$oid !==list[0]._id.$oid) {
|
||||
const new_queue =list;
|
||||
localStorage.setItem("queue", JSON.stringify(new_queue));
|
||||
state.queue.value = new_queue;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import state from "./state.js";
|
||||
const base_url = "http://127.0.0.1:9876/search?q=";
|
||||
|
||||
async function search(query) {
|
||||
const url = base_url + query;
|
||||
const url = base_url + encodeURIComponent(query);
|
||||
|
||||
const res = await fetch(url);
|
||||
const json = await res.json();
|
||||
|
||||
@@ -12,7 +12,7 @@ const queue = ref([
|
||||
},
|
||||
]);
|
||||
|
||||
const song_list = ref([])
|
||||
const folder_song_list = ref([])
|
||||
const folder_list = ref([])
|
||||
|
||||
const current = ref({
|
||||
@@ -31,6 +31,9 @@ const prev = ref({
|
||||
},
|
||||
});
|
||||
|
||||
const album_song_list = ref([])
|
||||
const album_info = ref([])
|
||||
|
||||
const filters = ref([]);
|
||||
const magic_flag = ref(false);
|
||||
const loading = ref(false);
|
||||
@@ -44,7 +47,7 @@ const search_artists = ref([]);
|
||||
export default {
|
||||
search_query,
|
||||
queue,
|
||||
song_list,
|
||||
folder_song_list,
|
||||
folder_list,
|
||||
current,
|
||||
prev,
|
||||
@@ -55,4 +58,6 @@ export default {
|
||||
search_tracks,
|
||||
search_albums,
|
||||
search_artists,
|
||||
album_song_list,
|
||||
album_info
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user