Fixed sonarr downloads not starting

This commit is contained in:
Aleksi Lassila
2023-08-05 13:21:51 +03:00
parent 03e4ff5056
commit 7f86bb07e9

View File

@@ -1,6 +1,10 @@
<script lang="ts"> <script lang="ts">
import { fetchRadarrReleases } from '$lib/apis/radarr/radarrApi'; import { downloadRadarrMovie, fetchRadarrReleases } from '$lib/apis/radarr/radarrApi';
import { fetchSonarrReleases, fetchSonarrSeasonReleases } from '$lib/apis/sonarr/sonarrApi'; import {
downloadSonarrEpisode,
fetchSonarrReleases,
fetchSonarrSeasonReleases
} from '$lib/apis/sonarr/sonarrApi';
import { formatMinutesToTime, formatSize } from '$lib/utils'; import { formatMinutesToTime, formatSize } from '$lib/utils';
import { DotFilled, Download, Plus } from 'radix-icons-svelte'; import { DotFilled, Download, Plus } from 'radix-icons-svelte';
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher } from 'svelte';
@@ -64,16 +68,23 @@
function handleDownload(guid: string) { function handleDownload(guid: string) {
downloadFetchingGuid = guid; downloadFetchingGuid = guid;
fetch('/movie/0/releases', { if (radarrId) {
method: 'POST', downloadRadarrMovie(guid).then((res) => {
body: JSON.stringify({ guid }) dispatch('download');
}).then((res) => { downloadFetchingGuid = undefined;
dispatch('download'); if (res.response?.ok) {
downloadFetchingGuid = undefined; downloadingGuid = guid;
if (res.ok) { }
downloadingGuid = guid; });
} } else {
}); downloadSonarrEpisode(guid).then((res) => {
dispatch('download');
downloadFetchingGuid = undefined;
if (res.response?.ok) {
downloadingGuid = guid;
}
});
}
} }
function toggleShowAll() { function toggleShowAll() {