CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Threaded View

  1. #1
    Join Date
    Jun 2008
    Posts
    1

    itunes, C# fundamentals, iTunes COM interface

    hi, I'm programing in C# for the first time. I'm trying to write a small console application that creates a new playlist and adds all tracks with the inputted search term.
    I've run into a snag and I'm not sure if it's my C# fundamentals that are wrong or if the iTunes COM interface is wrong.
    Here's a link to the iTunes SDK http://developer.apple.com/sdk/itunescomsdk.html
    some of the methods I've used are not recognized by the compiler, there is also no alternative recognized by the compiler,
    even though the methods came straight from the Itunes COM interface SDK.

    here's the code I've written with the problem methods commented
    using System;
    using iTunesLib;
    using iTunesAdminLib;

    namespace Badger_Search
    {
    class Program
    {
    static void Main(string[] args)
    {
    //get new playlist name
    Console.WriteLine("new playlist name");
    string newPlayListName = Console.ReadLine();

    iTunesLib.IiTunes iTunesApp;
    iTunesApp = new iTunesLib.iTunesAppClass();
    IITLibraryPlaylist mainLibrary = iTunesApp.LibraryPlaylist;
    IITTrackCollection tracks = mainLibrary.Tracks;

    //create new userPlaylist
    IITPlaylist newPlaylist = iTunesApp.CreatePlaylist(newPlayListName) as IITUserPlaylist;


    for ( ; ; )
    {
    //get searh term
    Console.WriteLine("search for");
    string searchItem = Console.ReadLine();
    if (searchItem.Equals(""))
    {
    break;
    }

    IITTrackCollection results = mainLibrary.Search(searchItem, 0);

    int addCounter = results.Count;
    for(; addCounter == 0 ; addCounter--)
    {
    IITTrack trackToAdd = results.Item(addCounter); //compiler does not recognize
    //add found track to created playlist

    newPlaylist.AddTrack(trackToAdd); //compiler does not recognize
    }
    }
    newPlaylist.Reveal(); //compiler does not recognize
    Console.ReadLine();
    }
    }
    }



    thanks in advanced

    im using microsoft visual C# express edition
    Last edited by colonelBadger; June 19th, 2008 at 08:05 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured