[PATCH 4/4] core: removed grl_metadata_source_setup_full_resolution_mode().



It has been replaced by grl_metadata_source_expand_operation_keys() and
grl_metadata_source_get_additional_sources().
---
 src/grl-metadata-source-priv.h |    5 -
 src/grl-metadata-source.c      |  169 ----------------------------------------
 2 files changed, 0 insertions(+), 174 deletions(-)

diff --git a/src/grl-metadata-source-priv.h b/src/grl-metadata-source-priv.h
index 9bed860..4ccbbd4 100644
--- a/src/grl-metadata-source-priv.h
+++ b/src/grl-metadata-source-priv.h
@@ -44,11 +44,6 @@ struct SourceKeyMapList {
 
 G_BEGIN_DECLS
 
-void grl_metadata_source_setup_full_resolution_mode (GrlMetadataSource *source,
-                                                     GrlMedia *media,
-                                                     const GList *keys,
-                                                     struct SourceKeyMapList *key_mapping);
-
 GList * grl_metadata_source_expand_operation_keys (GrlMetadataSource *source,
                                                    GrlMedia *media,
                                                    GList *keys);
diff --git a/src/grl-metadata-source.c b/src/grl-metadata-source.c
index 843271a..25ded5c 100644
--- a/src/grl-metadata-source.c
+++ b/src/grl-metadata-source.c
@@ -1272,175 +1272,6 @@ grl_metadata_source_get_additional_sources (GrlMetadataSource *source,
   return list_union (NULL, result, NULL);
 }
 
-void
-grl_metadata_source_setup_full_resolution_mode (GrlMetadataSource *source,
-                                                GrlMedia *media,
-                                                const GList *keys,
-                                                struct SourceKeyMapList *key_mapping)
-{
-  g_return_if_fail (GRL_IS_METADATA_SOURCE (source));
-  g_return_if_fail (key_mapping != NULL);
-
-  key_mapping->source_maps = NULL;
-  key_mapping->operation_keys = NULL;
-
-  /* key_list holds keys to be resolved */
-  GList *key_list = g_list_copy ((GList *) keys);
-
-  /* Filter keys supported by this source */
-  key_mapping->operation_keys =
-    grl_metadata_source_filter_supported (source, &key_list, TRUE);
-
-  if (key_list == NULL) {
-    GRL_DEBUG ("Source supports all requested keys");
-    return;
-  }
-
-  /*
-   * 1) Find which sources (other than the current one) can resolve
-   *    some of the missing keys
-   * 2) Check out dependencies for the keys they can resolve
-   *    2.1) If dependency is already resolved in Media, add key to be resolved
-   *    2.2) Else check if original source can resolve dependency.
-   *         2.2.1) Yes: Add key and dependencies to be resolved
-   *         2.2.2) No: forget about that key and its dependencies
-   *                Ideally, we would check if other sources can resolve them
-   * 3) Execute the user operation passing in our own callback
-   * 4) For each result, check the sources that can resolve
-   *    the missing metadata and issue resolution operations on them.
-   *    We could do this once per source passing in a list with all the
-   *    browse results. Problem is we lose response time although we gain
-   *    overall efficiency.
-   * 5) Invoke user callback with results
-   */
-
-  /* Find which sources resolve which keys */
-  GList *supported_keys;
-  GrlMetadataSource *_source;
-  GList *sources;
-  GList *sources_iter;
-  GList *iter;
-  GrlPluginRegistry *registry;
-
-  registry = grl_plugin_registry_get_default ();
-  sources = grl_plugin_registry_get_sources_by_operations (registry,
-                                                               GRL_OP_RESOLVE,
-                                                               TRUE);
-
-  for (sources_iter = sources; sources_iter && key_list;
-      sources_iter = g_list_next(sources_iter)) {
-    gchar *name;
-
-    _source = GRL_METADATA_SOURCE (sources_iter->data);
-
-    /* Interested in sources other than this  */
-    if (_source == source) {
-      continue;
-    }
-
-    /* Check if this source supports some of the missing keys */
-    g_object_get (_source, "source-name", &name, NULL);
-    GRL_DEBUG ("Checking resolution capabilities for source '%s'", name);
-    supported_keys = grl_metadata_source_filter_supported (_source,
-                                                           &key_list, TRUE);
-
-    if (!supported_keys) {
-      GRL_DEBUG ("  Source does not support any of the keys, skipping.");
-      continue;
-    }
-
-    GRL_DEBUG ("  '%s' can resolve some keys, checking deps", name);
-
-    /* Check the external dependencies for these supported keys */
-    GList *supported_deps;
-    GList *iter_prev;
-    iter = supported_keys;
-    while (iter) {
-      GrlKeyID key = iter->data;
-      GList *deps =
-	g_list_copy ((GList *) grl_metadata_source_key_depends (_source, key));
-
-      iter_prev = iter;
-      iter = g_list_next (iter);
-
-      /* deps == NULL means the key cannot be resolved
-	 by using only metadata */
-      if (!deps) {
-	GRL_DEBUG ("    Key '%s' cannot be resolved from metadata",
-                   GRL_METADATA_KEY_GET_NAME (key));
-	supported_keys = g_list_delete_link (supported_keys, iter_prev);
-	key_list = g_list_prepend (key_list, key);
-	continue;
-      }
-
-      if (media) {
-        GRL_DEBUG ("    Key '%s' might be resolved using current media",
-                   GRL_METADATA_KEY_GET_NAME (key));
-        GList *iter_deps;
-        GList *iter_deps_prev;
-        iter_deps = deps;
-        while (iter_deps) {
-          if (grl_data_key_is_known (GRL_DATA (media), iter_deps->data)) {
-            iter_deps_prev = iter_deps;
-            iter_deps = g_list_next (iter_deps);
-            deps = g_list_delete_link (deps, iter_deps_prev);
-          } else {
-            iter_deps = g_list_next (iter_deps);
-          }
-        }
-        if (!deps) {
-          GRL_DEBUG ("    Key '%s' can be resolved solely using current media",
-                     GRL_METADATA_KEY_GET_NAME (key));
-          continue;
-        }
-      }
-
-      GRL_DEBUG ("    Key '%s' might be resolved using external metadata",
-                 GRL_METADATA_KEY_GET_NAME (key));
-
-      /* Check if the original source can solve these dependencies */
-      supported_deps =
-	grl_metadata_source_filter_supported (GRL_METADATA_SOURCE (source),
-                                              &deps, TRUE);
-      if (deps) {
-	GRL_DEBUG ("      Dependencies not supported by source, dropping key");
-	/* Maybe some other source can still resolve it */
-	/* TODO: maybe some of the sources already inspected could provide
-	   these keys! */
-	supported_keys =
-	  g_list_delete_link (supported_keys, iter_prev);
-	/* Put the key back in the list, maybe some other soure can
-	   resolve it */
-	key_list = g_list_prepend (key_list, key);
-      } else {
-	GRL_DEBUG ("      Dependencies supported by source, including key");
-	/* Add these dependencies to the list of keys for
-	   the browse operation */
-	/* TODO: maybe some of these keys are in the list already! */
-	key_mapping->operation_keys =
-	  g_list_concat (key_mapping->operation_keys, supported_deps);
-      }
-    }
-
-    /* Save the key map for this source */
-    if (supported_keys) {
-      GRL_DEBUG ("  Adding source '%s' to the resolution map", name);
-      struct SourceKeyMap *source_key_map = g_new (struct SourceKeyMap, 1);
-      source_key_map->source = g_object_ref (_source);
-      source_key_map->keys = supported_keys;
-      key_mapping->source_maps =
-	g_list_prepend (key_mapping->source_maps, source_key_map);
-    }
-  }
-
-  if (key_mapping->source_maps == NULL) {
-    GRL_DEBUG ("No key mapping for other sources, can't resolve more metadata");
-  }
-
-  g_list_free (sources);
-  return;
-}
-
 /**
  * grl_metadata_source_get_id:
  * @source: a metadata source
-- 
1.7.1



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