Skip to content

Commit

Permalink
Compound playlist actions
Browse files Browse the repository at this point in the history
Examples of compound playlist actions - hacks, don't have proper state
checking/error handling
  • Loading branch information
ldolse committed Nov 24, 2012
1 parent 27c0ccd commit 6f0f329
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions empcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,24 @@ F_CMDA(f_load, mpd_sendLoadCommand)
F_CMDA(f_remove, mpd_sendRmCommand)
F_CMDN(f_clear, mpd_sendClearCommand)

void f_reload(const char *arg, const char *args)
{
mpd_sendClearCommand(mpd);
mpd_finishCommand(mpd);
mpd_sendLoadCommand(mpd,arg);
mpd_finishCommand(mpd);
mpd_sendPlayCommand(mpd,-1);
mpd_finishCommand(mpd);
}

void f_overwrite(const char *arg, const char *args)
{
mpd_sendRmCommand(mpd,arg);
mpd_finishCommand(mpd);
mpd_sendSaveCommand(mpd,arg);
mpd_finishCommand(mpd);
}

void f_volume(const char *arg, const char *args)
{
int dir = 0, volume = 0, i = 0, retry = 5;
Expand Down Expand Up @@ -409,6 +427,8 @@ static const struct empcd_funcs
{ f_save, true, "mpd_plst_save", "<playlist>", "MPD Save Playlist" },
{ f_clear, true, "mpd_plst_clear", NULL, "MPD Clear Playlist" },
{ f_remove, true, "mpd_plst_remove", "<playlist>", "MPD Remove Playlist" },
{ f_reload, true, "mpd_plst_reload", NULL, "MPD Reload Playlist" },
{ f_overwrite, true, "mpd_plst_save_force", "<playlist>", "MPD Overwrite Playlist" },

/* End */
{ NULL, false, NULL, NULL, "undefined" }
Expand Down

0 comments on commit 6f0f329

Please sign in to comment.