summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/db-artwork-parser.c24
-rw-r--r--src/db-artwork-writer.c9
2 files changed, 25 insertions, 8 deletions
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