void cmd_sort (xmmsc_connection_t *conn, gint argc, gchar **argv) { gchar *playlist; xmmsv_t *sortby; xmmsc_result_t *res; if (argc < 3) { print_error ("Sort needs a property to sort on"); } else if (argc == 3) { playlist = NULL; sortby = xmmsv_make_stringlist (&argv[2], argc - 2); } else { playlist = argv[2]; sortby = xmmsv_make_stringlist (&argv[3], argc - 3); } res = xmmsc_playlist_sort (conn, playlist, sortby); xmmsc_result_wait (res); if (xmmsc_result_iserror (res)) { print_error ("%s", xmmsc_result_get_error (res)); } xmmsc_result_unref (res); xmmsv_unref (sortby); }
/* * call-seq: * pl.sort(properties) -> result * * Sorts the playlist on _properties_, which is an array of medialib properties * such as ["title", "artist"]. */ static VALUE c_sort (VALUE self, VALUE props) { xmmsv_t *cprops; PLAYLIST_METHOD_HANDLER_HEADER cprops = parse_string_array2 (props); res = xmmsc_playlist_sort (xmms->real, pl->name, cprops); xmmsv_unref (cprops); PLAYLIST_METHOD_HANDLER_FOOTER }