mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 11:26:25 -05:00
Creating Video.ffprobe_json column which stores ffprobe information about the video file. Creating find_corrupt_videos.py script which automatically re-downloads videos which do not have both video and audio streams.
This commit is contained in:
parent
097c3143e1
commit
36083200e6
39 changed files with 598 additions and 172 deletions
|
|
@ -131,11 +131,11 @@ function ArchivePage() {
|
|||
historyList = <FileCards files={history}/>;
|
||||
}
|
||||
|
||||
const domain = data.domain ? data.domain.domain : null;
|
||||
const domain = data.domain ? data.domain : null;
|
||||
let domainHeader;
|
||||
if (domain) {
|
||||
const domainUrl = `/archive?domain=${domain}`;
|
||||
domainHeader = <Header as='h5'>
|
||||
domainHeader = <Header as='h4'>
|
||||
<CardLink to={domainUrl}>
|
||||
{domain}
|
||||
</CardLink>
|
||||
|
|
@ -272,7 +272,7 @@ export function DomainsPage() {
|
|||
filteredDomains = domains.filter(i => re.test(i['domain']));
|
||||
}
|
||||
|
||||
const row = ({domain, url_count}) => {
|
||||
const domainRow = ({domain, url_count, size}) => {
|
||||
return <TableRow key={domain}>
|
||||
<TableCell>
|
||||
<Link to={`/archive?domain=${domain}`}>
|
||||
|
|
@ -280,12 +280,14 @@ export function DomainsPage() {
|
|||
</Link>
|
||||
</TableCell>
|
||||
<TableCell>{url_count}</TableCell>
|
||||
<TableCell>{humanFileSize(size)}</TableCell>
|
||||
</TableRow>
|
||||
}
|
||||
|
||||
const headers = [
|
||||
{key: 'domain', text: 'Domain', sortBy: 'domain', width: 12},
|
||||
{key: 'archives', text: 'Archives', sortBy: 'url_count', width: 2},
|
||||
{key: 'Size', text: 'Size', sortBy: 'size', width: 2},
|
||||
];
|
||||
|
||||
return <>
|
||||
|
|
@ -298,7 +300,7 @@ export function DomainsPage() {
|
|||
<SortableTable
|
||||
tableProps={{unstackable: true}}
|
||||
data={filteredDomains}
|
||||
rowFunc={(i, sortData) => row(i)}
|
||||
rowFunc={(i, sortData) => domainRow(i)}
|
||||
rowKey='domain'
|
||||
tableHeaders={headers}
|
||||
/>
|
||||
|
|
@ -362,11 +364,10 @@ function ArchivesPage() {
|
|||
}
|
||||
}
|
||||
|
||||
const onDelete = async (e) => {
|
||||
e.preventDefault();
|
||||
const onDelete = async () => {
|
||||
setDeleteOpen(false);
|
||||
const archiveIds = archives.filter(i => selectedArchives.indexOf(i['primary_path']) >= 0)
|
||||
.map(i => i['archive']['id']);
|
||||
.map(i => i['data']['id']);
|
||||
await deleteArchives(archiveIds);
|
||||
await fetchArchives();
|
||||
setSelectedArchives([]);
|
||||
|
|
@ -383,18 +384,13 @@ function ArchivesPage() {
|
|||
}
|
||||
|
||||
const selectElm = <div style={{marginTop: '0.5em'}}>
|
||||
<Button
|
||||
<APIButton
|
||||
color='red'
|
||||
disabled={_.isEmpty(selectedArchives)}
|
||||
onClick={() => setDeleteOpen(true)}
|
||||
>Delete</Button>
|
||||
<Confirm
|
||||
open={deleteOpen}
|
||||
content='Are you sure you want to delete these archives files? This cannot be undone.'
|
||||
confirmButton='Delete'
|
||||
onCancel={() => setDeleteOpen(false)}
|
||||
onConfirm={onDelete}
|
||||
/>
|
||||
confirmContent='Are you sure you want to delete these archives files? This cannot be undone.'
|
||||
onClick={onDelete}
|
||||
>Delete</APIButton>
|
||||
<Button
|
||||
color='grey'
|
||||
onClick={invertSelection}
|
||||
|
|
|
|||
|
|
@ -541,6 +541,7 @@ export function CardPoster({to, file}) {
|
|||
const {s} = useContext(ThemeContext);
|
||||
// Used to center posters in CardIcon.
|
||||
const style = {display: 'flex', justifyContent: 'center', ...s['style']};
|
||||
const navigate = useNavigate();
|
||||
|
||||
const cardTagIcon = <div className="ui green left corner label">
|
||||
<i aria-hidden="true" className="tag icon"></i>
|
||||
|
|
@ -549,8 +550,27 @@ export function CardPoster({to, file}) {
|
|||
|
||||
let posterPath = findPosterPath(file);
|
||||
|
||||
if (!posterPath) {
|
||||
// No poster, use a FileIcon.
|
||||
if (!posterPath && to && (to.startsWith('/download/') || to.startsWith('/media/'))) {
|
||||
// No poster, link is to download a file directly.
|
||||
return <ExternalCardLink to={to}>
|
||||
<CardIcon onClick={() => {
|
||||
window.location.href = to;
|
||||
return null
|
||||
}}>
|
||||
{imageLabel}
|
||||
<FileIcon file={file}/>
|
||||
</CardIcon>
|
||||
</ExternalCardLink>
|
||||
} else if (!posterPath && to) {
|
||||
// No poster, link to the full page.
|
||||
return <Link to={to}>
|
||||
<CardIcon onClick={() => navigate(to)}>
|
||||
{imageLabel}
|
||||
<FileIcon file={file}/>
|
||||
</CardIcon>
|
||||
</Link>
|
||||
} else if (!posterPath) {
|
||||
// No poster, no to, use a Preview.
|
||||
return <PreviewLink file={file}>
|
||||
<CardIcon>
|
||||
{imageLabel}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,22 @@ export function DonatePage() {
|
|||
<Segment>
|
||||
<Header as='h1'>Donate</Header>
|
||||
<Header as='h3'>We appreciate any support you can provide to WROLPi!</Header>
|
||||
|
||||
<p>
|
||||
<Button
|
||||
size='huge'
|
||||
icon='paypal'
|
||||
as='a'
|
||||
color='blue'
|
||||
href='https://www.paypal.com/donate/?hosted_button_id=ZH2CN92SMJ66N'
|
||||
label={{
|
||||
basic: true,
|
||||
content: 'Donate on PayPal',
|
||||
color: 'blue'
|
||||
}}
|
||||
/>
|
||||
</p>
|
||||
|
||||
<CoinRow header='Monero' qrCodeValue={moneroContent} address={moneroAddress} buttonColor='orange'/>
|
||||
<CoinRow header='Litecoin' qrCodeValue={litecoinContent} address={litecoinAddress} buttonColor='grey'/>
|
||||
<CoinRow header='Ethereum' qrCodeValue={ethereumContent} address={ethereumAddress} buttonColor='blue'/>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import {
|
|||
useQuery,
|
||||
useSearchFiles,
|
||||
useSearchFilter,
|
||||
useSearchView,
|
||||
useSearchView, useStatusFlag,
|
||||
useWROLMode
|
||||
} from "../hooks/customHooks";
|
||||
import {Route, Routes} from "react-router-dom";
|
||||
|
|
@ -62,7 +62,7 @@ import {SelectableTable} from "./Tables";
|
|||
import {VideoCard, VideoRowCells} from "./Videos";
|
||||
import _ from 'lodash';
|
||||
import {FileBrowser} from "./FileBrowser";
|
||||
import {refreshDirectoryFiles, refreshFiles} from "../api";
|
||||
import {refreshFiles} from "../api";
|
||||
import {useSubscribeEventName} from "../Events";
|
||||
import {TagsSelector} from "../Tags";
|
||||
import {Headlines} from "./Headline";
|
||||
|
|
@ -571,26 +571,37 @@ export function FilesRoute() {
|
|||
</PageContainer>;
|
||||
}
|
||||
|
||||
export function FilesRefreshButton() {
|
||||
const {status} = useContext(StatusContext);
|
||||
const useRefresh = () => {
|
||||
const refreshing = useStatusFlag('refreshing');
|
||||
const refreshingDirectory = useStatusFlag('refreshing_directory');
|
||||
const wrolModeEnabled = useWROLMode();
|
||||
const refreshing = status && status['flags'] && status['flags'].indexOf('refreshing') >= 0;
|
||||
const refreshingDirectory = status && status['flags'] && status['flags'].indexOf('refreshing_directory') >= 0;
|
||||
|
||||
const [loading, setLoading] = React.useState(false);
|
||||
|
||||
const handleClick = async () => {
|
||||
const localRefreshFiles = async (paths) => {
|
||||
setLoading(true);
|
||||
await refreshFiles();
|
||||
await refreshFiles(paths);
|
||||
}
|
||||
|
||||
// Clear loading when global refresh event completes.
|
||||
useSubscribeEventName('global_refresh_completed', () => setLoading(false));
|
||||
useSubscribeEventName('refresh_completed', () => setLoading(false));
|
||||
|
||||
return {
|
||||
refreshing,
|
||||
refreshingDirectory,
|
||||
wrolModeEnabled,
|
||||
loading,
|
||||
refreshFiles: localRefreshFiles,
|
||||
}
|
||||
}
|
||||
|
||||
export function FilesRefreshButton() {
|
||||
const {refreshing, refreshingDirectory, wrolModeEnabled, loading, refreshFiles} = useRefresh();
|
||||
|
||||
return <Button icon
|
||||
labelPosition='left'
|
||||
loading={loading || refreshing || refreshingDirectory}
|
||||
onClick={handleClick}
|
||||
onClick={() => refreshFiles()}
|
||||
disabled={wrolModeEnabled || loading || refreshing}>
|
||||
<Icon name='refresh'/>
|
||||
Refresh All
|
||||
|
|
@ -598,26 +609,12 @@ export function FilesRefreshButton() {
|
|||
}
|
||||
|
||||
export function DirectoryRefreshButton({paths}) {
|
||||
const {status} = useContext(StatusContext);
|
||||
const refreshing = status && status['flags'] && status['flags'].indexOf('refreshing') >= 0;
|
||||
const refreshingDirectory = status && status['flags'] && status['flags'].indexOf('refreshing_directory') >= 0;
|
||||
const wrolModeEnabled = useWROLMode();
|
||||
|
||||
const [loading, setLoading] = React.useState(false);
|
||||
|
||||
const handleClick = async () => {
|
||||
setLoading(true);
|
||||
await refreshDirectoryFiles(paths);
|
||||
}
|
||||
|
||||
// Clear loading when global refresh event completes.
|
||||
useSubscribeEventName('global_refresh_completed', () => setLoading(false));
|
||||
useSubscribeEventName('directory_refresh_completed', () => setLoading(false));
|
||||
const {refreshing, refreshingDirectory, wrolModeEnabled, loading, refreshFiles} = useRefresh();
|
||||
|
||||
return <Button icon
|
||||
labelPosition='left'
|
||||
loading={loading || refreshing || refreshingDirectory}
|
||||
onClick={handleClick}
|
||||
onClick={() => refreshFiles(paths)}
|
||||
disabled={wrolModeEnabled || loading || refreshing || refreshingDirectory}
|
||||
>
|
||||
<Icon name='refresh'/>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import {ThemeContext} from "../contexts/contexts";
|
|||
import {Button, darkTheme, Header, Icon, Segment, Tab, TabPane} from "./Theme";
|
||||
import {VideoCard} from "./Videos";
|
||||
import {TagsSelector} from "../Tags";
|
||||
import {Label} from "semantic-ui-react";
|
||||
|
||||
const MEDIA_PATH = '/media';
|
||||
|
||||
|
|
@ -109,6 +110,9 @@ function VideoPage({videoFile, prevFile, nextFile, fetchVideo, ...props}) {
|
|||
|
||||
<h3>Censored</h3>
|
||||
<p>{video.censored ? 'Yes' : 'No'}</p>
|
||||
|
||||
<h3>Codec Names</h3>
|
||||
<>{video.codec_names ? video.codec_names.map(i => <Label>{i}</Label>) : 'N/A'}</>
|
||||
</TabPane>
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +137,7 @@ function VideoPage({videoFile, prevFile, nextFile, fetchVideo, ...props}) {
|
|||
|
||||
<h4>Caption Files</h4>
|
||||
{caption_files &&
|
||||
caption_files.map(i => <PreviewPath key={i['path']} {...i}>{i['path']}</PreviewPath>)
|
||||
caption_files.map(i => <p key={i['path']}><PreviewPath {...i}>{i['path']}</PreviewPath></p>)
|
||||
}
|
||||
|
||||
<h4>Poster File</h4>
|
||||
|
|
@ -161,6 +165,13 @@ function VideoPage({videoFile, prevFile, nextFile, fetchVideo, ...props}) {
|
|||
await fetchVideo();
|
||||
}
|
||||
|
||||
let videoSource = <source src={videoUrl}/>;
|
||||
if (video.codec_names && video.codec_names.indexOf('mp4') >= 0) {
|
||||
videoSource = <source src={videoUrl} type="video/mp4"/>
|
||||
} else if (video.codec_names && video.codec_names.indexOf('vp9') >= 0) {
|
||||
videoSource = <source src={videoUrl} type='video/mp4;codecs="vp9, vorbis"'/>
|
||||
}
|
||||
|
||||
return <>
|
||||
<Container style={{margin: '1em'}}>
|
||||
<BackButton/>
|
||||
|
|
@ -174,7 +185,7 @@ function VideoPage({videoFile, prevFile, nextFile, fetchVideo, ...props}) {
|
|||
style={{maxWidth: '100%'}}
|
||||
ref={videoRef}
|
||||
>
|
||||
<source src={videoUrl} type="video/mp4"/>
|
||||
{videoSource}
|
||||
{/* Only WebVTT captions can be displayed. */}
|
||||
{captionUrls.map(i => <track key={i} kind="captions" label="English" src={i} srcLang="en" default/>)}
|
||||
</video>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import React, {useContext, useEffect, useState} from 'react';
|
||||
import {Link, Route, Routes, useParams} from "react-router-dom";
|
||||
import {
|
||||
APIButton,
|
||||
CardLink,
|
||||
CardPoster,
|
||||
cardTitleWrapper,
|
||||
|
|
@ -13,6 +14,7 @@ import {
|
|||
isoDatetimeToString,
|
||||
mimetypeColor,
|
||||
PageContainer,
|
||||
PreviewLink,
|
||||
scrollToTop,
|
||||
SearchInput,
|
||||
SortButton,
|
||||
|
|
@ -25,7 +27,6 @@ import {
|
|||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
Confirm,
|
||||
Container,
|
||||
Image,
|
||||
PlaceholderHeader,
|
||||
|
|
@ -60,7 +61,6 @@ function VideosPage() {
|
|||
const {channelId} = useParams();
|
||||
const {searchParams} = useQuery();
|
||||
const [selectedVideos, setSelectedVideos] = useState([]);
|
||||
const [deleteOpen, setDeleteOpen] = useState(false);
|
||||
|
||||
let searchOrder = defaultVideoOrder;
|
||||
if (searchParams.get('order')) {
|
||||
|
|
@ -118,9 +118,7 @@ function VideosPage() {
|
|||
setSelectedVideos(newSelectedVideos);
|
||||
}
|
||||
|
||||
const onDelete = async (e) => {
|
||||
e.preventDefault();
|
||||
setDeleteOpen(false);
|
||||
const onDelete = async () => {
|
||||
const videoIds = videos.filter(i => selectedVideos.indexOf(i['primary_path']) >= 0).map(i => i['video']['id']);
|
||||
await deleteVideos(videoIds);
|
||||
await fetchVideos();
|
||||
|
|
@ -138,18 +136,13 @@ function VideosPage() {
|
|||
}
|
||||
|
||||
const selectElm = <div style={{marginTop: '0.5em'}}>
|
||||
<Button
|
||||
<APIButton
|
||||
color='red'
|
||||
disabled={_.isEmpty(selectedVideos)}
|
||||
onClick={() => setDeleteOpen(true)}
|
||||
>Delete</Button>
|
||||
<Confirm
|
||||
open={deleteOpen}
|
||||
content='Are you sure you want to delete these video files? This cannot be undone.'
|
||||
confirmButton='Delete'
|
||||
onCancel={() => setDeleteOpen(false)}
|
||||
onConfirm={onDelete}
|
||||
/>
|
||||
confirmContent='Are you sure you want to delete these video files? This cannot be undone.'
|
||||
onClick={onDelete}
|
||||
>Delete</APIButton>
|
||||
<Button
|
||||
color='grey'
|
||||
onClick={() => invertSelection()}
|
||||
|
|
@ -290,18 +283,35 @@ export function VideoCard({file}) {
|
|||
const {video} = file;
|
||||
const {s} = useContext(ThemeContext);
|
||||
|
||||
let video_url = `/videos/video/${video.id}`;
|
||||
// Default to video FilePreview for lone video files.
|
||||
let video_url;
|
||||
|
||||
const upload_date = isoDatetimeToString(video.upload_date);
|
||||
// A video may not have a channel.
|
||||
const channel = video.channel ? video.channel : null;
|
||||
let channel_url = null;
|
||||
if (channel) {
|
||||
// Link to Video in the Channel if possible.
|
||||
channel_url = `/videos/channel/${channel.id}/video`;
|
||||
video_url = `/videos/channel/${channel.id}/video/${video.id}`;
|
||||
} else if (file.files.length > 1) {
|
||||
// No Channel, but the video has multiple files (subtitles, etc.). Use the full VideoPage.
|
||||
video_url = `/videos/video/${video.id}`
|
||||
}
|
||||
|
||||
let poster = <CardPoster to={video_url} file={file}/>;
|
||||
|
||||
let header = <p {...s}>{cardTitleWrapper(file.title || file.name || video.stem || video.video_path)}</p>;
|
||||
if (video_url) {
|
||||
// Link to Channel-Video page or Video page.
|
||||
header = <Link to={video_url} className="no-link-underscore card-link">{header}</Link>;
|
||||
} else {
|
||||
// Video is just a lone video file.
|
||||
header = <PreviewLink file={file}>
|
||||
{header}
|
||||
</PreviewLink>;
|
||||
}
|
||||
|
||||
const color = mimetypeColor(file.mimetype);
|
||||
return <Card color={color}>
|
||||
{poster}
|
||||
|
|
@ -309,9 +319,7 @@ export function VideoCard({file}) {
|
|||
<CardContent {...s}>
|
||||
<CardHeader>
|
||||
<Container textAlign='left'>
|
||||
<Link to={video_url} className="no-link-underscore card-link">
|
||||
<p {...s}>{cardTitleWrapper(file.title || file.name || video.stem || video.video_path)}</p>
|
||||
</Link>
|
||||
{header}
|
||||
</Container>
|
||||
</CardHeader>
|
||||
<CardDescription>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue