perfect snapshot detail cards

This commit is contained in:
Nick Sweeting
2026-01-19 14:56:15 -08:00
parent 86e7973334
commit f3f55d3395
3 changed files with 102 additions and 29 deletions

View File

@@ -2484,15 +2484,19 @@ class ArchiveResult(ModelWithOutputDir, ModelWithConfig, ModelWithNotes, ModelWi
'mp4', 'webm', 'mp3', 'opus', 'ogg', 'wav',
}
for name in ('index.html', 'index.htm'):
candidate = dir_path / name
if candidate.exists() and candidate.is_file():
return candidate
plugin_lower = (plugin_name or '').lower()
prefer_media = plugin_lower in ('ytdlp', 'yt-dlp', 'youtube-dl')
if not prefer_media:
for name in ('index.html', 'index.htm'):
candidate = dir_path / name
if candidate.exists() and candidate.is_file():
return candidate
candidates = []
file_count = 0
max_scan = 200
plugin_lower = (plugin_name or '').lower()
media_exts = {'mp4', 'webm', 'mp3', 'opus', 'ogg', 'wav'}
for file_path in dir_path.rglob('*'):
file_count += 1
if file_count > max_scan:
@@ -2514,6 +2518,8 @@ class ArchiveResult(ModelWithOutputDir, ModelWithConfig, ModelWithNotes, ModelWi
priority = 60
elif ext in ('html', 'htm', 'pdf'):
priority = 40
elif ext in media_exts:
priority = 50 if prefer_media else 10
elif ext in ('png', 'jpg', 'jpeg', 'webp', 'svg', 'gif', 'ico'):
priority = 30
elif ext in ('json', 'jsonl', 'txt', 'md', 'csv', 'tsv'):