Closed Batwam closed 1 year ago
Ok, I tried to do a simple fix by including the filter update in updateActiveList()
. It worked for the list but the label no longer showed the song info. As I had to go do something else and didn't want to leave a broken implementation, I have reverted these changes.
This still could be a solution to explore if we can't work out a neater way to trigger the filter callback.
Edit: I just realised that it was taking th extension into an endless loop as _filterList()
calls updateActiveList()
...
ok, I played around trying to put a ~2s delay with SetTimeout()
to work around the premature identity
check. I couldn't get it to work so updated the code to call _filterList()
on updateActiveList()
which means that it runs on every iteration so if it doesn't work the first time around, it will later. I don't think that it add much more complexity to the code than what we already have.
I also noticed that if a source was playing and gets filtered, it stays in the label so I am proposing to clear this.selected
if the player is no longer part of the player list because it was filtered.
By the way, have you considered increasing the default refresh delay from 300ms to 500ms or even 1s? that would reduce the number of cycles quite a bit over time and I doubt anyone would notice.
Calling _filterList
inside updateActiveList
is a cheat! But updateActiveList
is in itself a cheat. I'm not against this approach but we should definitely seek to replace it later (alongside updateActiveList
)
If we follow this implementation it would be better to call _filterList
directly from _refresh
and drop the underscore, for clarity.
Compared against past implementations, _refresh
isn't a slow function , and it's still tied to refreshing the label (which we want to refresh reasonably fast), so I don't see the point of increasing the refresh delay.
Follow-up on #32 with separate rebased working branch. This is a testing branch which doesn't yet solve the issue.
As per other PR, player filtering is no longer effective since it occurs before the
identity
information is made available:_updateList -> _filterList -> _onEntryProxyReady
_filterList
is only called when: a. An mpris address is added or removed to the dbus list b. filter options are modifiedThis in code translates to:
Which is part of
_initList