Fix processing when artist and albumArtist are null

master
tesshucom 6 years ago
parent f5f1ec336f
commit 133cf666b7
  1. 14
      airsonic-main/src/main/java/org/airsonic/player/service/metadata/JaudiotaggerParser.java

@ -97,8 +97,8 @@ public class JaudiotaggerParser extends MetaDataParser {
metaData.setTrackNumber(parseTrackNumber(getTagField(tag, FieldKey.TRACK))); metaData.setTrackNumber(parseTrackNumber(getTagField(tag, FieldKey.TRACK)));
metaData.setMusicBrainzReleaseId(getTagField(tag, FieldKey.MUSICBRAINZ_RELEASEID)); metaData.setMusicBrainzReleaseId(getTagField(tag, FieldKey.MUSICBRAINZ_RELEASEID));
String songArtist = getTagField(tag, FieldKey.ARTIST); metaData.setArtist(getTagField(tag, FieldKey.ARTIST));
String albumArtist = getTagField(tag, FieldKey.ALBUM_ARTIST); metaData.setAlbumArtist(getTagField(tag, FieldKey.ALBUM_ARTIST));
if (tag instanceof AbstractID3Tag && 0 < audioFile.getTag().getFieldCount()) { if (tag instanceof AbstractID3Tag && 0 < audioFile.getTag().getFieldCount()) {
@ -140,7 +140,7 @@ public class JaudiotaggerParser extends MetaDataParser {
} }
break; break;
case ID3v24Frames.FRAME_ID_ARTIST: case ID3v24Frames.FRAME_ID_ARTIST:
if (null == metaData.getArtist() && null == songArtist) { if (null == metaData.getArtist()) {
metaData.setArtist(f.toString()); metaData.setArtist(f.toString());
} }
break; break;
@ -155,11 +155,11 @@ public class JaudiotaggerParser extends MetaDataParser {
}); });
} }
} }
if(StringUtils.isBlank(metaData.getArtist())) { if (StringUtils.isBlank(metaData.getArtist())) {
metaData.setArtist(StringUtils.isBlank(songArtist) ? albumArtist : songArtist); metaData.setArtist(metaData.getAlbumArtist());
} }
if(StringUtils.isBlank(metaData.getAlbumArtist())) { if (StringUtils.isBlank(metaData.getAlbumArtist())) {
metaData.setAlbumArtist(StringUtils.isBlank(albumArtist) ? songArtist : albumArtist); metaData.setAlbumArtist(metaData.getArtist());
} }
} }

Loading…
Cancel
Save