mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
feat: add hot playback cache (queue prefetch, alpha)
Ephemeral on-disk cache for upcoming queue tracks. Adds Rust commands (download/delete/purge), hotCacheStore with LRU eviction, serial prefetch worker, playback gate, and Settings UI. Disabled by default. - fix: boundary check before file delete in delete_hot_cache_track - fix: remove stale languageRu2 key from ru.ts - fix: restore accidentally removed lyricsServerFirst/fsLyricsToggle/lyricsSource* strings in ru.ts
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
/** When true, hot-cache prefetch must not start new downloads (playback has priority). */
|
||||
let deferHotCachePrefetch = false;
|
||||
|
||||
export function setDeferHotCachePrefetch(v: boolean): void {
|
||||
deferHotCachePrefetch = v;
|
||||
}
|
||||
|
||||
export function getDeferHotCachePrefetch(): boolean {
|
||||
return deferHotCachePrefetch;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { buildStreamUrl } from '../api/subsonic';
|
||||
import { useOfflineStore } from '../store/offlineStore';
|
||||
import { useHotCacheStore } from '../store/hotCacheStore';
|
||||
|
||||
/** Offline library → hot playback cache → HTTP stream. */
|
||||
export function resolvePlaybackUrl(trackId: string, serverId: string): string {
|
||||
const offline = useOfflineStore.getState().getLocalUrl(trackId, serverId);
|
||||
if (offline) return offline;
|
||||
const hot = useHotCacheStore.getState().getLocalUrl(trackId, serverId);
|
||||
if (hot) return hot;
|
||||
return buildStreamUrl(trackId);
|
||||
}
|
||||
Reference in New Issue
Block a user