summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorg Schuler <jcsjcs@users.sourceforge.net>2005-12-04 05:27:13 +0000
committerJorg Schuler <jcsjcs@users.sourceforge.net>2005-12-04 05:27:13 +0000
commit6f8befd8425ad913a612dfa9895b524f7c4ab202 (patch)
tree193971631e52cba1b26900fb5ecd0bd7ea4248c2
parent114bc20689f6d1d6963510b49002e1955cbe1008 (diff)
downloadlibgpod-6f8befd8425ad913a612dfa9895b524f7c4ab202.tar.gz
libgpod-6f8befd8425ad913a612dfa9895b524f7c4ab202.tar.xz
libgpod-6f8befd8425ad913a612dfa9895b524f7c4ab202.zip
* src/db-artwork-writer/parser.c: Create ArtworkDB when it does
not exist. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1183 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r--ChangeLog5
-rw-r--r--src/db-artwork-parser.c24
-rw-r--r--src/db-artwork-writer.c9
3 files changed, 30 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b16f72..9eba702 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-12-05 Jorg Schuler <jcsjcs at users.sourceforge.net>
+
+ * src/db-artwork-writer/parser.c: Create ArtworkDB when it does
+ not exist.
+
2005-11-30 Christophe Fergeau <teuf@gnome.org>
* src/db-artwork-parser.c: (parse_mhni): don't crash if
diff --git a/src/db-artwork-parser.c b/src/db-artwork-parser.c
index 6796bbe..2709e42 100644
--- a/src/db-artwork-parser.c
+++ b/src/db-artwork-parser.c
@@ -438,8 +438,24 @@ parse_mhfd (DBParseContext *ctx, Itdb_iTunesDB *db, GError **error)
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 @@ ipod_parse_artwork_db (Itdb_iTunesDB *db)
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) {
diff --git a/src/db-artwork-writer.c b/src/db-artwork-writer.c
index 280c2b7..7159885 100644
--- a/src/db-artwork-writer.c
+++ b/src/db-artwork-writer.c
@@ -741,16 +741,13 @@ ipod_write_artwork_db (Itdb_iTunesDB *db)
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