fix: invalid ui info
This commit is contained in:
parent
8250b42714
commit
99d6953f03
1 changed files with 11 additions and 3 deletions
14
src/index.ts
14
src/index.ts
|
|
@ -57,7 +57,15 @@ function addStreamToUI(url: string, parsed?: ParsedPlaylist): void {
|
|||
if (!streamsContainer) return;
|
||||
|
||||
const existing = streamsContainer.querySelector(`[data-url="${url}"]`);
|
||||
if (existing) return;
|
||||
if (existing) {
|
||||
const metaEl = existing.querySelector('.m3u8-dl-stream-meta');
|
||||
if (metaEl && parsed && !parsed.isMaster) {
|
||||
const segmentCount = parsed.segments.length;
|
||||
const encrypted = parsed.segments.some(s => s.key !== null);
|
||||
metaEl.textContent = `Video | Segments: ${segmentCount} | Encrypted: ${encrypted ? 'AES-128' : 'No'}`;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const emptyMsg = streamsContainer.querySelector('.m3u8-dl-empty');
|
||||
if (emptyMsg) emptyMsg.remove();
|
||||
|
|
@ -79,10 +87,10 @@ function addStreamToUI(url: string, parsed?: ParsedPlaylist): void {
|
|||
`;
|
||||
} else {
|
||||
const segmentCount = parsed && !parsed.isMaster ? parsed.segments.length : '--';
|
||||
const encrypted = parsed && !parsed.isMaster ? parsed.segments.some(s => s.key !== null) : 'unknown';
|
||||
const encrypted = parsed && !parsed.isMaster ? parsed.segments.some(s => s.key !== null) : false;
|
||||
item.innerHTML = `
|
||||
<div class="m3u8-dl-stream-url">${url}</div>
|
||||
<div class="m3u8-dl-stream-meta">Video | Segments: ${segmentCount} | Encrypted: ${encrypted ? 'AES-128' : 'No'}</div>
|
||||
<div class="m3u8-dl-stream-meta">Video | Segments: ${segmentCount} | Encrypted: ${segmentCount === '--' ? '--' : (encrypted ? 'AES-128' : 'No')}</div>
|
||||
<div class="m3u8-dl-stream-actions">
|
||||
<button class="m3u8-dl-download-btn" data-url="${url}">Download</button>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue