Skip to content

Commit

Permalink
Fix audio events that are not including the player id
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulh committed Apr 5, 2019
1 parent 01f7f12 commit d16c9df
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/bin/calaos_server/Audio/Squeezebox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,9 @@ void Squeezebox::processNotificationMessage(string msg)
Params p;
p.Parse(msg);

if (param["id"] != url_decode2(p["0"]))
if (id != url_decode2(p["0"]))
return;

int pid;
from_string(param["pid"], pid);

if (p["1"] == "playlist")
{
if (p["2"] == "open" || p["2"] == "newsong") //current song changes !
Expand All @@ -285,15 +282,15 @@ void Squeezebox::processNotificationMessage(string msg)
set_status(AudioSongChange);

EventManager::create(CalaosEvent::EventAudioSongChanged,
{ { "player_id", get_param("pid") } });
{ { "player_id", id } });
}
else if (p["2"] == "move")
{
//notify the player's input
set_status(AudioPlaylistChange);

EventManager::create(CalaosEvent::EventAudioPlaylistMove,
{ { "player_id", get_param("pid") },
{ { "player_id", id },
{ "from", p["3"] },
{ "to", p["4"] } });
}
Expand All @@ -303,7 +300,7 @@ void Squeezebox::processNotificationMessage(string msg)
set_status(AudioPlaylistChange);

EventManager::create(CalaosEvent::EventAudioPlaylistDelete,
{ { "player_id", get_param("pid") },
{ { "player_id", id },
{ "position", p["3"] } });
}
else if (p["2"] == "loadtracks" || p["2"] == "clear" || p["2"] == "play" || p["2"] == "load")
Expand All @@ -312,23 +309,23 @@ void Squeezebox::processNotificationMessage(string msg)
set_status(AudioPlaylistChange);

EventManager::create(CalaosEvent::EventAudioPlaylistReload,
{ { "player_id", get_param("pid") } });
{ { "player_id", id } });
}
else if (p["2"] == "addtracks" || p["2"] == "add")
{
//notify the player's input
set_status(AudioPlaylistChange);

EventManager::create(CalaosEvent::EventAudioPlaylistAdd,
{ { "player_id", get_param("pid") } });
{ { "player_id", id } });
}
else if (p["2"] == "clear")
{
//notify the player's input
set_status(AudioPlaylistChange);

EventManager::create(CalaosEvent::EventAudioPlaylistCleared,
{ { "player_id", get_param("pid") } });
{ { "player_id", id } });
}
else if (p["2"] == "pause")
{
Expand All @@ -345,7 +342,7 @@ void Squeezebox::processNotificationMessage(string msg)
state = "pause";

EventManager::create(CalaosEvent::EventAudioStatusChanged,
{ { "player_id", get_param("pid") },
{ { "player_id", id },
{ "state", state } });
}
else if (p["2"] == "stop")
Expand All @@ -354,7 +351,7 @@ void Squeezebox::processNotificationMessage(string msg)
set_status(AudioStop);

EventManager::create(CalaosEvent::EventAudioStatusChanged,
{ { "player_id", get_param("pid") },
{ { "player_id", id },
{ "state", "stop" } });
}
}
Expand All @@ -366,7 +363,7 @@ void Squeezebox::processNotificationMessage(string msg)
set_status(AudioVolumeChange);

EventManager::create(CalaosEvent::EventAudioVolumeChanged,
{ { "player_id", get_param("pid") },
{ { "player_id", id },
{ "volume", Utils::url_decode(p["3"]) } });
}
}
Expand Down

0 comments on commit d16c9df

Please sign in to comment.