Probe player paths in a non-UI thread#78
Conversation
Network operations tend to be extremely slow when checking all user inputs for player path, so perform those checks in a non-UI thread so the GUI remains responsive. While queries are ongoing, the icon is a "busy" spinner.
Spawning a lot of threads tends to be inefficient and they often get serialized, so have a single thread that always looks at the latest path only.
|
Thanks for this. What's the copyright license on the .mng file and who was the author? |
|
I created it myself with the tool here (and imagemagick to turn it into an mng) which seems to have disappeared in the past few days. From an archived version, its output can be used freely:
|
|
Oh, excellent :)
|
|
I note that the spinner.mng resource has not been added to the list of resources to be included in BuildPy2exe.py. If Uriziel is otherwise happy with the PR then this would be an easy thing to fix, though. |
Probe player paths in a non-UI thread
Move calls to
getPlayerIconByPathinto a background thread so the GUI doesn't lock up when those calls take a long time.This is particularly important for supporting remote players which are specified by URL, like Kodi. Determining if a player exists at the given path requires hitting the network, and invalid paths often require a timeout to determine they are indeed invalid. It may also be useful with slow filesystems.
While the thread is working, the player icon is replaced with an animated spinner to indicate it's busy:
. (The actual version looks better than this gif since it has transparency.)