当前位置: 首页>>代码示例>>Java>>正文


Java ID3v1Tag类代码示例

本文整理汇总了Java中org.jaudiotagger.tag.id3.ID3v1Tag的典型用法代码示例。如果您正苦于以下问题:Java ID3v1Tag类的具体用法?Java ID3v1Tag怎么用?Java ID3v1Tag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ID3v1Tag类属于org.jaudiotagger.tag.id3包,在下文中一共展示了ID3v1Tag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMp3Info

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
/**
 * 获取mp3信息
 *
 * @return
 */
public Mp3Info getMp3Info() {
    if (this.mp3Info == null) {
        try {
            MP3File mp3 = new MP3File(this.mSourceMp3File);
            ID3v1Tag v1 = mp3.getID3v1Tag();
            String encoding = v1.getEncoding();
            MP3AudioHeader header = (MP3AudioHeader) mp3.getAudioHeader();
            this.mp3Info = new Mp3Info();
            this.mp3Info.setTitle(StringUtil.convertEncode(v1.getFirst(FieldKey.TITLE), encoding));
            this.mp3Info.setArtist(StringUtil.convertEncode(v1.getFirst(FieldKey.ARTIST), encoding));
            this.mp3Info.setAlbum(StringUtil.convertEncode(v1.getFirst(FieldKey.ALBUM), encoding));
            this.mp3Info.setTrackLength(header.getTrackLength());
            this.mp3Info.setBiteRate(header.getBitRate());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return this.mp3Info;
}
 
开发者ID:zyl409214686,项目名称:Mp3Cutter,代码行数:25,代码来源:Mp3CutLogic.java

示例2: testConvertFromId3V1_Empty_v10

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
@Test(timeout = 8000)
public void testConvertFromId3V1_Empty_v10() {
  ID3v1Tag id3v1Tag = new ID3v1Tag();
  ID3v24Tag id3v24Tag = FlacToMp3Impl.convertFromId3V1(id3v1Tag);

  assertThat(id3v24Tag, notNullValue());

  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.ALBUM), null), equalTo(null));
  /* no FieldKey.ALBUM_ARTIST */
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.ARTIST), null), equalTo(null));
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.YEAR), null), equalTo(null));
  /* no FieldKey.DISC_NO */
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.GENRE), null), equalTo(null));
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.TITLE), null), equalTo(null));
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.TRACK), null), equalTo(null));
  /* no FieldKey.TRACK_TOTAL */
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:18,代码来源:TestFlacToMp3Impl.java

示例3: testConvertFromId3V1_Random_v10

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
@Test(timeout = 8000)
public void testConvertFromId3V1_Random_v10() throws KeyNotFoundException {
  ID3v1Tag id3v1Tag = TagHelper.getRandomID3v1Tag(true);

  ID3v24Tag id3v24Tag = FlacToMp3Impl.convertFromId3V1(id3v1Tag);

  assertThat(id3v24Tag, notNullValue());

  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.ALBUM), null),
      equalTo("Text=\"" + TagHelper.album + "\"; "));
  /* no FieldKey.ALBUM_ARTIST */
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.ARTIST), null),
      equalTo("Text=\"" + TagHelper.artist + "\"; "));
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.YEAR), null),
      equalTo("Text=\"" + TagHelper.date + "\"; "));
  /* no FieldKey.DISC_NO */
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.GENRE), null),
      equalTo("Text=\"" + TagHelper.genreNumber + "\"; "));
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.TITLE), null),
      equalTo("Text=\"" + TagHelper.title + "\"; "));
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.TRACK), null), equalTo(null));
  /* no FieldKey.TRACK_TOTAL */
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:24,代码来源:TestFlacToMp3Impl.java

示例4: testConvertFromId3V1_Random_v11

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
@Test(timeout = 8000)
public void testConvertFromId3V1_Random_v11() throws KeyNotFoundException {
  ID3v1Tag id3v1Tag = TagHelper.getRandomID3v1Tag(false);

  ID3v24Tag id3v24Tag = FlacToMp3Impl.convertFromId3V1(id3v1Tag);

  assertThat(id3v24Tag, notNullValue());

  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.ALBUM), null),
      equalTo("Text=\"" + TagHelper.album + "\"; "));
  /* no FieldKey.ALBUM_ARTIST */
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.ARTIST), null),
      equalTo("Text=\"" + TagHelper.artist + "\"; "));
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.YEAR), null),
      equalTo("Text=\"" + TagHelper.date + "\"; "));
  /* no FieldKey.DISC_NO */
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.GENRE), null),
      equalTo("Text=\"" + TagHelper.genreNumber + "\"; "));
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.TITLE), null),
      equalTo("Text=\"" + TagHelper.title + "\"; "));
  assertThat(TagUtils.concatenateTagFields(id3v24Tag.getFields(FieldKey.TRACK), null),
      equalTo("Text=\"" + TagHelper.tracknumber + "\"; "));
  /* no FieldKey.TRACK_TOTAL */
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:25,代码来源:TestFlacToMp3Impl.java

示例5: delete

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
/**
 * @param file
 * @throws IOException
 */
public void delete(RandomAccessFile file) throws IOException
{
    long filePointer;
    ID3v1Tag id3v1tag = new ID3v1Tag();


}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:12,代码来源:AbstractLyrics3.java

示例6: delete

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
/**
 * Remove tag from file
 *
 * @param mp3tag
 * @throws FileNotFoundException
 * @throws IOException
 */
public void delete(AbstractTag mp3tag) throws FileNotFoundException, IOException {
    RandomAccessFile raf = new RandomAccessFile(this.file, "rw");
    mp3tag.delete(raf);
    raf.close();
    if (mp3tag instanceof ID3v1Tag) {
        id3v1tag = null;
    }

    if (mp3tag instanceof AbstractID3v2Tag) {
        id3v2tag = null;
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:20,代码来源:MP3File.java

示例7: setTag

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
/**
 * Set the Tag
 * <p>
 * If the parameter tag is a v1tag then the v1 tag is set if v2tag then the v2tag.
 *
 * @param tag
 */
public void setTag(Tag tag) {
    this.tag = tag;
    if (tag instanceof ID3v1Tag) {
        setID3v1Tag((ID3v1Tag) tag);
    } else {
        setID3v2Tag((AbstractID3v2Tag) tag);
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:16,代码来源:MP3File.java

示例8: delete

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
public void delete(AbstractTag mp3tag) throws FileNotFoundException, IOException {
    RandomAccessFile raf = new RandomAccessFile(this.file, "rw");
    mp3tag.delete(raf);
    raf.close();
    if (mp3tag instanceof ID3v1Tag) {
        id3v1tag = null;
    }

    if (mp3tag instanceof AbstractID3v2Tag) {
        id3v2tag = null;
    }
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:13,代码来源:MP3File.java

示例9: setTag

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
public void setTag(Tag tag) {
    this.tag = tag;
    if (tag instanceof ID3v1Tag) {
        setID3v1Tag((ID3v1Tag) tag);
    } else {
        setID3v2Tag((AbstractID3v2Tag) tag);
    }
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:9,代码来源:MP3File.java

示例10: testCheck_NullMap

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
@Test(timeout = 8000)
public void testCheck_NullMap() {
  GenericTag tag = TypeUtilsForTests.setupTag("11", "1/1", "", "1", "2013", null, null, null, null);
  tag.addSourceTagClass(ID3v1Tag.class);

  /* set album title field to null */
  Map<GenericTagFieldName, Map<String, Set<String>>> fields = tag.getFields();
  fields.put(GenericTagFieldName.ALBUMTITLE, null);

  checker.check(tag);

  Map<GenericTagFieldName, List<ProblemReport>> reports = tag.getReports();
  assertThat(Integer.valueOf(reports.size()), equalTo(Integer.valueOf(0)));
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:15,代码来源:TestID3v1TagChecker.java

示例11: testCheck_EmptyMap

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
@Test(timeout = 8000)
public void testCheck_EmptyMap() {
  GenericTag tag = TypeUtilsForTests.setupTag("11", "1/1", "", "1", "2013", null, null, null, null);
  tag.addSourceTagClass(ID3v1Tag.class);

  /* set album title field to null */
  Map<GenericTagFieldName, Map<String, Set<String>>> fields = tag.getFields();
  fields.put(GenericTagFieldName.ALBUMTITLE, new HashMap<String, Set<String>>());

  checker.check(tag);

  Map<GenericTagFieldName, List<ProblemReport>> reports = tag.getReports();
  assertThat(Integer.valueOf(reports.size()), equalTo(Integer.valueOf(0)));
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:15,代码来源:TestID3v1TagChecker.java

示例12: write

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
/**
 * @param file
 * @throws IOException
 */
public void write(RandomAccessFile file) throws IOException
{
    String str;
    int offset;
    byte[] buffer;
    ID3v1Tag id3v1tag;

    id3v1tag = null;

    delete(file);
    file.seek(file.length());

    buffer = new byte[lyric.length() + 11 + 9];

    str = "LYRICSBEGIN";

    for (int i = 0; i < str.length(); i++)
    {
        buffer[i] = (byte) str.charAt(i);
    }

    offset = str.length();

    str = ID3Tags.truncate(lyric, 5100);

    for (int i = 0; i < str.length(); i++)
    {
        buffer[i + offset] = (byte) str.charAt(i);
    }

    offset += str.length();

    str = "LYRICSEND";

    for (int i = 0; i < str.length(); i++)
    {
        buffer[i + offset] = (byte) str.charAt(i);
    }

    offset += str.length();

    file.write(buffer, 0, offset);

    if (id3v1tag != null)
    {
        id3v1tag.write(file);
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:53,代码来源:Lyrics3v1.java

示例13: setID3v1Tag

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
public void setID3v1Tag(Tag id3v1tag) {
    logger.config("setting tagv1:v1 tag");
    this.id3v1tag = (ID3v1Tag) id3v1tag;
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:5,代码来源:MP3File.java

示例14: write

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
/**
 * @param file
 * @throws IOException
 */
public void write(RandomAccessFile file) throws IOException {
    String str;
    int offset;
    byte[] buffer;
    ID3v1Tag id3v1tag;

    id3v1tag = null;

    delete(file);
    file.seek(file.length());

    buffer = new byte[lyric.length() + 11 + 9];

    str = "LYRICSBEGIN";

    for (int i = 0; i < str.length(); i++) {
        buffer[i] = (byte) str.charAt(i);
    }

    offset = str.length();

    str = ID3Tags.truncate(lyric, 5100);

    for (int i = 0; i < str.length(); i++) {
        buffer[i + offset] = (byte) str.charAt(i);
    }

    offset += str.length();

    str = "LYRICSEND";

    for (int i = 0; i < str.length(); i++) {
        buffer[i + offset] = (byte) str.charAt(i);
    }

    offset += str.length();

    file.write(buffer, 0, offset);

    if (id3v1tag != null) {
        id3v1tag.write(file);
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:48,代码来源:Lyrics3v1.java

示例15: setID3v1Tag

import org.jaudiotagger.tag.id3.ID3v1Tag; //导入依赖的package包/类
public void setID3v1Tag(ID3v1Tag id3v1tag) {
    logger.config("setting tagv1:v1 tag");
    this.id3v1tag = id3v1tag;
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:5,代码来源:MP3File.java


注:本文中的org.jaudiotagger.tag.id3.ID3v1Tag类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。