Example #1
0
CStdString CWmp_scrobbler::GetCurrentSongFileName()
{
	USES_CONVERSION;
	CStdString strSong;
	IWMPMedia* pMedia = NULL;
	BSTR bstrSong;

	if(m_spCore)
	{
		m_spCore->get_currentMedia(&pMedia);
		
		if(pMedia != NULL)
		{
			pMedia->get_sourceURL(&bstrSong);

            char buf[1000];
            EncodingUtils::UnicodeToUtf8(
                bstrSong, -1,
                buf, 999);
            
            strSong = buf;
        }
	}

	return strSong;
}
Example #2
0
void CWmp2mirc::OnPlay()
{
  // if we are locked (property page could be doing stuff, or the timer proc), then just ignore the request.
  if(!m_cs.TryEnter())
  {
    LibCC::g_pLog->Message(_T("WMircP is busy; ignoring the play event."));
    return;
  }

  IWMPMedia* pMedia = 0;
  m_spCore->get_currentMedia(&pMedia);

  if(!pMedia)
  {
    LibCC::g_pLog->Message(_T("WMircP could not get a pointer to the current media."));
  }
  else
  {
    CComBSTR url;
    pMedia->get_sourceURL(&url);

		LibCC::LogScopeMessage lsm(LibCC::Format("OnPlay %").qs((BSTR)url).Str());
    m.OnPlay(pMedia, (PCWSTR)url);
    pMedia->Release();
  }

  m_cs.Leave();
}