NowPlayingPlugin: Added SetPosition and Pause bangs plus some tweaks.

This commit is contained in:
Birunthan Mohanathas
2011-06-09 09:47:55 +00:00
parent a2396a7d0f
commit 62d441bd3d
22 changed files with 285 additions and 1935 deletions

View File

@ -375,7 +375,7 @@ LPCTSTR GetString(UINT id, UINT flags)
case MEASURE_PROGRESS:
if (player->GetDuration())
{
UINT res = (player->GetPosition() * 100) / player->GetDuration();
int res = (player->GetPosition() * 100) / player->GetDuration();
_itow(res, buffer, 10);
return buffer;
}
@ -419,7 +419,11 @@ void ExecuteBang(LPCTSTR bang, UINT id)
{
CPlayer* player = (*i).second->player;
if (_wcsicmp(bang, L"Play") == 0)
if (_wcsicmp(bang, L"Pause") == 0)
{
player->Pause();
}
else if (_wcsicmp(bang, L"Play") == 0)
{
player->Play();
}
@ -457,20 +461,31 @@ void ExecuteBang(LPCTSTR bang, UINT id)
if (++arg) // Skip the space
{
if (wcsnicmp(bang, L"SetRating", 9) == 0)
if (wcsnicmp(bang, L"SetPosition", 11) == 0)
{
//(player->GetPosition() * 100) / player->GetDuration()
int position = (_wtoi(arg) * player->GetDuration()) / 100;
if (arg[0] == L'+' || arg[0] == L'-')
{
position += player->GetPosition();
}
player->SetPosition(position);
}
else if (wcsnicmp(bang, L"SetRating", 9) == 0)
{
player->SetRating(_wtoi(arg));
}
else if (wcsnicmp(bang, L"SetVolume", 9) == 0)
{
int volume = _wtoi(arg);
if (arg[0] == L'+' || arg[0] == L'-')
{
player->ChangeVolume(_wtoi(arg));
}
else
{
player->SetVolume(_wtoi(arg));
// Relative to current volume
volume += player->GetVolume();
}
player->SetVolume(volume);
}
else
{