mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-10-29 11:04:42 +00:00
add recently played playlist
This commit is contained in:
1 parent
30768dd5d6
commit
bbcacf81bd
10 files changed
+142
-62
No files matched your search
+10
-2
@@ -129,10 +129,18 @@ class TrackStore:
|
||||
"""
|
||||
Returns a list of tracks by their hashes.
|
||||
"""
|
||||
hash_set = set(trackhashes)
|
||||
set_len = len(hash_set)
|
||||
|
||||
trackhashes = " ".join(trackhashes)
|
||||
tracks = [track for track in cls.tracks if track.trackhash in trackhashes]
|
||||
tracks = []
|
||||
for track in cls.tracks:
|
||||
if track.trackhash in hash_set:
|
||||
tracks.append(track)
|
||||
|
||||
if len(tracks) == set_len:
|
||||
break
|
||||
|
||||
# sort the tracks in the order of the given trackhashes
|
||||
tracks.sort(key=lambda t: trackhashes.index(t.trackhash))
|
||||
return tracks
|
||||
|
||||
|
||||
Reference in new issue
Block a user