Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 4abbe632 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

Fix lkt

parent d72eb145
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!55Lkt fix
Ce commit fait partie de la requête de fusion !55. Les commentaires créés ici seront créés dans le contexte de cette requête de fusion.
...@@ -48,7 +48,7 @@ help(void) ...@@ -48,7 +48,7 @@ help(void)
" status: get the status of lektor.\n" " status: get the status of lektor.\n"
" current: get the currently playing song.\n" " current: get the currently playing song.\n"
" add <query>: add a kara to the playlist with a query.\n" " add <query>: add a kara to the playlist with a query.\n"
" delete <id>: delete the id or a range of ids from the queue.\n" " delete <arg>: delete the id or a range of ids from the queue.\n"
" clear: clear the queue of lektor.\n" " clear: clear the queue of lektor.\n"
" prev: play previous kara in the queue.\n" " prev: play previous kara in the queue.\n"
" next: play the next kara in the queue.\n" " next: play the next kara in the queue.\n"
...@@ -486,21 +486,28 @@ delete__(struct lkt_cmd_args *args) ...@@ -486,21 +486,28 @@ delete__(struct lkt_cmd_args *args)
fail("Invalid argument, need onlt one argument"); fail("Invalid argument, need onlt one argument");
static const char *cmd_range__ = "delete %s\nclose\n"; static const char *cmd_range__ = "delete %s\nclose\n";
static const char *cmd_id__ = "deleteid %s\nclose\n"; static const char *cmd_id__ = "deleteid %d\nclose\n";
int dumy1 = 0, dumy2 = 0;; int dumy1 = 0, dumy2 = 0;;
FILE *sock = lkt_connect(); FILE *sock = lkt_connect();
char buff[3]; char buff[3], dumy3;
/* Is this a range? matches only `int:` and `int:int` */ /* Is this a range? matches only `int:int` */
sscanf(args->argv[0], "%d:%d", &dumy1, &dumy2); sscanf(args->argv[0], "%d:%d", &dumy1, &dumy2);
if (dumy1 != 0 || dumy2 != 0) { if (dumy1 != 0 && dumy2 != 0) {
write_socket_format(sock, cmd_range__, args->argv[0]); write_socket_format(sock, cmd_range__, args->argv[0]);
goto check; goto check;
} }
/* Ranges, matches `:int`. */ /* Ranges, matches `:int`. */
sscanf(args->argv[0], ":%d", &dumy1); sscanf(args->argv[0], ":%d", &dumy1);
if (dumy1 != 0) { if (args->argv[0][0] == ':' && dumy1 != 0) {
write_socket_format(sock, cmd_range__, args->argv[0]);
goto check;
}
/* Ranges, matches `int:`. */
sscanf(args->argv[0], "%d%c", &dumy1, &dumy3);
if (dumy1 != 0 && dumy3 == ':') {
write_socket_format(sock, cmd_range__, args->argv[0]); write_socket_format(sock, cmd_range__, args->argv[0]);
goto check; goto check;
} }
...@@ -508,7 +515,7 @@ delete__(struct lkt_cmd_args *args) ...@@ -508,7 +515,7 @@ delete__(struct lkt_cmd_args *args)
/* Or only an id? */ /* Or only an id? */
sscanf(args->argv[0], "%d", &dumy1); sscanf(args->argv[0], "%d", &dumy1);
if (dumy1 != 0) { if (dumy1 != 0) {
write_socket_format(sock, cmd_id__, args->argv[0]); write_socket_format(sock, cmd_id__, dumy1);
goto check; goto check;
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter