gap-dev-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gap-dev-discuss] Cynthiune loading large playlist


From: Philippe Roussel
Subject: Re: [Gap-dev-discuss] Cynthiune loading large playlist
Date: Sun, 03 Jun 2012 21:21:28 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Hi,

Le 03/06/2012 12:11, Sebastian Reitenbach a écrit :
> Hi,
> 
>> When opening the Playlist on a different computer, where the files are not
>> available, then the problem doesn't show up, otherwise I'd have attached 
>> my playlist. I also recognized, that the problem doesn't seem to happen 
>> always, it took me about 3 or 5 times to try to reproduce it. Just tested
>> different directories, my home directory, and then one level down, the
>> directory where my music is in.
> 
> So, after more digging, I found the problem doesn't depend on the 
> amount of songs in the playlist. But I found a way how to easily reproduce
> the problem:
> Add music files to Cynthiune, via opening a m3u or other playlist file, which
> contains songs with an unsupported extension. I for example had a m3u
> file, which pointed to a bunch of m4a audio files. When loading such
> playlist, then in the Cynthiune Playlist viewer, each file got an entry in the
> list stating something about a unknown file format.
> Now my solution is, when loading a playlist, then check the extensions 
> of the music files referenced there, whether they are actually supported,
> and if not, then just skip that file in question. See attached patch, which
> fixed my problem for me.
> 
> Is that sane, or someone with a better idea how to fix that?

The patch looks sane to me but you could do the test in
PlaylistController around line 528, there are already similar tests done
with FormatTester.

It would be nice to find the real cause of the file handle shortage but
there are no reason to add unsupported files to the playlist so
something like your patch should probably be commited.

Philippe

> Sebastian
> 
> $OpenBSD$
> --- Playlist.m.orig   Wed May 23 19:45:22 2012
> +++ Playlist.m        Sun Jun  3 12:02:09 2012
> @@ -31,6 +31,7 @@
>  #import <Cynthiune/NSArrayExtensions.h>
>  #import <Cynthiune/utils.h>
>  
> +#import "FormatTester.h"
>  #import "M3UArchiver.h"
>  #import "PLSArchiver.h"
>  #import "Playlist.h"
> @@ -122,6 +123,8 @@ static NSString *PlaylistChangedNotification = @"Playl
>  
>    if (array)
>      {
> +      FormatTester *formatTester;
> +      formatTester = [FormatTester formatTester];
>        firstSong = nil;
>        max = [list count];
>        songEnumerator = [array objectEnumerator];
> @@ -134,11 +137,18 @@ static NSString *PlaylistChangedNotification = @"Playl
>               NSLog(@"Skipping duplicate song: %@", [song filename]);
>                else
>                  {
> -                  if (!firstSong)
> -                    firstSong = song;
> -                  [list addObject: song];
> -                  if (shuffleList)
> -                    [shuffleList addObjectRandomly: song];
> +               if (![formatTester extensionIsSupported:[[song filename] 
> pathExtension]]) 
> +                 {
> +                   NSLog(@"skipping unsupported song: %@", [song filename]);
> +                 }
> +               else
> +                 {
> +                      if (!firstSong)
> +                        firstSong = song;
> +                      [list addObject: song];
> +                      if (shuffleList)
> +                        [shuffleList addObjectRandomly: song];
> +                 }
>                  }
>              }
>            else
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]