Is it possible to use the Windows COM SDK to add tracks to iPod's playlist (or even modify them, etc? iTunes is throwing an exception when I attempt to call AddTrack on an IITLibraryPlaylist object acquired from an iPod...
Here's the code...
// this works
CComPtr newPlaylist = app()->CreatePlaylist(playlistName);
if (FAILED(newPlaylist->QueryInterface(&newUPlaylist)) || !newUPlaylist) {
std::cerr << "ERROR: Could not create playlist '" << playlistName << "'." << std::endl;
_com_issue_errorex(hr, app(), __uuidof(app()));
}
CComVariant cv(i->track());
CComPtr newTrack = newUPlaylist->AddTrack(&cv);
// this blows up at the AddTrack call (everything before that works fine)
CComPtr sources = app()->GetSources();
CComPtr iPod = sources->GetItem(ipodSourceNum);
CComPtr iPodPlaylists = iPod->GetPlaylists();
CComPtr iPodPlaylist = iPodPlaylists->GetItem(1);
std::cout << "iPod Playlist: " << iPodPlaylist->GetName() << std::endl;
CComPtr iPodUPlaylist;
if( FAILED(iPodPlaylist->QueryInterface(&iPodUPlaylist)) || !iPodUPlaylist )
std::cerr << "ERROR: Could not query iPod playlist interface" << std::endl;
CComPtr iPodNewTrack = iPodUPlaylist->AddTrack(&cv); // boom
Aqua-Soft Forums