ref: 1d902b24b710d385033e1e6b8069bf8c48bf477f
parent: 68a4565cabee2e272740b375bcd02565823021e5
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Mar 10 17:45:36 EDT 2024
libtags: separate "album artist" key
--- a/sys/src/cmd/audio/libtags/id3v2.c
+++ b/sys/src/cmd/audio/libtags/id3v2.c
@@ -19,8 +19,10 @@
k++;
if(strcmp(k, "AL") == 0 || strcmp(k, "ALB") == 0)
txtcb(ctx, Talbum, k-1, v);
- else if(strcmp(k, "PE1") == 0 || strcmp(k, "PE2") == 0 || strcmp(k, "P1") == 0 || strcmp(k, "P2") == 0)
+ else if(strcmp(k, "PE1") == 0 || strcmp(k, "P1") == 0)
txtcb(ctx, Tartist, k-1, v);
+ else if(strcmp(k, "PE2") == 0 || strcmp(k, "P2") == 0)
+ txtcb(ctx, Talbumartist, k-1, v);
else if(strcmp(k, "IT2") == 0 || strcmp(k, "T2") == 0)
txtcb(ctx, Ttitle, k-1, v);
else if(strcmp(k, "YE") == 0 || strcmp(k, "YER") == 0 || strcmp(k, "DRC") == 0)
--- a/sys/src/cmd/audio/libtags/m4a.c
+++ b/sys/src/cmd/audio/libtags/m4a.c
@@ -87,6 +87,8 @@
type = Talbum;
else if(memcmp(d, "\251ART", 4) == 0)
type = Tartist;
+ else if(memcmp(d, "aART", 4) == 0)
+ type = Talbumartist;
else if(memcmp(d, "\251gen", 4) == 0 || memcmp(d, "gnre", 4) == 0)
type = Tgenre;
else if(memcmp(d, "\251day", 4) == 0)
--- a/sys/src/cmd/audio/libtags/tags.h
+++ b/sys/src/cmd/audio/libtags/tags.h
@@ -20,6 +20,7 @@
Timage,
Tcomposer,
Tcomment,
+ Talbumartist,
};
/* GAIN note:
--- a/sys/src/cmd/audio/libtags/vorbis.c
+++ b/sys/src/cmd/audio/libtags/vorbis.c
@@ -22,6 +22,8 @@
{"genre", Tgenre},
{"composer", Tcomposer},
{"comment", Tcomment},
+ {"albumartist", Talbumartist},
+ {"album artist", Talbumartist}, // some legacy leftovers
};
void
--- a/sys/src/cmd/audio/readtags/readtags.c
+++ b/sys/src/cmd/audio/readtags/readtags.c
@@ -24,6 +24,7 @@
[Timage] = "image",
[Tcomposer] = "composer",
[Tcomment] = "comment",
+ [Talbumartist] = "albumartist",
};
static int image;
--- a/sys/src/cmd/audio/zuke/mkplist.c
+++ b/sys/src/cmd/audio/zuke/mkplist.c
@@ -79,11 +79,14 @@
switch(t){
case Tartist:
+ case Talbumartist:
if(aux->numartist < Maxartist){
iscomposer = strcmp(k, "TCM") == 0 || strcmp(k, "TCOM") == 0;
- /* prefer lead performer/soloist, helps when TP2/TPE2 is the first one and is set to "VA" */
- /* always put composer first, if available */
- if(iscomposer || (!aux->keepfirstartist && (strcmp(k, "TP1") == 0 || strcmp(k, "TPE1") == 0))){
+ /* prefer lead performer/soloist, helps when TP2/TPE2
+ * (album artist) is the first one and is set to "VA";
+ * always put composer first, if available
+ */
+ if(iscomposer || (!aux->keepfirstartist && t == Tartist)){
if(aux->numartist > 0)
aux->artist[aux->numartist] = aux->artist[aux->numartist-1];
aux->artist[0] = strdup(v);