本文整理汇总了Java中com.mpatric.mp3agic.ID3v1类的典型用法代码示例。如果您正苦于以下问题:Java ID3v1类的具体用法?Java ID3v1怎么用?Java ID3v1使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ID3v1类属于com.mpatric.mp3agic包,在下文中一共展示了ID3v1类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: allTags
import com.mpatric.mp3agic.ID3v1; //导入依赖的package包/类
@Test
public void allTags()
throws InvalidDataException, IOException, UnsupportedTagException {
final ID3v1 tag = new ID3v1AnnotatedSafe(
new BasicTagFromMp3File(
new Mp3File(
new File("src/test/resources/album/test.mp3")
)
).construct()
);
MatcherAssert.assertThat(
"Cannot construct a message with tags",
new MessageBasic(
tag.getAlbum(),
tag.getArtist()
).construct(),
Matchers.equalTo(
String.format("Album: Elegant Testing%nArtist: Test Man")
)
);
}
开发者ID:driver733,项目名称:VKMusicUploader,代码行数:22,代码来源:MessageTest.java
示例2: stripMp3ID3v1
import com.mpatric.mp3agic.ID3v1; //导入依赖的package包/类
/**
* Private helper method that strips ID3v1 tags from an mp3 file.
*
* @param mp3File - Target Mp3File with ID3v1 tags to strip.
* @return A Song object containing all the tags from the mp3File.
*/
private LocalSong stripMp3ID3v1(Mp3File mp3File) {
if(!mp3File.hasId3v1Tag()) {
throw new IllegalArgumentException("No such file exists!");
}
ID3v1 id3v1Tags = mp3File.getId3v1Tag();
LocalSong mp3Song = new LocalSong();
mp3Song.setTitle(id3v1Tags.getTitle());
mp3Song.setArtist(id3v1Tags.getArtist());
mp3Song.setAlbum(id3v1Tags.getAlbum());
mp3Song.setLength("" + mp3File.getLengthInSeconds());
return mp3Song;
}
开发者ID:brokenprogrammer,项目名称:RapidTunes,代码行数:22,代码来源:FileStripper.java
示例3: catalogId3Fields
import com.mpatric.mp3agic.ID3v1; //导入依赖的package包/类
private void catalogId3Fields(StringBuffer cat) {
ID3v1 id3v1tag = mp3file.getId3v1Tag();
ID3v2 id3v2tag = mp3file.getId3v2Tag();
ID3Wrapper id3wrapper = new ID3Wrapper(id3v1tag, id3v2tag);
if (id3v1tag != null) catalogField(cat, "1." + id3v1tag.getVersion());
else catalogField(cat, null);
if (id3v2tag != null) catalogField(cat, "2." + id3v2tag.getVersion());
else catalogField(cat, null);
catalogField(cat, id3wrapper.getTrack());
catalogField(cat, id3wrapper.getArtist());
catalogField(cat, id3wrapper.getAlbum());
catalogField(cat, id3wrapper.getTitle());
catalogField(cat, id3wrapper.getYear());
catalogField(cat, id3wrapper.getGenreDescription());
catalogField(cat, id3wrapper.getComment());
catalogField(cat, id3wrapper.getComposer());
catalogField(cat, id3wrapper.getOriginalArtist());
catalogField(cat, id3wrapper.getCopyright());
catalogField(cat, id3wrapper.getUrl());
catalogField(cat, id3wrapper.getEncoder());
catalogField(cat, id3wrapper.getAlbumImageMimeType());
}
开发者ID:mpatric,项目名称:mp3agic-examples,代码行数:23,代码来源:Mp3Catalog.java
示例4: construct
import com.mpatric.mp3agic.ID3v1; //导入依赖的package包/类
@Override
public ID3v1 construct() throws IOException {
final ID3v1 result;
if (this.file.hasId3v1Tag()) {
result = this.file.getId3v1Tag();
} else if (this.file.hasId3v2Tag()) {
result = this.file.getId3v2Tag();
} else {
throw new IOException("No ID3v1 or ID3v2 tag found");
}
return result;
}
开发者ID:driver733,项目名称:VKMusicUploader,代码行数:13,代码来源:BasicTagFromMp3File.java
示例5: parse
import com.mpatric.mp3agic.ID3v1; //导入依赖的package包/类
@Override
public MetaData parse(Object object) {
Assert.isTrue(object instanceof Mp3File, "Support Mp3File class only.");
Mp3File mp3 = (Mp3File)object;
MetaData metaData = new MetaData();
if (mp3.hasId3v2Tag()) {
ID3v2 id3v2Tag = mp3.getId3v2Tag();
metaData.put(Audio.MetaName.Album, id3v2Tag.getAlbum());
metaData.put(Audio.MetaName.Artist, id3v2Tag.getArtist());
metaData.put(Audio.MetaName.Genre, id3v2Tag.getGenreDescription());
metaData.put(Audio.MetaName.Title, id3v2Tag.getTitle());
metaData.put(Audio.MetaName.Track, id3v2Tag.getTrack());
}else if(mp3.hasId3v1Tag()) {
ID3v1 id3v1Tag = mp3.getId3v1Tag();
metaData.put(Audio.MetaName.Album, id3v1Tag.getAlbum());
metaData.put(Audio.MetaName.Artist, id3v1Tag.getArtist());
metaData.put(Audio.MetaName.Genre, id3v1Tag.getGenreDescription());
metaData.put(Audio.MetaName.Title, id3v1Tag.getTitle());
metaData.put(Audio.MetaName.Track, id3v1Tag.getTrack());
}
return metaData;
}
开发者ID:ivarptr,项目名称:clobaframe,代码行数:28,代码来源:Mp3MetaDataPaser.java
示例6: showId3v1Fields
import com.mpatric.mp3agic.ID3v1; //导入依赖的package包/类
private void showId3v1Fields(StringBuffer buffer) {
buffer.append("ID3v1 Data\n");
ID3v1 id3v1tag = mp3file.getId3v1Tag();
if (id3v1tag == null) {
buffer.append(" NONE!\n");
} else {
showField(buffer, "Track", id3v1tag.getTrack());
showField(buffer, "Artist", id3v1tag.getArtist());
showField(buffer, "Title", id3v1tag.getTitle());
showField(buffer, "Album", id3v1tag.getAlbum());
showField(buffer, "Year", id3v1tag.getYear());
showField(buffer, "Genre", id3v1tag.getGenreDescription());
showField(buffer, "Comment", id3v1tag.getComment());
}
}
开发者ID:mpatric,项目名称:mp3agic-examples,代码行数:16,代码来源:Mp3Details.java
示例7: invalid
import com.mpatric.mp3agic.ID3v1; //导入依赖的package包/类
@Test
public void invalid()
throws InvalidDataException, IOException, UnsupportedTagException {
final ID3v1 missing = new ID3v1AnnotatedSafe(
new BasicTagFromMp3File(
new Mp3File("src/test/resources/album/testMissingTags.mp3")
).construct()
);
MatcherAssert.assertThat(
missing.getAlbum(),
Matchers.equalTo("")
);
MatcherAssert.assertThat(
missing.getArtist(),
Matchers.equalTo("")
);
MatcherAssert.assertThat(
missing.getVersion(),
Matchers.equalTo("1")
);
MatcherAssert.assertThat(
missing.getTrack(),
Matchers.equalTo("")
);
MatcherAssert.assertThat(
missing.getTitle(),
Matchers.equalTo("")
);
MatcherAssert.assertThat(
missing.getYear(),
Matchers.equalTo("")
);
MatcherAssert.assertThat(
missing.getComment(),
Matchers.equalTo("")
);
MatcherAssert.assertThat(
missing.getGenre(),
Matchers.equalTo(-1)
);
MatcherAssert.assertThat(
missing.getGenreDescription(),
Matchers.equalTo("")
);
}
开发者ID:driver733,项目名称:VKMusicUploader,代码行数:46,代码来源:ID3v1AnnotatedSafeTest.java
示例8: getId3v1Tag
import com.mpatric.mp3agic.ID3v1; //导入依赖的package包/类
public ID3v1 getId3v1Tag() {
return id3v1Tag;
}
开发者ID:dimattiami,项目名称:ytdl,代码行数:4,代码来源:MyMp3FileOverride.java
示例9: setId3v1Tag
import com.mpatric.mp3agic.ID3v1; //导入依赖的package包/类
public void setId3v1Tag(ID3v1 id3v1Tag) {
this.id3v1Tag = id3v1Tag;
}
开发者ID:dimattiami,项目名称:ytdl,代码行数:4,代码来源:MyMp3FileOverride.java
示例10: construct
import com.mpatric.mp3agic.ID3v1; //导入依赖的package包/类
/**
* Checks the tag for missing items, such as album name.
* @return The {@link ID3v1} tag.
* @throws IOException If the tag has any of the requested items missing.
*/
ID3v1 construct() throws IOException;
开发者ID:driver733,项目名称:VKMusicUploader,代码行数:7,代码来源:BasicTag.java
示例11: ID3v1AnnotatedSafe
import com.mpatric.mp3agic.ID3v1; //导入依赖的package包/类
/**
* Ctor.
* @param tag Origin.
*/
public ID3v1AnnotatedSafe(final ID3v1 tag) {
this.tag = tag;
}
开发者ID:driver733,项目名称:VKMusicUploader,代码行数:8,代码来源:ID3v1AnnotatedSafe.java
注:本文中的com.mpatric.mp3agic.ID3v1类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论