summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorg Schuler <jcsjcs@users.sourceforge.net>2005-11-19 08:07:12 +0000
committerJorg Schuler <jcsjcs@users.sourceforge.net>2005-11-19 08:07:12 +0000
commite1afa7fbda872017def878a532536ec6dd546528 (patch)
treea396e70cb1913d8a5f0b9d6a9e3491db52790a19
parent2833ab58e8d34c2b28ce429ca8edbb723a6a9281 (diff)
downloadlibgpod-e1afa7fbda872017def878a532536ec6dd546528.tar.gz
libgpod-e1afa7fbda872017def878a532536ec6dd546528.tar.xz
libgpod-e1afa7fbda872017def878a532536ec6dd546528.zip
* itdb_itunesdb.c: (itdb_rename_files) also remove "iTunesShuffle"
as this file might confuse iPod Shuffles. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1155 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r--ChangeLog3
-rw-r--r--src/itdb_itunesdb.c23
2 files changed, 25 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b9328c..f2ce04b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@
* itdb_playlist.c: added itdb_spl_update_live() for convenience
+ * itdb_itunesdb.c: (itdb_rename_files) also remove "iTunesShuffle"
+ as this file might confuse iPod Shuffles.
+
2005-11-17 Jorg Schuler <jcsjcs at users.sourceforge.net>
* configure.ac: check for version 2.4 of glib -- now we need to
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c
index eacbf77..3e02427 100644
--- a/src/itdb_itunesdb.c
+++ b/src/itdb_itunesdb.c
@@ -1,4 +1,4 @@
-/* Time-stamp: <2005-11-13 14:58:17 jcs>
+/* Time-stamp: <2005-11-19 17:05:44 jcs>
|
| Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
| Part of the gtkpod project.
@@ -3997,10 +3997,12 @@ gboolean itdb_rename_files (const gchar *mp, GError **error)
const gchar *db_itd[] = {"iPod_Control", "iTunes", NULL};
const gchar *db_plc_o[] = {"Play Counts", NULL};
const gchar *db_otg[] = {"OTGPlaylistInfo", NULL};
+ const gchar *db_shu[] = {"iTunesShuffle", NULL};
gchar *itunesdir;
gchar *plcname_o;
gchar *plcname_n;
gchar *otgname;
+ gchar *shuname;
gboolean result = TRUE;
itunesdir = itdb_resolve_path (mp, db_itd);
@@ -4022,6 +4024,7 @@ gboolean itdb_rename_files (const gchar *mp, GError **error)
plcname_n = g_build_filename (itunesdir,
"Play Counts.bak", NULL);
otgname = itdb_resolve_path (itunesdir, db_otg);
+ shuname = itdb_resolve_path (itunesdir, db_shu);
/* rename "Play Counts" to "Play Counts.bak" */
if (plcname_o)
@@ -4055,9 +4058,27 @@ gboolean itdb_rename_files (const gchar *mp, GError **error)
}
}
+ /* remove some Shuffle files */
+ if (shuname)
+ {
+ if (unlink (shuname) == -1)
+ {
+ if (error && !*error)
+ { /* don't overwrite previous error */
+ g_set_error (error,
+ G_FILE_ERROR,
+ g_file_error_from_errno (errno),
+ _("Error removing '%s' (%s)."),
+ shuname, g_strerror (errno));
+ }
+ result = FALSE;
+ }
+ }
+
g_free (plcname_o);
g_free (plcname_n);
g_free (otgname);
+ g_free (shuname);
g_free (itunesdir);
return result;