From 617834454292f302d43b356944a1d5d7d2e472c5 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sun, 20 Oct 2013 18:55:23 +0300 Subject: [PATCH] NowPlaying: Clear details when track ends with iTunes --- Plugins/PluginNowPlaying/PlayerITunes.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Plugins/PluginNowPlaying/PlayerITunes.cpp b/Plugins/PluginNowPlaying/PlayerITunes.cpp index c2e332c9..13700dbe 100644 --- a/Plugins/PluginNowPlaying/PlayerITunes.cpp +++ b/Plugins/PluginNowPlaying/PlayerITunes.cpp @@ -207,7 +207,7 @@ void PlayerITunes::Initialize() if (state == ITPlayerStateStopped) { // Determine if paused of stopped - long position; + long position = 0; m_iTunes->get_PlayerPosition(&position); if (position != 0) @@ -319,7 +319,7 @@ void PlayerITunes::UpdateData() { if ((m_Initialized || CheckWindow()) && m_State != STATE_STOPPED) { - long position; + long position = 0; m_iTunes->get_PlayerPosition(&position); m_Position = (UINT)position; } @@ -471,8 +471,15 @@ void PlayerITunes::OnStateChange(bool playing) } else { + long position = 0; + m_iTunes->get_PlayerPosition(&position); + // Guess if paused or stopped from track time - m_State = (m_Position == 0) ? STATE_STOPPED : STATE_PAUSED; + m_State = (position == 0) ? STATE_STOPPED : STATE_PAUSED; + if (m_State == STATE_STOPPED) + { + ClearData(false); + } } }