(activeChannelUUIDs)
| 21 | }; |
| 22 | |
| 23 | export const getCurrentPrograms = async (activeChannelUUIDs) => { |
| 24 | try { |
| 25 | if (!activeChannelUUIDs || activeChannelUUIDs.length === 0) { |
| 26 | return {}; |
| 27 | } |
| 28 | |
| 29 | const programs = await API.getCurrentPrograms(activeChannelUUIDs); |
| 30 | |
| 31 | // Convert array to map keyed by channel UUID for easy lookup |
| 32 | const programsMap = {}; |
| 33 | if (programs && Array.isArray(programs)) { |
| 34 | programs.forEach((program) => { |
| 35 | if (program.channel_uuid) { |
| 36 | programsMap[program.channel_uuid] = program; |
| 37 | } |
| 38 | }); |
| 39 | } |
| 40 | |
| 41 | return programsMap; |
| 42 | } catch (error) { |
| 43 | console.error('Error fetching current programs:', error); |
| 44 | return {}; |
| 45 | } |
| 46 | }; |
| 47 | |
| 48 | export const getCombinedConnections = (channelHistory, vodConnections) => { |
| 49 | const activeStreams = Object.values(channelHistory).map((channel) => ({ |
no test coverage detected