Xfce Wiki

Sub domains
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
midori:webmedia_now-playing [2015/01/05 19:50] – [Using Shell script] jamesaxlmidori:webmedia_now-playing [2015/01/24 00:42] jamesaxl
Line 38: Line 38:
 Enjoy baby :-D Enjoy baby :-D
 ===== Some examples ===== ===== Some examples =====
 +**VALA**
 +<code>
 +[DBus (name = "org.midori.mediaHerald")]
 +interface Demo : Object {
 +    public abstract string video_title {owned get; owned set;}
 +    public abstract string video_uri {owned get; owned set;}
 +}
 +
 +void main () {
 +  try {
 +    Demo demo = Bus.get_proxy_sync (BusType.SESSION, "org.midori.mediaHerald",
 +                                    "/org/midori/mediaHerald");
 +
 +    string title = demo.video_title;
 +    string uri = demo.video_uri;
 +    stdout.printf ("you are playing %s, follow me on %s\n", title, uri);
 +
 +  } catch (IOError e) {
 +    stderr.printf ("%s\n", e.message);
 +  }
 +}
 +</code>
 +Result :\\
 +<code>
 +you are playing ‪Midori 0.5.8 : A Fast and Lightweight Web Browser For Linux Mint - YouTube, follow me on https://www.youtube.com/watch?v=O2cebaY5Wlc
 +</code>
 +**Python let's make it more short 8-)**
 +<code>
 +import dbus
 +bus = dbus.SessionBus()
 +service = bus.get_object('org.midori.mediaHerald','/org/midori/mediaHerald')
 +props_iface = dbus.Interface(service, 'org.freedesktop.DBus.Properties')
 +properties = props_iface.GetAll('org.midori.mediaHerald')
 +print "You are playing %s, follow me %s" %(properties.get("VideoTitle")[1:], properties.get("VideoUri")[0:])
 +</code>
 +**Result:**\\
 +<code>
 +You are playing Midori 0.5.8 : A Fast and Lightweight Web Browser For Linux Mint - YouTube, follow me https://www.youtube.com/watch?v=O2cebaY5Wlc
 +</code>