shithub: libtags

Download patch

ref: 5f03152c619d5b15ffb100fc325ff8046593d606
parent: a2dc55b11af2a516fef397f8af0f49d041b932f0
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Tue Mar 2 05:43:52 EST 2021

add a very simple XM parser

--- a/README.md
+++ b/README.md
@@ -13,6 +13,8 @@
 | m4a            | yes             | no               | yes              |
 | opus           | yes             | no               | yes              |
 | WAV            | yes             | no               | yes              |
+| IT             | yes             | no               | ???              |
+| XM             | yes             | no               | ???              |
 | replay gain    | yes             | no               | ???              |
 | size           | tiny            | bloated          | more bloated     |
 | license        | MIT             | LGPL             | LGPL/MPL         |
--- a/mkfile
+++ b/mkfile
@@ -14,6 +14,7 @@
 	utf16.$O\
 	vorbis.$O\
 	wav.$O\
+	xm.$O\
 
 HFILES=\
 	/sys/include/tags.h\
--- a/tags.c
+++ b/tags.c
@@ -16,6 +16,7 @@
 extern int tagm4a(Tagctx *ctx);
 extern int tagopus(Tagctx *ctx);
 extern int tagwav(Tagctx *ctx);
+extern int tagxm(Tagctx *ctx);
 
 static const Getter g[] =
 {
@@ -27,6 +28,7 @@
 	{tagopus, Fopus},
 	{tagwav, Fwav},
 	{tagit, Fit},
+	{tagxm, Fxm},
 };
 
 void
--- a/tags.h
+++ b/tags.h
@@ -33,6 +33,7 @@
 	Fopus,
 	Fwav,
 	Fit,
+	Fxm,
 
 	Fmax,
 };
--- /dev/null
+++ b/xm.c
@@ -1,0 +1,15 @@
+#include "tagspriv.h"
+
+int
+tagxm(Tagctx *ctx)
+{
+	char d[17+20+1], *s;
+
+	if(ctx->read(ctx, d, 17+20) != 17+20 || memcmp(d, "Extended Module: ", 17) != 0)
+		return -1;
+	d[17+20] = 0;
+	for(s = d+17; *s == ' '; s++);
+	txtcb(ctx, Ttitle, "", s);
+
+	return 0;
+}