From 2af920a7acc13d77d65ac27f8ae3dd6e1d903562 Mon Sep 17 00:00:00 2001 From: Neshura Date: Thu, 2 May 2024 03:53:28 +0200 Subject: [PATCH] Add Album Page --- src/lib/opensubsonic.ts | 22 ++++ src/routes/album/[albumId]/+page.svelte | 165 ++++++++++++++++++++++++ src/routes/album/[albumId]/+page.ts | 7 + 3 files changed, 194 insertions(+) diff --git a/src/lib/opensubsonic.ts b/src/lib/opensubsonic.ts index edadff8..84477e3 100644 --- a/src/lib/opensubsonic.ts +++ b/src/lib/opensubsonic.ts @@ -1,5 +1,6 @@ import {Md5} from "ts-md5"; import Cookies from 'js-cookie'; +import {Disc} from "radix-icons-svelte"; function getIdent(): string { let cookie = Cookies.get("subsonicPlayerIdent"); @@ -242,6 +243,27 @@ export interface AlbumID3 { discTitles?: Array } +export interface GetAlbumInfo2Response extends OpenSubsonicResponse { + albumInfo: AlbumInfo +} + +export interface AlbumInfo { + notes?: string, + musicBrainzId?: string, + lastFmUrl?: string, + smallImageUrl?: string, + mediumImageUrl?: string, + largeImageUrl?: string, +} + +export interface GetAlbumResponse extends OpenSubsonicResponse{ + album: AlbumID3WithSongs +} + +export interface AlbumID3WithSongs extends AlbumID3 { + song?: Array, +} + interface RecordLabel { name: string } diff --git a/src/routes/album/[albumId]/+page.svelte b/src/routes/album/[albumId]/+page.svelte index e69de29..f022ab9 100644 --- a/src/routes/album/[albumId]/+page.svelte +++ b/src/routes/album/[albumId]/+page.svelte @@ -0,0 +1,165 @@ + + + + +{#if loading} +

Loading

+{:else} +
+ {album.data.name +
+

{album.data.name}

+

{album.info.notes}

+

{album.info.lastFmUrl}

+

{album.info.musicBrainzId}

+
+
+
+
playHover = true} onmouseleave={() => playHover = false}> + + {#if playHover} + + {/if} +
+
shuffleHover = true} onmouseleave={() => shuffleHover = false}> + + + {#if shuffleHover} + + {/if} +
+
+
+ {#each album.data.song as song} +

playSong(song)}>{song.title}

+ {/each} +
+ +{/if} + + diff --git a/src/routes/album/[albumId]/+page.ts b/src/routes/album/[albumId]/+page.ts index e69de29..b8a801c 100644 --- a/src/routes/album/[albumId]/+page.ts +++ b/src/routes/album/[albumId]/+page.ts @@ -0,0 +1,7 @@ +import type { RouteParams } from './$types'; + +export const load = ({ params }: { params: RouteParams }) => { + return { + albumId: params.albumId + } +} \ No newline at end of file