summaryrefslogtreecommitdiff
path: root/plugins/hotkeys/actionhandlers.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/hotkeys/actionhandlers.c')
-rw-r--r--plugins/hotkeys/actionhandlers.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/plugins/hotkeys/actionhandlers.c b/plugins/hotkeys/actionhandlers.c
index c1d49b26..ec1f305c 100644
--- a/plugins/hotkeys/actionhandlers.c
+++ b/plugins/hotkeys/actionhandlers.c
@@ -195,3 +195,56 @@ action_playlist10_handler (DB_plugin_action_t *act, int ctx) {
return 0;
}
+int
+action_sort_randomize_handler (DB_plugin_action_t *act, int ctx) {
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ deadbeef->plt_sort (plt, PL_MAIN, -1, NULL, DDB_SORT_RANDOM);
+ deadbeef->plt_unref (plt);
+ deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
+ return 0;
+}
+
+int
+action_sort_by_date_handler (DB_plugin_action_t *act, int ctx) {
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ deadbeef->plt_sort (plt, PL_MAIN, -1, "%y", DDB_SORT_ASCENDING);
+ deadbeef->plt_unref (plt);
+ deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
+ return 0;
+}
+
+int
+action_sort_by_artist_handler (DB_plugin_action_t *act, int ctx) {
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ deadbeef->plt_sort (plt, PL_MAIN, -1, "%a", DDB_SORT_ASCENDING);
+ deadbeef->plt_unref (plt);
+ deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
+ return 0;
+}
+
+int
+action_sort_by_album_handler (DB_plugin_action_t *act, int ctx) {
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ deadbeef->plt_sort (plt, PL_MAIN, -1, "%b", DDB_SORT_ASCENDING);
+ deadbeef->plt_unref (plt);
+ deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
+ return 0;
+}
+
+int
+action_sort_by_tracknr_handler (DB_plugin_action_t *act, int ctx) {
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ deadbeef->plt_sort (plt, PL_MAIN, -1, "%n", DDB_SORT_ASCENDING);
+ deadbeef->plt_unref (plt);
+ deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
+ return 0;
+}
+
+int
+action_sort_by_title_handler (DB_plugin_action_t *act, int ctx) {
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ deadbeef->plt_sort (plt, PL_MAIN, -1, "%t", DDB_SORT_ASCENDING);
+ deadbeef->plt_unref (plt);
+ deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
+ return 0;
+}