From 494d97ee60de0e254e8e5d489c3da51136990e39 Mon Sep 17 00:00:00 2001 From: n8detar Date: Mon, 18 Apr 2022 10:51:41 -0700 Subject: [PATCH] Added Ignore and Add back to queue functionality --- tubearchivist/www/src/lib/getDownloads.ts | 21 +++++++++++++++++++++ tubearchivist/www/src/pages/download.tsx | 10 +++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/tubearchivist/www/src/lib/getDownloads.ts b/tubearchivist/www/src/lib/getDownloads.ts index b714a92..68ba5cd 100755 --- a/tubearchivist/www/src/lib/getDownloads.ts +++ b/tubearchivist/www/src/lib/getDownloads.ts @@ -74,4 +74,25 @@ export const sendDeleteVideoQueuedIgnored = async (token: string, videoId: strin // return response.json(); } return response.json(); +}; + +export const sendMoveVideoQueuedIgnored = async (token: string, videoId: string, status: string): Promise => { + var data = { + "status": status + }; + const response = await fetch(`${TA_BASE_URL.server}/api/download/${videoId}/`, { + body: JSON.stringify(data), + headers: { + Accept: "application/json", + "Content-Type": "application/json", + Authorization: `Token ${token}`, + mode: "no-cors", + }, + method: "POST" + }); + if (!response.ok) { + // throw new Error("Error adding content to the download queue."); + // return response.json(); + } + return response.json(); }; \ No newline at end of file diff --git a/tubearchivist/www/src/pages/download.tsx b/tubearchivist/www/src/pages/download.tsx index b151140..1a20a59 100755 --- a/tubearchivist/www/src/pages/download.tsx +++ b/tubearchivist/www/src/pages/download.tsx @@ -5,7 +5,7 @@ import { dehydrate, QueryClient, useQuery } from "react-query"; import { CustomHead } from "../components/CustomHead"; import { Layout } from "../components/Layout"; import NextImage from "next/image"; -import { getDownloads, sendDeleteAllQueuedIgnored, sendDeleteVideoQueuedIgnored } from "../lib/getDownloads"; +import { getDownloads, sendDeleteAllQueuedIgnored, sendDeleteVideoQueuedIgnored, sendMoveVideoQueuedIgnored } from "../lib/getDownloads"; import { sendDownloads } from "../lib/getDownloads"; import RescanIcon from "../images/icon-rescan.svg"; import DownloadIcon from "../images/icon-download.svg"; @@ -237,8 +237,8 @@ const Download: NextPage = () => { {/*

Published: {{ video.source.published }} | Duration: {{ video.source.duration }} | {{ video.source.youtube_id }}

*/} {ignoredStatus &&
- - + +
} {/* {% if show_ignored_only %} */} @@ -246,9 +246,9 @@ const Download: NextPage = () => { {/* */} {!ignoredStatus &&
- + - +
} {/* {% else %} */}