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:
+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