Skip to content

Commit

Permalink
Select correct playlist and track if starting with option resume_play…
Browse files Browse the repository at this point in the history
…back and gui (#825)
  • Loading branch information
luzip665 committed Oct 7, 2022
1 parent 9ee5726 commit e401039
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion xl/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,16 @@ def __init(self):
# -> don't do it in command line mode, since that isn't expected
self.gui.rescan_collection_with_progress(True)

if restore:
restore_play_state = settings.get_option("player/resume_playback", True)

if restore and restore_play_state:
player.QUEUE._restore_player_state(
os.path.join(xdg.get_data_dir(), 'player.state')
)

if self.gui:
self.gui.get_playlist_container().show_current_track()

# pylint: enable-msg=W0201

def _set_locale(self, custom_lang: str = None) -> None:
Expand Down
4 changes: 3 additions & 1 deletion xl/player/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,6 @@ def _do_restore_player_state(self, state):
"%s/resume_paused" % self.player._name, False
)

self.player.play(self.get_current(), start_at=start_at, paused=paused)
self.player.play(
self.current_playlist.get_current(), start_at=start_at, paused=paused
)
3 changes: 3 additions & 0 deletions xlgui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ def get_panel(self, panel_name):
"""
return self.panel_notebook.panels[panel_name].panel

def get_playlist_container(self):
return self.main.playlist_container

def quit(self):
"""
Quits the gui, saving anything that needs to be saved
Expand Down

0 comments on commit e401039

Please sign in to comment.