Hi Max,

I've built a small patch that will "clean" the track and disc numbers.
Maybe you want to apply that attached patch.

Best regards,
Andreas


2015-07-01 8:07 GMT+02:00 Max Kellermann <[email protected]>:
> On 2015/06/28 08:40, Andreas Mair <[email protected]> wrote:
>> I've taken a look at the MPD sources and I think the problem is, that
>> MPD tries an exact *string* match. If I use "... find 01/10" it works,
>> but I think that's not ideal to work like this because one has to know
>> (1)  how many songs an album has and (2) if the number of total tracks
>> is stored and (3) if leading zeros are used.
>
> Actually, MPD does not expect the "track" tag to have something other
> than the track number.  The problem is that some tag specifications
> (such as ID3) allow the total number of tracks appended to the "track"
> tag.
>
> What MPD should do is filter out this extra data.  And filter out
> leading zeroes.
diff --git a/src/tag/TagHandler.cxx b/src/tag/TagHandler.cxx
index 9bbaae3..dfebfa9 100644
--- a/src/tag/TagHandler.cxx
+++ b/src/tag/TagHandler.cxx
@@ -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"
@@ -35,7 +38,13 @@ 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 s[6];
+		snprintf(s, 6, "%d", atoi(value));
+		tag.AddItem(type, s);
+	} else  {
+		tag.AddItem(type, value);
+	}
 }
 
 const struct tag_handler add_tag_handler = {
_______________________________________________
mpd-devel mailing list
[email protected]
http://mailman.blarg.de/listinfo/mpd-devel

Reply via email to