Merge pull request #269 from karlicoss/mpd-play
Add support for starting playback in stopped state
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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") { }
|
||||
|
||||
Reference in New Issue
Block a user