wip: external subs and cleanup

This commit is contained in:
Fredrik Burmester
2024-10-15 07:32:25 +02:00
parent 3807f847fd
commit 13d4117cc1
21 changed files with 75 additions and 152 deletions

View File

@@ -174,7 +174,7 @@ function useDownloadProvider() {
url: settings?.optimizedVersionsServerUrl,
});
} catch (error) {
console.log(error);
console.error(error);
}
},
[settings?.optimizedVersionsServerUrl, authHeader]
@@ -184,7 +184,6 @@ function useDownloadProvider() {
async (process: JobStatus) => {
if (!process?.item.Id || !authHeader) throw new Error("No item id");
console.log("[0] Setting process to downloading");
setProcesses((prev) =>
prev.map((p) =>
p.id === process.id
@@ -239,7 +238,6 @@ function useDownloadProvider() {
})
.progress((data) => {
const percent = (data.bytesDownloaded / data.bytesTotal) * 100;
console.log("Download progress:", percent);
setProcesses((prev) =>
prev.map((p) =>
p.id === process.id
@@ -467,7 +465,6 @@ function useDownloadProvider() {
if (itemNameWithoutExtension === id) {
const filePath = `${directory}${item}`;
await FileSystem.deleteAsync(filePath, { idempotent: true });
console.log(`Successfully deleted file: ${item}`);
break;
}
}
@@ -480,10 +477,6 @@ function useDownloadProvider() {
}
queryClient.invalidateQueries({ queryKey: ["downloadedItems"] });
console.log(
`Successfully deleted file and AsyncStorage entry for ID ${id}`
);
} catch (error) {
console.error(
`Failed to delete file and AsyncStorage entry for ID ${id}:`,

View File

@@ -7,6 +7,7 @@ import old from "@/utils/profiles/old";
import {
BaseItemDto,
MediaSourceInfo,
PlaybackInfoResponse,
} from "@jellyfin/sdk/lib/generated-client";
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api";
import { useAtomValue } from "jotai";
@@ -30,6 +31,7 @@ export type PlaybackType = {
type PlaySettingsContextType = {
playSettings: PlaybackType | null;
mediaSource: MediaSourceInfo | null;
setPlaySettings: (
dataOrUpdater:
| PlaybackType
@@ -51,6 +53,7 @@ export const PlaySettingsProvider: React.FC<{ children: React.ReactNode }> = ({
children,
}) => {
const [playSettings, _setPlaySettings] = useState<PlaybackType | null>(null);
const [mediaSource, setMediaSource] = useState<MediaSourceInfo | null>(null);
const [playUrl, setPlayUrl] = useState<string | null>(null);
const [playSessionId, setPlaySessionId] = useState<string | null>(null);
@@ -109,11 +112,10 @@ export const PlaySettingsProvider: React.FC<{ children: React.ReactNode }> = ({
forceDirectPlay: settings.forceDirectPlay,
});
console.log("getStreamUrl ~ ", data?.url);
_setPlaySettings(newSettings);
setPlayUrl(data?.url!);
setPlaySessionId(data?.sessionId!);
setMediaSource(data?.mediaSource!);
return data;
} catch (error) {
@@ -158,6 +160,7 @@ export const PlaySettingsProvider: React.FC<{ children: React.ReactNode }> = ({
setMusicPlaySettings,
setOfflineSettings,
playSessionId,
mediaSource,
}}
>
{children}