From ddcb410df6b001514bf243749b6fda2e439de4ac Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Sat, 28 Sep 2024 19:57:56 +0200 Subject: [PATCH] wip --- app.json | 4 +- components/downloads/ActiveDownload.tsx | 27 ++++-- components/settings/SettingToggles.tsx | 104 ++++++++++++++---------- eas.json | 4 +- hooks/useRemuxHlsToMp4.ts | 4 - providers/JellyfinProvider.tsx | 4 +- 6 files changed, 85 insertions(+), 62 deletions(-) diff --git a/app.json b/app.json index 36c126c2..f173d0d3 100644 --- a/app.json +++ b/app.json @@ -2,7 +2,7 @@ "expo": { "name": "Streamyfin", "slug": "streamyfin", - "version": "0.15.0", + "version": "0.16.0", "orientation": "default", "icon": "./assets/images/icon.png", "scheme": "streamyfin", @@ -33,7 +33,7 @@ }, "android": { "jsEngine": "hermes", - "versionCode": 41, + "versionCode": 42, "adaptiveIcon": { "foregroundImage": "./assets/images/icon.png" }, diff --git a/components/downloads/ActiveDownload.tsx b/components/downloads/ActiveDownload.tsx index d77c2dc7..c386ecea 100644 --- a/components/downloads/ActiveDownload.tsx +++ b/components/downloads/ActiveDownload.tsx @@ -9,6 +9,7 @@ import { useMutation } from "@tanstack/react-query"; import axios from "axios"; import { toast } from "sonner-native"; import { useSettings } from "@/utils/atoms/settings"; +import { FFmpegKit } from "ffmpeg-kit-react-native"; interface Props extends ViewProps {} @@ -21,17 +22,25 @@ export const ActiveDownload: React.FC = ({ ...props }) => { mutationFn: async () => { if (!process) throw new Error("No active download"); - await axios.delete(settings?.optimizedVersionsServerUrl + process.id, { - headers: { - Authorization: `Bearer ${settings?.optimizedVersionsAuthHeader}`, - }, - }); - const tasks = await checkForExistingDownloads(); - for (const task of tasks) task.stop(); - clearProcess(); + if (settings?.optimizedVersionsServerUrl) { + await axios.delete( + settings?.optimizedVersionsServerUrl + "cancel-job/" + process.id, + { + headers: { + Authorization: `Bearer ${settings?.optimizedVersionsAuthHeader}`, + }, + } + ); + const tasks = await checkForExistingDownloads(); + for (const task of tasks) task.stop(); + clearProcess(); + } else { + FFmpegKit.cancel(); + clearProcess(); + } }, onSuccess: () => { - toast.success("Download cancelled"); + toast.success("Download canceled"); }, onError: (e) => { console.log(e); diff --git a/components/settings/SettingToggles.tsx b/components/settings/SettingToggles.tsx index a256c4fe..812980c4 100644 --- a/components/settings/SettingToggles.tsx +++ b/components/settings/SettingToggles.tsx @@ -454,6 +454,12 @@ export const SettingToggles: React.FC = ({ ...props }) => { )} + + + + + Optimized versions + Optimized versions server @@ -461,26 +467,24 @@ export const SettingToggles: React.FC = ({ ...props }) => { Set the URL for the optimized versions server for downloads. - - - setOptimizedVersionsServerUrl(text)} - /> - + + setOptimizedVersionsServerUrl(text)} + /> diff --git a/eas.json b/eas.json index 1bfada25..710dabc5 100644 --- a/eas.json +++ b/eas.json @@ -21,13 +21,13 @@ } }, "production": { - "channel": "0.15.0", + "channel": "0.16.0", "android": { "image": "latest" } }, "production-apk": { - "channel": "0.15.0", + "channel": "0.16.0", "android": { "buildType": "apk", "image": "latest" diff --git a/hooks/useRemuxHlsToMp4.ts b/hooks/useRemuxHlsToMp4.ts index 564f7c1d..e4b1b179 100644 --- a/hooks/useRemuxHlsToMp4.ts +++ b/hooks/useRemuxHlsToMp4.ts @@ -126,10 +126,6 @@ export const useRemuxHlsToMp4 = (item: BaseItemDto) => { const cancelRemuxing = useCallback(() => { FFmpegKit.cancel(); clearProcess(); - writeToLog( - "INFO", - `useRemuxHlsToMp4 ~ remuxing cancelled for item: ${item.Name}` - ); }, [item.Name, clearProcess]); return { startRemuxing, cancelRemuxing }; diff --git a/providers/JellyfinProvider.tsx b/providers/JellyfinProvider.tsx index 2ae72c73..f1a13370 100644 --- a/providers/JellyfinProvider.tsx +++ b/providers/JellyfinProvider.tsx @@ -63,7 +63,7 @@ export const JellyfinProvider: React.FC<{ children: ReactNode }> = ({ setJellyfin( () => new Jellyfin({ - clientInfo: { name: "Streamyfin", version: "0.15.0" }, + clientInfo: { name: "Streamyfin", version: "0.16.0" }, deviceInfo: { name: Platform.OS === "ios" ? "iOS" : "Android", id }, }) ); @@ -97,7 +97,7 @@ export const JellyfinProvider: React.FC<{ children: ReactNode }> = ({ return { authorization: `MediaBrowser Client="Streamyfin", Device=${ Platform.OS === "android" ? "Android" : "iOS" - }, DeviceId="${deviceId}", Version="0.15.0"`, + }, DeviceId="${deviceId}", Version="0.16.0"`, }; }, [deviceId]);