[grilo] grl-inspect: Introspect sources, not plugins



commit b3346e81da62872edbb05fd8cb727f3b3926f112
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Fri Jul 16 13:23:14 2010 +0200

    grl-inspect: Introspect sources, not plugins
    
    Actually, grl-inspect is intended to introspect sources, not plugins.

 tools/grilo-inspect/grl-inspect.c |   68 +++++++++++++++++++------------------
 1 files changed, 35 insertions(+), 33 deletions(-)
---
diff --git a/tools/grilo-inspect/grl-inspect.c b/tools/grilo-inspect/grl-inspect.c
index 6aa049c..841f499 100644
--- a/tools/grilo-inspect/grl-inspect.c
+++ b/tools/grilo-inspect/grl-inspect.c
@@ -25,7 +25,7 @@
 
 static gint delay = 0;
 static GMainLoop *mainloop = NULL;
-static gchar **introspect_plugins = NULL;
+static gchar **introspect_sources = NULL;
 static GrlPluginRegistry *registry = NULL;
 
 static GOptionEntry entries[] = {
@@ -34,8 +34,8 @@ static GOptionEntry entries[] = {
     "Wait some seconds before showing results",
     NULL },
   { G_OPTION_REMAINING, '\0', 0,
-    G_OPTION_ARG_STRING_ARRAY, &introspect_plugins,
-    "Plugins to introspect",
+    G_OPTION_ARG_STRING_ARRAY, &introspect_sources,
+    "Sources to introspect",
     NULL },
   { NULL }
 };
@@ -43,12 +43,14 @@ static GOptionEntry entries[] = {
 static void
 list_all_sources ()
 {
-  GrlMediaPlugin **plugin;
-  GrlMediaPlugin **plugins;
-
-  plugins = grl_plugin_registry_get_sources (registry, FALSE);
-  for (plugin = plugins; *plugin; plugin++) {
-    g_print ("%s\n", grl_media_plugin_get_id (*plugin));
+  GrlMediaPlugin **source;
+  GrlMediaPlugin **sources;
+
+  sources = grl_plugin_registry_get_sources (registry, FALSE);
+  for (source = sources; *source; source++) {
+    g_print ("%s:  %s\n",
+             grl_media_plugin_get_id (*source),
+             grl_metadata_source_get_id (GRL_METADATA_SOURCE (*source)));
   }
 }
 
@@ -65,50 +67,50 @@ print_keys (const GList *keys)
 }
 
 static void
-introspect_plugin (const gchar *plugin_id)
+introspect_source (const gchar *source_id)
 {
-  GrlMediaPlugin *plugin;
+  GrlMediaPlugin *source;
   GrlSupportedOps supported_ops;
   const gchar *value;
 
-  plugin = grl_plugin_registry_lookup_source (registry, plugin_id);
+  source = grl_plugin_registry_lookup_source (registry, source_id);
 
-  if (plugin) {
+  if (source) {
     g_print ("Plugin Details:\n");
-    g_print ("  Identifier:\t\t%s\n", grl_media_plugin_get_id (plugin));
-    g_print ("  Filename:\t\t%s\n", grl_media_plugin_get_filename (plugin));
+    g_print ("  Identifier:\t\t%s\n", grl_media_plugin_get_id (source));
+    g_print ("  Filename:\t\t%s\n", grl_media_plugin_get_filename (source));
     g_print ("  Type:\t\t\t%s\n",
-             GRL_IS_MEDIA_SOURCE (plugin)? "Media Provider": "Metadata Provider");
-    g_print ("  Rank:\t\t\t%d\n", grl_media_plugin_get_rank (plugin));
-
-    value = grl_media_plugin_get_name (plugin);
+             GRL_IS_MEDIA_SOURCE (source)? "Media Provider": "Metadata Provider");
+    g_print ("  Rank:\t\t\t%d\n", grl_media_plugin_get_rank (source);
+    value = grl_media_plugin_get_name (source);
     if (value) {
       g_print ("  Name:\t\t\t%s\n", value);
     }
-    value = grl_media_plugin_get_description (plugin);
+    value = grl_media_plugin_get_description (source);
     if (value) {
       g_print ("  Description:\t\t%s\n", value);
     }
-    value = grl_media_plugin_get_version (plugin);
+    value = grl_media_plugin_get_version (source);
     if (value) {
       g_print ("  Version:\t\t%s\n", value);
     }
-    value = grl_media_plugin_get_license (plugin);
+    value = grl_media_plugin_get_license (source);
     if (value) {
       g_print ("  License:\t\t%s\n", value);
     }
-    value = grl_media_plugin_get_author (plugin);
+    value = grl_media_plugin_get_author (source);
     if (value) {
       g_print ("  Author:\t\t%s\n", value);
     }
-    value = grl_media_plugin_get_site (plugin);
+    value = grl_media_plugin_get_site (source);
     if (value) {
       g_print ("  Site:\t\t\t%s\n", value);
     }
     g_print ("\n");
 
     /* Print supported operations */
-    supported_ops = grl_metadata_source_supported_operations (GRL_METADATA_SOURCE (plugin));
+    supported_ops =
+      grl_metadata_source_supported_operations (GRL_METADATA_SOURCE (source));
     g_print ("Supported operations:\n");
     if (supported_ops & GRL_OP_RESOLVE) {
       g_print ("  grl_metadata_source_resolve():\tResolve Metadata\n");
@@ -139,14 +141,14 @@ introspect_plugin (const gchar *plugin_id)
     /* Print supported keys */
     g_print ("Supported keys:\n");
     g_print ("  Readable Keys:\t\t");
-    print_keys (grl_metadata_source_supported_keys (GRL_METADATA_SOURCE (plugin)));
+    print_keys (grl_metadata_source_supported_keys (GRL_METADATA_SOURCE (source)));
     g_print ("\n");
     g_print ("  Writable Keys:\t\t");
-    print_keys (grl_metadata_source_writable_keys (GRL_METADATA_SOURCE (plugin)));
+    print_keys (grl_metadata_source_writable_keys (GRL_METADATA_SOURCE (source)));
     g_print ("\n");
     g_print ("\n");
   } else {
-    g_printerr ("Plugin Not Found: %s\n\n", plugin_id);
+    g_printerr ("Source Not Found: %s\n\n", source_id);
   }
   g_print ("\n");
 }
@@ -154,11 +156,11 @@ introspect_plugin (const gchar *plugin_id)
 static gboolean
 run (gpointer data)
 {
-  gchar **p;
+  gchar **s;
 
-  if (introspect_plugins) {
-    for (p = introspect_plugins; *p; p++) {
-      introspect_plugin (*p);
+  if (introspect_sources) {
+    for (s = introspect_sources; *s; s++) {
+      introspect_source (*s);
     }
   } else {
     list_all_sources ();
@@ -175,7 +177,7 @@ main (int argc, char *argv[])
   GError *error = NULL;
   GOptionContext *context;
 
-  context = g_option_context_new ("- introspect Grilo plugins");
+  context = g_option_context_new ("- introspect Grilo sources");
   g_option_context_add_main_entries (context, entries, NULL);
   g_option_context_add_group (context, grl_init_get_option_group ());
   g_option_context_parse (context, &argc, &argv, &error);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]