Search in sources :

Example 6 with ID3v1Tag

use of com.frostwire.mp3.ID3v1Tag in project frostwire by frostwire.

the class SoundcloudDownload method setAlbumArt.

private boolean setAlbumArt(String mp3Filename, String mp3outputFilename) {
    try {
        byte[] imageBytes = HttpClientFactory.getInstance(HttpClientFactory.HttpContext.DOWNLOAD).getBytes(sr.getThumbnailUrl());
        Mp3File mp3 = new Mp3File(mp3Filename);
        ID3Wrapper newId3Wrapper = new ID3Wrapper(new ID3v1Tag(), new ID3v23Tag());
        newId3Wrapper.setAlbum(sr.getUsername() + ": " + sr.getDisplayName() + " via SoundCloud.com");
        newId3Wrapper.setArtist(sr.getUsername());
        newId3Wrapper.setTitle(sr.getDisplayName());
        newId3Wrapper.setAlbumImage(imageBytes, "image/jpg");
        newId3Wrapper.setUrl(sr.getDetailsUrl());
        newId3Wrapper.getId3v2Tag().setPadding(true);
        mp3.setId3v1Tag(newId3Wrapper.getId3v1Tag());
        mp3.setId3v2Tag(newId3Wrapper.getId3v2Tag());
        mp3.save(mp3outputFilename);
        return true;
    } catch (Throwable e) {
        return false;
    }
}
Also used : Mp3File(com.frostwire.mp3.Mp3File) ID3Wrapper(com.frostwire.mp3.ID3Wrapper) ID3v1Tag(com.frostwire.mp3.ID3v1Tag) ID3v23Tag(com.frostwire.mp3.ID3v23Tag)

Example 7 with ID3v1Tag

use of com.frostwire.mp3.ID3v1Tag in project mpeg-audio-streams by addradio.

the class ID3v1TagCodec method decodeID3v1Tag.

/**
 * decodeID3v1Tag.
 * @param bis {@link BitInputStream}
 * @return {@link ID3v1Tag}
 * @throws IOException due to IO problems.
 * @throws UnsupportedEncodingException while byte to string conversion.
 * @throws MPEGAudioCodecException if {@link Genre} could not be decoded.
 */
public static final ID3v1Tag decodeID3v1Tag(final BitInputStream bis) throws IOException, UnsupportedEncodingException, MPEGAudioCodecException {
    final ID3v1Tag tag = new ID3v1Tag();
    tag.setTitle(ID3CodecTools.readStringFromStream(bis, 30));
    tag.setArtist(ID3CodecTools.readStringFromStream(bis, 30));
    tag.setAlbum(ID3CodecTools.readStringFromStream(bis, 30));
    tag.setTitle(ID3CodecTools.readStringFromStream(bis, 30));
    final String readStringFromStream = ID3CodecTools.readStringFromStream(bis, 4);
    tag.setYear(saveParseInt(readStringFromStream));
    tag.setComment(ID3CodecTools.readStringFromStream(bis, 30));
    tag.setGenre((Genre) BitMaskFlagCodec.decode(bis.read(), Genre.class));
    return tag;
}
Also used : ID3v1Tag(net.addradio.codec.id3.model.v1.ID3v1Tag)

Aggregations

ID3v1Tag (org.jaudiotagger.tag.id3.ID3v1Tag)4 ID3Wrapper (com.frostwire.mp3.ID3Wrapper)2 ID3v1Tag (com.frostwire.mp3.ID3v1Tag)2 ID3v23Tag (com.frostwire.mp3.ID3v23Tag)2 Mp3File (com.frostwire.mp3.Mp3File)2 IOException (java.io.IOException)1 ByteBuffer (java.nio.ByteBuffer)1 FileChannel (java.nio.channels.FileChannel)1 ID3v1Tag (net.addradio.codec.id3.model.v1.ID3v1Tag)1 DLNAMediaAudio (net.pms.dlna.DLNAMediaAudio)1