Skip to content

Commit 99b44b4

Browse files
committed
add command 'tags'
1 parent c91c08f commit 99b44b4

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
0.36 (not yet released)
2+
* add command "tags"
23

34
0.35 (2023/12/21)
45
* fix null pointer dereference on bad status format

doc/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ Database Commands
312312

313313
mpc list album group artist
314314

315+
:command:`tags` - display all MPD tags known by the mpc client
316+
315317
:command:`stats` - Displays statistics about MPD.
316318

317319
:command:`update [\-\-wait] [<path>]` - Scans for updated files in the

src/command.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,21 @@ cmd_load(int argc, char **argv, struct mpd_connection *conn)
870870
return 0;
871871
}
872872

873+
int
874+
cmd_tags(gcc_unused int argc, gcc_unused char **argv, gcc_unused struct mpd_connection *conn)
875+
{
876+
const char *name = NULL;
877+
878+
for (unsigned i = 0; i < MPD_TAG_COUNT; i++) {
879+
name = mpd_tag_name(i);
880+
if (name != NULL) {
881+
printf("%s\n", name);
882+
}
883+
}
884+
885+
return 0;
886+
}
887+
873888
int
874889
cmd_list(int argc, char **argv, struct mpd_connection *conn)
875890
{

src/command.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,7 @@ cmd_waitmessage(int argc, char **argv, struct mpd_connection *conn);
6666
int
6767
cmd_subscribe(int argc, char **argv, struct mpd_connection *conn);
6868

69+
int
70+
cmd_tags(int argc, char **argv, struct mpd_connection *conn);
71+
6972
#endif /* COMMAND_H */

src/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ static const struct command {
120120
{"stop", 0, 0, 0, cmd_stop, "", "Stop playback"},
121121
{"subscribe", 1, 1, 0, cmd_subscribe, "<channel>", "Subscribe to the specified channel and continuously receive messages." },
122122
{"tab", 1, 1, 0, cmd_tab, "<path>", NULL},
123+
{"tags", 0, 0, 0, cmd_tags, "", "Display all MPD tags known by the mpc client" },
123124
{"toggle", 0, 0, 0, cmd_toggle, "", "Toggles Play/Pause, plays if stopped"},
124125
{"toggleoutput", 1, -1, 0, cmd_toggle_output, "<output # or name> [...]", "Toggle output(s)"},
125126
{"unmount", 1, 1, 0, cmd_unmount, "<mount-path>", "Remove a mount." },

0 commit comments

Comments
 (0)