diff --git a/CHANGELOG.md b/CHANGELOG.md index ac6a90177080aa515f7b0a4256b65dbe88036f48..fa98e98c8b8589a1bba0f629280ef5b613a9626f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ - Add MPD commands: seek, seekid, seekcur, delete (partial), playlistid - Alias list\* commands as find - lkt handle the playlistid (queue id) and \_\_flat (queue flatten), pause, unpause commands +- lkt `queue delete` is now `queue remove` to delete by id +- lkt `queue delete` now deletes a kara in the queue by their position - lkt shuffle works the same way as klkt, it doens't force the 'play' command but unpause, i.e it doesn't replay the kara - Remove archlinux package support (replaced by AppImage) - Fix dl process with the repo module diff --git a/man/lkt.template b/man/lkt.template index bf6c2c3efc710367c5885b6f735735972a26febc..c64f8c601f13cb33056c4469b00ca943838461ae 100644 --- a/man/lkt.template +++ b/man/lkt.template @@ -87,38 +87,42 @@ List all the available playlists .TP .PD \fBqueue\fP [count] -Prints the names and ids of the next karas in the queue +Prints the names and ids of the next karas in the queue. .TP \fBqueue pos\fP <pos | from:to> Prints the names and ids of karas in the queue. Karas can be designated by -their position or with a range +their position or with a range. .TP \fBqueue pop\fP Delete the currently playing kara from the queue and pass to the next one. -This can work only if the currently playong kara is not the last +This can work only if the currently playong kara is not the last. .TP \fBqueue add\fP <query> -Add karas to the queue at the end of it with a valid query +Add karas to the queue at the end of it with a valid query. .TP \fBqueue insert\fP <query> -Add karas to the queue just after the currently playing kara +Add karas to the queue just after the currently playing kara. .TP \fBqueue seek\fP <id> -Goto to the kara with the specified id in the queue +Goto to the kara with the specified id in the queue. .TP -\fBqueue delete\fP <id> -Delete karas from the playlist with their id. You can't delete the currently -playing kara, for that use the \fBpop\fP queue command +\fBqueue delete\fP <pos> +Delete a kara from the playlist with their position. You can delete the +currently playing kara, use the \fBqueue pop\fP command for that. +.TP +\fBqueue remove\fP <id> +Delete karas from the playlist with their id. You can't remove the currently +playing kara, for that use the \fBqueue pop\fP queue command. .TP \fBqueue clear\fP -Clear the queue and set the state to \fIstopped\fP +Clear the queue and set the state to \fIstopped\fP. .TP \fBqueue crop\fP Crop the queue, delete every kara from it appart from the currently -playing one +playing one. .TP \fBqueue replace\fP <plt-name> -Replace the queue with the content of a playlist. Keep the playling state +Replace the queue with the content of a playlist. Keep the playling state. .TP \fBqueue swap\fP <pos1> <pos2> Swaps two karas in the queue by their position. diff --git a/src/main/lkt.c b/src/main/lkt.c index 3a0bde57144e90bfb00db7ffc409a2b75a3bed79..6a4f6c5cc1415008449032840a29c61f63c0f662 100644 --- a/src/main/lkt.c +++ b/src/main/lkt.c @@ -736,13 +736,33 @@ error: exit(ret); } +noreturn void +queue_remove__(struct cmd_args *args) +{ + if (args->argc != 1) + fail("Invalid argument, need onlt one argument: queue id <id>"); + + static const char *cmd__ = "deleteid %d\n"; + int dumy = 0; + FILE *sock = lkt_connect(); + char buff[3]; + + sscanf(args->argv[0], "%d", &dumy); + if (dumy != 0) { + write_socket(sock, cmd__, dumy); + exit_with_status(sock, buff); + } + + fail("Invalid argument"); +} + noreturn void queue_delete__(struct cmd_args *args) { if (args->argc != 1) - fail("Invalid argument, need onlt one argument: queue delete <id>"); + fail("Invalid argument, need onlt one argument: queue delete <pos>"); - static const char *cmd_id__ = "deleteid %d\n"; + static const char *cmd_id__ = "delete %d\n"; int dumy = 0; FILE *sock = lkt_connect(); char buff[3]; @@ -1157,6 +1177,7 @@ static struct cmd_opt options_queue[] = { { .name = "add", .call = queue_add__ }, { .name = "seek", .call = queue_seek__ }, { .name = "delete", .call = queue_delete__ }, + { .name = "remove", .call = queue_remove__ }, { .name = "clear", .call = queue_clear__ }, { .name = "crop", .call = queue_crop__ }, { .name = "replace", .call = queue_replace__ },