Merge pull request #269 from karlicoss/mpd-play

Add support for starting playback in stopped state
This commit is contained in:
Larson Carter
2019-09-30 18:06:20 -05:00
committed by GitHub
2 changed files with 21 additions and 0 deletions

View File

@@ -804,6 +804,11 @@ void NextSong::run()
Mpd.Next();
}
bool Pause::canBeRun()
{
return Status::State::player() != MPD::psStop;
}
void Pause::run()
{
Mpd.Toggle();
@@ -845,6 +850,11 @@ void Stop::run()
Mpd.Stop();
}
void Play::run()
{
Mpd.Play();
}
void ExecuteCommand::run()
{
using Global::wFooter;
@@ -2734,6 +2744,7 @@ void populateActions()
insert_action(new Actions::NextSong());
insert_action(new Actions::Pause());
insert_action(new Actions::Stop());
insert_action(new Actions::Play());
insert_action(new Actions::ExecuteCommand());
insert_action(new Actions::SavePlaylist());
insert_action(new Actions::MoveSortOrderUp());

View File

@@ -68,6 +68,7 @@ enum class Type
Next,
Pause,
Stop,
Play,
ExecuteCommand,
SavePlaylist,
MoveSortOrderUp,
@@ -515,6 +516,7 @@ struct Pause: BaseAction
Pause(): BaseAction(Type::Pause, "pause") { }
private:
virtual bool canBeRun() override;
virtual void run() override;
};
@@ -526,6 +528,14 @@ private:
virtual void run() override;
};
struct Play: BaseAction
{
Play(): BaseAction(Type::Play, "play") { }
private:
virtual void run() override;
};
struct ExecuteCommand: BaseAction
{
ExecuteCommand(): BaseAction(Type::ExecuteCommand, "execute_command") { }