[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gap-dev-discuss] Skipping duplicate song
From: |
Philippe Roussel |
Subject: |
[Gap-dev-discuss] Skipping duplicate song |
Date: |
Mon, 14 May 2012 19:33:09 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
Le 14/05/2012 19:07, Sebastian Reitenbach a écrit :
[snip]
>>>> 2) object deduplication
>>> Works for me, even if deduplication is only based on file path right now.
>> Yes, but it is enough, I'd say. Seems to work for me. One drawback is
>> that if you have a default playlist with duplicates, Cynthiune will
>> crash at startup.
>
> I have seen that too, but unfortunately deleted my playlist file, instead of
> moving
> it out of the way. How about the patch below. Instead of throwing an
> exception,
> just spit out a message on the console about skipping the song, then go on
> with the next.
> Have it only tested with loading a m3u file with double entries, but not one
> on startup. Hope one of you still may have such a bogus file around.
Nope but it's easy enough to create one : your patch works as expected.
Thanks,
Philippe
> Sebastian
>
>
>
> Index: Playlist.m
> ===================================================================
> RCS file: /sources/gap/gap/user-apps/Cynthiune/Playlist.m,v
> retrieving revision 1.2
> diff -u -r1.2 Playlist.m
> --- Playlist.m 13 May 2012 16:56:42 -0000 1.2
> +++ Playlist.m 14 May 2012 17:00:44 -0000
> @@ -103,8 +103,7 @@
> - (void) addSong: (Song *) song
> {
> if ([list containsObject: song])
> - raiseException (@"Duplicate song", @"a given song can be added only"
> - @" once to the same playlist");
> + NSLog(@"Skipping duplicate song: %@", [song filename]);
> else
> {
> [list addObject: song];
> @@ -132,9 +131,7 @@
> if ([song isKindOfClass: [Song class]])
> {
> if ([list containsObject: song])
> - raiseException (@"Duplicate song",
> - @"a given song can be added only once to"
> - @" the same playlist");
> + NSLog(@"Skipping duplicate song: %@", [song filename]);
> else
> {
> if (!firstSong)
> @@ -160,8 +157,7 @@
> atIndex: (unsigned int) index
> {
> if ([list containsObject: song])
> - raiseException (@"Duplicate song", @"a given song can be added only"
> - @" once to the same playlist");
> + NSLog(@"Skipping duplicate song: %@", [song filename]);
> else
> {
> [list insertObject: song atIndex: index];