Refactor return type of the search
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user