Ejemplo n.º 1
0
  private boolean setAlbumArt(
      byte[] imageBytes,
      String mp3Filename,
      String mp3outputFilename,
      String username,
      String title,
      String detailsUrl) {
    try {
      Mp3File mp3 = new Mp3File(mp3Filename);

      ID3Wrapper newId3Wrapper = new ID3Wrapper(new ID3v1Tag(), new ID3v23Tag());

      newId3Wrapper.setAlbum(username + ": " + title + " via SoundCloud.com");
      newId3Wrapper.setArtist(username);
      newId3Wrapper.setTitle(title);
      newId3Wrapper.setAlbumImage(imageBytes, "image/jpg");
      newId3Wrapper.setUrl(detailsUrl);
      newId3Wrapper.getId3v2Tag().setPadding(true);

      mp3.setId3v1Tag(newId3Wrapper.getId3v1Tag());
      mp3.setId3v2Tag(newId3Wrapper.getId3v2Tag());

      mp3.save(mp3outputFilename);

      return true;
    } catch (Throwable e) {
      return false;
    }
  }
Ejemplo n.º 2
0
  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;
    }
  }