fixed #2095
This commit is contained in:
parent
0296949b73
commit
6b20dc5f8c
|
@ -419,5 +419,7 @@ SchedulerWindow :: onStopCurrentlyPlayingButtonClicked(void) throw ()
|
|||
Ptr<Glib::ustring>::Ref errorMessage(new Glib::ustring(e.what()));
|
||||
gLiveSupport->displayMessageWindow(errorMessage);
|
||||
}
|
||||
|
||||
showContents();
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h"
|
||||
#include "LiveSupport/Core/XmlRpcTools.h"
|
||||
#include "SchedulerDaemon.h"
|
||||
#include "ScheduleInterface.h"
|
||||
#include "ScheduleFactory.h"
|
||||
|
||||
#include "StopCurrentlyPlayingMethod.h"
|
||||
|
||||
|
@ -115,8 +117,28 @@ StopCurrentlyPlayingMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
|
|||
// TODO: check the session ID
|
||||
|
||||
Ptr<SchedulerDaemon>::Ref sd = SchedulerDaemon::getInstance();
|
||||
Ptr<ScheduleFactory>::Ref sf = ScheduleFactory::getInstance();
|
||||
Ptr<ScheduleInterface>::Ref schedule = sf->getSchedule();
|
||||
Ptr<ScheduleEntry>::Ref currentlyPlaying;
|
||||
|
||||
// remove the item from the schedule, so something else can be scheduled
|
||||
try {
|
||||
currentlyPlaying = schedule->getCurrentlyPlaying();
|
||||
if (currentlyPlaying) {
|
||||
schedule->removeFromSchedule(currentlyPlaying->getId());
|
||||
|
||||
// tell the scheduler daemon to reload the scheduled events
|
||||
sd->update();
|
||||
}
|
||||
} catch (std::invalid_argument &e) {
|
||||
XmlRpcTools::markError(errorId+3, "schedule entry not found",
|
||||
returnValue);
|
||||
return;
|
||||
}
|
||||
|
||||
// stop the audio player
|
||||
Ptr<AudioPlayerInterface>::Ref audioPlayer = sd->getAudioPlayer();
|
||||
|
||||
|
||||
try {
|
||||
audioPlayer->stop();
|
||||
audioPlayer->close();
|
||||
|
|
|
@ -69,6 +69,9 @@ using namespace LiveSupport::Core;
|
|||
* The name of the method when called through XML-RPC is
|
||||
* "stopCurrentlyPlaying".
|
||||
*
|
||||
* Stops the audio player, and removes the current item from the schedule,
|
||||
* so that something else can be scheduled in its place.
|
||||
*
|
||||
* The expected parameter is an XML-RPC structure, with the following
|
||||
* member:
|
||||
* <ul>
|
||||
|
|
Loading…
Reference in New Issue