Copy ffprobe in output

This commit is contained in:
Nick Mowen 2022-11-09 14:47:03 -07:00
parent 3077ff07fc
commit 1ccc9bd6b7
2 changed files with 18 additions and 7 deletions

View File

@ -630,7 +630,7 @@ def ffprobe(camera_name):
else:
output += "error getting stream\n"
return output
return jsonify(output, "200")
else:
# user has single stream
ffprobe = ffprobe_stream(config.ffmpeg.inputs[0].path)
@ -643,9 +643,7 @@ def ffprobe(camera_name):
"500",
)
else:
return jsonify(
{"success": True, "message": ffprobe}, "200"
)
return jsonify(ffprobe, "200")
@bp.route("/<camera_name>")

View File

@ -5,6 +5,7 @@ import Heading from '../components/Heading';
import Link from '../components/Link';
import { useMqtt } from '../api/mqtt';
import useSWR from 'swr';
import axios from 'axios';
import { Table, Tbody, Thead, Tr, Th, Td } from '../components/Table';
import { useCallback } from 'preact/hooks';
@ -32,6 +33,18 @@ export default function Debug() {
copy();
}, [config]);
const onCopyFfprobe = async (camera, e) => {
if (e) {
e.stopPropagation();
}
const response = await axios.get(`${camera}/ffprobe`);
if (response.status === 200) {
await window.navigator.clipboard.writeText(JSON.stringify(response.data, null, 2));
}
};
return (
<div className="space-y-4 p-2 px-4">
<Heading>
@ -76,9 +89,9 @@ export default function Debug() {
<div className='dark:bg-gray-800 shadow-md hover:shadow-lg rounded-lg transition-shadow p-4 m-2'>
<div className='text-lg flex justify-between'>
<Link href={`/cameras/${camera}`}>{camera.replaceAll('_', ' ')}</Link>
<div className='text-sm'>
ffprobe
</div>
<Button onClick={(e) => onCopyFfprobe(camera, e)}>
copy ffprobe
</Button>
</div>
<div className='p-4'>
<Table className='w-full'>