mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
minor refactors
This commit is contained in:
+2
-2
@@ -353,8 +353,8 @@ def getAlbums():
|
|||||||
|
|
||||||
@bp.route('/albums/<query>')
|
@bp.route('/albums/<query>')
|
||||||
def getAlbumSongs(query: str):
|
def getAlbumSongs(query: str):
|
||||||
album = query.split('::')[0]
|
album = query.split('::')[0].replace('|', '/')
|
||||||
artist = query.split('::')[1]
|
artist = query.split('::')[1].replace('|', '/')
|
||||||
|
|
||||||
songs = all_songs_instance.find_songs_by_album(album, artist)
|
songs = all_songs_instance.find_songs_by_album(album, artist)
|
||||||
songs_array = convert_to_json(songs)
|
songs_array = convert_to_json(songs)
|
||||||
|
|||||||
@@ -84,11 +84,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.f-container .f-item:hover {
|
.f-container .f-item:hover {
|
||||||
transition: all 0.2s ease;
|
background-color: $blue;
|
||||||
background: #000000;
|
|
||||||
background: no-repeat 8%/100% url(../../assets/icons/folder.svg),
|
|
||||||
-webkit-linear-gradient(to bottom, #434343, #000000);
|
|
||||||
background: no-repeat 8%/10% url(../../assets/icons/folder.svg),
|
|
||||||
linear-gradient(to bottom, #434343, #000000);
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -86,7 +86,6 @@ export default {
|
|||||||
const putCommas = perks.putCommas;
|
const putCommas = perks.putCommas;
|
||||||
|
|
||||||
const updateQueue = async (song) => {
|
const updateQueue = async (song) => {
|
||||||
console.log(song.artists.length);
|
|
||||||
if (perks.queue.value[0]._id.$oid !== song_list.value[0]._id.$oid) {
|
if (perks.queue.value[0]._id.$oid !== song_list.value[0]._id.$oid) {
|
||||||
const queue = song_list.value;
|
const queue = song_list.value;
|
||||||
localStorage.setItem("queue", JSON.stringify(queue));
|
localStorage.setItem("queue", JSON.stringify(queue));
|
||||||
|
|||||||
@@ -73,14 +73,17 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.side-nav-container .in {
|
.collapsed .nav-button {
|
||||||
display: flex;
|
font-size: smaller;
|
||||||
|
margin-top: 5px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
justify-content: center;
|
||||||
|
|
||||||
.collapsed .in {
|
.in {
|
||||||
|
width: 100%;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.side-nav-container {
|
.side-nav-container {
|
||||||
padding: $small;
|
padding: $small;
|
||||||
@@ -91,67 +94,60 @@ export default {
|
|||||||
|
|
||||||
.nav-button {
|
.nav-button {
|
||||||
border-radius: $small;
|
border-radius: $small;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.side-nav-container .nav-button {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 10px;
|
padding: 0.6rem 0 0.6rem 0;
|
||||||
}
|
|
||||||
|
|
||||||
.collapsed .nav-button {
|
&:hover {
|
||||||
font-size: smaller;
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.side-nav-container .nav-button:hover {
|
|
||||||
background-color: rgb(5, 80, 150);
|
background-color: rgb(5, 80, 150);
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-nav-container .nav-button .nav-icon {
|
.nav-icon {
|
||||||
height: 24px;
|
height: 1.5rem;
|
||||||
width: 24px;
|
width: 1.5rem;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-nav-container #home-button #home-icon {
|
.in {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#home-icon {
|
||||||
background-image: url(../../assets/icons/home.svg);
|
background-image: url(../../assets/icons/home.svg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-nav-container #album-button #album-icon {
|
#album-icon {
|
||||||
background-image: url(../../assets/icons/album.svg);
|
background-image: url(../../assets/icons/album.svg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-nav-container #home-button #text {
|
#text {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-nav-container #artists-button #artists-icon {
|
#artists-icon {
|
||||||
background-image: url(../../assets/icons/artist.svg);
|
background-image: url(../../assets/icons/artist.svg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-nav-container #playlists-button #playlists-icon {
|
#playlists-icon {
|
||||||
background-image: url(../../assets/icons/playlist.svg);
|
background-image: url(../../assets/icons/playlist.svg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-nav-container #mixes-button #mixes-icon {
|
#mixes-icon {
|
||||||
background-image: url(../../assets/icons/mix.svg);
|
background-image: url(../../assets/icons/mix.svg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-nav-container #folders-button #folders-icon {
|
#folders-icon {
|
||||||
background-image: url(../../assets/icons/folder.svg);
|
background-image: url(../../assets/icons/folder.svg);
|
||||||
}
|
}
|
||||||
.side-nav-container #folders-button #settings-icon {
|
#settings-icon {
|
||||||
background-image: url(../../assets/icons/settings.svg);
|
background-image: url(../../assets/icons/settings.svg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.side-nav-container #folders-button #text {
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-nav-container hr {
|
.side-nav-container hr {
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div class="right-search" ref="searchComponent">
|
||||||
class="right-search"
|
|
||||||
@mouseenter="magic_flag = true"
|
|
||||||
@mouseleave="toggleMagicFlag"
|
|
||||||
>
|
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<div class="search-icon image"></div>
|
<div class="search-icon image"></div>
|
||||||
<div class="filter">
|
<div class="filter">
|
||||||
@@ -19,6 +15,9 @@
|
|||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
id="search"
|
id="search"
|
||||||
|
@focus="toggleMagicFlag"
|
||||||
|
@blur="toggleMagicFlag"
|
||||||
|
@keyup.backspace="removeLastFilter"
|
||||||
placeholder="find your music"
|
placeholder="find your music"
|
||||||
v-model="query"
|
v-model="query"
|
||||||
/>
|
/>
|
||||||
@@ -127,6 +126,7 @@ export default {
|
|||||||
icon: "🈁",
|
icon: "🈁",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const searchComponent = ref(null);
|
||||||
const filters = ref([]);
|
const filters = ref([]);
|
||||||
const albums = [
|
const albums = [
|
||||||
"Smooth Criminal like wtf ... and im serious",
|
"Smooth Criminal like wtf ... and im serious",
|
||||||
@@ -148,14 +148,22 @@ export default {
|
|||||||
filters.value = filters.value.filter((f) => f !== filter);
|
filters.value = filters.value.filter((f) => f !== filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeLastFilter() {
|
||||||
|
if (query.value === '') {
|
||||||
|
if (filters.value.length) {
|
||||||
|
filters.value.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function toggleMagicFlag() {
|
function toggleMagicFlag() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
magic_flag.value = false;
|
magic_flag.value = !magic_flag.value;
|
||||||
}, 1000);
|
}, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(query, (new_query) => {
|
watch(query, (new_query) => {
|
||||||
if (new_query.length > 0) {
|
if (new_query) {
|
||||||
emit("expandSearch");
|
emit("expandSearch");
|
||||||
} else {
|
} else {
|
||||||
emit("collapseSearch");
|
emit("collapseSearch");
|
||||||
@@ -166,6 +174,7 @@ export default {
|
|||||||
addFilter,
|
addFilter,
|
||||||
toggleMagicFlag,
|
toggleMagicFlag,
|
||||||
removeFilter,
|
removeFilter,
|
||||||
|
removeLastFilter,
|
||||||
songs,
|
songs,
|
||||||
albums,
|
albums,
|
||||||
artists,
|
artists,
|
||||||
@@ -174,6 +183,7 @@ export default {
|
|||||||
magic_flag,
|
magic_flag,
|
||||||
options,
|
options,
|
||||||
filters,
|
filters,
|
||||||
|
searchComponent,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
let base_uri = "http://127.0.0.1:9876";
|
let base_uri = "http://127.0.0.1:9876";
|
||||||
|
|
||||||
const getAlbum = async (name, artist) => {
|
const getAlbum = async (name, artist) => {
|
||||||
const res = await fetch(base_uri + "/albums/" + name + "::" + artist);
|
const res = await fetch(base_uri + "/albums/" + name.replaceAll("/", "|") + "::" + artist.replaceAll("/", "|"));
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
const message = `An error has occured: ${res.status}`;
|
const message = `An error has occured: ${res.status}`;
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
const url = "http://127.0.0.1:9876/get/queue";
|
|
||||||
|
|
||||||
const getQueue = async (type, id) => {
|
|
||||||
const res = await fetch(url, {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
Accept: "application/json",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
type: type,
|
|
||||||
id: id,
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!res.ok) {
|
|
||||||
const message = `An error has occured: ${res.status}`;
|
|
||||||
throw new Error(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = await res.json();
|
|
||||||
|
|
||||||
return data.songs;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default getQueue;
|
|
||||||
Reference in New Issue
Block a user