Using "convert" from iTunes with ScriptingBridge

  • I am trying to use ScriptingBridge to control iTunes to convert and
    import an aiff file generated by my application, and failing.

    I have the file stored as an aiff on disk and the correct file name as
    an NSString. I also have an iTunesApplication instance up and working.
    However when I add the file name (as NSString) to an NSArray and call
    convert with it, nothing crashes but nothing seems to happen.

    An iTunes Track is successfully returned from the convert call but if
    I NSLog the returned object, I get this:

    2008-02-06 19:11:01.317 TunesSampleApp[12073:613] (
    )

    I have pastie'd the code I am using here (I realise the Array building
    could be more efficient but I wanted to make sure i was drop dead
    simple for the example):

    http://pastie.caboo.se/148337

    As far as I can see, there is no documentation about what type the
    entries in the NSArray have to be to be accepted by iTunes or any
    documentation really on what convert should actually do.

    For all I know it could be converting the file but not adding it to
    iTunes and just storing it somewhere on the disk? Is there any
    documentation other than the sdef and .h files for the API's with
    ScriptingBridge?

    Thanks in advance
    Dave

    --
    e-mail: <dave.verwer...>
    web: http://shinydevelopment.com

    Shiny Development Ltd. is registered in England, Registration Number:
    05805802. Registered Office: 4 Claridge Court, Lower Kings Road,
    Berkhamsted, Herts., HP4 2AF.
  • If no-one knows what is going on with this problem specifically, does
    anyone have any links to decent documentation on using iTunes over
    ScriptingBridge from ObjC?

    Cheers
    Dave

    On 2/6/08, Dave Verwer <dave.verwer...> wrote:
    > I am trying to use ScriptingBridge to control iTunes to convert and
    > import an aiff file generated by my application, and failing.
    >
    > I have the file stored as an aiff on disk and the correct file name as
    > an NSString. I also have an iTunesApplication instance up and working.
    > However when I add the file name (as NSString) to an NSArray and call
    > convert with it, nothing crashes but nothing seems to happen.
    >
    > An iTunes Track is successfully returned from the convert call but if
    > I NSLog the returned object, I get this:
    >
    > 2008-02-06 19:11:01.317 TunesSampleApp[12073:613] (
    > )
    >
    > I have pastie'd the code I am using here (I realise the Array building
    > could be more efficient but I wanted to make sure i was drop dead
    > simple for the example):
    >
    > http://pastie.caboo.se/148337
    >
    > As far as I can see, there is no documentation about what type the
    > entries in the NSArray have to be to be accepted by iTunes or any
    > documentation really on what convert should actually do.
    >
    > For all I know it could be converting the file but not adding it to
    > iTunes and just storing it somewhere on the disk? Is there any
    > documentation other than the sdef and .h files for the API's with
    > ScriptingBridge?
    >
    > Thanks in advance
    > Dave
    >
    > --
    > e-mail: <dave.verwer...>
    > web: http://shinydevelopment.com
    >
    > Shiny Development Ltd. is registered in England, Registration Number:
    > 05805802. Registered Office: 4 Claridge Court, Lower Kings Road,
    > Berkhamsted, Herts., HP4 2AF.
    >

    --
    e-mail: <dave.verwer...>
    web: http://shinydevelopment.com

    Shiny Development Ltd. is registered in England, Registration Number:
    05805802. Registered Office: 4 Claridge Court, Lower Kings Road,
    Berkhamsted, Herts., HP4 2AF.
  • Le 7 févr. 08 à 12:10, Dave Verwer a écrit :

    > If no-one knows what is going on with this problem specifically, does
    > anyone have any links to decent documentation on using iTunes over
    > ScriptingBridge from ObjC?
    >
    > Cheers
    > Dave
    >
    > On 2/6/08, Dave Verwer <dave.verwer...> wrote:
    >> I am trying to use ScriptingBridge to control iTunes to convert and
    >> import an aiff file generated by my application, and failing.
    >>
    >> I have the file stored as an aiff on disk and the correct file name
    >> as
    >> an NSString. I also have an iTunesApplication instance up and
    >> working.
    >> However when I add the file name (as NSString) to an NSArray and call
    >> convert with it, nothing crashes but nothing seems to happen.
    >>
    >> An iTunes Track is successfully returned from the convert call but if
    >> I NSLog the returned object, I get this:
    >>
    >> 2008-02-06 19:11:01.317 TunesSampleApp[12073:613] (
    >> )
    >>
    >> I have pastie'd the code I am using here (I realise the Array
    >> building
    >> could be more efficient but I wanted to make sure i was drop dead
    >> simple for the example):
    >>
    >> http://pastie.caboo.se/148337
    >>
    >> As far as I can see, there is no documentation about what type the
    >> entries in the NSArray have to be to be accepted by iTunes or any
    >> documentation really on what convert should actually do.
    >>
    >> For all I know it could be converting the file but not adding it to
    >> iTunes and just storing it somewhere on the disk? Is there any
    >> documentation other than the sdef and .h files for the API's with
    >> ScriptingBridge?
    >>
    >> Thanks in advance
    >> Dave
    >>
    >> --
    >> e-mail: <dave.verwer...>
    >> web: http://shinydevelopment.com
    >>
    >> Shiny Development Ltd. is registered in England, Registration Number:
    >> 05805802. Registered Office: 4 Claridge Court, Lower Kings Road,
    >> Berkhamsted, Herts., HP4 2AF

    Are you trying to generate MP3 or another format? If you want to
    convert your AIFF into something that is not MP3 (AAC for example),
    there is better way than using iTunes. Else, as OS X does not include
    an MP3 converter (for legal issues), you will have to use iTunes (or
    another third party library like LAME).
  • Le 7 févr. 08 à 12:36, Dave Verwer a écrit :

    > AAC or MP3 does not really matter, I just want it converted to
    > something smaller than AIFF and then imported into the iTunes library
    > so it can be synced with an iPod without the user manually having to
    > worry about moving the file around.
    >
    > Cheers
    > Dave

    OK.
    I'have just tested, and it look like the scripting bridge expects an
    NSURL when it want a file.

    So -[iTunes convert:] works well with an array of NSURL, and it
    returns an array of iTunesFileTrack corresponding to the encoded tracks.
  • That works!! Thanks very much Jean-Daniel.

    Dave

    On 2/7/08, Jean-Daniel Dupas <devlists...> wrote:
    >
    > Le 7 févr. 08 à 12:36, Dave Verwer a écrit :
    >
    >> AAC or MP3 does not really matter, I just want it converted to
    >> something smaller than AIFF and then imported into the iTunes library
    >> so it can be synced with an iPod without the user manually having to
    >> worry about moving the file around.
    >>
    >> Cheers
    >> Dave
    >
    > OK.
    > I'have just tested, and it look like the scripting bridge expects an
    > NSURL when it want a file.
    >
    > So -[iTunes convert:] works well with an array of NSURL, and it
    > returns an array of iTunesFileTrack corresponding to the encoded tracks.
    >
    >

    --
    e-mail: <dave.verwer...>
    web: http://shinydevelopment.com

    Shiny Development Ltd. is registered in England, Registration Number:
    05805802. Registered Office: 4 Claridge Court, Lower Kings Road,
    Berkhamsted, Herts., HP4 2AF.