Fix matching behavior, fix duration on album

This commit is contained in:
DataHoarder 2022-02-20 01:31:49 +01:00
parent f6a90f22e7
commit d7ec08e0e7
2 changed files with 12 additions and 4 deletions

View file

@ -418,6 +418,7 @@ func processIndexDirectory(filePath, indexPath, kind string, wg *sync.WaitGroup)
createDisc := func() {
if len(disc.Tracks) > 0 {
disc.TrackCount = len(disc.Tracks)
entry.Duration += disc.Duration
entry.Discs = append(entry.Discs, disc)
}
}
@ -790,9 +791,19 @@ func main() {
writer.Write([]byte(fmt.Sprintf("DTITLE=%s / %s\n", group, entry.MainTitle)))
}
if !entry.ReleaseDate.IsZero() {
writer.Write([]byte(fmt.Sprintf("DYEAR=%d\nDGENRE=Soundtrack\n", entry.ReleaseDate.Year())))
writer.Write([]byte(fmt.Sprintf("DYEAR=%d\n", entry.ReleaseDate.Year())))
}
var genres []string
if entry.Type == "arrangement" {
genres = append(genres, entry.Type)
}
genres = append(genres, entry.Genre...)
if len(genres) == 0 {
genres = append(genres, "soundtrack")
}
writer.Write([]byte(fmt.Sprintf("DGENRE=%s\n", strings.Join(genres, ", "))))
for i, t := range entry.Discs[discIndex].Tracks {
writer.Write([]byte(fmt.Sprintf("TTITLE%d=%s\n", i, t.MainTitle)))
}

View file

@ -41,9 +41,6 @@ func NewTOCFromCDDBString(toc string) (r TOC) {
t = t[1 : len(t)-1] //cut
r = append(TOC{t[len(t)-1]}, t[0:len(t)-1]...) //put last sample at the front
for i := 0; i < len(t); i++ {
r[i] += TocPregap
}
return
}