Update to 0.1.17

This commit is contained in:
Bastien Nocera 2011-10-17 10:46:25 +01:00
parent 77250ebf33
commit b2f7665b31
4 changed files with 10 additions and 391 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/grilo-plugins-0.1.15.tar.bz2
/grilo-plugins-0.1.16.tar.xz
/grilo-plugins-0.1.17.tar.xz

View File

@ -1,382 +0,0 @@
From e1e81916715b68e7808b09e2353ccd80c87d2bd5 Mon Sep 17 00:00:00 2001
From: Philip Withnall <philip@tecnocode.co.uk>
Date: Mon, 4 Jul 2011 22:53:18 +0100
Subject: [PATCH] youtube: Fix ISO C90 warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Can't mix declarations and code.
youtube: Fix old-style function declarations
youtube: Fix variable shadowing a parameter
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.
youtube: Add a missing case to a switch statement
https://bugzilla.gnome.org/show_bug.cgi?id=653975
---
configure.ac | 4 +
src/media/youtube/grl-youtube.c | 129 +++++++++++++++++++++++++++++++--------
2 files changed, 108 insertions(+), 25 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 19b68c5..2cdf36f 100644
--- a/src/media/youtube/grl-youtube.c
+++ b/src/media/youtube/grl-youtube.c
@@ -250,6 +250,7 @@ grl_youtube_plugin_init (GrlPluginRegistry *registry,
gchar *api_key;
GrlConfig *config;
gint config_count;
+ GrlYoutubeSource *source;
GRL_LOG_DOMAIN_INIT (youtube_log_domain, "youtube");
@@ -277,8 +278,7 @@ grl_youtube_plugin_init (GrlPluginRegistry *registry,
g_thread_init (NULL);
}
- GrlYoutubeSource *source =
- grl_youtube_source_new (api_key, YOUTUBE_CLIENT_ID);
+ source = grl_youtube_source_new (api_key, YOUTUBE_CLIENT_ID);
grl_plugin_registry_register_source (registry,
plugin,
@@ -301,12 +301,16 @@ G_DEFINE_TYPE (GrlYoutubeSource, grl_youtube_source, GRL_TYPE_MEDIA_SOURCE);
static GrlYoutubeSource *
grl_youtube_source_new (const gchar *api_key, const gchar *client_id)
{
- GRL_DEBUG ("grl_youtube_source_new");
-
GrlYoutubeSource *source;
GDataYouTubeService *service;
+ 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;
@@ -424,11 +428,15 @@ release_operation_data (GrlMetadataSource *source,
}
static OperationSpec *
-operation_spec_new ()
+operation_spec_new (void)
{
+ OperationSpec *os;
+
GRL_DEBUG ("Allocating new spec");
- OperationSpec *os = g_slice_new0 (OperationSpec);
+
+ os = g_slice_new0 (OperationSpec);
os->ref_count = 1;
+
return os;
}
@@ -453,7 +461,7 @@ operation_spec_ref (OperationSpec *os)
}
inline static GrlNetWc *
-get_wc ()
+get_wc (void)
{
if (ytsrc && !ytsrc->priv->wc)
ytsrc->priv->wc = grl_net_wc_new ();
@@ -601,9 +609,9 @@ build_media_from_entry (GrlYoutubeSource *source,
gdata_youtube_video_look_up_content (video,
"application/x-shockwave-flash");
if (youtube_content != NULL) {
- GDataMediaContent *content = GDATA_MEDIA_CONTENT (youtube_content);
- grl_media_set_external_player (media,
- gdata_media_content_get_uri (content));
+ const gchar *uri =
+ gdata_media_content_get_uri (GDATA_MEDIA_CONTENT (youtube_content));
+ grl_media_set_external_player (media, uri);
}
}
iter = g_list_next (iter);
@@ -615,14 +623,14 @@ build_media_from_entry (GrlYoutubeSource *source,
static void
parse_categories (xmlDocPtr doc, xmlNodePtr node, OperationSpec *os)
{
- GRL_DEBUG ("parse_categories");
-
guint total = 0;
GList *all = NULL, *iter;
CategoryInfo *cat_info;
gchar *id;
guint index = 0;
+ GRL_DEBUG ("parse_categories");
+
while (node) {
cat_info = g_slice_new (CategoryInfo);
id = (gchar *) xmlGetProp (node, (xmlChar *) "term");
@@ -801,14 +809,14 @@ metadata_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- GRL_DEBUG ("metadata_cb");
-
GError *error = NULL;
GrlYoutubeSource *source;
GDataEntry *video;
GDataService *service;
GrlMediaSourceMetadataSpec *ms = (GrlMediaSourceMetadataSpec *) user_data;
+ GRL_DEBUG ("metadata_cb");
+
source = GRL_YOUTUBE_SOURCE (ms->source);
service = GDATA_SERVICE (source->priv->service);
@@ -877,13 +885,13 @@ search_progress_cb (GDataEntry *entry,
static void
search_cb (GObject *object, GAsyncResult *result, OperationSpec *os)
{
- GRL_DEBUG ("search_cb");
-
GDataFeed *feed;
GError *error = NULL;
gboolean need_extra_unref = FALSE;
GrlYoutubeSource *source = GRL_YOUTUBE_SOURCE (os->source);
+ GRL_DEBUG ("search_cb");
+
/* Check if operation was cancelled */
if (g_cancellable_is_cancelled (os->cancellable)) {
GRL_DEBUG ("Search operation has been cancelled");
@@ -1046,10 +1054,10 @@ produce_container_from_directory (GDataService *service,
static void
produce_from_directory (CategoryInfo *dir, gint dir_size, OperationSpec *os)
{
- GRL_DEBUG ("produce_from_directory");
-
guint index, remaining;
+ GRL_DEBUG ("produce_from_directory");
+
/* Youtube's first index is 1, but the directories start at 0 */
os->skip--;
@@ -1132,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);
}
@@ -1177,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,
@@ -1184,6 +1217,8 @@ produce_from_category (OperationSpec *os)
os,
(GAsyncReadyCallback) search_cb,
os);
+#endif /* !HAVE_LIBGDATA_0_9 */
+
g_object_unref (query);
}
@@ -1326,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,
@@ -1333,6 +1379,8 @@ grl_youtube_source_search (GrlMediaSource *source,
os,
(GAsyncReadyCallback) search_cb,
os);
+#endif /* !HAVE_LIBGDATA_0_9 */
+
g_object_unref (query);
}
@@ -1383,6 +1431,7 @@ grl_youtube_source_browse (GrlMediaSource *source,
case YOUTUBE_MEDIA_TYPE_CATEGORY:
produce_from_category (os);
break;
+ case YOUTUBE_MEDIA_TYPE_VIDEO:
default:
g_assert_not_reached ();
break;
@@ -1449,6 +1498,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,
@@ -1456,6 +1516,8 @@ grl_youtube_source_metadata (GrlMediaSource *source,
cancellable,
metadata_cb,
ms);
+#endif /* !HAVE_LIBGDATA_0_9 */
+
g_free (entryid);
}
#else
@@ -1480,11 +1542,11 @@ grl_youtube_source_metadata (GrlMediaSource *source,
static gboolean
grl_youtube_test_media_from_uri (GrlMediaSource *source, const gchar *uri)
{
- GRL_DEBUG ("grl_youtube_test_media_from_uri");
-
gchar *video_id;
gboolean ok;
+ GRL_DEBUG ("grl_youtube_test_media_from_uri");
+
video_id = get_video_id_from_url (uri);
ok = (video_id != NULL);
g_free (video_id);
@@ -1495,12 +1557,15 @@ static void
grl_youtube_get_media_from_uri (GrlMediaSource *source,
GrlMediaSourceMediaFromUriSpec *mfus)
{
- GRL_DEBUG ("grl_youtube_get_media_from_uri");
-
gchar *video_id;
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");
video_id = get_video_id_from_url (mfus->uri);
if (video_id == NULL) {
@@ -1517,7 +1582,18 @@ 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
- gchar *entry_id = g_strconcat ("tag:youtube.com,2008:video:", video_id, NULL);
+ 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,
@@ -1525,6 +1601,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),
@@ -1540,10 +1618,11 @@ static void
grl_youtube_source_cancel (GrlMetadataSource *source,
guint operation_id)
{
+ GCancellable *cancellable;
+
GRL_DEBUG (__FUNCTION__);
- GCancellable *cancellable =
- (GCancellable *) grl_operation_get_data (operation_id);
+ cancellable = G_CANCELLABLE (grl_operation_get_data (operation_id));
if (cancellable) {
g_cancellable_cancel (cancellable);
--
1.7.5.4

View File

@ -2,7 +2,7 @@
%define release_version %(echo %{version} | awk -F. '{print $1"."$2}')
Name: grilo-plugins
Version: 0.1.16
Version: 0.1.17
Release: 1%{?dist}
Summary: Plugins for the Grilo framework
@ -25,9 +25,6 @@ BuildRequires: gmime-devel
BuildRequires: gnome-common
BuildRequires: automake autoconf intltool libtool
# https://bugzilla.gnome.org/show_bug.cgi?id=653975
Patch0: 0001-youtube-Fix-ISO-C90-warnings.patch
Requires: grilo >= %{version}
Requires: gupnp >= 0.13.0
Requires: gupnp-av >= 0.5.0
@ -55,10 +52,9 @@ This package contains plugins to get information from theses sources:
%prep
%setup -q
%patch0 -p1 -b .libgdata-0.9
# https://bugzilla.gnome.org/show_bug.cgi?id=653937
sed -i -e 's,gmime-2.4,gmime-2.6,g' configure.ac
# https://bugzilla.gnome.org/show_bug.cgi?id=658448
sed -i -e 's,tracker-sparql-0.11,tracker-sparql-0.12,g' configure.ac
autoreconf -f
@ -80,7 +76,8 @@ autoreconf -f
--enable-tracker \
--enable-upnp \
--enable-vimeo \
--enable-youtube
--enable-youtube \
--enable-tracker
make %{?_smp_mflags}
@ -98,6 +95,9 @@ rm -f $RPM_BUILD_ROOT%{_bindir}/*
%{_datadir}/grilo-%{release_version}/plugins/*.xml
%changelog
* Mon Oct 17 2011 Bastien Nocera <bnocera@redhat.com> 0.1.17-1
- Update to 0.1.17
* Mon Jul 04 2011 Bastien Nocera <bnocera@redhat.com> 0.1.16-1
- Update to 0.1.16

View File

@ -1 +1 @@
18d61775e43172dd7d8270818cfe6480 grilo-plugins-0.1.16.tar.xz
4553c823b3434a2b8187d1f95b5e61cc grilo-plugins-0.1.17.tar.xz