Updated to use util functions

This commit is contained in:
Nick Sandstrom 2025-12-27 23:17:42 -08:00
parent 26d9dbd246
commit ffa1331c3b

View file

@ -18,13 +18,14 @@ import useSettingsStore from '../store/settings';
import useVideoStore from '../store/useVideoStore';
import RecordingForm from '../components/forms/Recording';
import {
isAfter, isBefore,
useTimeHelpers,
} from '../utils/dateTimeUtils.js';
const RecordingDetailsModal = lazy(() => import('../components/forms/RecordingDetailsModal'));
import RecurringRuleModal from '../components/forms/RecurringRuleModal.jsx';
import RecordingCard from '../components/cards/RecordingCard.jsx';
import { categorizeRecordings } from '../utils/pages/DVRUtils.js';
import { getPosterUrl } from '../utils/cards/RecordingCardUtils.js';
import { getPosterUrl, getRecordingUrl, getShowVideoUrl } from '../utils/cards/RecordingCardUtils.js';
import ErrorBoundary from '../components/ErrorBoundary.jsx';
const DVRPage = () => {
@ -110,30 +111,20 @@ const DVRPage = () => {
const now = userNow();
const s = toUserTime(rec.start_time);
const e = toUserTime(rec.end_time);
if (now.isAfter(s) && now.isBefore(e)) {
if(isAfter(now, s) && isBefore(now, e)) {
// call into child RecordingCard behavior by constructing a URL like there
const channel = channels[rec.channel];
if (!channel) return;
let url = `/proxy/ts/stream/${channel.uuid}`;
if (useSettingsStore.getState().environment.env_mode === 'dev') {
url = `${window.location.protocol}//${window.location.hostname}:5656${url}`;
}
const url = getShowVideoUrl(channel, useSettingsStore.getState().environment.env_mode);
useVideoStore.getState().showVideo(url, 'live');
}
}
const handleOnWatchRecording = () => {
let fileUrl =
detailsRecording.custom_properties?.file_url ||
detailsRecording.custom_properties?.output_file_url;
if (!fileUrl) return;
if (
useSettingsStore.getState().environment.env_mode === 'dev' &&
fileUrl.startsWith('/')
) {
fileUrl = `${window.location.protocol}//${window.location.hostname}:5656${fileUrl}`;
}
useVideoStore.getState().showVideo(fileUrl, 'vod', {
const url = getRecordingUrl(
detailsRecording.custom_properties, useSettingsStore.getState().environment.env_mode);
if(!url) return;
useVideoStore.getState().showVideo(url, 'vod', {
name:
detailsRecording.custom_properties?.program?.title ||
'Recording',
@ -163,7 +154,7 @@ const DVRPage = () => {
>
New Recording
</Button>
<Stack gap="lg" style={{ paddingTop: 12 }}>
<Stack gap="lg" pt={12}>
<div>
<Group justify="space-between" mb={8}>
<Title order={4}>Currently Recording</Title>