The following example dumps your entire
iTunes library to the console. You need to reference the COM iTunes 1.2 Type library. Currently I am running iTunes version 4.7.1.30.
using System;
namespace PlayListExample
{
class CMain
{
[STAThread]
static void Main(string[] args)
{
iTunesLib.IiTunes app = null;
try
{
app = new iTunesLib.iTunesAppClass();
foreach (iTunesLib.IITTrack track in app.LibraryPlaylist.Tracks)
{
Console.WriteLine("Artist: {0}\nSong: {1}\nGenre: {2}\n", track.Artist, track.Name, track.Genre);
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
finally
{
app.Quit();
app = null;
Console.ReadLine();
}
}
}
}
Labels: .net, mac
0 Comments:
Post a Comment
<< Home