add audio prefetch cache with sliding window pre-downloads#46
Merged
nyakuoff merged 9 commits intonyakuoff:mainfrom Mar 9, 2026
Merged
add audio prefetch cache with sliding window pre-downloads#46nyakuoff merged 9 commits intonyakuoff:mainfrom
nyakuoff merged 9 commits intonyakuoff:mainfrom
Conversation
Downloads upcoming tracks to disk via yt-dlp so playback continues even without internet. Configurable window size (Off/1/3/5/10/Entire queue) in settings with EXPERIMENTAL tag. Sequential downloads, automatic eviction on track change, cache invalidation on quality change, and full cleanup on app quit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Trigger onTrackChanged on startup when queue exists (fixes no downloads until setting is toggled) - Sync prefetch state after cloud load - Add cached track indicator (SVG icon) in queue artist line - Add onCacheUpdateCb for live DOM updates without full re-render - Remove redundant --extract-audio flag from yt-dlp download Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Swap the SVG download icon for a simple 6px accent-colored dot next to the artist name in queue items. Update settings description to explain the dot meaning. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rors - Fix currently-playing track file deleted mid-playback (include current track in cache window to prevent eviction while audio is using it) - Clean up partial files after SIGTERM cancel (--no-part leaves corrupt files that passed the existence check, causing broken playback) - Add generation counter to prevent concurrent _processQueue loops (clear() + immediate onTrackChanged() caused race condition) - Fix _activeDownloadProc callback clobbering new process reference - Add pathToFileUrl() helper for correct Windows file:// URLs - Fix path traversal in cache:deleteFile (add path.sep to startsWith) - Use getState().queue instead of stale captured queue reference - Replace per-track dot indicator with global counter pill badge - Add missing prefetch hooks for clear queue, remove item, drag reorder, and Start Radio skip-restart (×3) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts: # src/renderer/app.js
Resolved 5 conflicts: - 3x start-radio: use main's startRadio() helper with I18n - playTrack: keep prefetch cache lookup + I18n toast - queue header: wrap data-i18n in span to preserve cached count - Add queue.cached translation key to all 12 locales
- Add data-i18n attributes to prefetch settings label, description, and all 6 select options in index.html - Add 8 translation keys to all 12 locales Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve conflicts in app.js (state defaults/saveState/loadState/cloudSync), main.js (CSP: keep both http: and file: in media-src), and 11 locale files (keep both prefetch + plugin i18n keys). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
Don't forget to check this |
Owner
|
Hey! I've been busy with work lately, I will handle this PR and the currently open issues tomorrow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
prefetchCountsetting in Settings > Playback (Off by default), persisted to localStorage and cloud syncedImplementation Details
prefetch-cache.jswith public API (getCachedPath,onTrackChanged,clear,destroy, etc.)playTrack()checks cache before fetching from network;pathToFileUrl()converts paths to file:// URLs (cross-platform with backslash normalization forWindows)
onTrackChanged()orclear()(play, shuffle, add, remove, load state)UI Changes
Grabacion.de.pantalla.desde.2026-03-03.15-23-48.mp4
Testing
Notes
getCachedPath()returns null and falls back to networ