summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorg Schuler <jcsjcs@users.sourceforge.net>2008-05-11 07:17:29 +0000
committerJorg Schuler <jcsjcs@users.sourceforge.net>2008-05-11 07:17:29 +0000
commit17f9cb587e889fa9fbf034228c5c6380311af219 (patch)
tree6947112a14808c0192fe61381e9ddde904b4bf95
parent58234ef2d087da17c40e774942c511012f90eb70 (diff)
downloadlibgpod-17f9cb587e889fa9fbf034228c5c6380311af219.tar.gz
libgpod-17f9cb587e889fa9fbf034228c5c6380311af219.tar.xz
libgpod-17f9cb587e889fa9fbf034228c5c6380311af219.zip
* src/itdb_photoalbum.c
src/itdb_private.h src/db-artwork-writer.c: renamed itdb_get_free_photo_id() to itdb_get_max_photo_id() and implemented Jacob Hoffman-Andrew's patch about the photo_ids and album_ids being shared. * tests/test-covers.c: print more info (marginally) git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1971 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r--ChangeLog11
-rw-r--r--src/db-artwork-writer.c4
-rw-r--r--src/itdb_photoalbum.c17
-rw-r--r--src/itdb_private.h2
-rw-r--r--tests/test-covers.c2
5 files changed, 26 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 42fb9e2..8653df3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,17 @@
+2008-05-11 Jorg Schuler <jcsjcs at users.sourceforge.net>
+
+ * src/itdb_photoalbum.c
+ src/itdb_private.h
+ src/db-artwork-writer.c: renamed itdb_get_free_photo_id() to
+ itdb_get_max_photo_id() and implemented Jacob Hoffman-Andrew's
+ patch about the photo_ids and album_ids being shared.
+
+ * tests/test-covers.c: print more info (marginally)
+
2008-05-10 Jorg Schuler <jcsjcs at users.sourceforge.net>
* tests/test-covers.c: print more status messages.
-
2008-05-01 Todd Zullinger <tmzullinger at users.sourceforge.net>
* configure.ac:
diff --git a/src/db-artwork-writer.c b/src/db-artwork-writer.c
index 21b6a91..50e65b3 100644
--- a/src/db-artwork-writer.c
+++ b/src/db-artwork-writer.c
@@ -1086,8 +1086,8 @@ ipod_write_photo_db (Itdb_PhotoDB *photodb)
g_free (filename);
return -1;
}
- id_max = itdb_get_free_photo_id( photodb );
- bytes_written = write_mhfd (&db, buf, id_max);
+ id_max = itdb_get_max_photo_id( photodb );
+ bytes_written = write_mhfd (&db, buf, id_max+1);
/* Refcount of the shared buffer should drop to 0 and this should
* sync buffered data to disk
diff --git a/src/itdb_photoalbum.c b/src/itdb_photoalbum.c
index 994875e..b55c4d0 100644
--- a/src/itdb_photoalbum.c
+++ b/src/itdb_photoalbum.c
@@ -309,19 +309,26 @@ void itdb_photodb_free (Itdb_PhotoDB *photodb)
-G_GNUC_INTERNAL gint itdb_get_free_photo_id ( Itdb_PhotoDB *db )
+G_GNUC_INTERNAL gint itdb_get_max_photo_id ( Itdb_PhotoDB *db )
{
- gint photo_id = 0;
+ gint max_seen_id = 0;
GList *it;
for (it = db->photos; it != NULL; it = it->next) {
Itdb_Artwork *artwork;
artwork = (Itdb_Artwork *)it->data;
- if( artwork->id > photo_id )
- photo_id = artwork->id;
+ if( artwork->id > max_seen_id )
+ max_seen_id = artwork->id;
}
- return photo_id + 1;
+ for (it = db->photoalbums; it != NULL; it = it->next) {
+ Itdb_PhotoAlbum *album;
+ album = (Itdb_PhotoAlbum *)it->data;
+ if ( album->album_id > max_seen_id )
+ max_seen_id = album->album_id;
+
+ }
+ return max_seen_id;
}
static void itdb_photodb_photoalbum_free (Itdb_PhotoAlbum *album)
diff --git a/src/itdb_private.h b/src/itdb_private.h
index 7e9e410..2417423 100644
--- a/src/itdb_private.h
+++ b/src/itdb_private.h
@@ -146,7 +146,7 @@ G_GNUC_INTERNAL void itdb_splr_free (Itdb_SPLRule *splr);
G_GNUC_INTERNAL const gchar *itdb_photodb_get_mountpoint (Itdb_PhotoDB *photodb);
G_GNUC_INTERNAL gchar *db_get_mountpoint (Itdb_DB *db);
G_GNUC_INTERNAL Itdb_Device *db_get_device(Itdb_DB *db);
-G_GNUC_INTERNAL gint itdb_get_free_photo_id ( Itdb_PhotoDB *db );
+G_GNUC_INTERNAL gint itdb_get_max_photo_id ( Itdb_PhotoDB *db );
G_GNUC_INTERNAL Itdb_iTunesDB *db_get_itunesdb (Itdb_DB *db);
G_GNUC_INTERNAL Itdb_PhotoDB *db_get_photodb (Itdb_DB *db);
G_GNUC_INTERNAL gint itdb_thumb_get_byteorder (ItdbThumbFormat format);
diff --git a/tests/test-covers.c b/tests/test-covers.c
index ef353c1..02c5c78 100644
--- a/tests/test-covers.c
+++ b/tests/test-covers.c
@@ -80,7 +80,7 @@ save_thumbnails (Itdb_iTunesDB *db)
Itdb_Track *song;
song = (Itdb_Track *)it->data;
- g_print ("Track %d\n", count++);
+ g_print ("Track %d (%016"G_GINT64_MODIFIER"x)\n", count++, song->dbid);
save_song_thumbnails (song);
}
}