get info about genere from musicbrainz in info

This commit is contained in:
2026-05-20 22:22:18 +02:00
parent f520cc8913
commit 0a7849ebfa
3 changed files with 68 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"git.kapelle.org/niklas/ripsort/internal/clients/musicbrainz"
"git.kapelle.org/niklas/ripsort/internal/metadata"
)
@@ -18,12 +19,30 @@ func Scan(filePath string) error {
return err
}
fmt.Printf("Title: %s\n", info.Title)
mbc := musicbrainz.NewMusicBrainzClient()
genre, err := metadata.SearchForGenre(mbc, info)
if err != nil {
slog.Error("Failed to search for genere", "err", err)
return err
}
if info.Title != nil {
fmt.Printf("Title: %s\n", *info.Title)
}
fmt.Printf("Artist: %s\n", info.Artist)
fmt.Printf("Album: %s\n", info.Album)
if info.Album != nil {
fmt.Printf("Album: %s\n", *info.Album)
}
fmt.Printf("Album Artist: %s\n", info.AlbumArtist)
fmt.Printf("Track: %d/%d\n", info.Track, info.TotalTracks)
fmt.Printf("Comment: %s\n", info.Comment)
if info.ISRC != nil {
fmt.Printf("ISRC: %s\n", *info.ISRC)
}
if info.Comment != nil {
fmt.Printf("Comment: %s\n", *info.Comment)
}
fmt.Printf("Genre: %s\n", genre)
sortPath := pathForFile(filePath, *info)
fmt.Printf("Sort path: %s\n", sortPath)