feat: store duration as float, to cater for milliseconds
This commit is contained in:
+1
-1
@@ -159,7 +159,7 @@ func (b *browser) buildAlbumDir(al *model.Album, tracks model.MediaFiles) *Direc
|
||||
Artist: al.Artist,
|
||||
ArtistId: al.ArtistID,
|
||||
SongCount: al.SongCount,
|
||||
Duration: al.Duration,
|
||||
Duration: int(al.Duration),
|
||||
Created: al.CreatedAt,
|
||||
Year: al.Year,
|
||||
Genre: al.Genre,
|
||||
|
||||
+2
-2
@@ -69,7 +69,7 @@ func FromAlbum(al *model.Album) Entry {
|
||||
e.Created = al.CreatedAt
|
||||
e.AlbumId = al.ID
|
||||
e.ArtistId = al.ArtistID
|
||||
e.Duration = al.Duration
|
||||
e.Duration = int(al.Duration)
|
||||
e.SongCount = al.SongCount
|
||||
e.Starred = al.StarredAt
|
||||
e.PlayCount = int32(al.PlayCount)
|
||||
@@ -88,7 +88,7 @@ func FromMediaFile(mf *model.MediaFile) Entry {
|
||||
e.Artist = mf.Artist
|
||||
e.Genre = mf.Genre
|
||||
e.Track = mf.TrackNumber
|
||||
e.Duration = mf.Duration
|
||||
e.Duration = int(mf.Duration)
|
||||
e.Size = mf.Size
|
||||
e.Suffix = mf.Suffix
|
||||
e.BitRate = mf.BitRate
|
||||
|
||||
@@ -179,7 +179,7 @@ type streamHandlerFileInfo struct {
|
||||
}
|
||||
|
||||
func (f *streamHandlerFileInfo) Name() string { return f.mf.Title }
|
||||
func (f *streamHandlerFileInfo) Size() int64 { return int64((f.mf.Duration)*f.bitRate*1000) / 8 }
|
||||
func (f *streamHandlerFileInfo) Size() int64 { return int64(f.mf.Duration*float32(f.bitRate*1000)) / 8 }
|
||||
func (f *streamHandlerFileInfo) Mode() os.FileMode { return os.FileMode(0777) }
|
||||
func (f *streamHandlerFileInfo) ModTime() time.Time { return f.mf.UpdatedAt }
|
||||
func (f *streamHandlerFileInfo) IsDir() bool { return false }
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ func (p *playlists) Get(ctx context.Context, id string) (*PlaylistInfo, error) {
|
||||
Id: pl.ID,
|
||||
Name: pl.Name,
|
||||
SongCount: len(pl.Tracks),
|
||||
Duration: pl.Duration,
|
||||
Duration: int(pl.Duration),
|
||||
Public: pl.Public,
|
||||
Owner: pl.Owner,
|
||||
Comment: pl.Comment,
|
||||
|
||||
Reference in New Issue
Block a user