Add structured lyrics storage and indexing (line/word timing, byte offsets)
Adds database.InsertLyrics/GetSongStructuredLyrics storing multiple lyrics entries per song with per-line start times and, when the source provides it, word-level cues carrying precomputed UTF-8 byte offsets. library.IndexLyrics wires this into the scanner: embedded plain-text tags are stored unsynced, and a same-basename sidecar .lrc (plain or Enhanced) is parsed and stored synced, with word cues when present. IndexFile now takes the media file's absolute path so lyrics indexing can locate sidecar files. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014r98AtcBbevpscWLsfwVvv
This commit is contained in:
@@ -46,7 +46,7 @@ func TestIndexFileCreatesArtistAlbumSong(t *testing.T) {
|
||||
Year: 2020,
|
||||
}
|
||||
|
||||
song, err := IndexFile(db, mf, tags)
|
||||
song, err := IndexFile(db, mf, "/music/"+mf.RelativePath, tags)
|
||||
if err != nil {
|
||||
t.Fatalf("IndexFile: %v", err)
|
||||
}
|
||||
@@ -87,11 +87,11 @@ func TestIndexFileIsIdempotent(t *testing.T) {
|
||||
mf := makeMediaFile(t, db, "Artist/Album/01 - Song.flac")
|
||||
tags := &metadata.Tags{Title: "Song", Album: "Album", AlbumArtist: "Artist", Artists: []string{"Artist"}}
|
||||
|
||||
song1, err := IndexFile(db, mf, tags)
|
||||
song1, err := IndexFile(db, mf, "/music/"+mf.RelativePath, tags)
|
||||
if err != nil {
|
||||
t.Fatalf("IndexFile (1st): %v", err)
|
||||
}
|
||||
song2, err := IndexFile(db, mf, tags)
|
||||
song2, err := IndexFile(db, mf, "/music/"+mf.RelativePath, tags)
|
||||
if err != nil {
|
||||
t.Fatalf("IndexFile (2nd): %v", err)
|
||||
}
|
||||
@@ -114,7 +114,7 @@ func TestIndexFileIsIdempotent(t *testing.T) {
|
||||
func TestIndexFileUsesFilenameWhenNoTitle(t *testing.T) {
|
||||
db := openTestDB(t)
|
||||
mf := makeMediaFile(t, db, "Unknown/Track.flac")
|
||||
song, err := IndexFile(db, mf, &metadata.Tags{})
|
||||
song, err := IndexFile(db, mf, "/music/"+mf.RelativePath, &metadata.Tags{})
|
||||
if err != nil {
|
||||
t.Fatalf("IndexFile: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user