Playlists now get loaded when they are started and removed debug prints.

This commit is contained in:
The Wobbler 2025-02-12 13:50:12 +01:00
parent 0879575882
commit 0c2c91389d
5 changed files with 12 additions and 30 deletions

View file

@ -2,6 +2,7 @@
import os
import threading
from PyQt6.QtCore import Qt
from .track import Track
@ -44,14 +45,10 @@ class Playlist:
path = paths[i]
if os.path.isfile(path):
self.tracks.append(Track(self.app, path, cache=i==0)) # first track is cached
self.append_track(Track(self.app, path, cache=i==0)) # first track is cached
i += 1
self.save()
self.tracks = []
def load(self):
loading_thread = threading.Thread(target=self.loading_thread)
loading_thread.start()
@ -60,8 +57,11 @@ class Playlist:
if self.load_from is None: # if the playlist is in the library
self.load_from_wbz(self.path)
elif self.load_from is list:
pass
elif isinstance(self.load_from, str):
self.load_from_m3u(self.load_from)
elif isinstance(self.load_from, list):
self.load_from_paths(self.load_from)
def load_from_m3u(self, path):
file = open(path, "r")
@ -86,8 +86,6 @@ class Playlist:
i += 1
print("kolupp")
# set current track to the first track if there is no currently playing track
if self.current_track is None and self.has_tracks():
self.current_track = self.tracks[0]
@ -177,9 +175,6 @@ class Playlist:
self.tracks.append(track)
print(track.tags.title)
def h_last_track(self):
# get last track in history (only gets used in player.history)