gmusicbrowser Forum

Main board => Questions => Topic started by: hugosenari on December 14, 2011, 11:16:24

Title: Zeitgeist plugin
Post by: hugosenari on December 14, 2011, 11:16:24
Hi,

Tried to make a zeitgeist plug-in, but it doesn't work :(

The Code:
https://github.com/hugosenari/gmusicbrowser-plugin/ (zeitgeist.pm)

The problem:
When I try to send info dbus throws: unexpected end of struct at /usr/lib/perl5/Net/DBus/Binding/Introspector.pm line 758

What I think is the cause:
For some reason Net::DBus cannot parse response. I think this because calling GetEvents, the same error are returned.

Anyone can help-me?

ps: Excuse my bad English  :-[
Title: Re: Zeitgeist plugin
Post by: Quentin Sculo on December 14, 2011, 13:46:18
I only took a quick look, but it is probable that this is the same problem I encountered writing the mpris2 plugin, Net::DBus has problems with complex data types. I've managed to find workarounds, you can look at the GetMetadata_from function in the mpris2.pm plugin, don't hesitate to ask me for more info.
# Basically, it involves creating a type like, for example, this :
my $type=
[ &Net::DBus::Binding::Message::TYPE_DICT_ENTRY,
[ &Net::DBus::Binding::Message::TYPE_STRING,
[ &Net::DBus::Binding::Message::TYPE_VARIANT,
[],
]]];
#my ($type)= Net::DBus::Binding::Introspector->_convert(['dict','string',['variant']]); #works too, not sure which one is best
# and using it with this :
Net::DBus::Binding::Value->new($type,$value);
Title: Re: Zeitgeist plugin
Post by: hugosenari on December 16, 2011, 13:51:56
Hi,

My problem isn't with data I send, is with data I receive from method. Is when dbus module try to know methods of interface.
I open a bug for dbus module: https://rt.cpan.org/Public/Bug/Display.html?id=73313

Solved this problem my test "works". To be honest, the entry are registered but not showing at Gnome Activity Journal like when Rhythmbox insert items, suggestions? :/
I know that are registered because using GetEvents in another process my events are returned.

Thanks.  :D
Title: Re: Zeitgeist plugin
Post by: hugosenari on December 26, 2011, 04:12:05
Hi again.
I found a quick-and-dirty solution, rewrite it as zeitgeist extension using mpris2 of  gmb.  To me works fine.  8)

My code:
https://github.com/hugosenari/zeitgeist-extensions

know bugs:
- Gnome Activity Journal doesn't show musics (but Synapse show)
- I don't know how to get mine-type over dbus or with file path then I send all as audio/mpeg