[banshee] [YouTube] Handle API change in gdata-sharp 1.5



commit e12e025e38c661140b09e90a61ff2f4ff50a2d92
Author: Kevin Duffus <KevinDuffus gmail com>
Date:   Wed Sep 15 17:19:46 2010 -0700

    [YouTube] Handle API change in gdata-sharp 1.5
    
    The client_id parameter was removed from the
    YouTubeRequestSettings constructor in gdata-sharp 1.5. We now handle
    that properly, according to the gdata-sharp version. Fixes bgo#628602.
    
    Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>

 build/m4/banshee/youtube.m4                        |    9 ++++++---
 .../Banshee.YouTube.Data/YouTubeData.cs            |    9 +++++++--
 .../Banshee.YouTube/Banshee.YouTube.csproj         |    1 +
 src/Extensions/Banshee.YouTube/Makefile.am         |    5 +++++
 4 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/build/m4/banshee/youtube.m4 b/build/m4/banshee/youtube.m4
index 3ffe488..9161c5d 100644
--- a/build/m4/banshee/youtube.m4
+++ b/build/m4/banshee/youtube.m4
@@ -1,17 +1,20 @@
 AC_DEFUN([BANSHEE_CHECK_YOUTUBE],
 [
 	GDATASHARP_REQUIRED_VERSION=1.4
-	AC_SUBST(GDATASHARP_REQUIRED_VERSION)
 
 	AC_ARG_ENABLE(youtube, AC_HELP_STRING([--disable-youtube], [Disable Youtube extension]), , enable_youtube="yes")
 
 	if test "x$enable_youtube" = "xyes"; then
 		PKG_CHECK_MODULES(GDATASHARP,
-			gdata-sharp-core >= $GDATASHARP_REQUIRED_VERSION
-			gdata-sharp-youtube >= $GDATASHARP_REQUIRED_VERSION)
+			gdata-sharp-youtube >= 1.5,
+			[AM_CONDITIONAL(HAVE_GDATASHARP_1_5, true)],
+			[PKG_CHECK_MODULES(GDATASHARP, gdata-sharp-youtube >= $GDATASHARP_REQUIRED_VERSION)
+			 AM_CONDITIONAL(HAVE_GDATASHARP_1_5, false)]
+		)
 		AC_SUBST(GDATASHARP_LIBS)
 		AM_CONDITIONAL(HAVE_GDATA, true)
 	else
+		AM_CONDITIONAL(HAVE_GDATASHARP_1_5, false)
 		AM_CONDITIONAL(HAVE_GDATA, false)
 	fi
 ])
diff --git a/src/Extensions/Banshee.YouTube/Banshee.YouTube.Data/YouTubeData.cs b/src/Extensions/Banshee.YouTube/Banshee.YouTube.Data/YouTubeData.cs
index ff7ff35..eb7b7e7 100644
--- a/src/Extensions/Banshee.YouTube/Banshee.YouTube.Data/YouTubeData.cs
+++ b/src/Extensions/Banshee.YouTube/Banshee.YouTube.Data/YouTubeData.cs
@@ -53,6 +53,7 @@ namespace Banshee.YouTube.Data
     public class DataCore
     {
         private Feed<Video> video_results;
+        private YouTubeRequestSettings yt_request_settings;
         private YouTubeRequest yt_request;
         private const string app_name = "Banshee.YouTube";
         private const string client_id = "ytapi-KevinDuffus-BansheeMediaPlay-11toa30i-0";
@@ -60,7 +61,11 @@ namespace Banshee.YouTube.Data
 
         public bool InitYouTubeRequest ()
         {
-            YouTubeRequestSettings yt_request_settings = new YouTubeRequestSettings (app_name, client_id, developer_key);
+#if HAVE_GDATASHARP_1_5
+            yt_request_settings = new YouTubeRequestSettings (app_name, developer_key);
+#else
+            yt_request_settings = new YouTubeRequestSettings (app_name, client_id, developer_key);
+#endif
             this.yt_request = new YouTubeRequest (yt_request_settings);
 
             if (this.yt_request != null && yt_request_settings != null) {
@@ -89,4 +94,4 @@ namespace Banshee.YouTube.Data
             get { return this.video_results; }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/Extensions/Banshee.YouTube/Banshee.YouTube.csproj b/src/Extensions/Banshee.YouTube/Banshee.YouTube.csproj
index b61022a..3eaab5d 100644
--- a/src/Extensions/Banshee.YouTube/Banshee.YouTube.csproj
+++ b/src/Extensions/Banshee.YouTube/Banshee.YouTube.csproj
@@ -25,6 +25,7 @@
         <Command type="Execute" command="make run" workingdir="${SolutionDir}" />
       </CustomCommands>
     </CustomCommands>
+    <DefineConstants>HAVE_GDATASHARP_1_5</DefineConstants>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
diff --git a/src/Extensions/Banshee.YouTube/Makefile.am b/src/Extensions/Banshee.YouTube/Makefile.am
index 4c19bb5..8ca149f 100644
--- a/src/Extensions/Banshee.YouTube/Makefile.am
+++ b/src/Extensions/Banshee.YouTube/Makefile.am
@@ -18,3 +18,8 @@ include $(top_srcdir)/build/build.mk
 else
 EXTRA_DIST = $(SOURCES) $(RESOURCES)
 endif
+
+if HAVE_GDATASHARP_1_5
+GMCS_FLAGS += "-define:HAVE_GDATASHARP_1_5"
+endif
+



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