[grilo-plugins] youtube: Get rid of old libgdata API
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] youtube: Get rid of old libgdata API
- Date: Thu, 21 Jul 2011 12:07:29 +0000 (UTC)
commit 37ee6e0bf5c428bec58d92265568da2591419d07
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Thu Jul 21 11:01:27 2011 +0000
youtube: Get rid of old libgdata API
Do not support versions older than 0.7.
Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
configure.ac | 9 +-------
src/media/youtube/grl-youtube.c | 43 ++------------------------------------
2 files changed, 4 insertions(+), 48 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ed34ae5..e9be481 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,7 +117,7 @@ PKG_CHECK_MODULES(GUPNPAV, gupnp-av-1.0 >= 0.5, HAVE_GUPNPAV=yes, HAVE_GUPNPAV=n
PKG_CHECK_MODULES(SQLITE, sqlite3, HAVE_SQLITE=yes, HAVE_SQLITE=no)
-PKG_CHECK_MODULES(GDATA, libgdata >= 0.4.0, HAVE_GDATA=yes, HAVE_GDATA=no)
+PKG_CHECK_MODULES(GDATA, libgdata >= 0.7.0, HAVE_GDATA=yes, HAVE_GDATA=no)
PKG_CHECK_MODULES(QUVI, libquvi >= 0.2.15, HAVE_QUVI=yes, HAVE_QUVI=no)
@@ -153,13 +153,6 @@ PKG_CHECK_MODULES(GLIB_2_26, glib-2.0 >= 2.26.0,
# ----------------------------------------------------------
if test "x$HAVE_GDATA" = "xyes"; then
- gdata_version=`${PKG_CONFIG} --modversion libgdata`
- gdata_version_major=`echo $gdata_version | awk -F. '{ print $1 }'`
- gdata_version_minor=`echo $gdata_version | awk -F. '{ print $2 }'`
- 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
diff --git a/src/media/youtube/grl-youtube.c b/src/media/youtube/grl-youtube.c
index 2cdf36f..a752720 100644
--- a/src/media/youtube/grl-youtube.c
+++ b/src/media/youtube/grl-youtube.c
@@ -567,13 +567,9 @@ build_media_from_entry (GrlYoutubeSource *source,
} else if (key == GRL_METADATA_KEY_DATE) {
GTimeVal date;
gchar *date_str;
-#ifdef GDATA_API_SUBJECT_TO_CHANGE
gint64 published = gdata_entry_get_published (entry);
date.tv_sec = (glong) published;
date.tv_usec = 0;
-#else
- gdata_entry_get_published (entry, &date);
-#endif
if (date.tv_sec != 0 || date.tv_usec != 0) {
date_str = g_time_val_to_iso8601 (&date);
grl_media_set_date (media, date_str);
@@ -820,13 +816,8 @@ metadata_cb (GObject *object,
source = GRL_YOUTUBE_SOURCE (ms->source);
service = GDATA_SERVICE (source->priv->service);
-#ifdef GDATA_API_SUBJECT_TO_CHANGE
video = gdata_service_query_single_entry_finish (service, result, &error);
-#else
- video =
- GDATA_ENTRY (gdata_youtube_service_query_single_video_finish
- (GDATA_YOUTUBE_SERVICE (service), result, &error));
-#endif
+
if (error) {
release_operation_data (GRL_METADATA_SOURCE (ms->source), ms->metadata_id);
error->code = GRL_CORE_ERROR_METADATA_FAILED;
@@ -1271,13 +1262,7 @@ media_from_uri_cb (GObject *object, GAsyncResult *result, gpointer user_data)
source = GRL_YOUTUBE_SOURCE (mfus->source);
service = GDATA_SERVICE (source->priv->service);
-#ifdef GDATA_API_SUBJECT_TO_CHANGE
video = gdata_service_query_single_entry_finish (service, result, &error);
-#else
- video =
- GDATA_ENTRY (gdata_youtube_service_query_single_video_finish
- (GDATA_YOUTUBE_SERVICE (service), result, &error));
-#endif
if (error) {
error->code = GRL_CORE_ERROR_MEDIA_FROM_URI_FAILED;
@@ -1495,9 +1480,7 @@ grl_youtube_source_metadata (GrlMediaSource *source,
default:
cancellable = g_cancellable_new ();
grl_operation_set_data (ms->metadata_id, cancellable);
-#ifdef GDATA_API_SUBJECT_TO_CHANGE
- {
- gchar *entryid = g_strconcat ("tag:youtube.com,2008:video:", id, NULL);
+ gchar *entryid = g_strconcat ("tag:youtube.com,2008:video:", id, NULL);
#ifdef HAVE_LIBGDATA_0_9
gdata_service_query_single_entry_async (service,
@@ -1519,16 +1502,7 @@ grl_youtube_source_metadata (GrlMediaSource *source,
#endif /* !HAVE_LIBGDATA_0_9 */
g_free (entryid);
- }
-#else
- gdata_youtube_service_query_single_video_async (GDATA_YOUTUBE_SERVICE (service),
- NULL,
- id,
- cancellable,
- metadata_cb,
- ms);
-#endif
- break;
+ break;
}
if (error) {
@@ -1561,9 +1535,7 @@ grl_youtube_get_media_from_uri (GrlMediaSource *source,
GError *error;
GCancellable *cancellable;
GDataService *service;
-#ifdef GDATA_API_SUBJECT_TO_CHANGE
gchar *entry_id;
-#endif /* GDATA_API_SUBJECT_TO_CHANGE */
GRL_DEBUG ("grl_youtube_get_media_from_uri");
@@ -1581,7 +1553,6 @@ grl_youtube_get_media_from_uri (GrlMediaSource *source,
cancellable = g_cancellable_new ();
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
@@ -1604,14 +1575,6 @@ grl_youtube_get_media_from_uri (GrlMediaSource *source,
#endif /* !HAVE_LIBGDATA_0_9 */
g_free (entry_id);
-#else
- gdata_youtube_service_query_single_video_async (GDATA_YOUTUBE_SERVICE (service),
- NULL,
- video_id,
- cancellable,
- media_from_uri_cb,
- mfus);
-#endif
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]