- NowPlaying.dll: Additional change for r1201 for WMP

- Updated languages
This commit is contained in:
Birunthan Mohanathas 2012-02-22 14:34:57 +00:00
parent a9eeec4454
commit 37ef93f185
2 changed files with 18 additions and 29 deletions

View File

@ -357,7 +357,7 @@ void CPlayerITunes::OnTrackChange()
HRESULT hr = m_iTunes->get_CurrentTrack(&track); HRESULT hr = m_iTunes->get_CurrentTrack(&track);
if (SUCCEEDED(hr) && track) if (SUCCEEDED(hr) && track)
{ {
CComBSTR tmpStr; BSTR tmpStr;
long tmpVal; long tmpVal;
// Get metadata // Get metadata
@ -423,7 +423,7 @@ void CPlayerITunes::OnTrackChange()
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
tmpStr = m_TempCoverPath.c_str(); tmpStr = (BSTR)m_TempCoverPath.c_str();
hr = artwork->SaveArtworkToFile(tmpStr); hr = artwork->SaveArtworkToFile(tmpStr);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {

View File

@ -46,25 +46,14 @@ HRESULT CPlayerWMP::CRemoteHost::QueryService(REFGUID guidService, REFIID riid,
HRESULT CPlayerWMP::CRemoteHost::GetServiceType(BSTR* pbstrType) HRESULT CPlayerWMP::CRemoteHost::GetServiceType(BSTR* pbstrType)
{ {
HRESULT hr = E_POINTER; *pbstrType = SysAllocString(L"RemoteNoDialogs");
if (pbstrType) return *pbstrType ? S_OK : E_POINTER;
{
*pbstrType = SysAllocString(L"RemoteNoDialogs");
hr = *pbstrType? S_OK : E_POINTER;
}
return hr;
} }
HRESULT CPlayerWMP::CRemoteHost::GetApplicationName(BSTR* pbstrName) HRESULT CPlayerWMP::CRemoteHost::GetApplicationName(BSTR* pbstrName)
{ {
HRESULT hr = E_POINTER; *pbstrName = SysAllocString(L"Rainmeter NowPlaying");
if (pbstrName) return *pbstrName ? S_OK : E_POINTER;
{
CComBSTR bstrAppName = L"Rainmeter NowPlaying";
*pbstrName = bstrAppName.Detach();
hr = *pbstrName? S_OK : E_POINTER;
}
return hr;
} }
HRESULT CPlayerWMP::CRemoteHost::GetScriptableObject(BSTR* pbstrName, IDispatch** ppDispatch) HRESULT CPlayerWMP::CRemoteHost::GetScriptableObject(BSTR* pbstrName, IDispatch** ppDispatch)
@ -262,7 +251,7 @@ void CPlayerWMP::Initialize()
// Create WMP control // Create WMP control
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
hr = spHost->CreateControl(CComBSTR(L"{6BF52A52-394A-11D3-B153-00C04F79FAA6}"), m_AxWindow->m_hWnd, NULL); hr = spHost->CreateControl(L"{6BF52A52-394A-11D3-B153-00C04F79FAA6}", m_AxWindow->m_hWnd, NULL);
} }
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
@ -367,7 +356,6 @@ void CPlayerWMP::UpdateData()
if (m_TrackChanged) if (m_TrackChanged)
{ {
++m_TrackCount;
m_TrackChanged = false; m_TrackChanged = false;
CComPtr<IWMPMedia> spMedia; CComPtr<IWMPMedia> spMedia;
@ -375,17 +363,17 @@ void CPlayerWMP::UpdateData()
if (spMedia) if (spMedia)
{ {
CComBSTR val; BSTR val;
spMedia->getItemInfo(CComBSTR("Artist"), &val); spMedia->getItemInfo(L"Artist", &val);
m_Artist = val; m_Artist = val;
spMedia->getItemInfo(CComBSTR("Title"), &val); spMedia->getItemInfo(L"Title", &val);
m_Title = val; m_Title = val;
spMedia->getItemInfo(CComBSTR("Album"), &val); spMedia->getItemInfo(L"Album", &val);
m_Album = val; m_Album = val;
spMedia->getItemInfo(CComBSTR("UserRating"), &val); spMedia->getItemInfo(L"UserRating", &val);
int rating = _wtoi(val); int rating = _wtoi(val);
if (rating > 75) if (rating > 75)
@ -413,19 +401,20 @@ void CPlayerWMP::UpdateData()
spMedia->get_duration(&duration); spMedia->get_duration(&duration);
m_Duration = (UINT)duration; m_Duration = (UINT)duration;
CComBSTR url; BSTR url;
spMedia->get_sourceURL(&url); spMedia->get_sourceURL(&url);
std::wstring targetPath = url; std::wstring targetPath = url;
if (targetPath != m_FilePath) if (targetPath != m_FilePath)
{ {
++m_TrackCount;
m_FilePath = targetPath; m_FilePath = targetPath;
// Find cover if needed // Find cover if needed
// TODO: Fix temp solution // TODO: Fix temp solution
if (m_Measures & MEASURE_COVER || m_InstanceCount == 0) if (m_Measures & MEASURE_COVER || m_InstanceCount == 0)
{ {
spMedia->getItemInfo(CComBSTR("WM/WMCollectionID"), &val); spMedia->getItemInfo(L"WM/WMCollectionID", &val);
targetPath.resize(targetPath.find_last_of(L'\\') + 1); targetPath.resize(targetPath.find_last_of(L'\\') + 1);
targetPath += L"AlbumArt_"; targetPath += L"AlbumArt_";
targetPath += val; targetPath += val;
@ -535,7 +524,7 @@ void CPlayerWMP::SetRating(int rating)
if (spMedia) if (spMedia)
{ {
CComBSTR val; BSTR val;
switch (rating) switch (rating)
{ {
case 0: case 0:
@ -558,12 +547,12 @@ void CPlayerWMP::SetRating(int rating)
val = L"75"; val = L"75";
break; break;
case 5: default: // case 5:
val = L"99"; val = L"99";
break; break;
} }
spMedia->setItemInfo(CComBSTR("UserRating"), val); spMedia->setItemInfo(L"UserRating", val);
m_Rating = rating; m_Rating = rating;
} }
} }