This is an old revision of the document!
Webmedia now-playing - Tutorial
This document is licensed under the LGPL 2.1.
What is Webmedia now-playing
Webmedia now-playing is a midori extension developed for using Dbus, this extension allow users to get the video title that midori play in youtube/ Vimeo/ Dailymention/Coup.
In this Tuto We are going to show you how to use it .
Using Shell script
Big thanks to meebey the owner of this script.
eval $(dbus-send --session --print-reply --dest=org.midori.mediaHerald /org/midori/mediaHerald org.freedesktop.DBus.Properties.GetAll string:"org.midori.mediaHerald" | awk '
/string *"VideoTitle/{
while (1) {
getline line
if (line ~ /string "/)
sub(/.*string /, "TITLE=", line)
print line
break
}
}
/string *"VideoUri/{
while (1) {
getline line
if (line ~ /string "/)
sub(/.*string /, "URI=", line)
print line
break
}
}
')
echo "You are now playing: $ARTIST - $TITLE"
As you see mediaHerald is a Dbus service that extension created to store video's title and uri.
Let's do an example you first open https://www.youtube.com/watch?v=O2cebaY5Wlc and run our script shell, the result is:
You are now playing: - Midori 0.5.8 : A Fast and Lightweight Web Browser For Linux Mint - YouTube
Enjoy baby
Some examples
VALA
[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, join me on %s\n", title, uri);
} catch (IOError e) {
stderr.printf ("%s\n", e.message);
}
}
Result :
Pull Me Under (Live At Luna Park) - YouTube, join me on https://www.youtube.com/watch?v=C98sOdWjtsw