Re: get iTunes songs
Re: get iTunes songs
- Subject: Re: get iTunes songs
- From: John Stiles <email@hidden>
- Date: Mon, 16 Oct 2006 09:39:50 -0700
Ah, I see. You're doing thousands of tiny transactions instead of one
big transaction.
There is a way to do what you want but probably not via EyeTunes
directly. You may have to look into how to send AppleEvents, and how to
ask iTunes for "all tracks" instead of just one. Honestly this is
outside the scope of what I have personally done, but it seems doable to me.
Olariu Adrian Mihai wrote:
The performance is affected only by the code in which I get
information about a track like : [track name], [track time] and so
one. Is there a way to get all the tracks instantly like an
"automator" does? I rely need a fast solution to get all the tracks
and all information for each of them from itunes.
John Stiles wrote:
Does it affect the performance if you comment out this bit?
if (![artist isEqualToString:@""])
if (![artistArray containsObject:artist])
[artistArray addObject:artist];
This seems very slow as you are walking your entire artist array for
every song you load.
This could be a lot faster if you used a dictionary, but as a first
test, just comment it out and see if it affects things.
Olariu Adrian Mihai wrote:
If I have about 5000 tracks in the library mand it takes about 20
seconds to load all the track in my table view. Below is the code
that I use to load tracks.
while (track = [trackEnum nextObject])
{
id obj=[trackArray objectAtIndex:count];
count++;
if ([track databaseId] == [currentTrack databaseId])
{
currentTrackObject = obj;
[obj setValue:[playIcon image] forKey:@"Status"];
}
NSString *artist = [track artist];
[obj setValue:track forKey:@"Track"];
[obj setValue:[track name] forKey:@"Name"];
[obj setValue:[track time] forKey:@"Time"];
[obj setValue:artist forKey:@"Artist"];
[obj setValue:[track album] forKey:@"Album"];
[obj setValue:[[NSNumber alloc] initWithInt:[track
rating]/20 ] forKey:@"MyRating"];
if (![artist isEqualToString:@""])
if (![artistArray containsObject:artist])
[artistArray addObject:artist];
}
John Stiles wrote:
I think Automator will be doing the same basic thing as
EyeTunes—using AppleEvents to get a list of all available songs.
Could you post the EyeTunes code that was too slow for you?
How slow was too slow?
Olariu Adrian Mihai wrote:
I want to create an application that get all the songs from itunes
library and display them in a tableview.
I have tried EyeTunes framework but is to slow for what I am
trying to do. I see that from an "Automator" application it is
possible to get all the tracks from itunes library but how can I
include this functionality in my application?
Thanks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden