Playlist entries are now processed on main thread.
parent
d84a12d596
commit
92be178bf2
|
@ -278,7 +278,7 @@
|
||||||
readEntryInfoOperation = [[[NSInvocationOperation alloc]
|
readEntryInfoOperation = [[[NSInvocationOperation alloc]
|
||||||
initWithTarget:self
|
initWithTarget:self
|
||||||
selector:@selector(readEntryInfo:)
|
selector:@selector(readEntryInfo:)
|
||||||
object:pe] autorelease];
|
object:pe]autorelease];
|
||||||
if (oldReadEntryInfoOperation)
|
if (oldReadEntryInfoOperation)
|
||||||
{
|
{
|
||||||
[readEntryInfoOperation addDependency:oldReadEntryInfoOperation];
|
[readEntryInfoOperation addDependency:oldReadEntryInfoOperation];
|
||||||
|
@ -309,6 +309,25 @@
|
||||||
return entryInfo;
|
return entryInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)processEntryInfo:(NSInvocationOperation *)operation
|
||||||
|
{
|
||||||
|
NSDictionary *entryInfo = [operation result];
|
||||||
|
PlaylistEntry *pe;
|
||||||
|
// get the playlist entry that the thread was inspecting
|
||||||
|
[[operation invocation]getArgument:&pe atIndex:2];
|
||||||
|
if (entryInfo == nil)
|
||||||
|
{
|
||||||
|
pe.error = YES;
|
||||||
|
pe.errorMessage = @"Unable to retrieve properties.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[pe setValuesForKeysWithDictionary:entryInfo];
|
||||||
|
[playlistController updateTotalTime];
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)observeValueForKeyPath:(NSString *)keyPath
|
- (void)observeValueForKeyPath:(NSString *)keyPath
|
||||||
ofObject:(id)object
|
ofObject:(id)object
|
||||||
change:(NSDictionary *)change
|
change:(NSDictionary *)change
|
||||||
|
@ -317,30 +336,9 @@
|
||||||
// We finished reading the info for a playlist entry
|
// We finished reading the info for a playlist entry
|
||||||
if ([keyPath isEqualToString:@"isFinished"] && [object isFinished])
|
if ([keyPath isEqualToString:@"isFinished"] && [object isFinished])
|
||||||
{
|
{
|
||||||
// get the results
|
|
||||||
NSDictionary *entryInfo = [object result];
|
|
||||||
// get the playlist entry that the thread was inspecting
|
|
||||||
PlaylistEntry *pe;
|
|
||||||
[[object invocation]getArgument:&pe atIndex:2];
|
|
||||||
|
|
||||||
if (entryInfo == nil)
|
|
||||||
{
|
|
||||||
pe.error = YES;
|
|
||||||
pe.errorMessage = @"Unable to retrieve properties.";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[pe setValuesForKeysWithDictionary:entryInfo];
|
|
||||||
[playlistController updateTotalTime];
|
|
||||||
}
|
|
||||||
|
|
||||||
//Hack so the display gets updated
|
|
||||||
PlaylistEntry *tempEntry = [playlistController currentEntry];
|
|
||||||
[playlistController setCurrentEntry:pe];
|
|
||||||
[playlistController setCurrentEntry:tempEntry];
|
|
||||||
|
|
||||||
// stop observing
|
// stop observing
|
||||||
[object removeObserver:self forKeyPath:keyPath];
|
[object removeObserver:self forKeyPath:keyPath];
|
||||||
|
[self performSelectorOnMainThread:@selector(processEntryInfo:) withObject:object waitUntilDone:NO];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue