fix albumView using watch function

- other minor changes to almost all files
This commit is contained in:
geoffrey45
2022-02-02 21:45:23 +03:00
parent bdfbb59d76
commit 73dec9189e
27 changed files with 231 additions and 231 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
let base_uri = "http://0.0.0.0:9876";
const getData = async (path) => {
const getTracksAndDirs = async (path) => {
let url;
const encoded_path = encodeURIComponent(path.replaceAll("/", "|"));
@@ -21,4 +21,4 @@ const getData = async (path) => {
return { songs, folders };
};
export default getData;
export default getTracksAndDirs;
+10 -10
View File
@@ -37,9 +37,7 @@ const putCommas = (artists) => {
};
function updateNext(song_) {
const index = state.queue.value.findIndex(
(item) => item.id === song_.id
);
const index = state.queue.value.findIndex((item) => item.id === song_.id);
if (index == queue.value.length - 1) {
next.value = queue.value[0];
@@ -52,9 +50,7 @@ function updateNext(song_) {
}
function updatePrev(song) {
const index = state.queue.value.findIndex(
(item) => item.id === song.id
);
const index = state.queue.value.findIndex((item) => item.id === song.id);
if (index == 0) {
prev.value = queue.value[queue.value.length - 1];
@@ -82,7 +78,7 @@ const readQueue = () => {
};
const updateQueue = async (song, type) => {
playAudio.playAudio(song.filepath)
playAudio.playAudio(song.filepath);
let list;
switch (type) {
@@ -93,9 +89,9 @@ const updateQueue = async (song, type) => {
list = state.album_song_list.value;
break;
}
if (state.queue.value[0].id !==list[0].id) {
const new_queue =list;
if (state.queue.value[0].id !== list[0].id) {
const new_queue = list;
localStorage.setItem("queue", JSON.stringify(new_queue));
state.queue.value = new_queue;
}
@@ -152,6 +148,8 @@ window.addEventListener("keydown", (e) => {
switch (e.key) {
case "ArrowRight":
if (target.tagName == "INPUT") return;
{
if (!key_down_fired) {
key_down_fired = true;
@@ -168,6 +166,8 @@ window.addEventListener("keydown", (e) => {
case "ArrowLeft":
{
if (!key_down_fired) {
if (target.tagName == "INPUT") return;
key_down_fired = true;
playAudio.playPrev();
+5 -3
View File
@@ -4,6 +4,7 @@ import album from "./album.js";
import state from "./state.js";
function toAlbum(title, artist) {
state.loading.value = true;
album
.getAlbumTracks(title, artist)
.then((data) => {
@@ -24,15 +25,16 @@ function toAlbum(title, artist) {
}
})
)
.then(
.then(() => {
Router.push({
name: "AlbumView",
params: {
album: title,
artist: artist,
},
})
)
});
state.loading.value = false;
})
.catch((error) => {
console.log(error);
});