Friday, August 3, 2007

More code samples...

How about this one?

First I create a new playlist (called "New Playlist") and add a track to it. Then I can modify that track (in this case the comment field).

Then I can use the built-in IPodExporter class to easily copy a track to the users c:\ drive!

Could it be much easier? :)


try
{
Playlist newPlaylist = iPod.Playlists.Add("New Playlist");
newPlaylist.AddTrack(iPod.Tracks[0]);
}
catch (BaseSharePodException ex)
{
MessageBox.Show(ex.Message);
}

iPod.Tracks[0].Comment = "Modified by SharePodLib";
iPod.SaveChanges();

IPodFileExporter exporter = new IPodFileExporter(iPod, "c:\\", "[Artist] - [Album] - [Title]");
exporter.SetTracksToCopy(iPod.Tracks[0]);
exporter.PerformCopy();