Update of /cvsroot/gtkpod/libgpod/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16553/src

Modified Files:
        db-artwork-parser.c db-artwork-writer.c 
Log Message:
        * src/db-artwork-writer/parser.c: Create ArtworkDB when it does
          not exist.



Index: db-artwork-parser.c
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/src/db-artwork-parser.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- db-artwork-parser.c 30 Nov 2005 19:18:47 -0000      1.10
+++ db-artwork-parser.c 4 Dec 2005 05:27:13 -0000       1.11
@@ -438,8 +438,24 @@
 G_GNUC_INTERNAL char *
 ipod_db_get_artwork_db_path (const char *mount_point)
 {
+        gchar *filename;
        const char *paths[] = {"iPod_Control", "Artwork", "ArtworkDB", NULL};
-       return itdb_resolve_path (mount_point, paths);
+       filename = itdb_resolve_path (mount_point, paths);
+
+       /* itdb_resolve_path() only returns existing paths */
+       if (!filename)
+       {
+           gchar *path;
+           paths[2] = NULL;
+           path = itdb_resolve_path (mount_point, (const char **)paths);
+           if (path)
+           {
+               filename = g_build_filename (path, "ArtworkDB", NULL);
+           }
+           g_free (path);
+       }
+
+       return filename;
 }
 
 
@@ -492,7 +508,11 @@
        filename = ipod_db_get_artwork_db_path (db->mountpoint);
        if (filename == NULL) {
                goto error;
-       }       
+       }
+       if (!g_file_test (filename, G_FILE_TEST_EXISTS))
+       {
+               goto error;
+       }
        ctx = db_parse_context_new_from_file (filename);        
        g_free (filename);
        if (ctx == NULL) {

Index: db-artwork-writer.c
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/src/db-artwork-writer.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- db-artwork-writer.c 28 Nov 2005 16:20:40 -0000      1.11
+++ db-artwork-writer.c 4 Dec 2005 05:27:13 -0000       1.12
@@ -741,16 +741,13 @@
        char *filename;
        int id_max;
 
-       /* First, let's write the .ithmb files, this will create the various 
-        * thumbnails as well, and update the Itdb_Track items contained in
-        * the database appropriately (ie set the 'artwork_count' and 
-        * 'artwork_size' fields, as well as the 2 Itdb_Thumb fields
-        */
+       /* First, let's write the .ithmb files, this will create the
+        * various thumbnails as well */
+
        itdb_write_ithumb_files (db);
        /* Now we can update the ArtworkDB file */
        id_max = ipod_artwork_db_set_ids (db);
 
-       /* FIXME: need to create the file if it doesn't exist */
        filename = ipod_db_get_artwork_db_path (db->mountpoint);
        if (filename == NULL) {
                /* FIXME: the iTunesDB will be inconsistent wrt artwork_count



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to