Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/tag/TagHandler.cxx
Expand Up @@ -17,6 +17,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include <stdio.h>
#include <stdlib.h>

#include "config.h"
#include "TagHandler.hxx"
#include "TagBuilder.hxx"
Expand All @@ -35,7 +38,18 @@ 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) {
char *end;
int n = strtol(value, &end, 10);
if (value != end) {
char s[21];
if (snprintf(s, 21, "%d", n) >= 0) {
tag.AddItem(type, s);
}
}
} else {
tag.AddItem(type, value);
}
}

const struct tag_handler add_tag_handler = {
Expand Down