-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix loading albumArt from Chromium MPRIS #280
Fix loading albumArt from Chromium MPRIS #280
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Historically we have avoided adding application specific workarounds. Can this be reproduced with other flatpak apps as well? Can this be solved in way that isn't specifically hardcoding the Chrome RDNN?
For example at a minimum maybe can we check for the existing of the file in /tmp
and if it isn't there, then we can check if it exists in .flatpak
/ application_id? I think we should be able to get the app ID from MPRIS
Probably should also use GLib.Path to build paths https://valadoc.org/glib-2.0/GLib.Path.build_path.html
Checked, its not a flatpak-specific "feature" of chromium. Its a "chromium" way.
I will take look on it, to implement a cleaner way.
I will update code according to that note |
atleast, we got very strange behavior, dbus sending us something like that: And if i'm right, current implementation doesnt allow us to get an actual app_info from stripped ifaces. Fast way solution, updated: /**
* For some MPRIS sources, we can see strange file uri like "file:///tmp/.com.google.Chrome.{Hash}",
* files being stored in users runtime directory, and we should handle it properly to display albumArt.
*/
if (! FileUtils.test (fname, FileTest.EXISTS)) {
fname = Path.build_path (Path.DIR_SEPARATOR_S, GLib.Environment.get_user_runtime_dir (), ".flatpak", "com.google.Chrome", fname);
} UPDATED: According to MPRIS spec we wont get actual google chrome app name, because chrome developers set it as |
Hm yeah this seems like it's just a bug upstream in Chromium and will need to be addressed there since we can't get the proper app id from either the Another thing I can think of, it's kind of brute force, but you could iterate over every folder in |
Added Regex solution for strange app<->folder relations
Added little bit more elegant solution with a regex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's definitely a lot smarter than iterating over every folder, nice job! Just gotta make sure to stick to code style conventions re variable naming, spaces, etc.
https://docs.elementary.io/develop/writing-apps/code-style
See also linter output: https://github.com/elementary/wingpanel-indicator-sound/actions/runs/11359271917/job/31695048276?pr=280
@danirabbit code updated UPDATE: |
Hey sorry for taking a couple days to respond. We usually prefer printf syntax over string literals. See https://docs.elementary.io/develop/writing-apps/code-style#string-formatting |
I'm new in vala lang development(mostly use managed languages), but never encountered printf syntax over regexp literals. Anyway I've updated PR code. No more linter errors occur. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Nice fix!
Added new handle for albumArt from MPRIS metadata provided by Chromium based browser in a PlayerRow.
Before:
After:
Fixes #279