diff options
author | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2006-06-24 11:09:53 +0000 |
---|---|---|
committer | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2006-06-24 11:09:53 +0000 |
commit | 603dee7e51c02b5fdf340fada903e3e7aab4899e (patch) | |
tree | ac11c83c21e0b4d51e6afc879512670da0ccbbd7 | |
parent | 24faac9cc1f2b6a0ab4d27e0c03caa04755c8cbb (diff) | |
download | libgpod-603dee7e51c02b5fdf340fada903e3e7aab4899e.tar.gz libgpod-603dee7e51c02b5fdf340fada903e3e7aab4899e.tar.xz libgpod-603dee7e51c02b5fdf340fada903e3e7aab4899e.zip |
* src/itdb_itunesdb.c
src/itdb.h:
Added itdb_get_itunessd_path ().
itdb_init_ipod() will no longer overwrite existing iTunesDB and
iTunesSD.
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1304 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/itdb.h | 3 | ||||
-rw-r--r-- | src/itdb_itunesdb.c | 54 |
3 files changed, 56 insertions, 9 deletions
@@ -1,3 +1,11 @@ +2006-06-24 Jorg Schuler <jcsjcs at users.sourceforge.net> + + * src/itdb_itunesdb.c + src/itdb.h: + Added itdb_get_itunessd_path (). + itdb_init_ipod() will no longer overwrite existing iTunesDB and + iTunesSD. + 2006-06-10 Jorg Schuler <jcsjcs at users.sourceforge.net> * src/itdb_device.c (itdb_device_get_ipod_info): compare more than @@ -1,4 +1,4 @@ -/* Time-stamp: <2006-06-07 00:56:08 jcs> +/* Time-stamp: <2006-06-24 19:52:24 jcs> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -853,6 +853,7 @@ gchar *itdb_get_photos_dir (const gchar *mountpoint); gchar *itdb_get_photos_thumb_dir (const gchar *mountpoint); gchar *itdb_get_device_dir (const gchar *mountpoint); gchar *itdb_get_itunesdb_path (const gchar *mountpoint); +gchar *itdb_get_itunessd_path (const gchar *mountpoint); gchar *itdb_get_artworkdb_path (const gchar *mountpoint); gchar *itdb_get_photodb_path (const gchar *mountpoint); gchar *itdb_get_path (const gchar *dir, const gchar *file); diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c index 43f7ca6..b4b0ac3 100644 --- a/src/itdb_itunesdb.c +++ b/src/itdb_itunesdb.c @@ -1,4 +1,4 @@ -/* Time-stamp: <2006-06-08 00:35:09 jcs> +/* Time-stamp: <2006-06-24 19:52:24 jcs> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -4496,7 +4496,7 @@ gboolean itdb_shuffle_write (Itdb_iTunesDB *itdb, GError **error) * @filename: file to write to, cannot be NULL * @error: return location for a #GError or NULL * - * Do the actual writing to the iTuneSsD + * Do the actual writing to the iTunesSD * * Return value: TRUE on success, FALSE on error, in which case @error is * set accordingly. @@ -5353,6 +5353,32 @@ gchar *itdb_get_itunesdb_path (const gchar *mountpoint) } /** + * itdb_get_itunessd_path: + * @mountpoint: the iPod mountpoint + * + * Retrieve a path to the iTunesSD + * + * Return value: path to the iTunesSD or NULL if non-existent. Must g_free() + * after use. + **/ +gchar *itdb_get_itunessd_path (const gchar *mountpoint) +{ + gchar *itunes_dir, *path=NULL; + + g_return_val_if_fail (mountpoint, NULL); + + itunes_dir = itdb_get_itunes_dir (mountpoint); + + if (itunes_dir) + { + path = itdb_get_path (itunes_dir, "iTunesSD"); + g_free (itunes_dir); + } + + return path; +} + +/** * itdb_get_artworkdb_path: * @mountpoint: the iPod mountpoint * @@ -5460,6 +5486,7 @@ gboolean itdb_init_ipod (const gchar *mountpoint, gboolean writeok; Itdb_iTunesDB *itdb = NULL; Itdb_Playlist *mpl = NULL; + gchar *path; g_return_val_if_fail (mountpoint, FALSE); @@ -5504,20 +5531,31 @@ gboolean itdb_init_ipod (const gchar *mountpoint, itdb_playlist_set_mpl(mpl); itdb_playlist_add(itdb, mpl, -1); - /* Write both the iTunesDB and iTunesSD files to the new ipod */ - writeok = itdb_write(itdb, error); - if(! writeok) + /* Write both the iTunesDB and iTunesSD files to the new ipod, + * unless they already exist */ + path = itdb_get_itunesdb_path (mountpoint); + if (!path) { + writeok = itdb_write(itdb, error); + if(! writeok) + { itdb_free (itdb); return FALSE; + } } - - writeok = itdb_shuffle_write(itdb, error); - if(! writeok) + g_free (path); + + path = itdb_get_itunessd_path (mountpoint); + if (!path) { + writeok = itdb_shuffle_write(itdb, error); + if(! writeok) + { itdb_free (itdb); return FALSE; + } } + g_free (path); itdb_free (itdb); return TRUE; |