From 5d20dcbddd7b4b2f7b00ddae837b8d4495ac3c69 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sat, 19 Nov 2011 12:06:51 +0000 Subject: [PATCH] NowPlaying.dll: Some tweaks. --- Plugins/PluginNowPlaying/Player.cpp | 2 +- Plugins/PluginNowPlaying/PlayerITunes.cpp | 31 ++++++++++------------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/Plugins/PluginNowPlaying/Player.cpp b/Plugins/PluginNowPlaying/Player.cpp index 5b83dd55..5254363b 100644 --- a/Plugins/PluginNowPlaying/Player.cpp +++ b/Plugins/PluginNowPlaying/Player.cpp @@ -43,7 +43,7 @@ CPlayer::CPlayer() : // Get temporary file for cover art WCHAR buffer[MAX_PATH]; GetTempPath(MAX_PATH, buffer); - GetTempFileName(buffer, L"cvr", 0, buffer); + GetTempFileName(buffer, L"jpg", 0, buffer); m_TempCoverPath = buffer; } diff --git a/Plugins/PluginNowPlaying/PlayerITunes.cpp b/Plugins/PluginNowPlaying/PlayerITunes.cpp index a972ce47..35536be5 100644 --- a/Plugins/PluginNowPlaying/PlayerITunes.cpp +++ b/Plugins/PluginNowPlaying/PlayerITunes.cpp @@ -233,11 +233,13 @@ void CPlayerITunes::Initialize() m_State = PLAYER_PLAYING; OnTrackChange(); } - - long volume; - m_iTunes->get_SoundVolume(&volume); - m_Volume = (UINT)volume; } + + long volume; + m_iTunes->get_SoundVolume(&volume); + m_Volume = (UINT)volume; + + OnDatabaseChange(); } else { @@ -352,25 +354,18 @@ void CPlayerITunes::UpdateData() 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; + HRESULT hr = m_iTunes->get_CurrentPlaylist(&playlist); + if (SUCCEEDED(hr) && playlist) { - IITPlaylist* playlist; - hr = track->get_Playlist(&playlist); + VARIANT_BOOL shuffle; + hr = playlist->get_Shuffle(&shuffle); if (SUCCEEDED(hr)) { - VARIANT_BOOL shuffle; - hr = playlist->get_Shuffle(&shuffle); - if (SUCCEEDED(hr)) - { - m_Shuffle = (bool)shuffle; - } - - playlist->Release(); + m_Shuffle = (bool)shuffle; } - track->Release(); + playlist->Release(); } }