export tags to gallery



hi,
yesterday evening i found out that it was not possible to export my f-spot 
tags to my Gallery. I spent some time to create the attached patch that adds 
the nessesary lines to the GalleryRemote.cs . 
Unfortunately, it is also unsupported in the GalleryRemote API, so i had to 
patch the code on my gally, also. I published the code for the GalleryRemote 
Module on gallery forums some minutes ago. 
(http://gallery.menalto.com/node/60370)

What do you think of this hack?  I think this should be integrated (maybe 
after some tuning, I appreciate your comments ;-) ) in f-spot to be able to 
export the tags to gallery. Virtual album, for example, are very nice and i 
don't want to tag my photos twice to be able to use them ;-)
Integrating this without being supported by the gallery is no problem as the 
additional parameters are irgnored and cause no errors.

Regards
 Markus
Index: GalleryRemote.cs
===================================================================
--- GalleryRemote.cs	(Revision 2934)
+++ GalleryRemote.cs	(Arbeitskopie)
@@ -91,11 +91,17 @@
 			if (item == null)
 				Console.WriteLine ("NO PHOTO");
 			
+			string keywords = "";
+			foreach(Tag t in item.Tags){
+				keywords = keywords + t.Name + ",";
+			}			
 			return gallery.AddItem (this, 
 					 path,
 					 Path.GetFileName (item.DefaultVersionUri.LocalPath),
 					 item.Description, 
-					 true);
+					 true,
+					 keywords
+			);
 		}
 		
 		public string GetUrl ()
@@ -283,7 +289,7 @@
 		public abstract ArrayList FetchAlbums ();
 		public abstract ArrayList FetchAlbumsPrune ();
 		public abstract bool MoveAlbum (Album album, string end_name);
-		public abstract int AddItem (Album album, string path, string filename, string caption, bool autorotate);
+		public abstract int AddItem (Album album, string path, string filename, string caption, bool autorotate, string keywords);
 		//public abstract Album AlbumProperties (string album);
 		public abstract bool NewAlbum (string parent_name, string name, string title, string description);
 		public abstract ArrayList FetchAlbumImages (Album album, bool include_ablums);
@@ -746,7 +752,9 @@
 				     string path, 
 				     string filename,
 				     string caption, 
-				     bool autorotate)
+				     bool autorotate, 
+				string keywords
+				)
 		{
 			FormClient client = new FormClient (cookies);
 			
@@ -757,6 +765,7 @@
 			client.Add ("userfile_name", filename);
 			client.Add ("force_filename", filename);
 			client.Add ("auto_rotate", autorotate ? "yes" : "no");
+			client.Add ("extrafield.keywords", keywords);
 			client.Add ("userfile", new FileInfo (path));
 			
 			return ParseAddItem (client.Submit (uri, Progress));
@@ -961,7 +970,8 @@
 				     string path, 
 				     string filename,
 				     string caption, 
-				     bool autorotate)
+				     bool autorotate,
+				     string keywords	)
 		{
 			FormClient client = new FormClient (cookies);
 			
@@ -971,10 +981,11 @@
 			client.Add ("g2_form[caption]", caption);
 			client.Add ("g2_form[userfile_name]", filename);
 			client.Add ("g2_form[force_filename]", filename);
+			client.Add ("g2_form[keywords]", keywords);
 			client.Add ("g2_form[auto_rotate]", autorotate ? "yes" : "no");
 			client.Add ("g2_userfile", new FileInfo (path));
+			
 			AddG2Specific (client);
-			
 			return ParseAddItem (client.Submit (uri, Progress));
 		}
 		


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