From 686d8bbe6956b53000228c3754a278e7805467fc Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 12 Feb 2012 18:25:10 +0100 Subject: tag_handler: add new handler that updates has_playlist --- src/tag_handler.c | 17 +++++++++++++++++ src/tag_handler.h | 7 +++++++ 2 files changed, 24 insertions(+) (limited to 'src') diff --git a/src/tag_handler.c b/src/tag_handler.c index 32de7650d..316715e87 100644 --- a/src/tag_handler.c +++ b/src/tag_handler.c @@ -20,6 +20,8 @@ #include "config.h" #include "tag_handler.h" +#include + static void add_tag_duration(unsigned seconds, void *ctx) { @@ -41,3 +43,18 @@ const struct tag_handler add_tag_handler = { .tag = add_tag_tag, }; +static void +full_tag_pair(const char *name, G_GNUC_UNUSED const char *value, void *ctx) +{ + struct tag *tag = ctx; + + if (g_ascii_strcasecmp(name, "cuesheet") == 0) + tag->has_playlist = true; +} + +const struct tag_handler full_tag_handler = { + .duration = add_tag_duration, + .tag = add_tag_tag, + .pair = full_tag_pair, +}; + diff --git a/src/tag_handler.h b/src/tag_handler.h index 653918588..7f15c2a48 100644 --- a/src/tag_handler.h +++ b/src/tag_handler.h @@ -91,4 +91,11 @@ tag_handler_invoke_pair(const struct tag_handler *handler, void *ctx, */ extern const struct tag_handler add_tag_handler; +/** + * This #tag_handler implementation adds tag values to a #tag object + * (casted from the context pointer), and supports the has_playlist + * attribute. + */ +extern const struct tag_handler full_tag_handler; + #endif -- cgit v1.2.3