incremental waveform generation (kind-of) working
This commit is contained in:
@@ -15,8 +15,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
cacheValidDurationSeconds = 60
|
||||
runTimeTicksPerSecond = 10_000_000
|
||||
cacheValidDurationSeconds = 60
|
||||
runTimeTicksPerMicrosecond = 10
|
||||
)
|
||||
|
||||
type JellyfinServer struct {
|
||||
@@ -383,7 +383,7 @@ func (j *jellyfinMediaProvider) TrackBeganPlayback(trackID string) error {
|
||||
}
|
||||
|
||||
func (j *jellyfinMediaProvider) TrackEndedPlayback(trackID string, position int, submission bool) error {
|
||||
return j.client.UpdatePlayStatus(trackID, jellyfin.Stop, int64(position)*runTimeTicksPerSecond)
|
||||
return j.client.UpdatePlayStatus(trackID, jellyfin.Stop, int64(position)*runTimeTicksPerMicrosecond*1_000_000)
|
||||
}
|
||||
|
||||
func (j *jellyfinMediaProvider) RescanLibrary() error {
|
||||
@@ -408,7 +408,7 @@ func (j *jellyfinMediaProvider) GetLyrics(tr *mediaprovider.Track) (*mediaprovid
|
||||
func toLyricLine(ll jellyfin.LyricLine) mediaprovider.LyricLine {
|
||||
return mediaprovider.LyricLine{
|
||||
Text: ll.Text,
|
||||
Start: float64(ll.Start) / float64(runTimeTicksPerSecond),
|
||||
Start: (time.Duration(ll.Start/runTimeTicksPerMicrosecond) * time.Microsecond).Seconds(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ func toTrack(ch *jellyfin.Song) *mediaprovider.Track {
|
||||
CoverArtID: coverArtID,
|
||||
ParentID: ch.AlbumID,
|
||||
Title: ch.Name,
|
||||
Duration: int(ch.RunTimeTicks / runTimeTicksPerSecond),
|
||||
Duration: time.Duration(ch.RunTimeTicks/runTimeTicksPerMicrosecond) * time.Microsecond,
|
||||
TrackNumber: ch.IndexNumber,
|
||||
DiscNumber: ch.DiscNumber,
|
||||
//Genre: ch.Genres,
|
||||
@@ -483,7 +483,7 @@ func fillAlbum(a *jellyfin.Album, album *mediaprovider.Album) {
|
||||
album.ID = a.ID
|
||||
album.CoverArtID = a.ID
|
||||
album.Name = a.Name
|
||||
album.Duration = int(a.RunTimeTicks / runTimeTicksPerSecond)
|
||||
album.Duration = time.Duration(a.RunTimeTicks/runTimeTicksPerMicrosecond) * time.Microsecond
|
||||
album.ArtistIDs = artistIDs
|
||||
album.ArtistNames = artistNames
|
||||
album.Date.Year = &a.Year
|
||||
@@ -505,7 +505,7 @@ func (j *jellyfinMediaProvider) fillPlaylist(p *jellyfin.Playlist, pl *mediaprov
|
||||
pl.CoverArtID = p.ID
|
||||
pl.Description = p.Overview
|
||||
pl.TrackCount = p.SongCount
|
||||
pl.Duration = int(p.RunTimeTicks / runTimeTicksPerSecond)
|
||||
pl.Duration = time.Duration(p.RunTimeTicks/runTimeTicksPerMicrosecond) * time.Microsecond
|
||||
// Jellyfin does not have public playlists
|
||||
pl.Owner = j.client.LoggedInUser()
|
||||
pl.Public = false
|
||||
|
||||
@@ -67,7 +67,7 @@ type Album struct {
|
||||
ID string
|
||||
CoverArtID string
|
||||
Name string
|
||||
Duration int
|
||||
Duration time.Duration
|
||||
ArtistIDs []string
|
||||
ArtistNames []string
|
||||
Date ItemDate
|
||||
@@ -127,7 +127,7 @@ type Track struct {
|
||||
CoverArtID string
|
||||
ParentID string
|
||||
Title string
|
||||
Duration int
|
||||
Duration time.Duration
|
||||
TrackNumber int
|
||||
DiscNumber int
|
||||
Genres []string
|
||||
@@ -165,7 +165,7 @@ type Playlist struct {
|
||||
Description string
|
||||
Public bool
|
||||
Owner string
|
||||
Duration int
|
||||
Duration time.Duration
|
||||
TrackCount int
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ type MediaItemMetadata struct {
|
||||
Album string
|
||||
AlbumID string
|
||||
CoverArtID string
|
||||
Duration int
|
||||
Duration time.Duration
|
||||
}
|
||||
|
||||
type MediaItem interface {
|
||||
|
||||
@@ -551,7 +551,7 @@ func toTrack(ch *subsonic.Child) *mediaprovider.Track {
|
||||
CoverArtID: ch.CoverArt,
|
||||
ParentID: ch.Parent,
|
||||
Title: ch.Title,
|
||||
Duration: ch.Duration,
|
||||
Duration: time.Duration(ch.Duration) * time.Second,
|
||||
TrackNumber: ch.Track,
|
||||
DiscNumber: ch.DiscNumber,
|
||||
Genres: genres,
|
||||
@@ -628,7 +628,7 @@ func fillAlbum(subAlbum *subsonic.AlbumID3, album *mediaprovider.Album) {
|
||||
album.ID = subAlbum.ID
|
||||
album.CoverArtID = subAlbum.CoverArt
|
||||
album.Name = subAlbum.Name
|
||||
album.Duration = subAlbum.Duration
|
||||
album.Duration = time.Duration(subAlbum.Duration) * time.Second
|
||||
album.ArtistIDs = artistIDs
|
||||
album.ArtistNames = artistNames
|
||||
album.TrackCount = subAlbum.SongCount
|
||||
@@ -714,7 +714,7 @@ func fillPlaylist(pl *subsonic.Playlist, playlist *mediaprovider.Playlist) {
|
||||
playlist.Owner = pl.Owner
|
||||
playlist.Public = pl.Public
|
||||
playlist.TrackCount = pl.SongCount
|
||||
playlist.Duration = pl.Duration
|
||||
playlist.Duration = time.Duration(pl.Duration) * time.Second
|
||||
}
|
||||
|
||||
func (s *subsonicMediaProvider) GetSongRadio(trackID string, count int) ([]*mediaprovider.Track, error) {
|
||||
|
||||
Reference in New Issue
Block a user