f-spot r4231 - trunk/dpap-sharp/lib



Author: apart
Date: Sat Aug  9 21:22:52 2008
New Revision: 4231
URL: http://svn.gnome.org/viewvc/f-spot?rev=4231&view=rev

Log:
Fix missing content-codes


Modified:
   trunk/dpap-sharp/lib/ContentCodeBag.cs
   trunk/dpap-sharp/lib/Database.cs

Modified: trunk/dpap-sharp/lib/ContentCodeBag.cs
==============================================================================
--- trunk/dpap-sharp/lib/ContentCodeBag.cs	(original)
+++ trunk/dpap-sharp/lib/ContentCodeBag.cs	Sat Aug  9 21:22:52 2008
@@ -77,6 +77,8 @@
                             } while (bytes.Length == ChunkLength);
 
                             defaultBag = ContentCodeBag.ParseCodes(buf.GetBuffer());
+							// this is crappy too... this should be in the content-codes file...
+							defaultBag.AddCode ("aply", "dpap.databasecontainers", ContentType.Container);
                         }
                     }
                 }

Modified: trunk/dpap-sharp/lib/Database.cs
==============================================================================
--- trunk/dpap-sharp/lib/Database.cs	(original)
+++ trunk/dpap-sharp/lib/Database.cs	Sat Aug  9 21:22:52 2008
@@ -30,6 +30,7 @@
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Threading;
+using Gdk;
 
 namespace DPAP {
 
@@ -473,6 +474,7 @@
                 
                 writer.Close ();
             }*/
+			// maybe use FetchResponse to get a stream and feed it to pixbuf?
 			 byte[] photosData = client.Fetcher.Fetch (String.Format ("/databases/{0}/items",id), 
 			                                     String.Format("meta=dpap.filedata&query=('dmap.itemid:{0}')",photo.Id));
 			ContentNode node = ContentParser.Parse(client.Bag, photosData);
@@ -483,12 +485,20 @@
 			ContentNode fileDataNode = node.GetChild("dpap.filedata");
 			Console.WriteLine("Photo starts at index " + fileDataNode.Value);
 			BinaryWriter writer = new BinaryWriter (File.Open (dest, FileMode.Create));
+			
 			int count = 0;
 			int off = System.Int32.Parse(fileDataNode.Value.ToString());
-			
+			byte[] photoBuf;
+			MemoryStream data = new MemoryStream ();
 			//while ( count < photosData.Length - fileDataNode.Value)
-			
+			data.Write(photosData, (int)off, (int)photosData.Length-off);
 			writer.Write(photosData, (int)off, (int)photosData.Length-off);
+			data.Position = 0;
+			Gdk.Pixbuf pb = new Gdk.Pixbuf(data);
+			data.Close();
+			writer.Close();
+			
+			
 			
 			Console.Write("Written " + count + " out of " + (photosData.Length-off));
         }



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