mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-07-16 22:50:06 +00:00
try new bottom components
This commit is contained in:
parent
2f78ee3883
commit
f919ce35df
@ -33,6 +33,7 @@ def extract_thumb(filepath: str, webp_path: str) -> bool:
|
|||||||
Extracts the thumbnail from an audio file. Returns the path to the thumbnail.
|
Extracts the thumbnail from an audio file. Returns the path to the thumbnail.
|
||||||
"""
|
"""
|
||||||
img_path = os.path.join(settings.THUMBS_PATH, webp_path)
|
img_path = os.path.join(settings.THUMBS_PATH, webp_path)
|
||||||
|
tsize = settings.THUMB_SIZE
|
||||||
|
|
||||||
if os.path.exists(img_path):
|
if os.path.exists(img_path):
|
||||||
return True
|
return True
|
||||||
@ -43,12 +44,12 @@ def extract_thumb(filepath: str, webp_path: str) -> bool:
|
|||||||
img = Image.open(BytesIO(album_art))
|
img = Image.open(BytesIO(album_art))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
small_img = img.resize((250, 250), Image.ANTIALIAS)
|
small_img = img.resize((tsize, tsize), Image.ANTIALIAS)
|
||||||
small_img.save(img_path, format="webp")
|
small_img.save(img_path, format="webp")
|
||||||
except OSError:
|
except OSError:
|
||||||
try:
|
try:
|
||||||
png = img.convert("RGB")
|
png = img.convert("RGB")
|
||||||
small_img = png.resize((250, 250), Image.ANTIALIAS)
|
small_img = png.resize((tsize, tsize), Image.ANTIALIAS)
|
||||||
small_img.save(webp_path, format="webp")
|
small_img.save(webp_path, format="webp")
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from app.settings import logger
|
|
||||||
|
|
||||||
|
|
||||||
class CustomFormatter(logging.Formatter):
|
class CustomFormatter(logging.Formatter):
|
||||||
|
|
||||||
grey = "\x1b[38;20m"
|
grey = "\x1b[38;20m"
|
||||||
|
@ -29,5 +29,9 @@ LAST_FM_API_KEY = "762db7a44a9e6fb5585661f5f2bdf23a"
|
|||||||
CPU_COUNT = multiprocessing.cpu_count()
|
CPU_COUNT = multiprocessing.cpu_count()
|
||||||
|
|
||||||
|
|
||||||
class logger:
|
THUMB_SIZE: int = 400
|
||||||
enable = True
|
"""
|
||||||
|
The size of extracted in pixels
|
||||||
|
"""
|
||||||
|
|
||||||
|
LOGGER_ENABLE: bool = True
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup lang="ts">
|
||||||
export default {
|
defineProps<{
|
||||||
props: ['bio'],
|
bio: string;
|
||||||
};
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@ -48,7 +48,6 @@ export default {
|
|||||||
width: 10rem;
|
width: 10rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.rect {
|
.rect {
|
||||||
width: 10rem;
|
width: 10rem;
|
||||||
height: 10rem;
|
height: 10rem;
|
||||||
@ -59,10 +58,10 @@ export default {
|
|||||||
left: 7rem;
|
left: 7rem;
|
||||||
transform: rotate(45deg) translate(-1rem, -9rem);
|
transform: rotate(45deg) translate(-1rem, -9rem);
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
transition: all .5s ease-in-out;
|
transition: all 0.5s ease-in-out;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
transition: all .5s ease-in-out;
|
transition: all 0.5s ease-in-out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,18 +53,17 @@ const imguri = paths.images.thumb;
|
|||||||
const nav = useNavStore();
|
const nav = useNavStore();
|
||||||
|
|
||||||
useVisibility(albumheaderthing, nav.toggleShowPlay);
|
useVisibility(albumheaderthing, nav.toggleShowPlay);
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.album-h {
|
.album-h {
|
||||||
height: 16rem;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.a-header {
|
.a-header {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 15rem 1fr;
|
grid-template-columns: max-content 1fr;
|
||||||
|
gap: 1rem;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: $black;
|
background-color: $black;
|
||||||
@ -79,8 +78,8 @@ useVisibility(albumheaderthing, nav.toggleShowPlay);
|
|||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
|
|
||||||
.image {
|
.image {
|
||||||
width: 14rem;
|
width: 15rem;
|
||||||
height: 14rem;
|
height: 15rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,56 +3,49 @@
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="headin">Featured Artists</div>
|
<div class="headin">Featured Artists</div>
|
||||||
<div class="xcontrols">
|
<div class="xcontrols">
|
||||||
<div class="prev" @click="scrollLeft"></div>
|
<div class="expand rounded">
|
||||||
<div class="next" @click="scrollRight"></div>
|
EXPAND
|
||||||
|
</div>
|
||||||
|
<div class="prev icon" @click="scrollLeft()"></div>
|
||||||
|
<div class="next icon" @click="scrollRight()"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="separator no-border"></div>
|
<div class="separator no-border"></div>
|
||||||
<div class="artists" ref="artists_dom">
|
<div class="artists" ref="artists_dom">
|
||||||
<ArtistCard
|
<ArtistCard
|
||||||
v-for="artist in artists"
|
v-for="artist in artists"
|
||||||
:key="artist"
|
:key="artist.image"
|
||||||
:artist="artist"
|
:artist="artist"
|
||||||
:color="'ffffff00'"
|
:color="'ffffff00'"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup lang="ts">
|
||||||
import { ref } from "@vue/reactivity";
|
import { ref } from "@vue/reactivity";
|
||||||
import ArtistCard from "@/components/shared/ArtistCard.vue";
|
import ArtistCard from "@/components/shared/ArtistCard.vue";
|
||||||
import { computed, reactive } from "vue";
|
import { Artist } from "@/interfaces";
|
||||||
|
|
||||||
export default {
|
defineProps<{
|
||||||
props: ["artists"],
|
artists: Artist[];
|
||||||
components: {
|
}>();
|
||||||
ArtistCard,
|
|
||||||
},
|
|
||||||
setup() {
|
|
||||||
const artists_dom = ref(null);
|
|
||||||
|
|
||||||
const scrollLeft = () => {
|
const artists_dom = ref(null);
|
||||||
const dom = artists_dom.value;
|
|
||||||
dom.scrollBy({
|
|
||||||
left: -700,
|
|
||||||
behavior: "smooth",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const scrollRight = () => {
|
const scrollLeft = () => {
|
||||||
const dom = artists_dom.value;
|
const dom = artists_dom.value;
|
||||||
dom.scrollBy({
|
dom.scrollBy({
|
||||||
left: 700,
|
left: -700,
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
const scrollRight = () => {
|
||||||
artists_dom,
|
const dom = artists_dom.value;
|
||||||
scrollLeft,
|
dom.scrollBy({
|
||||||
scrollRight,
|
left: 700,
|
||||||
};
|
behavior: "smooth",
|
||||||
},
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -64,9 +57,9 @@ export default {
|
|||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
border-radius: $small;
|
border-radius: $small;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
background: linear-gradient(0deg, transparent, $black);
|
// background: linear-gradient(0deg, transparent, $black);
|
||||||
position: relative;
|
position: relative;
|
||||||
background-color: #ffffff00;
|
// background-color: #ffffff00;
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -85,40 +78,45 @@ export default {
|
|||||||
|
|
||||||
.f-artists .xcontrols {
|
.f-artists .xcontrols {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
width: 5rem;
|
|
||||||
height: 2rem;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
&:hover {
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.next {
|
|
||||||
background: url(../../assets/icons/right-arrow.svg) no-repeat center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.prev {
|
.prev {
|
||||||
background: url(../../assets/icons/right-arrow.svg) no-repeat center;
|
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
.next,
|
.icon {
|
||||||
.prev {
|
background: url(../../assets/icons/right-arrow.svg) no-repeat center;
|
||||||
width: 2em;
|
width: 2rem;
|
||||||
height: 2em;
|
height: 2rem;
|
||||||
border-radius: $small;
|
border-radius: $small;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.5s ease;
|
transition: all 0.5s ease;
|
||||||
background-color: rgb(51, 51, 51);
|
background-color: rgb(51, 51, 51);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: $blue;
|
||||||
|
transition: all 0.5s ease;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.next:hover,
|
.expand {
|
||||||
.prev:hover {
|
background-color: $gray3;
|
||||||
background-color: $blue;
|
padding: $smaller 1rem;
|
||||||
transition: all 0.5s ease;
|
font-size: 0.9rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
height: 1rem;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
background-color: transparent;
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ function emitUpdate(track: Track) {
|
|||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
|
|
||||||
@include tablet-landscape {
|
@include tablet-landscape {
|
||||||
grid-template-columns: 1.5rem 1.5fr 1fr 1.5fr 2.5rem;
|
grid-template-columns: 1.5rem 1.5fr 1fr 1fr 2.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include tablet-portrait {
|
@include tablet-portrait {
|
||||||
|
@ -1,17 +1,26 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="al-view rounded">
|
<div class="al-view rounded">
|
||||||
<div>
|
<div class="al-content">
|
||||||
<Header :album="album.info" />
|
<div>
|
||||||
</div>
|
<Header :album="album.info" />
|
||||||
<div class="separator" id="av-sep"></div>
|
</div>
|
||||||
<div class="songs rounded">
|
|
||||||
<SongList :tracks="album.tracks" :on_album_page="true"/>
|
|
||||||
</div>
|
|
||||||
<div class="separator" id="av-sep"></div>
|
|
||||||
<FeaturedArtists :artists="album.artists" />
|
|
||||||
<div v-if="album.bio">
|
|
||||||
<div class="separator" id="av-sep"></div>
|
<div class="separator" id="av-sep"></div>
|
||||||
<AlbumBio :bio="album.bio" />
|
<div class="songs rounded">
|
||||||
|
<SongList :tracks="album.tracks" :on_album_page="true" />
|
||||||
|
</div>
|
||||||
|
<div class="separator" id="av-sep"></div>
|
||||||
|
<div
|
||||||
|
id="bottom-items"
|
||||||
|
class="rounded"
|
||||||
|
ref="albumbottomcards"
|
||||||
|
@click="expandBottom"
|
||||||
|
>
|
||||||
|
<FeaturedArtists :artists="album.artists" /> <div v-if="album.bio">
|
||||||
|
<div class="separator" id="av-sep"></div>
|
||||||
|
<AlbumBio :bio="album.bio" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -25,19 +34,45 @@ import FeaturedArtists from "../components/PlaylistView/FeaturedArtists.vue";
|
|||||||
|
|
||||||
import useAStore from "../stores/pages/album";
|
import useAStore from "../stores/pages/album";
|
||||||
import { onBeforeRouteUpdate } from "vue-router";
|
import { onBeforeRouteUpdate } from "vue-router";
|
||||||
|
import { ref } from "vue";
|
||||||
|
|
||||||
const album = useAStore();
|
const album = useAStore();
|
||||||
|
const albumbottomcards = ref<HTMLElement>(null);
|
||||||
|
|
||||||
onBeforeRouteUpdate(async (to) => {
|
onBeforeRouteUpdate(async (to) => {
|
||||||
await album.fetchTracksAndArtists(to.params.hash.toString());
|
await album.fetchTracksAndArtists(to.params.hash.toString());
|
||||||
album.fetchBio(to.params.hash.toString());
|
album.fetchBio(to.params.hash.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function increaseBottomHeight(e: WheelEvent) {
|
||||||
|
e.preventDefault();
|
||||||
|
console.log(e.ctrlKey);
|
||||||
|
const elem = albumbottomcards.value;
|
||||||
|
const pos = elem.offsetHeight + 100;
|
||||||
|
|
||||||
|
elem.style.height = `${pos}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function expandBottom(){
|
||||||
|
const elem = albumbottomcards.value;
|
||||||
|
elem.style.height = `${40}rem`;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.al-view {
|
.al-view {
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
// border: solid red 1px;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.al-content {
|
||||||
|
// border: solid blue 1px;
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
padding-bottom: 17rem;
|
||||||
|
}
|
||||||
|
|
||||||
.songs {
|
.songs {
|
||||||
min-height: calc(100% - 31.5rem);
|
min-height: calc(100% - 31.5rem);
|
||||||
@ -50,5 +85,20 @@ onBeforeRouteUpdate(async (to) => {
|
|||||||
#av-sep {
|
#av-sep {
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#bottom-items {
|
||||||
|
z-index: 77;
|
||||||
|
padding: $small;
|
||||||
|
// border: solid red;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 15rem;
|
||||||
|
max-height: 35rem;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: $gray;
|
||||||
|
transition: all 0.5s ease;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user