NowPlaying.dll:

- Fixed that invalid PlayerName= caused crash
- Fixed that PlayerType=COVER didn't work with iTunes
This commit is contained in:
Birunthan Mohanathas 2012-03-02 12:27:37 +00:00
parent 4a7ef7508f
commit e5f5ea41cb
2 changed files with 16 additions and 15 deletions

View File

@ -103,7 +103,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
break; break;
} }
} }
if (!measure->parent) if (!measure->parent)
{ {
// The referenced section doesn't exist // The referenced section doesn't exist
@ -171,23 +171,24 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
{ {
parent->player = CPlayerWinamp::Create(WA_WINAMP); parent->player = CPlayerWinamp::Create(WA_WINAMP);
} }
else if (_wcsicmp(L"WLM", str) == 0)
{
parent->player = CPlayerWLM::Create();
}
else if (_wcsicmp(L"WMP", str) == 0) else if (_wcsicmp(L"WMP", str) == 0)
{ {
parent->player = CPlayerWMP::Create(); parent->player = CPlayerWMP::Create();
} }
else else
{ {
std::wstring error = L"NowPlaying.dll: Invalid PlayerName="; // Default to WLM
error += str; parent->player = CPlayerWLM::Create();
error += L" in [";
error += parent->ownerName; if (_wcsicmp(L"WLM", str) != 0)
error += L"]"; {
RmLog(LOG_ERROR, error.c_str()); std::wstring error = L"NowPlaying.dll: Invalid PlayerName=";
return; error += str;
error += L" in [";
error += parent->ownerName;
error += L"]";
RmLog(LOG_ERROR, error.c_str());
}
} }
parent->player->AddInstance(); parent->player->AddInstance();
@ -346,7 +347,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data)
{ {
Measure* measure = (Measure*)data; Measure* measure = (Measure*)data;
ParentMeasure* parent = measure->parent; ParentMeasure* parent = measure->parent;
if (!parent) return L"Invalid player"; if (!parent) return NULL;
const CPlayer* player = parent->player; const CPlayer* player = parent->player;
static WCHAR buffer[32]; static WCHAR buffer[32];

View File

@ -423,8 +423,8 @@ void CPlayerITunes::OnTrackChange()
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
tmpStr = (BSTR)m_TempCoverPath.c_str(); CComBSTR coverPath = m_TempCoverPath.c_str();
hr = artwork->SaveArtworkToFile(tmpStr); hr = artwork->SaveArtworkToFile(coverPath);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
m_CoverPath = m_TempCoverPath; m_CoverPath = m_TempCoverPath;