Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
midori:webmedia_now-playing [2015/01/05 22:38] – [Some examples] jamesaxl | midori:webmedia_now-playing [2015/01/30 20:35] – jamesaxl | ||
---|---|---|---|
Line 29: | Line 29: | ||
} | } | ||
') | ') | ||
- | echo "You are now playing: $ARTIST | + | echo "You are now playing: $VideoTitle |
</ | </ | ||
- | As you see **mediaHerald** is a Dbus service that extension created to store video' | + | As you see **mediaHerald** is a Dbus service that our extension created to store video' |
- | Let's do an example you first open [[https:// | + | Let's do an example you should |
< | < | ||
You are now playing: | You are now playing: | ||
Line 60: | Line 60: | ||
} | } | ||
</ | </ | ||
- | Result :\\ | + | **Result:**\\ |
< | < | ||
you are playing Midori 0.5.8 : A Fast and Lightweight Web Browser For Linux Mint - YouTube, follow me on https:// | you are playing Midori 0.5.8 : A Fast and Lightweight Web Browser For Linux Mint - YouTube, follow me on https:// | ||
</ | </ | ||
- | **Python let's make more short 8-)** | + | **Python let's make it more short 8-)** |
< | < | ||
import dbus | import dbus | ||
Line 77: | Line 77: | ||
You are playing Midori 0.5.8 : A Fast and Lightweight Web Browser For Linux Mint - YouTube, follow me https:// | You are playing Midori 0.5.8 : A Fast and Lightweight Web Browser For Linux Mint - YouTube, follow me https:// | ||
</ | </ | ||
+ | **C with Glib and Gio Headche Please LOL** | ||
+ | < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | gchar* get_video_title(GDBusProxy *proxy) { | ||
+ | GVariant *_inner_reply; | ||
+ | _inner_reply = g_dbus_proxy_get_cached_property (proxy, " | ||
+ | gchar* _result; | ||
+ | if (!_inner_reply) { | ||
+ | GVariant *_arguments; | ||
+ | GVariant *_reply; | ||
+ | GVariantBuilder _arguments_builder; | ||
+ | g_variant_builder_init (& | ||
+ | g_variant_builder_add_value (& | ||
+ | g_variant_builder_add_value (& | ||
+ | _arguments = g_variant_builder_end (& | ||
+ | _reply = g_dbus_proxy_call_sync (proxy, " | ||
+ | if (!_reply) { | ||
+ | return NULL; | ||
+ | } | ||
+ | g_variant_get (_reply, " | ||
+ | g_variant_unref (_reply); | ||
+ | } | ||
+ | _result = g_variant_dup_string (_inner_reply, | ||
+ | g_variant_unref (_inner_reply); | ||
+ | return _result; | ||
+ | |||
+ | } | ||
+ | |||
+ | gchar* get_video_uri(GDBusProxy *proxy) { | ||
+ | GVariant *_inner_reply; | ||
+ | _inner_reply = g_dbus_proxy_get_cached_property (proxy, " | ||
+ | gchar* _result; | ||
+ | if (!_inner_reply) { | ||
+ | GVariant *_arguments; | ||
+ | GVariant *_reply; | ||
+ | GVariantBuilder _arguments_builder; | ||
+ | g_variant_builder_init (& | ||
+ | g_variant_builder_add_value (& | ||
+ | g_variant_builder_add_value (& | ||
+ | _arguments = g_variant_builder_end (& | ||
+ | _reply = g_dbus_proxy_call_sync (proxy, " | ||
+ | if (!_reply) { | ||
+ | return NULL; | ||
+ | } | ||
+ | g_variant_get (_reply, " | ||
+ | g_variant_unref (_reply); | ||
+ | } | ||
+ | _result = g_variant_dup_string (_inner_reply, | ||
+ | g_variant_unref (_inner_reply); | ||
+ | return _result; | ||
+ | } | ||
+ | |||
+ | |||
+ | int main(void) { | ||
+ | GError *error = NULL; | ||
+ | GDBusConnection *bus; | ||
+ | GDBusProxy *proxy; | ||
+ | bus = g_bus_get_sync(G_BUS_TYPE_SESSION, | ||
+ | if (!bus) { | ||
+ | g_warning(" | ||
+ | g_error_free(error); | ||
+ | return 1; | ||
+ | } | ||
+ | proxy | ||
+ | | ||
+ | NULL, | ||
+ | " | ||
+ | "/ | ||
+ | " | ||
+ | NULL, | ||
+ | & | ||
+ | gchar* title = get_video_title(proxy); | ||
+ | gchar* uri = get_video_uri(proxy); | ||
+ | g_printf(" | ||
+ | return 0; | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | MakeFile | ||
+ | < | ||
+ | pkg_packages := glib-2.0 gio-2.0 | ||
+ | CC=gcc | ||
+ | PKG_CFLAGS | ||
+ | PKG_LDFLAGS := $(shell pkg-config --libs $(pkg_packages)) | ||
+ | |||
+ | CFLAGS | ||
+ | LDFLAGS := $(PKG_LDFLAGS) $(LDFLAGS) | ||
+ | |||
+ | targets = midori-example | ||
+ | |||
+ | .PHONY: all clean | ||
+ | all: $(targets) | ||
+ | |||
+ | dbus-example: | ||
+ | $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) | ||
+ | |||
+ | clean: | ||
+ | $(RM) $(targets) | ||
+ | </ | ||
+ | |||
+ | **Result: | ||
+ | < | ||
+ | you are now watching | ||
+ | </ | ||
+ | |||
+ | ====== BIG THanks ====== | ||
+ | **kalikiana **: The developer of MIDORI, code helper. | ||
+ | **pfor**: Code helper. | ||
+ | **Earth and all that is in it, with knowledge we protect it. And the best of mankind knowledge makes him and he makes it.** | ||
+ |