load saved play position on startup
This commit is contained in:
+15
-1
@@ -317,7 +317,21 @@ func (a *App) LoadSavedPlayQueue() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return a.PlaybackManager.LoadTracks(queue.Tracks, false, false)
|
if len(queue.Tracks) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := a.PlaybackManager.LoadTracks(queue.Tracks, false, false); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if queue.TrackIndex >= 0 {
|
||||||
|
// TODO: This isn't ideal but doesn't seem to cause an audible play-for-a-split-second artifact
|
||||||
|
a.PlaybackManager.PlayTrackAt(queue.TrackIndex)
|
||||||
|
a.PlaybackManager.Pause()
|
||||||
|
time.Sleep(50 * time.Millisecond) // MPV seek fails if run immediately after
|
||||||
|
a.PlaybackManager.SeekSeconds(queue.TimePos)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) SaveConfigFile() {
|
func (a *App) SaveConfigFile() {
|
||||||
|
|||||||
+5
-3
@@ -142,9 +142,11 @@ func (m *MainWindow) RunOnServerConnectedTasks(app *backend.App, displayAppName
|
|||||||
m.BottomPanel.NowPlaying.DisableRating = !canRate
|
m.BottomPanel.NowPlaying.DisableRating = !canRate
|
||||||
|
|
||||||
if app.Config.Application.SavePlayQueue {
|
if app.Config.Application.SavePlayQueue {
|
||||||
if err := app.LoadSavedPlayQueue(); err != nil {
|
go func() {
|
||||||
log.Printf("failed to load saved play queue: %s", err.Error())
|
if err := app.LoadSavedPlayQueue(); err != nil {
|
||||||
}
|
log.Printf("failed to load saved play queue: %s", err.Error())
|
||||||
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if launching new version, else if found available update on startup
|
// check if launching new version, else if found available update on startup
|
||||||
|
|||||||
Reference in New Issue
Block a user