Implemented displaying of tracks in a QTreeWidget.
This commit is contained in:
parent
10c36b37a1
commit
af2b7b6c8d
11 changed files with 90 additions and 19 deletions
|
@ -19,7 +19,7 @@ class Player:
|
|||
|
||||
self.track_progress = TrackProgress(self.app)
|
||||
|
||||
self.current_playlist = Playlist(self.app)
|
||||
self.current_playlist = Playlist(self.app, "None")
|
||||
|
||||
self.playing = False
|
||||
self.paused = False
|
||||
|
|
|
@ -5,8 +5,9 @@ from .track import Track
|
|||
|
||||
|
||||
class Playlist:
|
||||
def __init__(self, app):
|
||||
def __init__(self, app, title: str):
|
||||
self.app = app
|
||||
self.title = title # playlist title
|
||||
self.tracks: list[Track] = []
|
||||
self.current_track_index = 0
|
||||
self.current_track: Track | None = None
|
||||
|
@ -22,7 +23,8 @@ class Playlist:
|
|||
|
||||
i += 1
|
||||
|
||||
self.current_track = self.tracks[0] # current track is the first track in the playlist
|
||||
if self.current_track is None: # set current track to the first track if there is no currently playing track
|
||||
self.current_track = self.tracks[0]
|
||||
|
||||
def load_from_m3u(self, path):
|
||||
file = open(path, "r")
|
||||
|
@ -43,7 +45,8 @@ class Playlist:
|
|||
|
||||
i += 1
|
||||
|
||||
self.current_track = self.tracks[0]
|
||||
if self.current_track is None: # set current track to the first track if there is no currently playing track
|
||||
self.current_track = self.tracks[0]
|
||||
|
||||
def load_from_wbz(self, path):
|
||||
pass
|
||||
|
|
|
@ -16,6 +16,8 @@ class Track:
|
|||
self.property_string = property_string
|
||||
self.cached = cache
|
||||
|
||||
# get filename (will be replaced by proper name getter in future)
|
||||
self.title = path.split("/")[-1].split(".")[0]
|
||||
self.audio = None
|
||||
self.sound = None
|
||||
self.duration = 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue