badger

badger

  • NA
  • 1
  • 0

itunes, C# fundamentals, iTunes COM interface

Jun 19 2008 8:29 AM
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

Answers (1)