From: Dave H. <da...@sr...> - 2009-06-15 18:58:10
|
There a small bug in add_files(). It only occurs when all the following are satisfied: 1. the track is in the database 2. the track is unmodified from the database copy 3. the track is not in the playlist and needs to be added When these all happen, it falls into the file handling case like for'case FILE_TYPE_MP3:'. The track hits the tr = g_hash_table_lookup (afd->filepath_hash, filename); and correctly fetches the track since it is in the database. The code then checks the mtime of the file, but since it is unmodified, the if() for mtime chainges does not hit. The track does not make it into the 'afd->tracks_updated' since the 'updated' variable was not set. The appended patch ensures that when we always explicitly check for a track's membership in the relevant playlist. --- trunk-dave/src/syncdir.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff -puN src/syncdir.c~playlist-add-if-in-db-but-not-in-playlist src/syncdir.c --- trunk/src/syncdir.c~playlist-add-if-in-db-but-not-in-playlist 2009-06-15 11:15:31.000000000 -0700 +++ trunk-dave/src/syncdir.c 2009-06-15 11:33:32.000000000 -0700 @@ -412,7 +412,7 @@ static void add_files (gpointer key, gpo case FILE_TYPE_FLAC: tr = g_hash_table_lookup (afd->filepath_hash, filename); if (tr) - { /* track is already present in playlist. + { /* track is already present in database. Update if date stamp is different. */ struct stat filestat; ExtraTrackData *etr = tr->userdata; @@ -431,6 +431,11 @@ printf ("%ld %ld (%s)\n, %ld %d\n", update_track_from_file (pl->itdb, tr); updated = TRUE; } + if (!itdb_playlist_contains_track (pl, tr)) + { + gp_playlist_add_track (pl, tr, TRUE); + updated = TRUE; + } } else { /* track is not known -- at least not by it's _ |