refactor: rename envFileEPG to envFileXML; add env var to rename

This commit is contained in:
2025-03-23 05:31:51 -07:00
parent a6abfcde90
commit 62da08860d
2 changed files with 10 additions and 10 deletions

View File

@@ -57,8 +57,8 @@ let EPG_FILE;
const envUrlRepo = process.env.URL_REPO || `https://git.binaryninja.net/binaryninja`; const envUrlRepo = process.env.URL_REPO || `https://git.binaryninja.net/binaryninja`;
const envStreamQuality = process.env.STREAM_QUALITY || `hd`; const envStreamQuality = process.env.STREAM_QUALITY || `hd`;
const envFilePlaylist = process.env.FILE_PLAYLIST || `playlist.m3u8`; const envFileM3U = process.env.FILE_PLAYLIST || `playlist.m3u8`;
const envFileEPG = process.env.FILE_EPG || `xmltv.xml`; const envFileXML = process.env.FILE_EPG || `xmltv.xml`;
const LOG_LEVEL = process.env.LOG_LEVEL || 10; const LOG_LEVEL = process.env.LOG_LEVEL || 10;
/* /*
@@ -169,7 +169,7 @@ if ( process.pkg )
const basePath = path.dirname( process.execPath ); const basePath = path.dirname( process.execPath );
URLS_FILE = path.join( basePath, 'urls.txt' ); URLS_FILE = path.join( basePath, 'urls.txt' );
FORMATTED_FILE = path.join( basePath, 'formatted.dat' ); FORMATTED_FILE = path.join( basePath, 'formatted.dat' );
EPG_FILE = path.join( basePath, 'xmltv.1.xml' ); EPG_FILE = path.join( basePath, `${ envFileXML }` );
EPG_FILE.length; EPG_FILE.length;
} }
else else
@@ -177,7 +177,7 @@ else
Log.info( `Processing Locals` ); Log.info( `Processing Locals` );
URLS_FILE = path.resolve( __dirname, 'urls.txt' ); URLS_FILE = path.resolve( __dirname, 'urls.txt' );
FORMATTED_FILE = path.resolve( __dirname, 'formatted.dat' ); FORMATTED_FILE = path.resolve( __dirname, 'formatted.dat' );
EPG_FILE = path.resolve( __dirname, 'xmltv.1.xml' ); EPG_FILE = path.resolve( __dirname, `${ envFileXML }` );
} }
/* /*
@@ -554,7 +554,7 @@ async function serveChannelPlaylist( req, res )
res.writeHead( 200, res.writeHead( 200,
{ {
'Content-Type': 'application/vnd.apple.mpegurl', 'Content-Type': 'application/vnd.apple.mpegurl',
'Content-Disposition': 'inline; filename="' + envFilePlaylist 'Content-Disposition': 'inline; filename="' + envFileM3U
}); });
res.end( rewrittenPlaylist ); res.end( rewrittenPlaylist );
@@ -581,7 +581,7 @@ async function serveChannelPlaylist( req, res )
const rewrittenPlaylist = await rewritePlaylist( hdUrl, req ); const rewrittenPlaylist = await rewritePlaylist( hdUrl, req );
res.writeHead( 200, { res.writeHead( 200, {
'Content-Type': 'application/vnd.apple.mpegurl', 'Content-Type': 'application/vnd.apple.mpegurl',
'Content-Disposition': 'inline; filename="' + envFilePlaylist 'Content-Disposition': 'inline; filename="' + envFileM3U
}); });
res.end( rewrittenPlaylist ); res.end( rewrittenPlaylist );
@@ -659,7 +659,7 @@ async function servePlaylist( response, req )
response.writeHead( 200, { response.writeHead( 200, {
'Content-Type': 'application/x-mpegURL', 'Content-Type': 'application/x-mpegURL',
'Content-Disposition': 'inline; filename="' + envFilePlaylist 'Content-Disposition': 'inline; filename="' + envFileM3U
}); });
response.end( updatedContent ); response.end( updatedContent );
@@ -691,7 +691,7 @@ async function serveXmltv( response, req )
response.writeHead( 200, { response.writeHead( 200, {
'Content-Type': 'application/xml', 'Content-Type': 'application/xml',
'Content-Disposition': 'inline; filename="xmltv.1.xml"' 'Content-Disposition': 'inline; filename="' + envFileXML
}); });
response.end( formattedContent ); response.end( formattedContent );
@@ -838,7 +838,7 @@ const server = http.createServer( ( request, response ) =>
read the loaded asset file read the loaded asset file
*/ */
ejs.renderFile( './www/' + loadAsset, { fileEPG: envFilePlaylist, fileM3U: envFileEPG, appName: name, appVersion: version }, ( err, data ) => ejs.renderFile( './www/' + loadAsset, { fileXML: envFileXML, fileM3U: envFileM3U, appName: name, appVersion: version }, ( err, data ) =>
{ {
if ( !err ) if ( !err )
{ {

View File

@@ -100,7 +100,7 @@
document.getElementById("playlist-link").textContent = playlistURL; document.getElementById("playlist-link").textContent = playlistURL;
document.getElementById("playlist-link").href = playlistURL; document.getElementById("playlist-link").href = playlistURL;
document.getElementById("epg-url").textContent = "<%= fileEPG %>"; document.getElementById("epg-url").textContent = "<%= fileXML %>";
document.getElementById("epg-url").href = epgURL; document.getElementById("epg-url").href = epgURL;
document.getElementById("epg-link").textContent = epgURL; document.getElementById("epg-link").textContent = epgURL;
document.getElementById("epg-link").href = epgURL; document.getElementById("epg-link").href = epgURL;