get iTunes songs

  • 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.
  • 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 (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/<jstiles...>
    >
    > This email sent to <jstiles...>
  • 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 (<Cocoa-dev...>)
    >> Help/Unsubscribe/Update your Subscription:
    >> http://lists.apple.com/mailman/options/cocoa-dev/<jstiles...>
    >>
    >> This email sent to <jstiles...>
    >
  • 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 (<Cocoa-dev...>)
    >>> Help/Unsubscribe/Update your Subscription:
    >>> http://lists.apple.com/mailman/options/cocoa-dev/<jstiles...>
    >>>
    >>> This email sent to <jstiles...>
    >>
    >
  • 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 (<Cocoa-dev...>)
    >>>> Help/Unsubscribe/Update your Subscription:
    >>>> http://lists.apple.com/mailman/options/cocoa-dev/<jstiles...>
    >>>>
    >>>>
    >>>> This email sent to <jstiles...>
    >>>
    >>
    >
  • > 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.

    I suppose that you should really fetch the data for a given track
    only when it actually gets displayed in your table view...
    Regards,

    Martin

    HairerSoft
    http://www.hairersoft.com/
  • The file:

    ~/Music/iTunes/iTunes Music Libary.xml

    is just a standard plist file.  Create an NSDictionary from it and do
    what you like.  Note that you probably want to do this in a separate
    thread since on larger libraries it can take a few seconds.

    Mike.

    On 16 Oct 2006, at 11:06, 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      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/mike.abdullah%
    > 40gmail.com
    >
    > This email sent to <mike.abdullah...>
  • 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 (<Cocoa-dev...>)
    >>>>> Help/Unsubscribe/Update your Subscription:
    >>>>> http://lists.apple.com/mailman/options/cocoa-dev/<jstiles...>
    >>>>>
    >>>>>
    >>>>> This email sent to <jstiles...>
    >>>>
    >>>
    >>
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/<jstiles...>
    >
    > This email sent to <jstiles...>
  • There is no need to fall back to using AppleScript to retrieve that
    data if you are writing a Cocoa app.  The fastest way is to simply
    read the iTunes xml file (which is a plist) loaded into an
    NSDictionary.  Connect that dictionary with some minimal glue code as
    the datasource to your tableview & you're done.

    If you want to map the dictionary values to your own object/s, you
    can quickly iterate thru the dictionary, though there is potential
    for some performance bottlenecks there due to key-value overhead, but
    nowhere near the level of using AppleScript.  I've found that
    populating core data objects from iTunes can be as much as 20 seconds
    for loading 10,000 tracks on an 876mhz G4 PowerBook & populating the
    tableview.  Same code on intel iMac (1.83) takes less than 3
    seconds.  That's without even bothering with any performance tuning.

    Niels

    On Oct 16, 2006, at 12:39 PM, John Stiles wrote:

    > 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 (<Cocoa-dev...>)
    >>>>>> Help/Unsubscribe/Update your Subscription:
    >>>>>> http://lists.apple.com/mailman/options/cocoa-dev/jstiles%
    >>>>>> 40blizzard.com
    >>>>>>
    >>>>>> This email sent to <jstiles...>
    >>>>>
    >>>>
    >>>
    >>
    >> _______________________________________________
    >> Do not post admin requests to the list. They will be ignored.
    >> Cocoa-dev mailing list      (<Cocoa-dev...>)
    >> Help/Unsubscribe/Update your Subscription:
    >> http://lists.apple.com/mailman/options/cocoa-dev/jstiles%
    >> 40blizzard.com
    >>
    >> This email sent to <jstiles...>
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/nmeersschaert%
    > 40mac.com
    >
    > This email sent to <nmeersschaert...>
  • On Mon, 16 Oct 2006 17:16:26 +0300, Olariu Adrian Mihai <oadrian...>
    said:
    > 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];
    > }
    >

    This construct is lightning-fast OMM:

    tell application "iTunes"
        tell library playlist "Library"
            get {name, time, album, artist} of every track
        end tell
    end tell

    Try that, modifying as necessary. The reason is that you aren't cycling thru
    every track (iTunes is) and you're only sending one Apple event. My
    AppleScript book gives this and other similar tips about speed. Of course
    you don't have to use AppleScript; you could use the raw Apple event version
    of that same code. But when it's a matter of sending just one Apple event,
    there's really no appreciable gain in that approach (especially if you
    pre-compile the script). m.

    --
    matt neuburg, phd = <matt...>, <http://www.tidbits.com/matt/>
    A fool + a tool + an autorelease pool = cool!
    AppleScript: the Definitive Guide - Second Edition!
    <http://www.amazon.com/gp/product/0596102119>
  • Are you certain that the XML is always up to date?
    For example, if the user opens up iTunes and adds a song, the XML
    might not reflect that song immediately.
    I believe AppleScript is still the way to go; you just need to
    minimize the number of transactions. There's no need to do a separate
    transaction for each property of each song; that's going to produce
    bad results.

    On Oct 16, 2006, at 11:46 AM, Niels Meersschaert wrote:

    > There is no need to fall back to using AppleScript to retrieve that
    > data if you are writing a Cocoa app.  The fastest way is to simply
    > read the iTunes xml file (which is a plist) loaded into an
    > NSDictionary.  Connect that dictionary with some minimal glue code
    > as the datasource to your tableview & you're done.
    >
    > If you want to map the dictionary values to your own object/s, you
    > can quickly iterate thru the dictionary, though there is potential
    > for some performance bottlenecks there due to key-value overhead,
    > but nowhere near the level of using AppleScript.  I've found that
    > populating core data objects from iTunes can be as much as 20
    > seconds for loading 10,000 tracks on an 876mhz G4 PowerBook &
    > populating the tableview.  Same code on intel iMac (1.83) takes
    > less than 3 seconds.  That's without even bothering with any
    > performance tuning.
    >
    > Niels
    >
    > On Oct 16, 2006, at 12:39 PM, John Stiles wrote:
    >
    >> 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 (<Cocoa-dev...>)
    >>>>>>> Help/Unsubscribe/Update your Subscription:
    >>>>>>> http://lists.apple.com/mailman/options/cocoa-dev/jstiles%
    >>>>>>> 40blizzard.com
    >>>>>>>
    >>>>>>> This email sent to <jstiles...>
    >>>>>>
    >>>>>
    >>>>
    >>>
    >>> _______________________________________________
    >>> Do not post admin requests to the list. They will be ignored.
    >>> Cocoa-dev mailing list      (<Cocoa-dev...>)
    >>> Help/Unsubscribe/Update your Subscription:
    >>> http://lists.apple.com/mailman/options/cocoa-dev/jstiles%
    >>> 40blizzard.com
    >>>
    >>> This email sent to <jstiles...>
    >> _______________________________________________
    >> Do not post admin requests to the list. They will be ignored.
    >> Cocoa-dev mailing list      (<Cocoa-dev...>)
    >> Help/Unsubscribe/Update your Subscription:
    >> http://lists.apple.com/mailman/options/cocoa-dev/nmeersschaert%
    >> 40mac.com
    >>
    >> This email sent to <nmeersschaert...>
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/jstiles%
    > 40blizzard.com
    >
    > This email sent to <jstiles...>
  • on 10/16/06 2:00 PM, John Stiles at <JStiles...> wrote:

    > Are you certain that the XML is always up to date?
    > For example, if the user opens up iTunes and adds a song, the XML
    > might not reflect that song immediately.
    > I believe AppleScript is still the way to go; you just need to
    > minimize the number of transactions. There's no need to do a separate
    > transaction for each property of each song; that's going to produce
    > bad results.

    As well, the XML library is technically a private format, subject to change
    without notice and breakage for your app without notice. It is my
    understanding that the AppleScript API for iTunes is the best way to go in
    terms of getting what you want in a way that ought to be compatible and work
    well into the future.

    I would agree... the best thing to try is some custom code that fetches the
    data in bulk, instead of multiple little transactions. Try different
    approaches to find what works best... different "groupings" of your batch
    information getting. Experiment to find the best batching for your needs.

    --
    John C. Daub }:-)>=
    <mailto:<hsoi...> <http://www.hsoi.com/>
    "We will make everything metal; blacker than the blackest black... times
    infinity!"  - Nathan Explosion
  • On 16 Oct 2006, at 20:33, John C. Daub wrote:

    > on 10/16/06 2:00 PM, John Stiles at <JStiles...> wrote:
    >
    >> Are you certain that the XML is always up to date?
    >> For example, if the user opens up iTunes and adds a song, the XML
    >> might not reflect that song immediately.
    >> I believe AppleScript is still the way to go; you just need to
    >> minimize the number of transactions. There's no need to do a separate
    >> transaction for each property of each song; that's going to produce
    >> bad results.
    >
    > As well, the XML library is technically a private format, subject
    > to change
    > without notice and breakage for your app without notice. It is my
    > understanding that the AppleScript API for iTunes is the best way
    > to go in
    > terms of getting what you want in a way that ought to be compatible
    > and work
    > well into the future.

    This is true.  However, on my PowerBook G4, it does take approx. 30
    seconds with iTunes 7 to run Matt's suggested script.  That's 30
    seconds where the app is completely unresponsive.  It's not easy to
    do this applescript in a secondary thread.

    Reading the dictionary on the other hand is very easy to do.

    Mike.
    >
    > I would agree... the best thing to try is some custom code that
    > fetches the
    > data in bulk, instead of multiple little transactions. Try different
    > approaches to find what works best... different "groupings" of your
    > batch
    > information getting. Experiment to find the best batching for your
    > needs.
    >
    > --
    > John C. Daub }:-)>=
    > <mailto:<hsoi...> <http://www.hsoi.com/>
    > "We will make everything metal; blacker than the blackest black...
    > times
    > infinity!"  - Nathan Explosion
    >
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/mike.abdullah%
    > 40gmail.com
    >
    > This email sent to <mike.abdullah...>
  • on 10/17/06 3:17 AM, Mike Abdullah at <mike.abdullah...> wrote:

    > This is true.  However, on my PowerBook G4, it does take approx. 30
    > seconds with iTunes 7 to run Matt's suggested script.  That's 30
    > seconds where the app is completely unresponsive.  It's not easy to
    > do this applescript in a secondary thread.

    This is also why I suggest trying different approaches, and you might want
    to try hand-writing the actual AppleEvents yourself instead of relying on
    however AppleScript does it. You may be able to arrive at a more efficient
    solution.

    > Reading the dictionary on the other hand is very easy to do.

    True.

    In the end it really depends what you want. Do you want something that's
    fast but risks breakage, constant maintenance and vigilance on your part to
    keep your users happy and working without interruption?  Or do you want
    something that's a bit slower, but is your best chance at working without
    interruption to your users?  I can't answer that, that's up to the needs of
    your users.

    If you really want to, provide both mechanisms... thus if the fast-direct
    method breaks, users can still have a fallback solution that won't be as
    fast, but ought to at least keep them working until you can update.

    --
    John C. Daub }:-)>=
    <mailto:<hsoi...> <http://www.hsoi.com/>
    "Lemon curry?"
  • But I thought Apple had provided the XML file with that very
    intention.  It is meant to be used by other apps.

    After all, the real iTunes Database is in a different file and many
    of Apple's other apps read in the XML.  If it breaks for my app, it
    is likely to break in a lot of Apple's apps as well.

    Mike.

    On 17 Oct 2006, at 20:28, John C. Daub wrote:

    > on 10/17/06 3:17 AM, Mike Abdullah at <mike.abdullah...> wrote:
    >
    >> This is true.  However, on my PowerBook G4, it does take approx. 30
    >> seconds with iTunes 7 to run Matt's suggested script.  That's 30
    >> seconds where the app is completely unresponsive.  It's not easy to
    >> do this applescript in a secondary thread.
    >
    > This is also why I suggest trying different approaches, and you
    > might want
    > to try hand-writing the actual AppleEvents yourself instead of
    > relying on
    > however AppleScript does it. You may be able to arrive at a more
    > efficient
    > solution.
    >
    >> Reading the dictionary on the other hand is very easy to do.
    >
    > True.
    >
    > In the end it really depends what you want. Do you want something
    > that's
    > fast but risks breakage, constant maintenance and vigilance on your
    > part to
    > keep your users happy and working without interruption?  Or do you
    > want
    > something that's a bit slower, but is your best chance at working
    > without
    > interruption to your users?  I can't answer that, that's up to the
    > needs of
    > your users.
    >
    > If you really want to, provide both mechanisms... thus if the fast-
    > direct
    > method breaks, users can still have a fallback solution that won't
    > be as
    > fast, but ought to at least keep them working until you can update.
    >
    > --
    > John C. Daub }:-)>=
    > <mailto:<hsoi...> <http://www.hsoi.com/>
    > "Lemon curry?"
    >
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/mike.abdullah%
    > 40gmail.com
    >
    > This email sent to <mike.abdullah...>
  • on 10/18/06 2:25 AM, Mike Abdullah at <mike.abdullah...> wrote:

    > But I thought Apple had provided the XML file with that very
    > intention.  It is meant to be used by other apps.

    That's the first I've heard of that, but my information may be out of date.

    > After all, the real iTunes Database is in a different file and many
    > of Apple's other apps read in the XML.  If it breaks for my app, it
    > is likely to break in a lot of Apple's apps as well.

    But Apple is privy to a lot of its own things that we're not. They're going
    to ensure their software works with their software.

    Anyway like I said, the bottom line is to choose the avenue that suits you
    and your users best. While my users want speed, I also know they don't want
    things to break (same with me, both as a user and a developer). Thus my
    preference has been to use the AppleScript interface using custom-made
    AppleEvents... it's a bit slower, but it's certain to work. Of course, I'm
    going through a major rewrite of my app right now and I know AppleEvent
    performance is going to improve... when I get around to rewriting that
    portion of the app I'll reevaluate and see... I may go direct to the XML
    then fall back to the AppleEvents if the XML chokes in some way. Like I've
    said, it really all depends upon your particular needs. Pick what is right
    for you.

    --
    John C. Daub }:-)>=
    <mailto:<hsoi...> <http://www.hsoi.com/>
    "When taxes are too high, people go hungry.
    When the government is too intrusive, people lose their spirit.
    Act for the people's benefit.
    Trust them; leave them alone." -- Tao Te Ching #75
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today