From 73dec9189e370812c928c557b911c96b55b6aaa2 Mon Sep 17 00:00:00 2001 From: geoffrey45 Date: Wed, 2 Feb 2022 21:45:23 +0300 Subject: [PATCH] fix albumView using watch function - other minor changes to almost all files --- server/app/api.py | 10 ++- server/app/functions.py | 2 +- server/app/helpers.py | 6 +- src/App.vue | 1 - src/assets/css/ProgressBar.scss | 10 ++- src/assets/css/Search/Search.scss | 27 +----- src/components/BottomBar/BottomBar.vue | 17 +--- src/components/BottomBar/SongCard.vue | 3 +- src/components/FolderView/SongList.vue | 21 +++-- .../PlaylistView/FeaturedArtists.vue | 1 + src/components/RightSideBar/Main.vue | 63 ++++++------- src/components/RightSideBar/Queue.vue | 18 ++-- src/components/Search.vue | 88 +++++-------------- src/components/Search/AlbumGrid.vue | 10 +-- src/components/Search/ArtistGrid.vue | 3 +- src/components/Search/Filters.vue | 4 +- src/components/Search/Options.vue | 51 +++++++++-- src/components/Search/TracksGrid.vue | 2 +- src/components/shared/AlbumCard.vue | 1 + src/components/shared/ArtistCard.vue | 1 - src/components/shared/SongItem.vue | 1 - src/components/shared/TrackItem.vue | 6 +- src/composables/getFiles.js | 4 +- src/composables/perks.js | 20 ++--- src/composables/routeLoader.js | 8 +- src/views/AlbumView.vue | 23 ++--- src/views/FolderView.vue | 61 +++++++++---- 27 files changed, 231 insertions(+), 231 deletions(-) diff --git a/server/app/api.py b/server/app/api.py index 8186120c..4a1b9398 100644 --- a/server/app/api.py +++ b/server/app/api.py @@ -28,6 +28,8 @@ def adutsfsd(): @bp.route('/search') def search_by_title(): + query:str = "" + if not request.args.get('q'): query = "mexican girl" else: @@ -83,20 +85,20 @@ def search_by_title(): else: more_tracks = False - if len(artists_dicts) > 8: + if len(artists_dicts) > 6: more_artists = True else: more_artists = False - if len(albums_dicts) > 8: + if len(albums_dicts) > 6: more_albums = True else: more_albums = False return {'data': [ {'tracks': tracks[:5], 'more': more_tracks}, - {'albums': albums_dicts[:8], 'more': more_albums}, - {'artists': artists_dicts[:8], 'more': more_artists} + {'albums': albums_dicts[:6], 'more': more_albums}, + {'artists': artists_dicts[:6], 'more': more_artists} ]} diff --git a/server/app/functions.py b/server/app/functions.py index ffcc2ec7..3f582738 100644 --- a/server/app/functions.py +++ b/server/app/functions.py @@ -83,7 +83,7 @@ def populate_images(): bar.finish() -def extract_thumb(audio_file_path: str = None) -> str: +def extract_thumb(audio_file_path: str) -> str: """ Extracts the thumbnail from an audio file. Returns the path to the thumbnail. """ diff --git a/server/app/helpers.py b/server/app/helpers.py index f75017c4..a7531062 100644 --- a/server/app/helpers.py +++ b/server/app/helpers.py @@ -5,6 +5,7 @@ This module contains mimi functions for the server. import os import threading import time +from typing import List import requests from io import BytesIO @@ -37,10 +38,11 @@ def check_for_new_songs(): while flag is False: functions.populate() + functions.populate_images() time.sleep(300) -def run_fast_scandir(dir: str, ext: str) -> list: +def run_fast_scandir(dir: str, ext: str): """ Scans a directory for files with a specific extension. Returns a list of files and folders in the directory. """ @@ -125,7 +127,7 @@ def create_config_dir() -> None: os.chmod(path, 0o755) -def getAllSongs() -> None: +def getAllSongs() -> List: """ Gets all songs under the ~/ directory. """ diff --git a/src/App.vue b/src/App.vue index 46e4f7e3..da994c72 100644 --- a/src/App.vue +++ b/src/App.vue @@ -67,7 +67,6 @@ export default { #toggle { position: absolute; - left: 0.2rem; width: 3rem; height: 100%; background: url(./assets/icons/menu.svg); diff --git a/src/assets/css/ProgressBar.scss b/src/assets/css/ProgressBar.scss index 14efdb2b..6576688f 100644 --- a/src/assets/css/ProgressBar.scss +++ b/src/assets/css/ProgressBar.scss @@ -21,18 +21,20 @@ input[type="range"]::-webkit-slider-thumb { input[type="range"]::-moz-range-thumb { -webkit-appearance: none; - height: 1rem; - width: 1rem; + height: 0.8rem; + width: 0.8rem; border-radius: 50%; background: $blue; + border: none; } input[type="range"]::-ms-thumb { -webkit-appearance: none; - height: 1rem; - width: 1rem; + height: 0.8rem; + width: 0.8rem; border-radius: 50%; background: $blue; + border: none; } input[type="range"]::-webkit-slider-thumb:hover { diff --git a/src/assets/css/Search/Search.scss b/src/assets/css/Search/Search.scss index 797ec0a5..c12ab114 100644 --- a/src/assets/css/Search/Search.scss +++ b/src/assets/css/Search/Search.scss @@ -8,11 +8,10 @@ width: auto; height: 100%; padding: $small $small 0 $small; - // margin: $small 0 $small 0; .no-res { text-align: center; - height: calc(100% - 1rem); + // height: calc(100% - 1rem); display: grid; .highlight { @@ -45,30 +44,6 @@ background-image: url(../../icons/search.svg); background-size: 70%; } - - .v11 { - opacity: 0; - transform: translateY(-4rem); - transition: all 0.2s ease-in; - } - - .v00 { - opacity: 1; - transition: all 0.2s ease-in; - } - - .suggestions { - display: flex; - gap: 0.5rem; - margin-left: 1rem; - position: absolute; - right: 2.5rem; - - .item::before { - content: "#"; - color: grey; - } - } } .right-search .scrollable { diff --git a/src/components/BottomBar/BottomBar.vue b/src/components/BottomBar/BottomBar.vue index 978a6363..bf760b16 100644 --- a/src/components/BottomBar/BottomBar.vue +++ b/src/components/BottomBar/BottomBar.vue @@ -1,7 +1,7 @@ diff --git a/src/components/BottomBar/SongCard.vue b/src/components/BottomBar/SongCard.vue index f6db3923..9c867b50 100644 --- a/src/components/BottomBar/SongCard.vue +++ b/src/components/BottomBar/SongCard.vue @@ -26,8 +26,9 @@ diff --git a/src/components/FolderView/SongList.vue b/src/components/FolderView/SongList.vue index 9c6e47ae..ef4b16e8 100644 --- a/src/components/FolderView/SongList.vue +++ b/src/components/FolderView/SongList.vue @@ -14,7 +14,7 @@
-
-
No tracks 🎸
+
Nothing down here 😑
@@ -47,8 +46,8 @@ import state from "@/composables/state.js"; const props = defineProps({ songs: { type: Array, - required: true - } + required: true, + }, }); let route; @@ -85,7 +84,15 @@ function loadAlbum(title, album_artist) { display: flex; align-items: center; justify-content: center; + flex-direction: column; padding: 1rem; + + // .icon { + // height: 10rem; + // width: 15rem; + // border: solid; + // background-image: url("../../assets/images/sokka.webp"); + // } } .table { @@ -138,7 +145,7 @@ table { display: none; } - width: 5rem; + width: 6rem; } th.album-header { @@ -152,4 +159,4 @@ table { } } } - \ No newline at end of file + diff --git a/src/components/PlaylistView/FeaturedArtists.vue b/src/components/PlaylistView/FeaturedArtists.vue index bbf1fb51..715f0728 100644 --- a/src/components/PlaylistView/FeaturedArtists.vue +++ b/src/components/PlaylistView/FeaturedArtists.vue @@ -110,6 +110,7 @@ export default { align-items: flex-end; flex-wrap: nowrap; overflow-x: scroll; + gap: $small; &::-webkit-scrollbar { display: none; diff --git a/src/components/RightSideBar/Main.vue b/src/components/RightSideBar/Main.vue index 0a35b6b2..4a25ba26 100644 --- a/src/components/RightSideBar/Main.vue +++ b/src/components/RightSideBar/Main.vue @@ -1,20 +1,16 @@ @@ -19,7 +19,7 @@ import { useRoute } from "vue-router"; import { onMounted } from "@vue/runtime-core"; import { onUnmounted } from "@vue/runtime-core"; - +import { watch, ref } from "vue"; import Header from "../components/AlbumView/Header.vue"; import AlbumBio from "../components/AlbumView/AlbumBio.vue"; @@ -27,7 +27,7 @@ import SongList from "../components/FolderView/SongList.vue"; import FeaturedArtists from "../components/PlaylistView/FeaturedArtists.vue"; import state from "@/composables/state.js"; -import routeLoader from "@/composables/routeLoader.js" +import routeLoader from "@/composables/routeLoader.js"; export default { components: { @@ -38,13 +38,16 @@ export default { }, setup() { const route = useRoute(); - const title = route.params.album; - const album_artists = route.params.artist; + + watch( + () => route.params, + () => { + routeLoader.toAlbum(route.params.album, route.params.artist); + } + ); onMounted(() => { - if (!state.album_song_list.value.length) { - routeLoader.toAlbum(title, album_artists); - } + routeLoader.toAlbum(route.params.album, route.params.artist); }); onUnmounted(() => { @@ -69,7 +72,7 @@ export default { height: calc(100% - 1rem); overflow: auto; margin-top: $small; - + scrollbar-width: none; .songs { padding: $small; background-color: $card-dark; @@ -83,4 +86,4 @@ export default { border: none; } } - \ No newline at end of file + diff --git a/src/views/FolderView.vue b/src/views/FolderView.vue index 66de4b1d..edee3aab 100644 --- a/src/views/FolderView.vue +++ b/src/views/FolderView.vue @@ -1,7 +1,7 @@