diff --git a/Plugins/PluginNowPlaying/NowPlaying.cpp b/Plugins/PluginNowPlaying/NowPlaying.cpp index f75e629e..0e09373d 100644 --- a/Plugins/PluginNowPlaying/NowPlaying.cpp +++ b/Plugins/PluginNowPlaying/NowPlaying.cpp @@ -26,12 +26,12 @@ #include "PlayerWinamp.h" #include "PlayerWMP.h" -static CPlayer* g_AIMP = NULL; -static CPlayer* g_Foobar = NULL; -static CPlayer* g_iTunes = NULL; -static CPlayer* g_Spotify = NULL; -static CPlayer* g_Winamp = NULL; -static CPlayer* g_WMP = NULL; +CPlayer* g_AIMP = NULL; +CPlayer* g_Foobar = NULL; +CPlayer* g_iTunes = NULL; +CPlayer* g_Spotify = NULL; +CPlayer* g_Winamp = NULL; +CPlayer* g_WMP = NULL; static MeasureMap g_Values; static bool g_DisableLeazingZero = false; @@ -99,9 +99,11 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id) if (!data->player) { - std::wstring error = L"NowPlayingPlugin: The referenced measure PlayerName="; + std::wstring error = L"NowPlayingPlugin: PlayerName="; error += str; - error += L" does not exist."; + error += L" in section ["; + error += section; + error += L"] does not exist."; LSLog(LOG_WARNING, L"Rainmeter", error.c_str()); return maxValue; } @@ -164,9 +166,9 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id) { std::wstring error = L"NowPlayingPlugin: PlayerName="; error += str; - error += L" is not valid in section ["; + error += L" in section ["; error += section; - error += L"]."; + error += L"] is not valid."; LSLog(LOG_ERROR, L"Rainmeter", error.c_str()); delete data; return maxValue; diff --git a/Plugins/PluginNowPlaying/PlayerAIMP.cpp b/Plugins/PluginNowPlaying/PlayerAIMP.cpp index 6d3ee98e..0adb2194 100644 --- a/Plugins/PluginNowPlaying/PlayerAIMP.cpp +++ b/Plugins/PluginNowPlaying/PlayerAIMP.cpp @@ -19,6 +19,8 @@ #include "StdAfx.h" #include "PlayerAIMP.h" +extern CPlayer* g_AIMP; + /* ** CPlayerAIMP ** @@ -72,6 +74,7 @@ void CPlayerAIMP::RemoveInstance() { if (--m_InstanceCount == 0) { + g_AIMP = NULL; delete this; } } @@ -199,6 +202,16 @@ void CPlayerAIMP::UpdateData() stringData += info->nArtistLen; stringData += info->nDateLen; std::wstring filepath(stringData, info->nFileNameLen); + + stringData += info->nFileNameLen; + stringData += info->nGenreLen; + m_Title.assign(stringData, info->nTitleLen); + + m_Duration = info->nDuration / 1000; + + // Get rating through the AIMP Winamp API + m_Rating = SendMessage(m_WinampWindow, WM_WA_IPC, 0, IPC_GETRATING); + if (filepath != m_FilePath) { m_FilePath = filepath; @@ -235,18 +248,6 @@ void CPlayerAIMP::UpdateData() m_CoverPath.clear(); } } - - stringData += info->nFileNameLen; - stringData += info->nGenreLen; - m_Title.assign(stringData, info->nTitleLen); - - m_Duration = info->nDuration / 1000; - - if (m_WinampWindow) - { - // Get the rating through the AIMP Winamp API - m_Rating = SendMessage(m_WinampWindow, WM_WA_IPC, 0, IPC_GETRATING); - } } } diff --git a/Plugins/PluginNowPlaying/PlayerFoobar.cpp b/Plugins/PluginNowPlaying/PlayerFoobar.cpp index a4c17d28..0d720788 100644 --- a/Plugins/PluginNowPlaying/PlayerFoobar.cpp +++ b/Plugins/PluginNowPlaying/PlayerFoobar.cpp @@ -19,6 +19,8 @@ #include "StdAfx.h" #include "PlayerFoobar.h" +extern CPlayer* g_Foobar; + /* ** CPlayerFoobar ** @@ -70,6 +72,7 @@ void CPlayerFoobar::RemoveInstance() { if (--m_InstanceCount == 0) { + g_Foobar = NULL; delete this; } } diff --git a/Plugins/PluginNowPlaying/PlayerITunes.cpp b/Plugins/PluginNowPlaying/PlayerITunes.cpp index 78aa12e5..661dd8d1 100644 --- a/Plugins/PluginNowPlaying/PlayerITunes.cpp +++ b/Plugins/PluginNowPlaying/PlayerITunes.cpp @@ -19,7 +19,7 @@ #include "StdAfx.h" #include "PlayerITunes.h" -extern std::wstring g_CachePath; +extern CPlayer* g_iTunes; /* ** CEventHandler @@ -166,6 +166,7 @@ void CPlayerITunes::RemoveInstance() { if (--m_InstanceCount == 0) { + g_iTunes = NULL; delete this; } } diff --git a/Plugins/PluginNowPlaying/PlayerSpotify.cpp b/Plugins/PluginNowPlaying/PlayerSpotify.cpp index de646503..a02545ed 100644 --- a/Plugins/PluginNowPlaying/PlayerSpotify.cpp +++ b/Plugins/PluginNowPlaying/PlayerSpotify.cpp @@ -19,6 +19,8 @@ #include "StdAfx.h" #include "PlayerSpotify.h" +extern CPlayer* g_Spotify; + /* ** CPlayerSpotify ** @@ -62,6 +64,7 @@ void CPlayerSpotify::RemoveInstance() { if (--m_InstanceCount == 0) { + g_Spotify = NULL; delete this; } } diff --git a/Plugins/PluginNowPlaying/PlayerWMP.cpp b/Plugins/PluginNowPlaying/PlayerWMP.cpp index 0829029d..21de94b1 100644 --- a/Plugins/PluginNowPlaying/PlayerWMP.cpp +++ b/Plugins/PluginNowPlaying/PlayerWMP.cpp @@ -19,6 +19,8 @@ #include "StdAfx.h" #include "PlayerWMP.h" +extern CPlayer* g_WMP; + /* ** CRemoteHost ** @@ -198,6 +200,7 @@ void CPlayerWMP::RemoveInstance() { if (--m_InstanceCount == 0) { + g_WMP = NULL; delete this; } } diff --git a/Plugins/PluginNowPlaying/PlayerWinamp.cpp b/Plugins/PluginNowPlaying/PlayerWinamp.cpp index de110f6d..7db4a050 100644 --- a/Plugins/PluginNowPlaying/PlayerWinamp.cpp +++ b/Plugins/PluginNowPlaying/PlayerWinamp.cpp @@ -19,6 +19,8 @@ #include "StdAfx.h" #include "PlayerWinamp.h" +extern CPlayer* g_Winamp; + /* ** CPlayerWinamp ** @@ -55,6 +57,7 @@ void CPlayerWinamp::AddInstance(MEASURETYPE type) if (type == MEASURE_COVER) { + g_Winamp = NULL; m_HasCoverMeasure = true; } }