Fix download + casting breakages from the specta migration
Casting: restore camelCase serialization on SessionInfo/NowPlayingItem/PlayState (container rename_all = "camelCase" + per-field PascalCase serde aliases so Jellyfin PascalCase still deserializes). Bindings and the existing frontend are camelCase again — casting works with no frontend session changes. Downloads: migrate DownloadButton.svelte and downloads.ts to the typed commands.downloadItemAndStart / downloadItem / downloadVideo wrappers (request objects), matching the bundled backend signatures. Tooling: - Enable tauri-specta ErrorHandlingMode::Throw so commands.* return Promise<T> and throw (drop-in for invoke()). - Disambiguate specta name collisions: player MediaItem/MediaSource -> PlayerMediaItem/PlayerMediaSource, auth ServerInfo -> AuthServerInfo. - Regenerate bindings.ts; svelte-check passes (0 errors).
This commit is contained in:
+522
-1492
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@
|
||||
import { downloads } from "$lib/stores/downloads";
|
||||
import { auth } from "$lib/stores/auth";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { commands } from "$lib/api/bindings";
|
||||
import DownloadButtonCore from "./DownloadButtonCore.svelte";
|
||||
import type { DownloadState } from "./DownloadButtonCore.svelte";
|
||||
|
||||
@@ -84,14 +85,14 @@
|
||||
console.log(" Target directory:", targetDir);
|
||||
|
||||
// Queue and start download in single atomic operation
|
||||
const downloadId = await invoke<number>("download_item_and_start", {
|
||||
const downloadId = await commands.downloadItemAndStart({
|
||||
itemId,
|
||||
userId,
|
||||
streamUrl,
|
||||
targetDir,
|
||||
itemName: itemName || undefined,
|
||||
artistName: artistName || undefined,
|
||||
albumName: albumName || undefined,
|
||||
itemName: itemName || null,
|
||||
artistName: artistName || null,
|
||||
albumName: albumName || null,
|
||||
});
|
||||
console.log(" Download queued and started with ID:", downloadId);
|
||||
|
||||
|
||||
+17
-15
@@ -2,6 +2,7 @@
|
||||
// TRACES: UR-011, UR-013, UR-018 | DR-015, DR-017
|
||||
import { writable, derived, get } from 'svelte/store';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { commands } from '$lib/api/bindings';
|
||||
import { listen, type UnlistenFn } from '@tauri-apps/api/event';
|
||||
|
||||
// Event listener state
|
||||
@@ -150,15 +151,16 @@ function createDownloadsStore() {
|
||||
): Promise<number> {
|
||||
try {
|
||||
console.log('📥 downloadItem called:', { itemId, userId, filePath, itemName, artistName, albumName });
|
||||
const downloadId = await invoke<number>('download_item', {
|
||||
const downloadId = await commands.downloadItem({
|
||||
itemId,
|
||||
userId,
|
||||
filePath,
|
||||
mimeType,
|
||||
priority,
|
||||
itemName,
|
||||
artistName,
|
||||
albumName
|
||||
mimeType: mimeType ?? null,
|
||||
priority: priority ?? null,
|
||||
itemName: itemName ?? null,
|
||||
artistName: artistName ?? null,
|
||||
albumName: albumName ?? null,
|
||||
expectedSize: null
|
||||
});
|
||||
console.log(' Got download ID from backend:', downloadId);
|
||||
|
||||
@@ -222,18 +224,18 @@ function createDownloadsStore() {
|
||||
qualityPreset,
|
||||
seriesName
|
||||
});
|
||||
const downloadId = await invoke<number>('download_video', {
|
||||
const downloadId = await commands.downloadVideo({
|
||||
itemId,
|
||||
userId,
|
||||
filePath,
|
||||
mimeType,
|
||||
priority,
|
||||
itemName,
|
||||
qualityPreset,
|
||||
seriesName,
|
||||
seasonName,
|
||||
episodeNumber,
|
||||
seasonNumber
|
||||
mimeType: mimeType ?? null,
|
||||
priority: priority ?? null,
|
||||
itemName: itemName ?? null,
|
||||
qualityPreset: qualityPreset ?? null,
|
||||
seriesName: seriesName ?? null,
|
||||
seasonName: seasonName ?? null,
|
||||
episodeNumber: episodeNumber ?? null,
|
||||
seasonNumber: seasonNumber ?? null
|
||||
});
|
||||
console.log(' Got download ID from backend:', downloadId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user