mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 11:50:14 +00:00
Adjust to API
This commit is contained in:
parent
483db30798
commit
2b39f2439d
@ -59,6 +59,8 @@ const Download: NextPage = () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var count = 0;
|
||||||
|
|
||||||
const [viewStyle, setViewStyle] = useState<ViewStyle>(downloads?.config?.default_view?.downloads);
|
const [viewStyle, setViewStyle] = useState<ViewStyle>(downloads?.config?.default_view?.downloads);
|
||||||
const [ignoredStatus, setIgnoredStatus] = useState<IgnoredStatus>(false);
|
const [ignoredStatus, setIgnoredStatus] = useState<IgnoredStatus>(false);
|
||||||
const [formHidden, setFormHidden] = useState<FormHidden>(true);
|
const [formHidden, setFormHidden] = useState<FormHidden>(true);
|
||||||
@ -199,12 +201,19 @@ const Download: NextPage = () => {
|
|||||||
<button onClick={() => console.log("deleteQueue(this)")} data-id="pending" title="Delete all pending videos from the queue">Delete all queued</button>
|
<button onClick={() => console.log("deleteQueue(this)")} data-id="pending" title="Delete all pending videos from the queue">Delete all queued</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<h3>Total videos: {downloads?.data?.length} {!downloads?.data?.length && <p>No videos queued for download. Press rescan subscriptions to check if there are any new videos.</p>}</h3>
|
{downloads?.data?.forEach((video) => {
|
||||||
|
if ((video?.status == "ignore" && ignoredStatus) || (video?.status == "pending" && !ignoredStatus)) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
<h3>Total videos: {count} {!count && <p>No videos queued for download. Press rescan subscriptions to check if there are any new videos.</p>}</h3>
|
||||||
<div className={`dl-list ${viewStyle}`}>
|
<div className={`dl-list ${viewStyle}`}>
|
||||||
{downloads.data &&
|
{downloads.data &&
|
||||||
downloads?.data?.map((video,i) => {
|
downloads?.data?.map((video) => {
|
||||||
|
count++;
|
||||||
|
if ((video?.status == "ignore" && ignoredStatus) || (video?.status == "pending" && !ignoredStatus)) {
|
||||||
return (
|
return (
|
||||||
<div key={i} className={`dl-item ${viewStyle}`}>
|
<div key={video?.youtube_id} className={`dl-item ${viewStyle}`}>
|
||||||
<div className={`dl-thumb ${viewStyle}`}>
|
<div className={`dl-thumb ${viewStyle}`}>
|
||||||
<img src={`${TA_BASE_URL}${video?.vid_thumb_url}`} alt="video_thumb"></img>
|
<img src={`${TA_BASE_URL}${video?.vid_thumb_url}`} alt="video_thumb"></img>
|
||||||
{ignoredStatus && <span>ignored</span>}
|
{ignoredStatus && <span>ignored</span>}
|
||||||
@ -217,14 +226,14 @@ const Download: NextPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className={`dl-desc ${viewStyle}`}>
|
<div className={`dl-desc ${viewStyle}`}>
|
||||||
<h3>{video?.title}</h3>
|
<h3>{video?.title}</h3>
|
||||||
{video?.channel?.channel_indexed && <a href={`/channel/${video?.channel?.channel_id}`}>{video?.channel?.channel_name}</a>}
|
{video?.channel_indexed && <a href={`/channel/${video?.channel_id}`}>{video?.channel_name}</a>}
|
||||||
{/* {% if video.source.channel_indexed %} */}
|
{/* {% if video.source.channel_indexed %} */}
|
||||||
{/* <a href="{% url 'channel_id' video.source.channel_id %}">{{ video.source.channel_name }}</a> */}
|
{/* <a href="{% url 'channel_id' video.source.channel_id %}">{{ video.source.channel_name }}</a> */}
|
||||||
{!video?.channel?.channel_indexed && <span>{video?.channel?.channel_name}</span>}
|
{!video?.channel_indexed && <span>{video?.channel_name}</span>}
|
||||||
{/* {% else %} */}
|
{/* {% else %} */}
|
||||||
{/* <span>{{ video.source.channel_name }}</span> */}
|
{/* <span>{{ video.source.channel_name }}</span> */}
|
||||||
{/* {% endif %} */}
|
{/* {% endif %} */}
|
||||||
<p>Published: {video?.published} | Duration: {video?.player?.duration_str} | {video?.youtube_id}</p>
|
<p>Published: {video?.published} | Duration: {video?.duration} | {video?.youtube_id}</p>
|
||||||
{/* <p>Published: {{ video.source.published }} | Duration: {{ video.source.duration }} | {{ video.source.youtube_id }}</p> */}
|
{/* <p>Published: {{ video.source.published }} | Duration: {{ video.source.duration }} | {{ video.source.youtube_id }}</p> */}
|
||||||
{ignoredStatus &&
|
{ignoredStatus &&
|
||||||
<div>
|
<div>
|
||||||
@ -248,6 +257,7 @@ const Download: NextPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
{/* {% if results %} */}
|
{/* {% if results %} */}
|
||||||
|
Loading…
Reference in New Issue
Block a user