|
|
@ -37,6 +37,7 @@ import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
import java.util.SortedSet; |
|
|
|
import java.util.SortedSet; |
|
|
@ -110,42 +111,42 @@ public class JaudiotaggerParser extends MetaDataParser { |
|
|
|
audioFile.getTag().getFields().forEachRemaining(f -> { |
|
|
|
audioFile.getTag().getFields().forEachRemaining(f -> { |
|
|
|
switch (f.getId()) { |
|
|
|
switch (f.getId()) { |
|
|
|
case ID3v24Frames.FRAME_ID_ALBUM: |
|
|
|
case ID3v24Frames.FRAME_ID_ALBUM: |
|
|
|
if (null == metaData.getAlbumName()) { |
|
|
|
if (StringUtils.isBlank(metaData.getAlbumName())) { |
|
|
|
metaData.setAlbumName(f.toString()); |
|
|
|
metaData.setAlbumName(f.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ID3v24Frames.FRAME_ID_TITLE: |
|
|
|
case ID3v24Frames.FRAME_ID_TITLE: |
|
|
|
if (null == metaData.getTitle()) { |
|
|
|
if (StringUtils.isBlank(metaData.getTitle())) { |
|
|
|
metaData.setTitle(f.toString()); |
|
|
|
metaData.setTitle(f.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ID3v24Frames.FRAME_ID_YEAR: |
|
|
|
case ID3v24Frames.FRAME_ID_YEAR: |
|
|
|
if (null == metaData.getYear()) { |
|
|
|
if (ObjectUtils.isEmpty(metaData.getYear())) { |
|
|
|
metaData.setYear(parseYear(f.toString())); |
|
|
|
metaData.setYear(parseYear(f.toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ID3v24Frames.FRAME_ID_GENRE: |
|
|
|
case ID3v24Frames.FRAME_ID_GENRE: |
|
|
|
if (null == metaData.getGenre()) { |
|
|
|
if (StringUtils.isBlank(metaData.getGenre())) { |
|
|
|
metaData.setGenre(mapGenre(f.toString())); |
|
|
|
metaData.setGenre(mapGenre(f.toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ID3v24Frames.FRAME_ID_SET: |
|
|
|
case ID3v24Frames.FRAME_ID_SET: |
|
|
|
if (null == metaData.getDiscNumber()) { |
|
|
|
if (ObjectUtils.isEmpty(metaData.getDiscNumber())) { |
|
|
|
metaData.setDiscNumber(parseInteger(f.toString())); |
|
|
|
metaData.setDiscNumber(parseInteger(f.toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ID3v24Frames.FRAME_ID_TRACK: |
|
|
|
case ID3v24Frames.FRAME_ID_TRACK: |
|
|
|
if (null == metaData.getTrackNumber()) { |
|
|
|
if (ObjectUtils.isEmpty(metaData.getTrackNumber())) { |
|
|
|
metaData.setTrackNumber(parseTrackNumber(f.toString())); |
|
|
|
metaData.setTrackNumber(parseTrackNumber(f.toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ID3v24Frames.FRAME_ID_ARTIST: |
|
|
|
case ID3v24Frames.FRAME_ID_ARTIST: |
|
|
|
if (null == metaData.getArtist()) { |
|
|
|
if (StringUtils.isBlank(metaData.getArtist())) { |
|
|
|
metaData.setArtist(f.toString()); |
|
|
|
metaData.setArtist(f.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ID3v24Frames.FRAME_ID_ACCOMPANIMENT: |
|
|
|
case ID3v24Frames.FRAME_ID_ACCOMPANIMENT: |
|
|
|
if (null == metaData.getAlbumArtist()) { |
|
|
|
if (StringUtils.isBlank(metaData.getAlbumArtist())) { |
|
|
|
metaData.setAlbumArtist(f.toString()); |
|
|
|
metaData.setAlbumArtist(f.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|