]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
play: Convert com_info() to lopsub.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 28 Mar 2016 03:48:50 +0000 (03:48 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 26 Mar 2017 09:02:28 +0000 (11:02 +0200)
This also improves the help text slightly to be more specific about
the output of the subcommand.

m4/lls/play_cmd.suite.m4
play.c
play.cmd

index 1c71e71e192294ae0ba53f6e3edc6f9712ef954d..f1434affb61afe0db087fbfb9dc43fa55903cef6 100644 (file)
@@ -54,3 +54,10 @@ caption = list of commands
                This prints all paths of the playlist. The currently
                active file is marked with an asterisk.
        [/description]
                This prints all paths of the playlist. The currently
                active file is marked with an asterisk.
        [/description]
+
+[subcommand info]
+       purpose = print information about the current file
+       [description]
+               The output contains the playlist position, the path
+               and information provided by the audio format handler.
+       [/description]
diff --git a/play.c b/play.c
index 1c1d809a8cd292798fbb138dc677c6467293d39d..1700f9ac467eff2998af7321747360b994698c46 100644 (file)
--- a/play.c
+++ b/play.c
@@ -793,14 +793,13 @@ static int com_help(struct play_task *pt, struct lls_parse_result *lpr)
 }
 EXPORT_PLAY_CMD_HANDLER(help);
 
 }
 EXPORT_PLAY_CMD_HANDLER(help);
 
-static int com_info(struct play_task *pt, int argc, __a_unused char **argv)
+static int com_info(struct play_task *pt,
+               __a_unused struct lls_parse_result *lpr)
 {
        char *buf;
        size_t sz;
        static char dflt[] = "[no information available]";
 
 {
        char *buf;
        size_t sz;
        static char dflt[] = "[no information available]";
 
-       if (argc != 1)
-               return -E_PLAY_SYNTAX;
        sz = xasprintf(&buf, "playlist_pos: %u\npath: %s\n",
                pt->current_file, conf.inputs[pt->current_file]);
        btr_add_output(buf, sz, pt->btrn);
        sz = xasprintf(&buf, "playlist_pos: %u\npath: %s\n",
                pt->current_file, conf.inputs[pt->current_file]);
        btr_add_output(buf, sz, pt->btrn);
@@ -808,6 +807,7 @@ static int com_info(struct play_task *pt, int argc, __a_unused char **argv)
        btr_add_output_dont_free(buf, strlen(buf), pt->btrn);
        return 0;
 }
        btr_add_output_dont_free(buf, strlen(buf), pt->btrn);
        return 0;
 }
+EXPORT_PLAY_CMD_HANDLER(info);
 
 static void list_file(struct play_task *pt, int num)
 {
 
 static void list_file(struct play_task *pt, int num)
 {
index 799abbfd5600c2711e4f3550fbb1b2e8552adf17..16cec2aaf7123ac131cd20adf0a3ec1dbfacff49 100644 (file)
--- a/play.cmd
+++ b/play.cmd
@@ -2,11 +2,6 @@ BN: play
 SF: play.c
 SN: list of commands
 ---
 SF: play.c
 SN: list of commands
 ---
-N: info
-D: Print information about the current file.
-U: info
-H: This is the audio file selector info.
----
 N: play
 D: Start or resume playing.
 U: play [<num>]
 N: play
 D: Start or resume playing.
 U: play [<num>]