@@ -64,8 +64,8 @@
{nowPlaying.name}
{#if nowPlaying.artists && nowPlaying.artists.length > 0}
{nowPlaying.artists.join(", ")}
- {:else if nowPlaying.albumName}
-
{nowPlaying.albumName}
+ {:else if nowPlaying.album}
+
{nowPlaying.album}
{/if}
diff --git a/src/lib/components/sessions/SessionPickerModal.svelte b/src/lib/components/sessions/SessionPickerModal.svelte
index 01ebea0..a34c5ee 100644
--- a/src/lib/components/sessions/SessionPickerModal.svelte
+++ b/src/lib/components/sessions/SessionPickerModal.svelte
@@ -63,8 +63,8 @@
}
}
- function getSessionIcon(client: string): string {
- const clientLower = client.toLowerCase();
+ function getSessionIcon(client: string | null | undefined): string {
+ const clientLower = (client ?? "").toLowerCase();
if (clientLower.includes("tv") || clientLower.includes("roku") || clientLower.includes("android tv")) {
return "tv";
} else if (clientLower.includes("web") || clientLower.includes("chrome") || clientLower.includes("firefox")) {
diff --git a/src/lib/components/sessions/SessionsList.svelte b/src/lib/components/sessions/SessionsList.svelte
index 6834b0a..fe168fb 100644
--- a/src/lib/components/sessions/SessionsList.svelte
+++ b/src/lib/components/sessions/SessionsList.svelte
@@ -68,7 +68,7 @@
handleSessionClick(session.id)}
+ onclick={() => handleSessionClick(session.id ?? "")}
/>
{/each}
diff --git a/src/lib/stores/downloads.test.ts b/src/lib/stores/downloads.test.ts
index 74bab64..8378fbc 100644
--- a/src/lib/stores/downloads.test.ts
+++ b/src/lib/stores/downloads.test.ts
@@ -80,14 +80,17 @@ describe("downloads store", () => {
);
expect(mockInvoke).toHaveBeenCalledWith("download_item", {
- itemId: "item-1",
- userId: "user-1",
- filePath: "/path/to/file.mp3",
- mimeType: "audio/mpeg",
- priority: 10,
- itemName: undefined,
- artistName: undefined,
- albumName: undefined,
+ request: {
+ itemId: "item-1",
+ userId: "user-1",
+ filePath: "/path/to/file.mp3",
+ mimeType: "audio/mpeg",
+ priority: 10,
+ itemName: null,
+ artistName: null,
+ albumName: null,
+ expectedSize: null,
+ },
});
expect(downloadId).toBe(123);
});
diff --git a/src/lib/stores/playbackMode.ts b/src/lib/stores/playbackMode.ts
index a9f4c8a..dd5b09c 100644
--- a/src/lib/stores/playbackMode.ts
+++ b/src/lib/stores/playbackMode.ts
@@ -73,7 +73,7 @@ function createPlaybackModeStore() {
* - Polls remote session until track loads
* - Stops local playback
*/
- async function transferToRemote(sessionId: string): Promise
{
+ async function transferToRemote(sessionId: string | null | undefined): Promise {
console.log("[PlaybackMode] Transferring to remote session:", sessionId);
update((s) => ({ ...s, isTransferring: true, transferError: null }));
@@ -100,11 +100,11 @@ function createPlaybackModeStore() {
}
// Update local state
- sessions.selectSession(sessionId);
+ sessions.selectSession(sessionId ?? null);
update((s) => ({
...s,
mode: "remote",
- remoteSessionId: sessionId,
+ remoteSessionId: sessionId ?? null,
isTransferring: false,
}));
diff --git a/src/lib/stores/sessions.test.ts b/src/lib/stores/sessions.test.ts
index ce35eae..b7432db 100644
--- a/src/lib/stores/sessions.test.ts
+++ b/src/lib/stores/sessions.test.ts
@@ -40,8 +40,15 @@ describe("sessions store", () => {
nowPlayingItem: {
id: "item-1",
name: "Test Song",
- type: "Audio",
- serverId: "server-1",
+ Type: "Audio",
+ runTimeTicks: null,
+ album: null,
+ albumId: null,
+ albumArtist: null,
+ artists: null,
+ imageTags: null,
+ primaryImageTag: null,
+ albumPrimaryImageTag: null,
},
playableMediaTypes: ["Audio", "Video"],
supportedCommands: ["PlayPause", "Stop", "Seek", "NextTrack", "PreviousTrack"],
diff --git a/src/lib/stores/sessions.ts b/src/lib/stores/sessions.ts
index 3bfa1e2..6e1e81f 100644
--- a/src/lib/stores/sessions.ts
+++ b/src/lib/stores/sessions.ts
@@ -89,7 +89,7 @@ function createSessionsStore() {
/**
* Send play/pause toggle command
*/
- async function sendPlayPause(sessionId: string): Promise {
+ async function sendPlayPause(sessionId: string | null | undefined): Promise {
try {
await invoke("remote_send_command", {
sessionId,
@@ -106,7 +106,7 @@ function createSessionsStore() {
/**
* Send stop command
*/
- async function sendStop(sessionId: string): Promise {
+ async function sendStop(sessionId: string | null | undefined): Promise {
try {
await invoke("remote_send_command", {
sessionId,
@@ -122,7 +122,7 @@ function createSessionsStore() {
/**
* Send next track command
*/
- async function sendNext(sessionId: string): Promise {
+ async function sendNext(sessionId: string | null | undefined): Promise {
try {
await invoke("remote_send_command", {
sessionId,
@@ -138,7 +138,7 @@ function createSessionsStore() {
/**
* Send previous track command
*/
- async function sendPrevious(sessionId: string): Promise {
+ async function sendPrevious(sessionId: string | null | undefined): Promise {
try {
await invoke("remote_send_command", {
sessionId,
@@ -154,7 +154,7 @@ function createSessionsStore() {
/**
* Seek to position (in ticks)
*/
- async function sendSeek(sessionId: string, positionTicks: number): Promise {
+ async function sendSeek(sessionId: string | null | undefined, positionTicks: number): Promise {
try {
await invoke("remote_session_seek", {
sessionId,
@@ -170,7 +170,7 @@ function createSessionsStore() {
/**
* Set volume (0-100)
*/
- async function sendVolume(sessionId: string, volume: number): Promise {
+ async function sendVolume(sessionId: string | null | undefined, volume: number): Promise {
try {
await invoke("remote_session_set_volume", {
sessionId,
@@ -186,7 +186,7 @@ function createSessionsStore() {
/**
* Toggle mute
*/
- async function sendToggleMute(sessionId: string): Promise {
+ async function sendToggleMute(sessionId: string | null | undefined): Promise {
try {
await invoke("remote_send_command", {
sessionId,
@@ -203,7 +203,7 @@ function createSessionsStore() {
* Play item(s) on remote session
*/
async function playOnSession(
- sessionId: string,
+ sessionId: string | null | undefined,
itemIds: string[],
startIndex = 0
): Promise {
diff --git a/src/lib/utils/duration.ts b/src/lib/utils/duration.ts
index a0298df..6d9df15 100644
--- a/src/lib/utils/duration.ts
+++ b/src/lib/utils/duration.ts
@@ -10,7 +10,7 @@
* @param format Format type: "mm:ss" (default) or "hh:mm:ss"
* @returns Formatted duration string or empty string if no ticks
*/
-export function formatDuration(ticks?: number, format: "mm:ss" | "hh:mm:ss" = "mm:ss"): string {
+export function formatDuration(ticks?: number | null, format: "mm:ss" | "hh:mm:ss" = "mm:ss"): string {
if (!ticks) return "";
// Jellyfin uses 10,000,000 ticks per second
diff --git a/src/lib/utils/playbackUnits.ts b/src/lib/utils/playbackUnits.ts
index 3998da1..3ed4cd4 100644
--- a/src/lib/utils/playbackUnits.ts
+++ b/src/lib/utils/playbackUnits.ts
@@ -25,8 +25,8 @@ export function secondsToTicks(seconds: number): number {
* @param ticks - Time in Jellyfin ticks
* @returns Time in seconds
*/
-export function ticksToSeconds(ticks: number): number {
- return ticks / TICKS_PER_SECOND;
+export function ticksToSeconds(ticks: number | null | undefined): number {
+ return (ticks ?? 0) / TICKS_PER_SECOND;
}
/**
diff --git a/src/routes/library/[id]/+page.svelte b/src/routes/library/[id]/+page.svelte
index b541ebd..19fa976 100644
--- a/src/routes/library/[id]/+page.svelte
+++ b/src/routes/library/[id]/+page.svelte
@@ -456,7 +456,7 @@
{#if item.people.some(p => p.type === "Director")}
p.type === "Writer")}
p.type === "Composer")}
{#if item.genres?.length}
-
+
{/if}
{#if (item.type === "Movie" || item.type === "Series" || item.type === "Episode") && item.people?.length}
-
+
{/if}
@@ -500,8 +500,8 @@
{/if}
@@ -528,7 +528,7 @@
a.id)}
limit={12}
/>