This commit is contained in:
Fredrik Burmester
2024-09-28 19:57:56 +02:00
parent b3a938b53a
commit ddcb410df6
6 changed files with 85 additions and 62 deletions

View File

@@ -2,7 +2,7 @@
"expo": { "expo": {
"name": "Streamyfin", "name": "Streamyfin",
"slug": "streamyfin", "slug": "streamyfin",
"version": "0.15.0", "version": "0.16.0",
"orientation": "default", "orientation": "default",
"icon": "./assets/images/icon.png", "icon": "./assets/images/icon.png",
"scheme": "streamyfin", "scheme": "streamyfin",
@@ -33,7 +33,7 @@
}, },
"android": { "android": {
"jsEngine": "hermes", "jsEngine": "hermes",
"versionCode": 41, "versionCode": 42,
"adaptiveIcon": { "adaptiveIcon": {
"foregroundImage": "./assets/images/icon.png" "foregroundImage": "./assets/images/icon.png"
}, },

View File

@@ -9,6 +9,7 @@ import { useMutation } from "@tanstack/react-query";
import axios from "axios"; import axios from "axios";
import { toast } from "sonner-native"; import { toast } from "sonner-native";
import { useSettings } from "@/utils/atoms/settings"; import { useSettings } from "@/utils/atoms/settings";
import { FFmpegKit } from "ffmpeg-kit-react-native";
interface Props extends ViewProps {} interface Props extends ViewProps {}
@@ -21,17 +22,25 @@ export const ActiveDownload: React.FC<Props> = ({ ...props }) => {
mutationFn: async () => { mutationFn: async () => {
if (!process) throw new Error("No active download"); if (!process) throw new Error("No active download");
await axios.delete(settings?.optimizedVersionsServerUrl + process.id, { if (settings?.optimizedVersionsServerUrl) {
headers: { await axios.delete(
Authorization: `Bearer ${settings?.optimizedVersionsAuthHeader}`, settings?.optimizedVersionsServerUrl + "cancel-job/" + process.id,
}, {
}); headers: {
const tasks = await checkForExistingDownloads(); Authorization: `Bearer ${settings?.optimizedVersionsAuthHeader}`,
for (const task of tasks) task.stop(); },
clearProcess(); }
);
const tasks = await checkForExistingDownloads();
for (const task of tasks) task.stop();
clearProcess();
} else {
FFmpegKit.cancel();
clearProcess();
}
}, },
onSuccess: () => { onSuccess: () => {
toast.success("Download cancelled"); toast.success("Download canceled");
}, },
onError: (e) => { onError: (e) => {
console.log(e); console.log(e);

View File

@@ -454,6 +454,12 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
</View> </View>
)} )}
</View> </View>
</View>
</View>
<View className="mt-4">
<Text className="text-lg font-bold mb-2">Optimized versions</Text>
<View className="flex flex-col rounded-xl overflow-hidden divide-y-2 divide-solid divide-neutral-800">
<View className="flex flex-col bg-neutral-900 px-4 py-4"> <View className="flex flex-col bg-neutral-900 px-4 py-4">
<View className="flex flex-col shrink mb-2"> <View className="flex flex-col shrink mb-2">
<Text className="font-semibold">Optimized versions server</Text> <Text className="font-semibold">Optimized versions server</Text>
@@ -461,26 +467,24 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
Set the URL for the optimized versions server for downloads. Set the URL for the optimized versions server for downloads.
</Text> </Text>
</View> </View>
<View className="flex flex-row items-center space-x-2"> <View className="flex flex-col">
<View className="grow"> <Input
<Input placeholder="Optimized versions server URL..."
placeholder="Optimized versions server URL..." defaultValue={
defaultValue={ settings.optimizedVersionsServerUrl
settings.optimizedVersionsServerUrl ? settings.optimizedVersionsServerUrl
? settings.optimizedVersionsServerUrl : ""
: "" }
} value={optimizedVersionsServerUrl}
value={optimizedVersionsServerUrl} keyboardType="url"
keyboardType="url" returnKeyType="done"
returnKeyType="done" autoCapitalize="none"
autoCapitalize="none" textContentType="URL"
textContentType="URL" onChangeText={(text) => setOptimizedVersionsServerUrl(text)}
onChangeText={(text) => setOptimizedVersionsServerUrl(text)} />
/>
</View>
<Button <Button
color="purple" color="purple"
className="shrink w-16 h-12" className="h-12 mt-2"
onPress={() => { onPress={() => {
updateSettings({ updateSettings({
optimizedVersionsServerUrl: optimizedVersionsServerUrl:
@@ -497,12 +501,13 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
</View> </View>
{settings.optimizedVersionsServerUrl && ( {settings.optimizedVersionsServerUrl && (
<Text className="text-neutral-500 mt-2"> <View className="p-4 bg-neutral-800 rounded-xl mt-2">
Current: {settings.optimizedVersionsServerUrl} <Text selectable>{settings.optimizedVersionsServerUrl}</Text>
</Text> </View>
)} )}
</View> </View>
<View className="flex flex-col bg-neutral-900 px-4 py-4">
<View className="flex flex-col bg-neutral-900 px-4 py-4 w-full grow-0">
<View className="flex flex-col shrink mb-2"> <View className="flex flex-col shrink mb-2">
<Text className="font-semibold"> <Text className="font-semibold">
Optimized versions auth header Optimized versions auth header
@@ -511,26 +516,25 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
The auth header for the optimized versions server. The auth header for the optimized versions server.
</Text> </Text>
</View> </View>
<View className="flex flex-row items-center space-x-2"> <View className="flex flex-col w-full">
<View className="shrink"> <Input
<Input placeholder="Optimized versions server URL..."
placeholder="Optimized versions server URL..." defaultValue={
defaultValue={ settings.optimizedVersionsAuthHeader
settings.optimizedVersionsAuthHeader ? settings.optimizedVersionsAuthHeader
? settings.optimizedVersionsAuthHeader : ""
: "" }
} value={optimizedVersionsAuthHeader}
value={optimizedVersionsAuthHeader} keyboardType="url"
keyboardType="url" returnKeyType="done"
returnKeyType="done" autoCapitalize="none"
autoCapitalize="none" textContentType="URL"
textContentType="URL" onChangeText={(text) => setOptimizedVersionsAuthHeader(text)}
onChangeText={(text) => setOptimizedVersionsAuthHeader(text)} className="w-full"
/> />
</View>
<Button <Button
color="purple" color="purple"
className=" w-16 h-12" className=" h-12 w-full mt-2"
onPress={() => { onPress={() => {
updateSettings({ updateSettings({
optimizedVersionsAuthHeader, optimizedVersionsAuthHeader,
@@ -542,10 +546,24 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
</View> </View>
{settings.optimizedVersionsAuthHeader && ( {settings.optimizedVersionsAuthHeader && (
<Text className="text-neutral-500 mt-2"> <View className="p-4 bg-neutral-800 rounded-xl mt-2">
Current: {settings.optimizedVersionsAuthHeader} <Text className="" selectable>
</Text> {settings.optimizedVersionsAuthHeader}
</Text>
</View>
)} )}
<Button
color="red"
className="mt-2"
onPress={() => {
updateSettings({
optimizedVersionsAuthHeader: null,
optimizedVersionsServerUrl: null,
});
}}
>
Reset
</Button>
</View> </View>
</View> </View>
</View> </View>

View File

@@ -21,13 +21,13 @@
} }
}, },
"production": { "production": {
"channel": "0.15.0", "channel": "0.16.0",
"android": { "android": {
"image": "latest" "image": "latest"
} }
}, },
"production-apk": { "production-apk": {
"channel": "0.15.0", "channel": "0.16.0",
"android": { "android": {
"buildType": "apk", "buildType": "apk",
"image": "latest" "image": "latest"

View File

@@ -126,10 +126,6 @@ export const useRemuxHlsToMp4 = (item: BaseItemDto) => {
const cancelRemuxing = useCallback(() => { const cancelRemuxing = useCallback(() => {
FFmpegKit.cancel(); FFmpegKit.cancel();
clearProcess(); clearProcess();
writeToLog(
"INFO",
`useRemuxHlsToMp4 ~ remuxing cancelled for item: ${item.Name}`
);
}, [item.Name, clearProcess]); }, [item.Name, clearProcess]);
return { startRemuxing, cancelRemuxing }; return { startRemuxing, cancelRemuxing };

View File

@@ -63,7 +63,7 @@ export const JellyfinProvider: React.FC<{ children: ReactNode }> = ({
setJellyfin( setJellyfin(
() => () =>
new Jellyfin({ new Jellyfin({
clientInfo: { name: "Streamyfin", version: "0.15.0" }, clientInfo: { name: "Streamyfin", version: "0.16.0" },
deviceInfo: { name: Platform.OS === "ios" ? "iOS" : "Android", id }, deviceInfo: { name: Platform.OS === "ios" ? "iOS" : "Android", id },
}) })
); );
@@ -97,7 +97,7 @@ export const JellyfinProvider: React.FC<{ children: ReactNode }> = ({
return { return {
authorization: `MediaBrowser Client="Streamyfin", Device=${ authorization: `MediaBrowser Client="Streamyfin", Device=${
Platform.OS === "android" ? "Android" : "iOS" Platform.OS === "android" ? "Android" : "iOS"
}, DeviceId="${deviceId}", Version="0.15.0"`, }, DeviceId="${deviceId}", Version="0.16.0"`,
}; };
}, [deviceId]); }, [deviceId]);