diff --git a/index.js b/index.js
index 0b26c57..155303c 100644
--- a/index.js
+++ b/index.js
@@ -198,7 +198,8 @@ app.get('/epg.xml', async (req, res) => {
xml += ` ${escapeXml(content.liveCategoryValue || content.liveCategory)}\n`;
}
if (content.liveImageUrl) {
- xml += ` \n`;
+ const iconUrl = content.liveImageUrl.replace('{type}', '720');
+ xml += ` \n`;
}
xml += ` \n`;
} else {
@@ -356,21 +357,10 @@ app.get('/stream/:channelId', async (req, res) => {
const hlsMedia = media.find(m => m.mediaId === 'HLS' || m.mediaId === 'LLHLS');
if (hlsMedia && hlsMedia.path) {
+ // Redirect Jellyfin to our proxy endpoint to ensure ffprobe/ffmpeg detects the HLS format correctly
const host = req.get('host');
const protocol = req.protocol;
- const baseUrl = `${protocol}://${host}`;
- const m3u8Url = hlsMedia.path;
-
- const m3u8Res = await axios.get(m3u8Url);
- let m3u8Data = m3u8Res.data;
-
- // Filter out unplayable variants (e.g. 1080p returning 403) before returning the playlist to Jellyfin
- m3u8Data = await filterMasterPlaylist(m3u8Data, m3u8Url);
-
- const processedM3U8 = processM3U8(m3u8Data, m3u8Url, baseUrl);
-
- res.header('Content-Type', 'application/vnd.apple.mpegurl');
- res.send(processedM3U8);
+ res.redirect(302, `${protocol}://${host}/m3u8?url=${encodeURIComponent(hlsMedia.path)}`);
} else {
res.status(404).send('HLS stream not found in playback info');
}
@@ -391,6 +381,11 @@ app.get('/m3u8', async (req, res) => {
const protocol = req.protocol;
const baseUrl = `${protocol}://${host}`;
+ // If it's a master playlist, dynamically check and filter out unplayable variants
+ if (m3u8Data.includes('#EXT-X-STREAM-INF')) {
+ m3u8Data = await filterMasterPlaylist(m3u8Data, m3u8Url);
+ }
+
const processedM3U8 = processM3U8(m3u8Data, m3u8Url, baseUrl);
res.header('Content-Type', 'application/vnd.apple.mpegurl');