diff options
Diffstat (limited to 'src/metadata-menu-item.vala')
-rw-r--r-- | src/metadata-menu-item.vala | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index ef72143..82926b1 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -13,15 +13,26 @@ public class MetadataMenuitem : Dbusmenu.Menuitem public MetadataMenuitem() { this.property_set(MENUITEM_PROP_TYPE, DBUSMENU_METADATA_MENUITEM_TYPE); - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, "Sonnamble"); - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_PIECE, "Nocturne"); - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_CONTAINER, "Seven Months in E minor"); - this.property_set(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, "/home/ronoc/Desktop/Sonnamble/Sonnamble_CD.jpg"); - - debug("image_path property set %s:", this.property_get(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH)); + } + public void update(HashMap<string, string> data) + { + 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.has_prefix("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!"); |