Moon-0xff / gnome-mpris-label

A music related GNOME extension.
GNU General Public License v3.0
51 stars 10 forks source link

Speed up extension #12

Closed Batwam closed 1 year ago

Batwam commented 1 year ago

Attempt to simplify the code where possible, in particular by minimising DBUS requests. Note, this is work in progress.

Batwam commented 1 year ago

@Moon-0xff Could you please help with the rewrite of getMetadata to extract the Metadata string only once and then read the varisou fields required from the initial string rather than multiple DBUS requests? I tried but couldn't get it to work as I believe that Metadata is some sort of Dictionary of strings.

Moon-0xff commented 1 year ago

Like this?

Batwam commented 1 year ago

Ah ah, I was initially thinking about putting the dictionary into a variable and having a separate function to extract the field value from that dictionary but this is simpler so, yes, that works!

I might be breaking some edge cases along the way but let's see how this goes. I'm focusing on reducing the Mpris calls to the media source primarily as they seem to be the largest bottlenecks in the code. Getting the list of sources isn't slow based on the previous time checks.

Moon-0xff commented 1 year ago

I will make some big changes to main soon, so please clean up this branch and let me know when is ready to merge.

Batwam commented 1 year ago

Hey, sorry but I'm out of action with a killer headache thanks to covid and I can barely stand... Would you be able to push your changes to the current version?

The branch is functional although I believe that there is a bit of an issue with shortwave metadata in particular as it won't read the artist properly with the latest changes. No issue with other sources...

As this is still a testing version, could we leave the logs for now? I'd like to see what is being requested and how long it's taking.

Moon-0xff commented 1 year ago

Hey, sorry but I'm out of action with a killer headache thanks to covid and I can barely stand

Oh! Don't worry about this then, I'll handle it. Take good rest and I hope you feel well soon!

Moon-0xff commented 1 year ago

Sorry, I didn't quite understand. Do you want me to merge this to the not-yet-created-branch-with-my-changes and leave the logs, right?

Moon-0xff commented 1 year ago

Well it shouldn't matter too much so i will merge it to not-yet-created-branch-with-my-changes, aka structure-changes