mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-03-31 17:10:29 +02:00
- Introduce coverCacheKey parameter through Go backend and Kotlin bridge for stable SAF cover caching - Add MetadataFromFilename flag to skip filename-only metadata and retry via temp-file copy - Add Qobuz album-search fallback between API search and store scraping - Extract buildReEnrichFFmpegMetadata to skip empty metadata fields - Add metadata completeness filter (complete, missing year/genre/album artist) - Add sort modes: artist, album, release date, genre (asc/desc) - Prune stale library cover cache files after full scan - Skip empty values and zero track/disc numbers in FFmpeg metadata - Add new l10n keys for metadata filter and sort options
35 lines
872 B
Go
35 lines
872 B
Go
package gobackend
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestResolveLibraryCoverCacheKeyUsesExplicitKey(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
const explicitKey = "content://media/external/audio/media/42|123456"
|
|
got := resolveLibraryCoverCacheKey("/tmp/saf_random.flac", explicitKey)
|
|
if got != explicitKey {
|
|
t.Fatalf("expected explicit cache key %q, got %q", explicitKey, got)
|
|
}
|
|
}
|
|
|
|
func TestResolveLibraryCoverCacheKeyUsesFilePathAndStatWhenNoExplicitKey(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
tempFile, err := os.CreateTemp("", "cover-cache-*.flac")
|
|
if err != nil {
|
|
t.Fatalf("CreateTemp failed: %v", err)
|
|
}
|
|
tempPath := tempFile.Name()
|
|
tempFile.Close()
|
|
defer os.Remove(tempPath)
|
|
|
|
got := resolveLibraryCoverCacheKey(tempPath, "")
|
|
if !strings.HasPrefix(got, tempPath+"|") {
|
|
t.Fatalf("expected stat-based cache key to start with %q, got %q", tempPath+"|", got)
|
|
}
|
|
}
|