From 2b39f2439dc5a93c9d42eff5acd29e354364e8f1 Mon Sep 17 00:00:00 2001 From: Nathan DeTar Date: Sat, 16 Apr 2022 21:01:10 -0700 Subject: [PATCH] Adjust to API --- tubearchivist/www/src/pages/download.tsx | 46 ++++++++++++++---------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/tubearchivist/www/src/pages/download.tsx b/tubearchivist/www/src/pages/download.tsx index e310841..224b38c 100755 --- a/tubearchivist/www/src/pages/download.tsx +++ b/tubearchivist/www/src/pages/download.tsx @@ -59,6 +59,8 @@ const Download: NextPage = () => { } ); + var count = 0; + const [viewStyle, setViewStyle] = useState(downloads?.config?.default_view?.downloads); const [ignoredStatus, setIgnoredStatus] = useState(false); const [formHidden, setFormHidden] = useState(true); @@ -187,24 +189,31 @@ const Download: NextPage = () => { {/* list view */} - {ignoredStatus && -
-

Ignored from download

- -
+ {ignoredStatus && +
+

Ignored from download

+ +
+ } + {!ignoredStatus && +
+

Download queue

+ +
+ } + {downloads?.data?.forEach((video) => { + if ((video?.status == "ignore" && ignoredStatus) || (video?.status == "pending" && !ignoredStatus)) { + count++; } - {!ignoredStatus && -
-

Download queue

- -
- } -

Total videos: {downloads?.data?.length} {!downloads?.data?.length &&

No videos queued for download. Press rescan subscriptions to check if there are any new videos.

}

+ })} +

Total videos: {count} {!count &&

No videos queued for download. Press rescan subscriptions to check if there are any new videos.

}

{downloads.data && - downloads?.data?.map((video,i) => { + downloads?.data?.map((video) => { + count++; + if ((video?.status == "ignore" && ignoredStatus) || (video?.status == "pending" && !ignoredStatus)) { return ( -
+
video_thumb {ignoredStatus && ignored} @@ -217,14 +226,14 @@ const Download: NextPage = () => {

{video?.title}

- {video?.channel?.channel_indexed && {video?.channel?.channel_name}} + {video?.channel_indexed && {video?.channel_name}} {/* {% if video.source.channel_indexed %} */} {/* {{ video.source.channel_name }} */} - {!video?.channel?.channel_indexed && {video?.channel?.channel_name}} + {!video?.channel_indexed && {video?.channel_name}} {/* {% else %} */} {/* {{ video.source.channel_name }} */} {/* {% endif %} */} -

Published: {video?.published} | Duration: {video?.player?.duration_str} | {video?.youtube_id}

+

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

{/*

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

*/} {ignoredStatus &&
@@ -248,6 +257,7 @@ const Download: NextPage = () => {
); + } }) } {/* {% if results %} */} @@ -289,4 +299,4 @@ const Download: NextPage = () => { ); }; -export default Download; \ No newline at end of file +export default Download;