patch2
This commit is contained in:
@@ -198,7 +198,8 @@ app.get('/epg.xml', async (req, res) => {
|
||||
xml += ` <category>${escapeXml(content.liveCategoryValue || content.liveCategory)}</category>\n`;
|
||||
}
|
||||
if (content.liveImageUrl) {
|
||||
xml += ` <icon src="${escapeXml(content.liveImageUrl)}" />\n`;
|
||||
const iconUrl = content.liveImageUrl.replace('{type}', '720');
|
||||
xml += ` <icon src="${escapeXml(iconUrl)}" />\n`;
|
||||
}
|
||||
xml += ` </programme>\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');
|
||||
|
||||
Reference in New Issue
Block a user