forked from Wobbl/Wobuzz
Connected PlaylistView.itemDoubleClicked to a function that then tells the player to play that track.
This commit is contained in:
parent
8fbb40d2f9
commit
da27963884
5 changed files with 34 additions and 6 deletions
|
@ -36,11 +36,14 @@ class Playlist:
|
|||
print(lines)
|
||||
|
||||
i = 0
|
||||
num_lines = len(lines)
|
||||
|
||||
while i < len(lines):
|
||||
while i < num_lines:
|
||||
line = lines[i]
|
||||
|
||||
if line.startswith("#") or line.startswith("http"): # filter out comments, extended m3u and urls
|
||||
i += 1
|
||||
|
||||
continue
|
||||
|
||||
self.tracks.append(Track(self.app, line, cache=i==0)) # first track is cached
|
||||
|
@ -68,7 +71,6 @@ class Playlist:
|
|||
|
||||
if not self.current_track.cached: # make sure the track is cached because else the player can't play it
|
||||
self.current_track.cache()
|
||||
self.current_track.cached = True
|
||||
|
||||
return self.current_track.sound, self.current_track.duration
|
||||
|
||||
|
@ -81,7 +83,16 @@ class Playlist:
|
|||
|
||||
if not self.current_track.cached: # make sure the track is cached because else the player can't play it
|
||||
self.current_track.cache()
|
||||
self.current_track.cached = True
|
||||
|
||||
return self.current_track.sound, self.current_track.duration
|
||||
|
||||
def set_track(self, track_index):
|
||||
self.current_track_index = track_index
|
||||
|
||||
self.current_track = self.tracks[self.current_track_index]
|
||||
|
||||
if not self.current_track.cached:
|
||||
self.current_track.cache()
|
||||
|
||||
return self.current_track.sound, self.current_track.duration
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue