Hack to fix display of newly added songs (no idea why this is should be necessary, maybe something wrong with KVO).

CQTexperiment
matthewleon 2008-03-01 19:56:10 +00:00
parent 8dee65b8b6
commit d84a12d596
1 changed files with 10 additions and 8 deletions

View File

@ -246,16 +246,16 @@
//Create actual entries //Create actual entries
int i; int i;
NSMutableArray *entries = [NSMutableArray array]; NSMutableArray *entries = [NSMutableArray arrayWithCapacity:[validURLs count]];
for (i = 0; i < [validURLs count]; i++) for (i = 0; i < [validURLs count]; i++)
{ {
PlaylistEntry *pe = [[PlaylistEntry alloc] init]; PlaylistEntry *pe = [[PlaylistEntry alloc] init];
NSURL *url = [validURLs objectAtIndex:i]; NSURL *url = [validURLs objectAtIndex:i];
[pe setURL:url]; pe.URL = url;
pe.index = index+i; pe.index = index+i;
[pe setTitle:[[url path] lastPathComponent]]; pe.title = [[url path] lastPathComponent];
[pe setQueuePosition:-1]; pe.queuePosition = -1;
[entries addObject:pe]; [entries addObject:pe];
[pe release]; [pe release];
@ -297,8 +297,8 @@
- (NSDictionary *)readEntryInfo:(PlaylistEntry *)pe - (NSDictionary *)readEntryInfo:(PlaylistEntry *)pe
{ {
// Just setting this to 30 for now... // Just setting this to 20 for now...
NSMutableDictionary *entryInfo = [NSMutableDictionary dictionaryWithCapacity:30]; NSMutableDictionary *entryInfo = [NSMutableDictionary dictionaryWithCapacity:20];
NSDictionary *entryProperties; NSDictionary *entryProperties;
entryProperties = [AudioPropertiesReader propertiesForURL:pe.URL]; entryProperties = [AudioPropertiesReader propertiesForURL:pe.URL];
if (entryProperties == nil) if (entryProperties == nil)
@ -335,8 +335,10 @@
} }
//Hack so the display gets updated //Hack so the display gets updated
if (pe == [playlistController currentEntry]) PlaylistEntry *tempEntry = [playlistController currentEntry];
[playlistController setCurrentEntry:[playlistController currentEntry]]; [playlistController setCurrentEntry:pe];
[playlistController setCurrentEntry:tempEntry];
// stop observing // stop observing
[object removeObserver:self forKeyPath:keyPath]; [object removeObserver:self forKeyPath:keyPath];
} }