Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
Sublime Music
Sublime Music
Commits
42d5a2fd
Verified
Commit
42d5a2fd
authored
Feb 20, 2020
by
Sumner Evans
💬
Browse files
Fixed issue with delayed play queue results
parent
916e190b
Pipeline
#119761161
passed with stages
in 8 minutes
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
sublime/ui/player_controls.py
sublime/ui/player_controls.py
+18
-4
sublime/ui/playlists.py
sublime/ui/playlists.py
+1
-1
No files found.
sublime/ui/player_controls.py
View file @
42d5a2fd
...
...
@@ -58,6 +58,7 @@ class PlayerControls(Gtk.ActionBar):
current_device
=
None
chromecasts
:
List
[
ChromecastPlayer
]
=
[]
cover_art_update_order_token
=
0
play_queue_update_order_token
=
0
def
__init__
(
self
):
Gtk
.
ActionBar
.
__init__
(
self
)
...
...
@@ -172,13 +173,20 @@ class PlayerControls(Gtk.ActionBar):
artist
=
util
.
esc
(
song_details
.
artist
)
return
f
'<b>
{
title
}
</b>
\n
{
util
.
dot_join
(
album
,
artist
)
}
'
def
make_idle_index_capturing_function
(
idx
,
fn
):
return
lambda
f
:
GLib
.
idle_add
(
fn
,
idx
,
f
.
result
())
def
make_idle_index_capturing_function
(
idx
,
order_token
,
fn
):
return
lambda
f
:
GLib
.
idle_add
(
fn
,
idx
,
order_token
,
f
.
result
())
def
on_cover_art_future_done
(
idx
,
order_token
,
cover_art_filename
):
if
order_token
!=
self
.
play_queue_update_order_token
:
return
def
on_cover_art_future_done
(
idx
,
cover_art_filename
):
self
.
play_queue_store
[
idx
][
0
]
=
cover_art_filename
def
on_song_details_future_done
(
idx
,
song_details
):
def
on_song_details_future_done
(
idx
,
order_token
,
song_details
):
if
order_token
!=
self
.
play_queue_update_order_token
:
return
self
.
play_queue_store
[
idx
][
1
]
=
calculate_label
(
song_details
)
# Cover Art
...
...
@@ -191,12 +199,16 @@ class PlayerControls(Gtk.ActionBar):
cover_art_result
.
add_done_callback
(
make_idle_index_capturing_function
(
i
,
order_token
,
on_cover_art_future_done
,
))
else
:
# We have the cover art already cached.
self
.
play_queue_store
[
idx
][
0
]
=
cover_art_future
.
result
()
if
state
.
play_queue
!=
[
x
[
-
1
]
for
x
in
self
.
play_queue_store
]:
self
.
play_queue_update_order_token
+=
1
song_details_results
=
[]
for
i
,
song_id
in
enumerate
(
state
.
play_queue
):
song_details_result
=
CacheManager
.
get_song_details
(
song_id
)
...
...
@@ -220,6 +232,7 @@ class PlayerControls(Gtk.ActionBar):
cover_art_result
.
add_done_callback
(
make_idle_index_capturing_function
(
i
,
self
.
play_queue_update_order_token
,
on_cover_art_future_done
,
))
else
:
...
...
@@ -241,6 +254,7 @@ class PlayerControls(Gtk.ActionBar):
song_details_result
.
add_done_callback
(
make_idle_index_capturing_function
(
idx
,
self
.
play_queue_update_order_token
,
on_song_details_future_done
,
))
...
...
sublime/ui/playlists.py
View file @
42d5a2fd
...
...
@@ -692,7 +692,7 @@ class PlaylistDetailPanel(Gtk.Overlay):
# We get both a delete and insert event, I think it's deterministic
# which one comes first, but just in case, we have this
# reordering_playlist_song_list flag.
.
# reordering_playlist_song_list flag.
if
self
.
reordering_playlist_song_list
:
self
.
update_playlist_order
(
self
.
playlist_id
)
self
.
reordering_playlist_song_list
=
False
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment