mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-10 23:49:28 +02:00
Subsonic: Partial support for some OpenSubsonic tags
This commit is contained in:
parent
68b2e649f0
commit
0b5f699383
4 changed files with 18 additions and 1 deletions
|
@ -88,11 +88,22 @@ func SongAsLove(song subsonic.Child, username string) models.Love {
|
|||
ArtistNames: []string{song.Artist},
|
||||
TrackNumber: song.Track,
|
||||
DiscNumber: song.DiscNumber,
|
||||
Tags: []string{song.Genre},
|
||||
RecordingMbid: models.MBID(song.MusicBrainzId),
|
||||
Tags: []string{},
|
||||
AdditionalInfo: map[string]any{},
|
||||
Duration: time.Duration(song.Duration * int(time.Second)),
|
||||
},
|
||||
}
|
||||
|
||||
if len(song.Genres) > 0 {
|
||||
genres := make([]string, 0, len(song.Genres))
|
||||
for _, genre := range song.Genres {
|
||||
genres = append(genres, genre.Name)
|
||||
}
|
||||
love.Track.Tags = genres
|
||||
} else if song.Genre != "" {
|
||||
love.Track.Tags = []string{song.Genre}
|
||||
}
|
||||
|
||||
return love
|
||||
}
|
||||
|
|
2
go.mod
2
go.mod
|
@ -2,6 +2,8 @@ module go.uploadedlobster.com/scotty
|
|||
|
||||
go 1.21.1
|
||||
|
||||
replace github.com/delucks/go-subsonic => github.com/phw/go-subsonic v0.0.0-20231123083950-2a64076c2396
|
||||
|
||||
require (
|
||||
github.com/VividCortex/ewma v1.2.0 // indirect
|
||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
|
||||
|
|
2
go.sum
2
go.sum
|
@ -177,6 +177,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
|
|||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
|
||||
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
|
||||
github.com/phw/go-subsonic v0.0.0-20231123084006-32e6ff0ea093 h1:Z95GJhfINktoEZVSSfScUoj1kV0a0d0qjiU66gndiaM=
|
||||
github.com/phw/go-subsonic v0.0.0-20231123084006-32e6ff0ea093/go.mod h1:wwUjRas8jxNAHqW51B+S+kDtb7tIZPSGuUeLwyTxnMg=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
|
|
|
@ -17,6 +17,8 @@ github.com/maxatome/go-testdeep v1.12.0/go.mod h1:lPZc/HAcJMP92l7yI6TRz1aZN5URwU
|
|||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/phw/go-subsonic v0.0.0-20231123083950-2a64076c2396 h1:z/CgFZbRqcEhtz5ZLYfpWUARjuz++vuVRRsWwhTWf+w=
|
||||
github.com/phw/go-subsonic v0.0.0-20231123083950-2a64076c2396/go.mod h1:vnbEuj6Z20PLcHB4rrLQAOXGMjtULfMGhRVSFPcSdUo=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
|
|
Loading…
Add table
Reference in a new issue