feat(xtream): add loadChannelEpg method to fetch EPG listings with decoding

This commit is contained in:
4gray committed 2024-12-26 22:21:37 +01:00
1 parent 175d631607
commit cf6c5b4317
1 file changed
+32
+32
View File
@@ -705,6 +705,7 @@ export const XtreamStore = signalStore(
username: store.currentPlaylist().username,
password: store.currentPlaylist().password,
stream_id: store.selectedItem().xtream_id,
limit: 10,
}
);
@@ -733,6 +734,37 @@ export const XtreamStore = signalStore(
return [];
}
},
async loadChannelEpg(streamId: number) {
try {
const response = await dataService.fetchData(
`${store.currentPlaylist().serverUrl}/player_api.php`,
{
action: 'get_short_epg',
username: store.currentPlaylist().username,
password: store.currentPlaylist().password,
stream_id: streamId,
limit: 1,
}
);
if (
response?.epg_listings &&
Array.isArray(response.epg_listings)
) {
return response.epg_listings.map((item) => ({
...item,
title: b64DecodeUnicode(item.title).trim(),
description: b64DecodeUnicode(
item.description
).trim(),
}));
}
return [];
} catch (error) {
console.error('Error loading channel EPG:', error);
return [];
}
},
setHideExternalInfoDialog(hideExternalInfoDialog: boolean) {
localStorage.setItem(
'hideExternalInfoDialog',