[grilo-plugins] youtube: Add support for compiling against libgdata ≥ 0.9.0
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] youtube: Add support for compiling against libgdata ≥ 0.9.0
- Date: Thu, 21 Jul 2011 12:07:19 +0000 (UTC)
commit 31572fcba82790e2e00fcc5bad59fc4d8b47cc6a
Author: Philip Withnall <philip tecnocode co uk>
Date: Mon Jul 4 23:12:53 2011 +0100
youtube: Add support for compiling against libgdata â 0.9.0
This adds conditional support for compiling against libgdata â 0.9.0, which
broke various APIs from 0.8.x.
This fixes https://bugzilla.gnome.org/show_bug.cgi?id=653975.
configure.ac | 4 ++
src/media/youtube/grl-youtube.c | 70 +++++++++++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9e1a7f7..ed34ae5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -159,6 +159,10 @@ if test "x$HAVE_GDATA" = "xyes"; then
if test $gdata_version_major -eq 0 -a $gdata_version_minor -ge 7; then
GDATA_CFLAGS="$GDATA_CFLAGS -DGDATA_API_SUBJECT_TO_CHANGE"
fi
+
+ if `$PKG_CONFIG --atleast-version=0.9.1 libgdata`; then
+ AC_DEFINE(HAVE_LIBGDATA_0_9, 1, [libgdata is 0.9.1 or higher])
+ fi
fi
# ----------------------------------------------------------
diff --git a/src/media/youtube/grl-youtube.c b/src/media/youtube/grl-youtube.c
index 412edc4..389d04f 100644
--- a/src/media/youtube/grl-youtube.c
+++ b/src/media/youtube/grl-youtube.c
@@ -306,7 +306,11 @@ grl_youtube_source_new (const gchar *api_key, const gchar *client_id)
GRL_DEBUG ("grl_youtube_source_new");
+#ifdef HAVE_LIBGDATA_0_9
+ service = gdata_youtube_service_new (api_key, NULL);
+#else /* HAVE_LIBGDATA_0_9 */
service = gdata_youtube_service_new (api_key, client_id);
+#endif /* !HAVE_LIBGDATA_0_9 */
if (!service) {
GRL_WARNING ("Failed to initialize gdata service");
return NULL;
@@ -1136,14 +1140,28 @@ produce_from_feed (OperationSpec *os)
service = GRL_YOUTUBE_SOURCE (os->source)->priv->service;
query = gdata_query_new_with_limits (NULL , os->skip, os->count);
os->category_info = &feeds_dir[feed_type];
+
+#ifdef HAVE_LIBGDATA_0_9
gdata_youtube_service_query_standard_feed_async (GDATA_YOUTUBE_SERVICE (service),
feed_type,
query,
os->cancellable,
search_progress_cb,
os,
+ NULL,
(GAsyncReadyCallback) search_cb,
os);
+#else /* HAVE_LIBGDATA_0_9 */
+ gdata_youtube_service_query_standard_feed_async (GDATA_YOUTUBE_SERVICE (service),
+ feed_type,
+ query,
+ os->cancellable,
+ search_progress_cb,
+ os,
+ (GAsyncReadyCallback) search_cb,
+ os);
+#endif /* !HAVE_LIBGDATA_0_9 */
+
g_object_unref (query);
}
@@ -1181,6 +1199,17 @@ produce_from_category (OperationSpec *os)
query = gdata_query_new_with_limits (NULL , os->skip, os->count);
os->category_info = &categories_dir[category_index];
gdata_query_set_categories (query, category_term);
+
+#ifdef HAVE_LIBGDATA_0_9
+ gdata_youtube_service_query_videos_async (GDATA_YOUTUBE_SERVICE (service),
+ query,
+ NULL,
+ search_progress_cb,
+ os,
+ NULL,
+ (GAsyncReadyCallback) search_cb,
+ os);
+#else /* HAVE_LIBGDATA_0_9 */
gdata_youtube_service_query_videos_async (GDATA_YOUTUBE_SERVICE (service),
query,
NULL,
@@ -1188,6 +1217,8 @@ produce_from_category (OperationSpec *os)
os,
(GAsyncReadyCallback) search_cb,
os);
+#endif /* !HAVE_LIBGDATA_0_9 */
+
g_object_unref (query);
}
@@ -1330,6 +1361,17 @@ grl_youtube_source_search (GrlMediaSource *source,
grl_operation_set_data (ss->search_id, os->cancellable);
query = gdata_query_new_with_limits (ss->text, os->skip, os->count);
+
+#ifdef HAVE_LIBGDATA_0_9
+ gdata_youtube_service_query_videos_async (GDATA_YOUTUBE_SERVICE (GRL_YOUTUBE_SOURCE (source)->priv->service),
+ query,
+ os->cancellable,
+ search_progress_cb,
+ os,
+ NULL,
+ (GAsyncReadyCallback) search_cb,
+ os);
+#else /* HAVE_LIBGDATA_0_9 */
gdata_youtube_service_query_videos_async (GDATA_YOUTUBE_SERVICE (GRL_YOUTUBE_SOURCE (source)->priv->service),
query,
os->cancellable,
@@ -1337,6 +1379,8 @@ grl_youtube_source_search (GrlMediaSource *source,
os,
(GAsyncReadyCallback) search_cb,
os);
+#endif /* !HAVE_LIBGDATA_0_9 */
+
g_object_unref (query);
}
@@ -1453,6 +1497,17 @@ grl_youtube_source_metadata (GrlMediaSource *source,
#ifdef GDATA_API_SUBJECT_TO_CHANGE
{
gchar *entryid = g_strconcat ("tag:youtube.com,2008:video:", id, NULL);
+
+#ifdef HAVE_LIBGDATA_0_9
+ gdata_service_query_single_entry_async (service,
+ NULL,
+ entryid,
+ NULL,
+ GDATA_TYPE_YOUTUBE_VIDEO,
+ cancellable,
+ metadata_cb,
+ ms);
+#else /* HAVE_LIBGDATA_0_9 */
gdata_service_query_single_entry_async (service,
entryid,
NULL,
@@ -1460,6 +1515,8 @@ grl_youtube_source_metadata (GrlMediaSource *source,
cancellable,
metadata_cb,
ms);
+#endif /* !HAVE_LIBGDATA_0_9 */
+
g_free (entryid);
}
#else
@@ -1525,6 +1582,17 @@ grl_youtube_get_media_from_uri (GrlMediaSource *source,
grl_operation_set_data (mfus->media_from_uri_id, cancellable);
#ifdef GDATA_API_SUBJECT_TO_CHANGE
entry_id = g_strconcat ("tag:youtube.com,2008:video:", video_id, NULL);
+
+#ifdef HAVE_LIBGDATA_0_9
+ gdata_service_query_single_entry_async (service,
+ NULL,
+ entry_id,
+ NULL,
+ GDATA_TYPE_YOUTUBE_VIDEO,
+ cancellable,
+ media_from_uri_cb,
+ mfus);
+#else /* HAVE_LIBGDATA_0_9 */
gdata_service_query_single_entry_async (service,
entry_id,
NULL,
@@ -1532,6 +1600,8 @@ grl_youtube_get_media_from_uri (GrlMediaSource *source,
cancellable,
media_from_uri_cb,
mfus);
+#endif /* !HAVE_LIBGDATA_0_9 */
+
g_free (entry_id);
#else
gdata_youtube_service_query_single_video_async (GDATA_YOUTUBE_SERVICE (service),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]