fix: fixes non-optimized downloads (#500)

This commit is contained in:
Simon Eklundh
2025-02-09 10:43:42 +01:00
committed by GitHub
parent ae9c30aa6d
commit 6688469b6c
7 changed files with 36 additions and 32 deletions

View File

@@ -153,7 +153,7 @@ export default function IndexLayout() {
disabled={settings.libraryOptions.imageStyle === "poster"}
key="show-titles-option"
value={settings.libraryOptions.showTitles}
onValueChange={(newValue) => {
onValueChange={(newValue: string) => {
if (settings.libraryOptions.imageStyle === "poster")
return;
updateSettings({
@@ -172,7 +172,7 @@ export default function IndexLayout() {
<DropdownMenu.CheckboxItem
key="show-stats-option"
value={settings.libraryOptions.showStats}
onValueChange={(newValue) => {
onValueChange={(newValue: string) => {
updateSettings({
libraryOptions: {
...settings.libraryOptions,

View File

@@ -70,9 +70,9 @@ export default function page() {
const progress = useSharedValue(0);
const isSeeking = useSharedValue(false);
const cacheProgress = useSharedValue(0);
let getDownloadedItem = null;
if (!Platform.isTV) {
const getDownloadedItem = downloadProvider.useDownload();
getDownloadedItem = downloadProvider.useDownload();
}
const revalidateProgressCache = useInvalidatePlaybackProgressCache();
@@ -386,16 +386,16 @@ export default function page() {
const allSubs =
stream?.mediaSource.MediaStreams?.filter(
(sub) => sub.Type === "Subtitle"
(sub: { Type: string; }) => sub.Type === "Subtitle"
) || [];
const chosenSubtitleTrack = allSubs.find(
(sub) => sub.Index === subtitleIndex
(sub: { Index: number; }) => sub.Index === subtitleIndex
);
const allAudio =
stream?.mediaSource.MediaStreams?.filter(
(audio) => audio.Type === "Audio"
(audio: { Type: string; }) => audio.Type === "Audio"
) || [];
const chosenAudioTrack = allAudio.find((audio) => audio.Index === audioIndex);
const chosenAudioTrack = allAudio.find((audio: { Index: number | undefined; }) => audio.Index === audioIndex);
// Direct playback CASE
if (!bitrateValue) {

View File

@@ -64,14 +64,14 @@ function useNotificationObserver() {
useEffect(() => {
let isMounted = true;
function redirect(notification: Notifications.Notification) {
function redirect(notification: typeof Notifications.Notification) {
const url = notification.request.content.data?.url;
if (url) {
router.push(url);
}
}
Notifications.getLastNotificationResponseAsync().then((response) => {
Notifications.getLastNotificationResponseAsync().then((response: { notification: any; }) => {
if (!isMounted || !response?.notification) {
return;
}
@@ -79,7 +79,7 @@ function useNotificationObserver() {
});
const subscription = Notifications.addNotificationResponseReceivedListener(
(response) => {
(response: { notification: any; }) => {
redirect(response.notification);
}
);
@@ -127,7 +127,7 @@ if (!Platform.isTV) {
const downloadUrl = url + "download/" + job.id;
const tasks = await BackGroundDownloader.checkForExistingDownloads();
if (tasks.find((task) => task.id === job.id)) {
if (tasks.find((task: { id: string; }) => task.id === job.id)) {
console.log("TaskManager ~ Download already in progress: ", job.id);
continue;
}
@@ -163,9 +163,9 @@ if (!Platform.isTV) {
trigger: null,
});
})
.error((error) => {
.error((error: any) => {
console.log("TaskManager ~ Download error: ", job.id, error);
completeHandler(job.id);
BackGroundDownloader.completeHandler(job.id);
Notifications.scheduleNotificationAsync({
content: {
title: job.item.Name,