mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
NowPlaying.dll: iTunes shuffle state change now detected immediately.
This commit is contained in:
parent
42ce3d9666
commit
d3a2a8a137
@ -1969,17 +1969,14 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
|
||||
ExecuteCommand(command.c_str() + notwhite, meterWindow);
|
||||
}
|
||||
}
|
||||
else if (args[i] == L'"' && args[i + 1] == L'"' && args[i + 2] == L'"')
|
||||
else if (args[i] == L'"' && isize > (i + 2) && args[i + 1] == L'"' && args[i + 2] == L'"')
|
||||
{
|
||||
i += 3;
|
||||
|
||||
if (isize > i)
|
||||
std::wstring::size_type pos = arg.find(L"\"\"\"", i);
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
std::wstring::size_type pos = arg.find(L"\"\"\"", i);
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
i = pos + 2; // Skip "", loop will skip last "
|
||||
}
|
||||
i = pos + 2; // Skip "", loop will skip last "
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,10 @@ HRESULT STDMETHODCALLTYPE CPlayerITunes::CEventHandler::Invoke(DISPID dispidMemb
|
||||
{
|
||||
switch (dispidMember)
|
||||
{
|
||||
case ITEventDatabaseChanged:
|
||||
m_Player->OnDatabaseChange();
|
||||
break;
|
||||
|
||||
case ITEventPlayerPlay:
|
||||
m_Player->OnStateChange(true);
|
||||
m_Player->OnTrackChange();
|
||||
@ -339,6 +343,37 @@ void CPlayerITunes::UpdateData()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** OnDatabaseChange
|
||||
**
|
||||
** Called by iTunes event handler when the database is changed.
|
||||
**
|
||||
*/
|
||||
void CPlayerITunes::OnDatabaseChange()
|
||||
{
|
||||
// Check the shuffle state. TODO: Find better way
|
||||
IITTrack* track;
|
||||
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
|
||||
if (SUCCEEDED(hr) && track)
|
||||
{
|
||||
IITPlaylist* playlist;
|
||||
hr = track->get_Playlist(&playlist);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
VARIANT_BOOL shuffle;
|
||||
hr = playlist->get_Shuffle(&shuffle);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
m_Shuffle = (bool)shuffle;
|
||||
}
|
||||
|
||||
playlist->Release();
|
||||
}
|
||||
|
||||
track->Release();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** OnTrackChange
|
||||
**
|
||||
@ -376,13 +411,6 @@ void CPlayerITunes::OnTrackChange()
|
||||
hr = track->get_Playlist(&playlist);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
VARIANT_BOOL shuffle;
|
||||
hr = playlist->get_Shuffle(&shuffle);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
m_Shuffle = (bool)shuffle;
|
||||
}
|
||||
|
||||
ITPlaylistRepeatMode repeat;
|
||||
hr = playlist->get_SongRepeat(&repeat);
|
||||
if (SUCCEEDED(hr))
|
||||
|
@ -87,6 +87,7 @@ private:
|
||||
|
||||
void Initialize();
|
||||
void Uninitialize();
|
||||
void OnDatabaseChange();
|
||||
void OnTrackChange();
|
||||
void OnStateChange(bool playing);
|
||||
void OnVolumeChange(int volume);
|
||||
|
Loading…
Reference in New Issue
Block a user