forked from Wobbl/Wobuzz
Fixed a crash where the current_track of a playlist won't get updated when the playlist is loaded from the command line.
This commit is contained in:
parent
2b1310990a
commit
027c2f6ac8
3 changed files with 9 additions and 2 deletions
|
@ -19,13 +19,13 @@ def main():
|
||||||
app = Wobuzz()
|
app = Wobuzz()
|
||||||
|
|
||||||
if arguments.playlist:
|
if arguments.playlist:
|
||||||
app.library.temporary_playlist.tracks = []
|
app.library.temporary_playlist.clear()
|
||||||
app.library.temporary_playlist.view.clear()
|
app.library.temporary_playlist.view.clear()
|
||||||
app.library.temporary_playlist.load_from_m3u(arguments.playlist)
|
app.library.temporary_playlist.load_from_m3u(arguments.playlist)
|
||||||
app.library.temporary_playlist.view.load_tracks()
|
app.library.temporary_playlist.view.load_tracks()
|
||||||
|
|
||||||
if arguments.track:
|
if arguments.track:
|
||||||
app.library.temporary_playlist.tracks = []
|
app.library.temporary_playlist.clear()
|
||||||
app.library.temporary_playlist.view.clear()
|
app.library.temporary_playlist.view.clear()
|
||||||
app.library.temporary_playlist.load_from_paths(arguments.track)
|
app.library.temporary_playlist.load_from_paths(arguments.track)
|
||||||
app.library.temporary_playlist.view.load_tracks()
|
app.library.temporary_playlist.view.load_tracks()
|
||||||
|
|
|
@ -23,6 +23,7 @@ class Library:
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
path_playlists = f"{self.app.settings.library_path}/playlists"
|
path_playlists = f"{self.app.settings.library_path}/playlists"
|
||||||
|
|
||||||
if not os.path.exists(path_playlists):
|
if not os.path.exists(path_playlists):
|
||||||
os.makedirs(path_playlists)
|
os.makedirs(path_playlists)
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,12 @@ class Playlist:
|
||||||
self.current_track: Track | None = None
|
self.current_track: Track | None = None
|
||||||
self.view = None
|
self.view = None
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
self.sorting: list[Qt.SortOrder] | None = None
|
||||||
|
self.tracks = []
|
||||||
|
self.current_track_index = 0
|
||||||
|
self.current_track = None
|
||||||
|
|
||||||
def load_from_paths(self, paths):
|
def load_from_paths(self, paths):
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue