PDA

View Full Version : Duplicates in Database



mwphoto
2005-07-24, 06:04
Hi,

I have a moderate collection of 400 albums or so, and I'm finding that I
have duplicate entries in the slimserver DB. For example I have one album of
15 tracks, but If I browse by artist to it with slim server tracks 4 and 11
appear twice (both pointing to the same flac file).

If I use Browse Music Folder I only see the 15 tracks

I'm using the latest 6.1 release and this problem does not go away if I
rescan the collection and clear the database first.

Interestingly If I do rescan and clear the database first track 4 is present
before the rest arrive so I suspect it is not properly cleared, when the 15
tracks are scanned they are added again duplicating this track.

Any idea what could cause this and where should I go to the code to start
debugging it?

Malcolm

mwphoto
2005-07-24, 06:31
Update,

Ok, the problem is to do with case sensitivity, I have the following 2
entries (ie dups) in the tracks table.

id:581
url
file:///g:/MUSIC/Jack%20Johnson/In%20Between%20Dreams/04%20-%20Good%20people
..flac

id:2774
url
file:///G:/MUSIC/Jack%20Johnson/In%20Between%20Dreams/04%20-%20Good%20people
..flac

the entry with id 581 appears because it is in a playlist, the entry 2774
appears because it is in the music folder. So during the scan process the
server did not identify that these were actually the same file (because of
the case of the drive letter). It therefore created a new entry.

Now I need to find the relevant code to develop the fix. If anyone can point
me in the right direction . . .

Malcolm
> -----Original Message-----
> From: developers-bounces (AT) lists (DOT) slimdevices.com
> [mailto:developers-bounces (AT) lists (DOT) slimdevices.com]On Behalf Of Malcolm
> Wotton
> Sent: 24 July 2005 14:04
> To: Slim Devices Developers
> Subject: [Developers] Duplicates in Database
>
>
> Hi,
>
> I have a moderate collection of 400 albums or so, and I'm finding that I
> have duplicate entries in the slimserver DB. For example I have
> one album of
> 15 tracks, but If I browse by artist to it with slim server
> tracks 4 and 11
> appear twice (both pointing to the same flac file).
>
> If I use Browse Music Folder I only see the 15 tracks
>
> I'm using the latest 6.1 release and this problem does not go away if I
> rescan the collection and clear the database first.
>
> Interestingly If I do rescan and clear the database first track 4
> is present
> before the rest arrive so I suspect it is not properly cleared,
> when the 15
> tracks are scanned they are added again duplicating this track.
>
> Any idea what could cause this and where should I go to the code to start
> debugging it?
>
> Malcolm
>
>

Dan Sully
2005-07-24, 07:38
* Malcolm Wotton shaped the electrons to say...

>the entry with id 581 appears because it is in a playlist, the entry 2774
>appears because it is in the music folder. So during the scan process the
>server did not identify that these were actually the same file (because of
>the case of the drive letter). It therefore created a new entry.
>
>Now I need to find the relevant code to develop the fix. If anyone can point
>me in the right direction . . .

I'd start looking in Slim/Utils/Misc.pm - fixPathCase() probably needs to be
integrated into fixPath()

-D
--
"My pockets hurt." - Homer Simpson

BKDotCom
2005-07-24, 20:46
along a similar vain would there be any way to tell slim that
file:///g:/music/.... and
file:///sharename/music are the same? :|

I've got some playlists and shortcuts that point to the share-name rather than the drive-letter.. I guess that's why they show up twice... right now I'm just doing a "clean-up" routine that includes DELETE from `tracks` where `url` LIKE "file:///sharename/%" (I'm using mysql.)

EarWax
2005-08-01, 11:00
I have the same problem. Some songs in my database appear as many as four times.

I have tracked this problem down to a problem with the way the SlimServer reads my playlists. I had some playlists with differences in capitalization. Some read:

F:\My Music\...

others

F:\my music\...

others

f:\My Music\...

and others

f:\my music\...

The SlimServer read all of these as different songs and added all of them as new entries into the database. The more a song appeared in one of my playlists, the more likely is was to show up multiple times.

I went through and edited all of my playlist to make them all consistent, deleted the database file, and rescanned. Now everything is fixed.

I'm not sure why the server scans my playlists in the first place. Songs do not need to be in the database in order for them to be played as long as the playlist points to the correct location.

There should perhaps be an option to turn off scanning playlist to minimize issues for other with this type of problem. Of course coverting everything to upper or lower case when SlimServer is scanning for new database entries should fix this as well.

John A. Tamplin
2005-08-01, 11:09
On Mon, 1 Aug 2005, EarWax wrote:

> Of course coverting everything to upper or lower case when SlimServer is
> scanning for new database entries should fix this as well.

And of course breaks operation on OSes which are case-sensitive.

--
John A. Tamplin jat (AT) jaet (DOT) org
770/436-5387 HOME 4116 Manson Ave
Smyrna, GA 30082-3723

Dan Sully
2005-08-01, 11:19
* EarWax shaped the electrons to say...

>I have the same problem. Some songs in my database appear as many as
>four times.
>
>I have tracked this problem down to a problem with the way the
>SlimServer reads my playlists. I had some playlists with differences
>in capitalization. Some read:
>
>F:\My Music\...
>
>others
>
>F:\my music\...
>
>others
>
>f:\My Music\...
>
>and others
>
>f:\my music\...

This should all be fixed in subversion / latest 6.2 nightlies.

Please give that a try, and wipe your database.

Thanks.

-D
--
<iNoah> kernel's original recipe: 11 secret args and switches