Filter out this extra data and leading zeroes in "track" and "disc" tags.
This commit is contained in:
parent
0366dcf604
commit
bea5973e0c
|
@ -22,6 +22,9 @@
|
||||||
#include "TagBuilder.hxx"
|
#include "TagBuilder.hxx"
|
||||||
#include "util/ASCII.hxx"
|
#include "util/ASCII.hxx"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_tag_duration(SongTime duration, void *ctx)
|
add_tag_duration(SongTime duration, void *ctx)
|
||||||
{
|
{
|
||||||
|
@ -35,6 +38,16 @@ add_tag_tag(TagType type, const char *value, void *ctx)
|
||||||
{
|
{
|
||||||
TagBuilder &tag = *(TagBuilder *)ctx;
|
TagBuilder &tag = *(TagBuilder *)ctx;
|
||||||
|
|
||||||
|
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);
|
tag.AddItem(type, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue