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: Sebastian Reitenbach
Subject: Re: [Gap-dev-discuss] Cynthiune loading large playlist
Date: Sun, 03 Jun 2012 12:11:12 +0200
User-agent: SOGoMail 1.3.15

Hi,
 
On Saturday, June 2, 2012 19:55 CEST, "Sebastian Reitenbach" <address@hidden> 
wrote: 
 
>  
> On Saturday, June 2, 2012 15:56 CEST, Philippe Roussel <address@hidden> 
> wrote: 
>  
> > Hi Sebastian,
> > 
> > Thanks for the details.
> > 
> > I quickly tried with ulimit -n 200 without any problem but I'll recheck
> > everything when I have more time.
> > 
> > What I don't understand is that when the playlist is shown, lsof on
> > Cynthiune doesn't list any media file opened, which should mean that the
> > file handles are correctly closed ?
> 
> 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?

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]