本文整理汇总了Java中org.blinkenlights.jid3.ID3Exception类的典型用法代码示例。如果您正苦于以下问题:Java ID3Exception类的具体用法?Java ID3Exception怎么用?Java ID3Exception使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ID3Exception类属于org.blinkenlights.jid3包,在下文中一共展示了ID3Exception类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extract
import org.blinkenlights.jid3.ID3Exception; //导入依赖的package包/类
@Override
public Map<String, String> extract(File file) throws CannotExtractMetaDataException {
this.properties.clear();
MediaFile mediaFile = new MP3File(file);
try {
ID3Tag[] tags = mediaFile.getTags();
for (ID3Tag tag : tags) {
processTag(tag);
}
} catch (ID3Exception ex) {
throw new CannotExtractMetaDataException(ex);
}
return properties;
}
示例2: writeTrackInfo
import org.blinkenlights.jid3.ID3Exception; //导入依赖的package包/类
@Override public void writeTrackInfo(Track track) throws IOException {
log.info("writing ID3 tags to {}", track);
try {
ID3V1Tag id3V1Tag = new ID3V1_1Tag();
ID3V2Tag id3V2Tag = new ID3V2_3_0Tag();
String artistName = track.getSong().getArtistName();
if (artistName != null) {
id3V1Tag.setArtist(fixLongIDV1String(artistName));
id3V2Tag.setArtist(artistName);
}
String albumName = track.getSong().getAlbumName();
if (albumName != null) {
id3V1Tag.setAlbum(fixLongIDV1String(albumName));
id3V2Tag.setAlbum(albumName);
}
String songName = track.getSong().getSongName();
if (songName != null) {
id3V1Tag.setTitle(fixLongIDV1String(songName));
id3V2Tag.setTitle(songName);
}
Integer trackNum = track.getSong().getTrackNum();
if (trackNum != null) {
id3V2Tag.setTrackNumber(trackNum);
}
MP3File mp3File = new MP3File(file);
mp3File.setID3Tag(id3V1Tag);
mp3File.setID3Tag(id3V2Tag);
mp3File.sync();
}
catch (ID3Exception ex) {
throw new IOException("cannot write ID3 tags to file " + file + "; track: " + track + "; reason: " + ex, ex);
}
}
示例3: LeerTags
import org.blinkenlights.jid3.ID3Exception; //导入依赖的package包/类
public void LeerTags() {
MediaFile mediaFile = new MP3File(mp3);
try {
for (Object obj : mediaFile.getTags()) {
if (obj instanceof ID3V1_0Tag)
LeerID3V1Tags(obj);
else if (obj instanceof ID3V2_3_0Tag)
LeerID3V2_3Tags(obj);
}
} catch (ID3Exception e1) {
e1.printStackTrace();
}
}