This method assigns those tags of tag
which are defined to
be common by jaudiotagger.
assert description.getContainerType() == ContainerType.EXTENDED_CONTENT;
MetadataDescriptor tmp;
if (!Utils.isBlank(tag.getFirst(FieldKey.ALBUM))) {
tmp = new MetadataDescriptor(description.getContainerType(),
AsfFieldKey.ALBUM.getFieldName(),
MetadataDescriptor.TYPE_STRING);
tmp.setStringValue(tag.getFirst(FieldKey.ALBUM));
description.removeDescriptorsByName(tmp.getName());
description.addDescriptor(tmp);
} else {
description.removeDescriptorsByName(AsfFieldKey.ALBUM
.getFieldName());
}
if (!Utils.isBlank(tag.getFirst(FieldKey.TRACK))) {
tmp = new MetadataDescriptor(description.getContainerType(),
AsfFieldKey.TRACK.getFieldName(),
MetadataDescriptor.TYPE_STRING);
tmp.setStringValue(tag.getFirst(FieldKey.TRACK));
description.removeDescriptorsByName(tmp.getName());
description.addDescriptor(tmp);
} else {
description.removeDescriptorsByName(AsfFieldKey.TRACK
.getFieldName());
}
if (!Utils.isBlank(tag.getFirst(FieldKey.YEAR))) {
tmp = new MetadataDescriptor(description.getContainerType(),
AsfFieldKey.YEAR.getFieldName(),
MetadataDescriptor.TYPE_STRING);
tmp.setStringValue(tag.getFirst(FieldKey.YEAR));
description.removeDescriptorsByName(tmp.getName());
description.addDescriptor(tmp);
} else {
description
.removeDescriptorsByName(AsfFieldKey.YEAR.getFieldName());
}
if (!Utils.isBlank(tag.getFirst(FieldKey.GENRE))) {
// Write Genre String value
tmp = new MetadataDescriptor(description.getContainerType(),
AsfFieldKey.GENRE.getFieldName(),
MetadataDescriptor.TYPE_STRING);
tmp.setStringValue(tag.getFirst(FieldKey.GENRE));
description.removeDescriptorsByName(tmp.getName());
description.addDescriptor(tmp);
Integer genreNum = GenreTypes.getInstanceOf().getIdForName(
tag.getFirst(FieldKey.GENRE));
// ..and if it is one of the standard genre types used the id as
// well
if (genreNum != null) {
tmp = new MetadataDescriptor(description.getContainerType(),
AsfFieldKey.GENRE_ID.getFieldName(),
MetadataDescriptor.TYPE_STRING);
tmp.setStringValue("(" + genreNum + ")");
description.removeDescriptorsByName(tmp.getName());
description.addDescriptor(tmp);
} else {
description.removeDescriptorsByName(AsfFieldKey.GENRE_ID
.getFieldName());
}
} else {
description.removeDescriptorsByName(AsfFieldKey.GENRE
.getFieldName());
description.removeDescriptorsByName(AsfFieldKey.GENRE_ID
.getFieldName());
}