mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-21 23:46:18 -05:00
Info JSON epoch is time of download, not time of upload.
This commit is contained in:
parent
ad405d30cd
commit
9ffe6ee3f6
7 changed files with 16 additions and 69 deletions
|
|
@ -29,7 +29,7 @@ import {
|
|||
SearchInput,
|
||||
TabLinks,
|
||||
textEllipsis,
|
||||
uploadDate,
|
||||
epochToDateString,
|
||||
useTitle
|
||||
} from "./Common";
|
||||
import {deleteArchives, postDownload} from "../api";
|
||||
|
|
@ -151,7 +151,7 @@ function ArchivePage() {
|
|||
<ExternalCardLink to={singlefileUrl}>
|
||||
<Header as='h2'>{textEllipsis(archive.title || archive.url, 100)}</Header>
|
||||
</ExternalCardLink>
|
||||
<Header as='h3'>{uploadDate(archive.archive_datetime)}</Header>
|
||||
<Header as='h3'>{epochToDateString(archive.archive_datetime)}</Header>
|
||||
{domainHeader}
|
||||
{urlHeader}
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ export function ArchiveCard({file}) {
|
|||
</CardLink>}
|
||||
<CardMeta {...s}>
|
||||
<p>
|
||||
{uploadDate(archive.archive_datetime)}
|
||||
{epochToDateString(archive.archive_datetime)}
|
||||
</p>
|
||||
</CardMeta>
|
||||
<CardDescription>
|
||||
|
|
|
|||
|
|
@ -106,14 +106,14 @@ export function Duration({video}) {
|
|||
}
|
||||
}
|
||||
|
||||
export function uploadDate(d) {
|
||||
export function epochToDateString(date) {
|
||||
// Convert a date integer to a human-readable date format.
|
||||
let upload_date = <></>;
|
||||
if (d) {
|
||||
upload_date = new Date(d * 1000);
|
||||
upload_date = `${upload_date.getFullYear()}-${upload_date.getMonth() + 1}-${upload_date.getDate()}`;
|
||||
let d = <></>;
|
||||
if (date) {
|
||||
d = new Date(date * 1000);
|
||||
d = `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;
|
||||
}
|
||||
return upload_date;
|
||||
return d;
|
||||
}
|
||||
|
||||
export function CardLink({to, newTab = false, ...props}) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import {
|
|||
PageContainer,
|
||||
Paginator,
|
||||
textEllipsis,
|
||||
uploadDate,
|
||||
epochToDateString,
|
||||
useTitle
|
||||
} from "./Common";
|
||||
import {useBrowseFiles, useQuery, useSearchFiles} from "../hooks/customHooks";
|
||||
|
|
@ -166,7 +166,7 @@ function ImageCard({file}) {
|
|||
</ExternalCardLink>
|
||||
</CardHeader>
|
||||
<CardMeta {...s}>
|
||||
<p>{uploadDate(file.modified / 1000)}</p>
|
||||
<p>{epochToDateString(file.modified / 1000)}</p>
|
||||
</CardMeta>
|
||||
<CardDescription {...s}>
|
||||
<p>{humanFileSize(file.size)}</p>
|
||||
|
|
@ -203,7 +203,7 @@ function FileCard({file}) {
|
|||
{textEllipsis(file.title || file.stem || file.path)}
|
||||
</ExternalCardLink>
|
||||
</CardHeader>
|
||||
<p>{uploadDate(file.modified / 1000)}</p>
|
||||
<p>{epochToDateString(file.modified / 1000)}</p>
|
||||
<p>{size}</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import React, {useContext, useState} from 'react';
|
|||
import {deleteVideos} from "../api";
|
||||
import {Link, useNavigate, useParams} from "react-router-dom";
|
||||
import _ from "lodash";
|
||||
import {BackButton, humanFileSize, humanNumber, PageContainer, uploadDate, useTitle} from "./Common";
|
||||
import {BackButton, epochToDateString, humanFileSize, humanNumber, PageContainer, useTitle} from "./Common";
|
||||
import {Confirm} from "semantic-ui-react";
|
||||
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
|
||||
import Container from "semantic-ui-react/dist/commonjs/elements/Container";
|
||||
|
|
@ -175,7 +175,7 @@ function VideoPage({videoFile, prevFile, nextFile, setFavorite, ...props}) {
|
|||
<Segment>
|
||||
|
||||
<Header as='h2'>{video.title || video.video_path}</Header>
|
||||
{video.upload_date && <h3>{uploadDate(video.upload_date)}</h3>}
|
||||
{video.upload_date && <h3>{epochToDateString(video.upload_date)}</h3>}
|
||||
<h3>
|
||||
{channel && <Link to={`/videos/channel/${channel.id}/video`}>
|
||||
{channel.name}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
SearchInput,
|
||||
TabLinks,
|
||||
textEllipsis,
|
||||
uploadDate,
|
||||
epochToDateString,
|
||||
useTitle
|
||||
} from "./Common"
|
||||
import VideoPage from "./VideoPlayer";
|
||||
|
|
@ -310,7 +310,7 @@ export function VideoCard({file}) {
|
|||
const {s} = useContext(ThemeContext);
|
||||
|
||||
let video_url = `/videos/video/${video.id}`;
|
||||
const upload_date = uploadDate(video.upload_date);
|
||||
const upload_date = epochToDateString(video.upload_date);
|
||||
// A video may not have a channel.
|
||||
const channel = video.channel ? video.channel : null;
|
||||
let channel_url = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue