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



Author: apart
Date: Wed Jul  2 09:28:03 2008
New Revision: 4134
URL: http://svn.gnome.org/viewvc/f-spot?rev=4134&view=rev

Log:
More DPAP content codes added


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

Modified: trunk/dpap-sharp/lib/Client.cs
==============================================================================
--- trunk/dpap-sharp/lib/Client.cs	(original)
+++ trunk/dpap-sharp/lib/Client.cs	Wed Jul  2 09:28:03 2008
@@ -125,7 +125,7 @@
 				//Console.Write(BitConverter.ToString(db_reply));
 			//	ContentNode dbnode = ContentParser.Parse (bag, fetcher.Fetch ("/databases"));
                 FetchDatabases ();
-               // Refresh ();
+                Refresh ();
                 
                /* if (serverInfo.SupportsUpdate) {
                     updateRunning = true;
@@ -164,7 +164,7 @@
 
                 foreach (ContentNode item in (ContentNode[]) child.Value) {
                     Database db = new Database (this, item);
-					Console.WriteLine("Adding database {0} with {1} items." , db.Name,db.TrackCount);
+					Console.WriteLine("Adding database {0} with id={1} and roll count={2}." , db.Name,db.Id,db.Playlists.Count); 
                     databases.Add (db);
                 }
             }
@@ -183,9 +183,9 @@
         }
 
         private void Refresh () {
-            int newrev = revision;
+            int newrev = 0;
 
-            if (serverInfo.SupportsUpdate) {
+           /* if (serverInfo.SupportsUpdate) {
                 if (revision == 0)
                     newrev = GetCurrentRevision ();
                 else
@@ -194,7 +194,7 @@
                 if (newrev == revision)
                     return;
             }
-                
+             */   
             // Console.WriteLine ("Got new revision: " + newrev);
             foreach (Database db in databases) {
                 db.Refresh (newrev);

Modified: trunk/dpap-sharp/lib/ContentCodeBag.cs
==============================================================================
--- trunk/dpap-sharp/lib/ContentCodeBag.cs	(original)
+++ trunk/dpap-sharp/lib/ContentCodeBag.cs	Wed Jul  2 09:28:03 2008
@@ -150,10 +150,28 @@
             bag.AddCode ("mstt", "dmap.status", ContentType.Long);
 
             // some photo-specific codes
+			// shouldn't those be automatically added when /content-codes is requested ?
             bag.AddCode ("ppro", "dpap.protocolversion", ContentType.Long);
             bag.AddCode ("pret", "dpap.blah", ContentType.Container);
 			bag.AddCode ("avdb", "dpap.serverdatabases", ContentType.Container);
-			
+			bag.AddCode ("aply", "dpap.databaseplaylists", ContentType.Container);
+			bag.AddCode ("abpl", "dpap.baseplaylist", ContentType.Char);
+			bag.AddCode ("apso", "dpap.playlistsongs", ContentType.Container);
+			bag.AddCode ("pasp", "dpap.aspectratio", ContentType.String);
+			bag.AddCode ("adbs", "daap.databasesongs", ContentType.Container);
+			bag.AddCode ("picd", "dpap.creationdate", ContentType.Long);
+			bag.AddCode ("pifs", "dpap.imagefilesize", ContentType.Long);
+			bag.AddCode ("pwth", "dpap.imagepixelwidth", ContentType.Long);
+			bag.AddCode ("phgt", "dpap.imagepixelheight", ContentType.Long);
+			bag.AddCode ("pcmt", "dpap.imagecomments", ContentType.String);
+			bag.AddCode ("prat", "dpap.imagerating", ContentType.Long);
+			bag.AddCode ("pimf", "dpap.imagefilename", ContentType.String);
+			bag.AddCode ("pfmt", "dpap.imageformat", ContentType.String);
+			bag.AddCode ("plsz", "dpap.imagelargefilesize", ContentType.Long);
+            //bag.AddCode ("pfdt", "dpap.filedata", ContentType.);
+            
+            
+
             ContentNode node = ContentParser.Parse (bag, buffer);
 
             foreach (ContentNode dictNode in (node.Value as ContentNode[])) {

Modified: trunk/dpap-sharp/lib/ContentParser.cs
==============================================================================
--- trunk/dpap-sharp/lib/ContentParser.cs	(original)
+++ trunk/dpap-sharp/lib/ContentParser.cs	Wed Jul  2 09:28:03 2008
@@ -114,11 +114,13 @@
             int num = IPAddress.NetworkToHostOrder (BitConverter.ToInt32 (buffer, offset));
 	//		System.Console.WriteLine("debug2!");
             ContentCode code = bag.Lookup (num);
-			//Console.WriteLine("Code number: "+num);
+			
 			//System.Console.WriteLine("debug3!");
             if (code.Equals (ContentCode.Zero)) {
                 // probably a buggy server.  fallback to our internal code bag
 				Console.WriteLine("fallback to internal code bag");
+				Console.WriteLine("Code number: "+num);
+				return null;
                 code = ContentCodeBag.Default.Lookup (num);
             }
 			

Modified: trunk/dpap-sharp/lib/Database.cs
==============================================================================
--- trunk/dpap-sharp/lib/Database.cs	(original)
+++ trunk/dpap-sharp/lib/Database.cs	Wed Jul  2 09:28:03 2008
@@ -58,20 +58,12 @@
     public class Database : ICloneable {
 
         private const int ChunkLength = 8192;
-        private const string TrackQuery = "meta=dmap.itemid,dmap.itemname,dmap.itemkind,dmap.persistentid," +
-                                         "daap.songalbum,daap.songgrouping,daap.songartist,daap.songbitrate," +
-                                         "daap.songbeatsperminute,daap.songcomment,daap.songcodectype," +
-                                         "daap.songcodecsubtype,daap.songcompilation,daap.songcomposer," +
-                                         "daap.songdateadded,daap.songdatemodified,daap.songdisccount," +
-                                         "daap.songdiscnumber,daap.songdisabled,daap.songeqpreset," +
-                                         "daap.songformat,daap.songgenre,daap.songdescription," +
-                                         "daap.songsamplerate,daap.songsize,daap.songstarttime," +
-                                         "daap.songstoptime,daap.songtime,daap.songtrackcount," +
-                                         "daap.songtracknumber,daap.songuserrating,daap.songyear," +
-                                         "daap.songdatakind,daap.songdataurl,com.apple.itunes.norm-volume," +
-                                         "com.apple.itunes.itms-songid,com.apple.itunes.itms-artistid," +
-                                         "com.apple.itunes.itms-playlistid,com.apple.itunes.itms-composerid," +
-                                         "com.apple.itunes.itms-genreid";
+		
+        private const string TrackQuery = "meta=dpap.aspectratio,dmap.itemid,dmap.itemname,dpap.imagefilename," +
+			"dpap.imagefilesize,dpap.creationdate,dpap.imagepixelwidth," +
+			"dpap.imagepixelheight,dpap.imageformat,dpap.imagerating," +
+			"dpap.imagecomments,dpap.imagelargefilesize&type=photo"; 
+			
 
         private static int nextid = 1;
         private Client client;
@@ -392,8 +384,8 @@
             if (client.Revision != 0)
                 revquery = String.Format ("revision-number={0}&delta={1}", newrev, newrev - client.Revision);
 
-            RefreshTracks (revquery);
-            RefreshPlaylists (revquery);
+            RefreshTracks ("");
+            RefreshPlaylists ("");
         }
 
         private HttpWebResponse FetchTrack (Track track, long offset) {

Modified: trunk/dpap-sharp/lib/dpap-sharp.pidb
==============================================================================
Binary files. No diff available.



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