Skip to content

Commit

Permalink
feat(xtream): add loadChannelEpg method to fetch EPG listings with de…
Browse files Browse the repository at this point in the history
…coding
  • Loading branch information
4gray committed Dec 26, 2024
1 parent 175d631 commit cf6c5b4
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/app/xtream-tauri/xtream.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ export const XtreamStore = signalStore(
username: store.currentPlaylist().username,
password: store.currentPlaylist().password,
stream_id: store.selectedItem().xtream_id,
limit: 10,
}
);

Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit cf6c5b4

Please sign in to comment.