mirror of
https://git.sr.ht/~phw/scotty
synced 2025-06-01 19:38:34 +02:00
Minor code cleanup when creation time.Duration
This commit is contained in:
parent
78a05e9f54
commit
0115eca1c6
5 changed files with 5 additions and 5 deletions
|
@ -251,7 +251,7 @@ func (t Track) AsTrack() models.Track {
|
||||||
TrackName: t.Title,
|
TrackName: t.Title,
|
||||||
ReleaseName: t.Album.Title,
|
ReleaseName: t.Album.Title,
|
||||||
ArtistNames: []string{t.Artist.Name},
|
ArtistNames: []string{t.Artist.Name},
|
||||||
Duration: time.Duration(t.Duration * int(time.Second)),
|
Duration: time.Duration(t.Duration) * time.Second,
|
||||||
AdditionalInfo: map[string]any{},
|
AdditionalInfo: map[string]any{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ func (t Track) AsTrack() models.Track {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(t.Uploads) > 0 {
|
if len(t.Uploads) > 0 {
|
||||||
track.Duration = time.Duration(t.Uploads[0].Duration * int(time.Second))
|
track.Duration = time.Duration(t.Uploads[0].Duration) * time.Second
|
||||||
}
|
}
|
||||||
|
|
||||||
return track
|
return track
|
||||||
|
|
|
@ -258,7 +258,7 @@ func (t Track) AsTrack() models.Track {
|
||||||
TrackName: t.Name,
|
TrackName: t.Name,
|
||||||
ReleaseName: t.Album.Name,
|
ReleaseName: t.Album.Name,
|
||||||
ArtistNames: make([]string, 0, len(t.Artists)),
|
ArtistNames: make([]string, 0, len(t.Artists)),
|
||||||
Duration: time.Duration(t.DurationMs * int(time.Millisecond)),
|
Duration: time.Duration(t.DurationMs) * time.Millisecond,
|
||||||
TrackNumber: t.TrackNumber,
|
TrackNumber: t.TrackNumber,
|
||||||
DiscNumber: t.DiscNumber,
|
DiscNumber: t.DiscNumber,
|
||||||
ISRC: t.ExternalIDs.ISRC,
|
ISRC: t.ExternalIDs.ISRC,
|
||||||
|
|
|
@ -89,7 +89,7 @@ func (i HistoryItem) AsListen() models.Listen {
|
||||||
AdditionalInfo: models.AdditionalInfo{},
|
AdditionalInfo: models.AdditionalInfo{},
|
||||||
},
|
},
|
||||||
ListenedAt: i.Timestamp,
|
ListenedAt: i.Timestamp,
|
||||||
PlaybackDuration: time.Duration(i.MillisecondsPlayed * int(time.Millisecond)),
|
PlaybackDuration: time.Duration(i.MillisecondsPlayed) * time.Millisecond,
|
||||||
UserName: i.UserName,
|
UserName: i.UserName,
|
||||||
}
|
}
|
||||||
if trackURL, err := formatSpotifyUri(i.SpotifyTrackUri); err != nil {
|
if trackURL, err := formatSpotifyUri(i.SpotifyTrackUri); err != nil {
|
||||||
|
|
|
@ -121,7 +121,7 @@ func SongAsLove(song subsonic.Child, username string) models.Love {
|
||||||
AdditionalInfo: map[string]any{
|
AdditionalInfo: map[string]any{
|
||||||
"subsonic_id": song.ID,
|
"subsonic_id": song.ID,
|
||||||
},
|
},
|
||||||
Duration: time.Duration(song.Duration * int(time.Second)),
|
Duration: time.Duration(song.Duration) * time.Second,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue