Example #1
0
void CWMPADialog::OnDblclkPlaylist()
{
	// TODO: Add your control notification handler code here
   long index;

   // Get the playlist name
   index = m_PlaylistBox.GetCurSel();
   CString playlistName;
   m_PlaylistBox.GetText(index, playlistName);

   // Get the playlist
   CWMPPlaylistCollection pc = m_WMP.GetPlaylistCollection();
   CWMPPlaylistArray pa = pc.getByName((LPCTSTR) playlistName);
   CWMPPlaylist playlist = pa.Item(0);
   m_WMP.SetCurrentPlaylist(playlist);

   // Set the song list
   UpdateSongList();

   m_WMP.GetControls().play();
   if (autoAnnounce) {
      hexchat_commandf(ph, "me is playing %s", (LPCTSTR) wmpaGetSongTitle());
   }
   else {
      hexchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
   }
}
Example #2
0
void CWMPADialog::UpdatePlayLists()
{
	// TODO: Add extra initialization here
   CWMPPlaylistCollection pc = m_WMP.GetPlaylistCollection();
   CWMPPlaylistArray pa = pc.getAll();
   CWMPPlaylist playlist;

   int index;
   int count = pa.GetCount();
   m_PlaylistBox.ResetContent();
   for (index = 0; index < count; index++) {
      playlist = pa.Item(index);
      m_PlaylistBox.AddString((LPCTSTR) playlist.GetName());
   }
}
CWMPPlaylist &MediaDatabase::getPlaylist() { // static
  if(playlist == NULL) {
    CWMPPlayer4           &player       = MediaDatabase::getPlayer();
    CWMPPlaylistCollection plCollection = player.GetPlaylistCollection();
    CWMPPlaylistArray      plArray      = plCollection.getByName(queueName);
    if(plArray.GetCount() > 0) {
      playlist = plArray.Item(0);
      playlist.clear();
    } else {
      playlist = plCollection.newPlaylist(queueName);
    }
    player.SetCurrentPlaylist(playlist);
  }
  return playlist;
}
CWMPPlaylist MediaDatabase::createPlayList(const String &name) { // static
  if(name.equalsIgnoreCase(queueName)) {
    throwException(_T("Cannot use name of queue (=%s) as name for playlist"), queueName);
  }
  CWMPPlayer4           &player       = MediaDatabase::getPlayer();
  CWMPPlaylistCollection plCollection = player.GetPlaylistCollection();
  CWMPPlaylistArray      plArray      = plCollection.getByName(name.cstr());
  CWMPPlaylist           result;
  if(plArray.GetCount() > 0) {
    result = plArray.Item(0);
    result.clear();
  } else {
    result = plCollection.newPlaylist(name.cstr());
  }
  return result;
}