mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-22 03:05:32 +02:00
fix(frontend): audio-only conflict handling in playlist quality selector
applyPlaylistQuality('audio'):
- Only sets quality='audio' on items where has_audio=true
- Items with has_audio=false: keep prior selection if set, else null
(conflict) — same rule as unsupported height, blocks archive until
user explicitly picks a quality for those items
Playlist-level 'Audio only' option:
- Changed hasAnyAudio → allHaveAudio (every item must have audio)
- When any item lacks audio, the option is hidden entirely so the
selector can never create immediate conflicts just by appearing
This commit is contained in:
parent
34ec0b44e2
commit
02b9207454
3 changed files with 21 additions and 12 deletions
File diff suppressed because one or more lines are too long
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>Archivr</title>
|
<title>Archivr</title>
|
||||||
<script type="module" crossorigin src="/assets/index-Biv9sexV.js"></script>
|
<script type="module" crossorigin src="/assets/index-8HhvMz5i.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-vCRGeW0A.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-vCRGeW0A.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -124,8 +124,17 @@ function makeItem(locator = '') {
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyPlaylistQuality(newQ, currentItems) {
|
function applyPlaylistQuality(newQ, currentItems) {
|
||||||
if (newQ === 'best' || newQ === 'audio') {
|
if (newQ === 'best') {
|
||||||
return currentItems.map(item => ({ ...item, quality: newQ }))
|
return currentItems.map(item => ({ ...item, quality: 'best' }))
|
||||||
|
}
|
||||||
|
if (newQ === 'audio') {
|
||||||
|
return currentItems.map(item => {
|
||||||
|
if (item.has_audio) return { ...item, quality: 'audio' }
|
||||||
|
// No audio track — same conflict rule as unsupported height:
|
||||||
|
// keep a prior selection if one exists, otherwise leave null (blocks archive).
|
||||||
|
if (item.quality !== null) return item
|
||||||
|
return { ...item, quality: null }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const newHeight = parseInt(newQ)
|
const newHeight = parseInt(newQ)
|
||||||
return currentItems.map(item => {
|
return currentItems.map(item => {
|
||||||
|
|
@ -698,7 +707,7 @@ function CaptureRow({ item, autoFocus, onLocatorChange, onQualityChange, onRemov
|
||||||
const allHeights = [...new Set(
|
const allHeights = [...new Set(
|
||||||
item.playlistItems.flatMap(pi => pi.qualities.map(q => parseInt(q)))
|
item.playlistItems.flatMap(pi => pi.qualities.map(q => parseInt(q)))
|
||||||
)].sort((a, b) => b - a)
|
)].sort((a, b) => b - a)
|
||||||
const hasAnyAudio = item.playlistItems.some(pi => pi.has_audio)
|
const allHaveAudio = item.playlistItems.every(pi => pi.has_audio)
|
||||||
const conflictCount = item.playlistItems.filter(pi => pi.quality === null).length
|
const conflictCount = item.playlistItems.filter(pi => pi.quality === null).length
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -711,7 +720,7 @@ function CaptureRow({ item, autoFocus, onLocatorChange, onQualityChange, onRemov
|
||||||
{!item.playlistQuality && <option value="" disabled>Select quality…</option>}
|
{!item.playlistQuality && <option value="" disabled>Select quality…</option>}
|
||||||
<option value="best">Best quality</option>
|
<option value="best">Best quality</option>
|
||||||
{allHeights.map(h => <option key={h} value={`${h}p`}>{h}p</option>)}
|
{allHeights.map(h => <option key={h} value={`${h}p`}>{h}p</option>)}
|
||||||
{hasAnyAudio && <option value="audio">Audio only</option>}
|
{allHaveAudio && <option value="audio">Audio only</option>}
|
||||||
</select>
|
</select>
|
||||||
{conflictCount > 0 && (
|
{conflictCount > 0 && (
|
||||||
<span className="capture-conflict-badge">{conflictCount} need selection</span>
|
<span className="capture-conflict-badge">{conflictCount} need selection</span>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue