[grilo-plugins] thetvdb: enable cache-only on GRL_RESOLVE_FAST_ONLY
- From: Victor Toso de Carvalho <victortoso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] thetvdb: enable cache-only on GRL_RESOLVE_FAST_ONLY
- Date: Fri, 1 May 2015 22:06:52 +0000 (UTC)
commit eaa64e947c88e16dd38216146071a7df0c96b319
Author: Victor Toso <me victortoso com>
Date: Mon Apr 27 22:15:27 2015 +0200
thetvdb: enable cache-only on GRL_RESOLVE_FAST_ONLY
https://bugzilla.gnome.org/show_bug.cgi?id=748422
src/thetvdb/grl-thetvdb.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/thetvdb/grl-thetvdb.c b/src/thetvdb/grl-thetvdb.c
index 8b81a84..f8ef814 100644
--- a/src/thetvdb/grl-thetvdb.c
+++ b/src/thetvdb/grl-thetvdb.c
@@ -126,6 +126,7 @@ typedef struct _OperationSpec {
guint error_code;
gchar *lang;
gboolean fetched_web;
+ gboolean cache_only;
SeriesResource *serie_resource;
GrlSourceResolveCb callback;
} OperationSpec;
@@ -1313,7 +1314,7 @@ cache_find_episode_done (GObject *object,
GRL_DEBUG ("[Episode] Cache miss with '%s' due '%s'", show, err->message);
g_error_free (err);
- if (os->fetched_web == FALSE) {
+ if (os->fetched_web == FALSE && os->cache_only == FALSE) {
/* Fetch web API in order to update current cache */
thetvdb_execute_resolve_web (os);
return;
@@ -1444,7 +1445,12 @@ cache_find_serie_done (GObject *object,
if (resource == NULL) {
GRL_DEBUG ("[Series] Cache miss with '%s' due '%s'", show, err->message);
g_error_free (err);
- thetvdb_execute_resolve_web (os);
+ if (os->cache_only == FALSE) {
+ thetvdb_execute_resolve_web (os);
+ } else {
+ os->callback (os->source, os->operation_id, os->media, os->user_data, NULL);
+ free_operation_spec (os);
+ }
return;
}
@@ -1486,8 +1492,10 @@ grl_thetvdb_source_resolve (GrlSource *source,
GrlSourceResolveSpec *rs)
{
OperationSpec *os = NULL;
+ GrlResolutionFlags res;
GRL_DEBUG ("thetvdb_resolve");
+ res = grl_operation_options_get_resolution_flags (rs->options);
os = g_slice_new0 (OperationSpec);
os->source = rs->source;
@@ -1499,6 +1507,9 @@ grl_thetvdb_source_resolve (GrlSource *source,
os->error_code = GRL_CORE_ERROR_RESOLVE_FAILED;
os->lang = get_pref_language (GRL_THETVDB_SOURCE (source));
os->fetched_web = FALSE;
+ os->cache_only = (res & GRL_RESOLVE_FAST_ONLY);
+
+ GRL_DEBUG ("cache-only: %s", (os->cache_only) ? "yes" : "no");
thetvdb_execute_resolve_cache (os);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]