aboutsummaryrefslogtreecommitdiff
path: root/src/metadata-menu-item.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/metadata-menu-item.vala')
-rw-r--r--src/metadata-menu-item.vala20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala
index 894ad3c..be078bd 100644
--- a/src/metadata-menu-item.vala
+++ b/src/metadata-menu-item.vala
@@ -17,12 +17,22 @@ public class MetadataMenuitem : Dbusmenu.Menuitem
public void update(HashMap<string, string> data)
{
- this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, data.get("artist"));
- this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_PIECE, data.get("title"));
- this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_CONTAINER, data.get("album"));
- this.property_set(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, data.get("arturl"));
+ this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, data.get("artist").strip());
+ this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_PIECE, data.get("title").strip());
+ this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_CONTAINER, data.get("album").strip());
+ this.property_set(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, sanitize_image_path(data.get("arturl")));
}
-
+
+ public static string sanitize_image_path(string path)
+ {
+ string result = path.strip();
+ if(result.contains("file:///")){
+ result = result.slice(7, result.len());
+ }
+ debug("Sanitize image path - result = %s", result);
+ return result;
+ }
+
public override void handle_event(string name, GLib.Value input_value, uint timestamp)
{
debug("MetadataItem -> handle event caught!");