Commit bea5973e authored by Andreas Mair's avatar Andreas Mair

Filter out this extra data and leading zeroes in "track" and "disc" tags.

parent 0366dcf6
......@@ -22,6 +22,9 @@
#include "TagBuilder.hxx"
#include "util/ASCII.hxx"
#include <stdio.h>
#include <stdlib.h>
static void
add_tag_duration(SongTime duration, void *ctx)
{
......@@ -35,7 +38,17 @@ add_tag_tag(TagType type, const char *value, void *ctx)
{
TagBuilder &tag = *(TagBuilder *)ctx;
tag.AddItem(type, value);
if (type == TAG_TRACK || type == TAG_DISC) {
/* filter out this extra data and leading zeroes */
char *end;
unsigned n = strtoul(value, &end, 10);
if (value != end) {
char s[21];
if (snprintf(s, 21, "%u", n) >= 0)
tag.AddItem(type, s);
}
} else
tag.AddItem(type, value);
}
const struct tag_handler add_tag_handler = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment