Refactor return type of the search

This commit is contained in:
Alexander
2026-05-05 14:41:45 +02:00
parent b41ea7d023
commit 2400c6345a
20 changed files with 339 additions and 56 deletions
+31
View File
@@ -1,5 +1,9 @@
package release
import (
pb "homelab.lan/music-agregator/gen/music_agregator/indexer/v1"
)
type Type int
const (
@@ -176,3 +180,30 @@ func (r *Release) IsSingleRelease() bool {
func (r *Release) HasYearRange() bool {
return r.YearEnd > 0 && r.YearEnd != r.Year
}
func (r *Release) ToProto() *pb.Release {
if r == nil {
return nil
}
return &pb.Release{
RawTitle: r.RawTitle,
Artist: r.Artist,
Album: r.Album,
Year: int32(r.Year),
YearEnd: int32(r.YearEnd),
Type: r.Type.String(),
Genres: r.Genres,
Format: r.Format.String(),
Source: r.Source.String(),
Bitrate: r.Bitrate,
BitDepth: int32(r.BitDepth),
SampleRate: int32(r.SampleRate),
RipType: r.RipType,
ReleaseCount: int32(r.ReleaseCount),
Tags: r.Tags,
Label: r.Label,
CatalogNum: r.CatalogNum,
ParsedSuccessfully: r.ParsedSuccessfully,
ParseErrors: r.ParseErrors,
}
}