After downloading the current stable version a few days ago, I 
discovered a couple of bugs.  The first looks to have been fixed
in the CVS repository (in playlist.cpp, lock wasn't released).
The other relates to duplicate entries in the My Music lists.
If you delete the database, do a search for music, and finally
exit and reload freeamp, then any music files in the first directory
searched (i.e. not the subdirectories) will appear duplicated in
the playlist.  What happens is that DoSearchMusic is called from
the Search Computer for Media dialog with a trailing directory
separator on the path.  On subsequent runs it is called without
this trailing slash.

Actually, just thinking about it now, it is probably the thread
that watches the music directory that calls search without the
trailing slash (or possibly with, if that's how it's configured
in the options).  So similar behaviour would probably occur if
the player was left running for the appropriate amount of time.

Anyway, the real problem is that the path passed to DoSearchMusic
isn't always checked for a trailing slash.  Thus the same filename
is passed to the database as /file.mp3 and //file.mp3 -- resulting
in duplicate entries.  The patch below fixes this.  What really
needs to be done, I think, is for keys to be canonicalised before
being passed to the database routines (removing sequential directory
markers as one part of this -- there are routines in utility.cpp that
already do some of this).

Oh, and thanks for the great media player.  The reason I'm looking
at the source to begin with is that I'm planning on writing a
plugin to automate recording to my minidisc recorder, doing titles
and such.



This patch is against base/src/musiccatalog.cpp from
3123340 Dec 16 22:41 /home/dave/packages/freeamp-2.1.1.tar.bz2

<     string search = path;
>     string search, sPath = path;
>     if (sPath[sPath.size() - 1] != DIR_MARKER)
>        sPath.append(DIR_MARKER_STR);
>     search = sPath;
<     if (!strcmp(path, "/dev") || !strcmp(path, "/proc"))
>     if (!strcmp(sPath.c_str(), "/dev/") || !strcmp(sPath.c_str(), "/proc/"))
<     if (search[search.size() - 1] != DIR_MARKER)
<        search.append(DIR_MARKER_STR);
<                     string newDir = path;
<                     if (path[strlen(path) - 1] != DIR_MARKER)
<                         newDir.append(DIR_MARKER_STR);
>                     string newDir = sPath;
<                 string dirtest = path;
<                 if (path[strlen(path) - 1] != DIR_MARKER)
<                     dirtest.append(DIR_MARKER_STR);
>                 string dirtest = sPath;
<                     string file = path;
<                     file.append(DIR_MARKER_STR);
>                     string file = sPath;
<                     string file = path;
<                     file.append(DIR_MARKER_STR);
>                     string file = sPath;


Reply via email to