From fc44e817e339017737e3063c050414301de4d671 Mon Sep 17 00:00:00 2001 From: Aleksejs Popovs Date: Thu, 1 May 2014 19:21:22 +0300 Subject: added "stop playback after current album finishes" functionality --- plugins/hotkeys/hotkeys.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'plugins/hotkeys') diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c index 9ad4aead..f1deaac8 100644 --- a/plugins/hotkeys/hotkeys.c +++ b/plugins/hotkeys/hotkeys.c @@ -745,6 +745,15 @@ action_toggle_stop_after_current_cb (struct DB_plugin_action_s *action, int ctx) return 0; } +int +action_toggle_stop_after_album_cb (struct DB_plugin_action_s *action, int ctx) { + int var = deadbeef->conf_get_int ("playlist.stop_after_album", 0); + var = 1 - var; + deadbeef->conf_set_int ("playlist.stop_after_album", var); + deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0); + return 0; +} + static DB_plugin_action_t action_reload_metadata = { .title = "Reload Metadata", .name = "reload_metadata", @@ -1058,10 +1067,18 @@ static DB_plugin_action_t action_toggle_stop_after_current = { .next = &action_volume_down }; +static DB_plugin_action_t action_toggle_stop_after_album = { + .title = "Playback/Toggle Stop After Current Album", + .name = "toggle_stop_after_album", + .flags = DB_ACTION_COMMON, + .callback2 = action_toggle_stop_after_album_cb, + .next = &action_toggle_stop_after_current +}; + static DB_plugin_action_t * hotkeys_get_actions (DB_playItem_t *it) { - return &action_toggle_stop_after_current; + return &action_toggle_stop_after_album; } // define plugin interface -- cgit v1.2.3