From 29cb481f787261ea0daccffdce1810ae6affb04b Mon Sep 17 00:00:00 2001 From: fezster <97789007+fezster@users.noreply.github.com> Date: Tue, 24 Mar 2026 15:29:35 +0000 Subject: [PATCH] feat: When recording from EPG, use the explicit channel number selected rather than relying on the findChannelByTvgId() function to select the channel - of which there can be many and it would default to the first channel in the list, which may not be the same stream you want to record. --- frontend/src/pages/Guide.jsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/src/pages/Guide.jsx b/frontend/src/pages/Guide.jsx index 81171637..09f6239f 100644 --- a/frontend/src/pages/Guide.jsx +++ b/frontend/src/pages/Guide.jsx @@ -114,6 +114,7 @@ export default function TVChannelGuide({ startDate, endDate }) { const [recordingForProgram, setRecordingForProgram] = useState(null); const [recordChoiceOpen, setRecordChoiceOpen] = useState(false); const [recordChoiceProgram, setRecordChoiceProgram] = useState(null); + const [recordChoiceChannel, setRecordChoiceChannel] = useState(null); const [existingRuleMode, setExistingRuleMode] = useState(null); const [rulesOpen, setRulesOpen] = useState(false); const [rules, setRules] = useState([]); @@ -708,8 +709,9 @@ export default function TVChannelGuide({ startDate, endDate }) { ); const openRecordChoice = useCallback( - async (program) => { + async (program, channel) => { setRecordChoiceProgram(program); + setRecordChoiceChannel(channel); setRecordChoiceOpen(true); try { const rules = await fetchRules(); @@ -725,8 +727,7 @@ export default function TVChannelGuide({ startDate, endDate }) { ); const recordOne = useCallback( - async (program) => { - const channel = findChannelByTvgId(program.tvg_id); + async (program, channel) => { if (!channel) { showNotification({ title: 'Unable to schedule recording', @@ -739,7 +740,7 @@ export default function TVChannelGuide({ startDate, endDate }) { await createRecording(channel, program); showNotification({ title: 'Recording scheduled' }); }, - [findChannelByTvgId] + [] ); const saveSeriesRule = useCallback(async (program, mode) => { @@ -1436,7 +1437,7 @@ export default function TVChannelGuide({ startDate, endDate }) { program={recordChoiceProgram} recording={recordingForProgram} existingRuleMode={existingRuleMode} - onRecordOne={() => recordOne(recordChoiceProgram)} + onRecordOne={() => recordOne(recordChoiceProgram, recordChoiceChannel)} onRecordSeriesAll={() => saveSeriesRule(recordChoiceProgram, 'all') } @@ -1473,7 +1474,7 @@ export default function TVChannelGuide({ startDate, endDate }) { recording={recordingForProgram} opened={!!selectedProgram} onClose={handleCloseModal} - onRecord={openRecordChoice} + onRecord={(program) => openRecordChoice(program, selectedChannel)} />