ealvatag

Java library for reading and writing tag information of audio files

License

License

GroupId

GroupId

com.ealva
ArtifactId

ArtifactId

ealvatag
Last Version

Last Version

0.4.6
Release Date

Release Date

Type

Type

jar
Description

Description

ealvatag
Java library for reading and writing tag information of audio files
Project URL

Project URL

https://github.com/ealva-com/ealvatag
Source Code Management

Source Code Management

https://github.com/ealva-com/ealvatag

Download ealvatag

How to add to project

<!-- https://jarcasting.com/artifacts/com.ealva/ealvatag/ -->
<dependency>
    <groupId>com.ealva</groupId>
    <artifactId>ealvatag</artifactId>
    <version>0.4.6</version>
</dependency>
// https://jarcasting.com/artifacts/com.ealva/ealvatag/
implementation 'com.ealva:ealvatag:0.4.6'
// https://jarcasting.com/artifacts/com.ealva/ealvatag/
implementation ("com.ealva:ealvatag:0.4.6")
'com.ealva:ealvatag:jar:0.4.6'
<dependency org="com.ealva" name="ealvatag" rev="0.4.6">
  <artifact name="ealvatag" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.ealva', module='ealvatag', version='0.4.6')
)
libraryDependencies += "com.ealva" % "ealvatag" % "0.4.6"
[com.ealva/ealvatag "0.4.6"]

Dependencies

compile (5)

Group / Artifact Type Version
com.squareup.okio : okio jar 2.9.0
com.google.guava : guava jar 20.0
com.ealva : ealvalog jar 0.5.4
com.ealva : ealvalog-core jar 0.5.4
com.ealva : ealvalog-java jar 0.5.4

test (3)

Group / Artifact Type Version
junit : junit jar 4.13.1
org.mockito : mockito-core jar 3.6.0
org.hamcrest : hamcrest-junit jar 2.0.0.0

Project Modules

There are no modules declared in this project.

eAlvaTag

eAlvaTag is a Java API for reading and writing tag information of audio files. The follow types are currently supported:

  • Mp3
  • Flac
  • OggVorbis
  • Mp4
  • Aiff
  • Wav
  • Wma
  • Dsf

Until the version of this library reaches 1.0, you should consider the API to be very unstable (no Semantic Versioning until 1.0.0 and later). Pull requests welcome.

Quick Start

 class Test {
  public void test() {
      TagOptionSingleton.getInstance().isAndroid = true;  // Android - put in Application.onCreate()
      File inputFile = new File("MyFavoriteSong.mp3");
      AudioFile audioFile = AudioFileIO.read(inputFile);
    
      final AudioHeader audioHeader = audioFile.getAudioHeader();
      final int channels = audioHeader.getChannelCount();
      final int bitRate = audioHeader.getBitRate();
      final String encodingType = audioHeader.getEncodingType();
    
      Tag tag = audioFile.getTag().or(NullTag.INSTANCE);
      final String title = tag.getValue(FieldKey.TITLE).or("");
      if ("".equals(title)) {
        if (tag == NullTag.INSTANCE) {
          // there was no tag. set a new default tag for the file type
          tag = audioFile.setNewDefaultTag();
        }
      }
    
      tag.setField(FieldKey.TITLE, "My New Title");
      audioFile.save();
    
      final ImmutableSet<FieldKey> supportedFields = tag.getSupportedFields();
      if (supportedFields.contains(FieldKey.COVER_ART)) {
        System.out.println("File type supports Artwork");
      }
    }
  }

eAlvaLog is a very thin facade used by eAlvaTag for logging purposes. Each Logger instance created by eAlvaTag logs all output with a Marker found at ealvatag.logging.Log.MARKER. This allows for easy filtering so log output can be directed and/or filtered as needed. eAlvaLog provides a very light Android specific LoggerFactory if you only need log to the Android log. If using the java.util.logging logger framework, you may also add a handler at Loggers.INSTANCE.get("ealvatag") to add a Handler specifically for eAlvaTag library log output. See eAlvaLog for more details on configuring logging.

Add eAlvaTag to your project

Gradle:

compile 'com.ealva:ealvatag:0.4.6'

Maven:

<dependency>
    <groupId>com.ealva</groupId>
    <artifactId>ealvatag</artifactId>
    <version>0.4.6</version>
</dependency>

Ensure you have the most recent version by checking here

For the latest SNAPSHOT check here

Dependencies

Square's Okio Used for reading mp3 and mp4 files and will be further integrated. The segment pooling dramatically increased read performance over Jdk stream/file IO.

implementation 'com.squareup.okio:okio:2.9.0'

Google's Guava Used for Optional<>, Immutable collections, and general utilities

implementation 'com.google.guava:guava:20.0'

eAlvaLog Thin logging facade. Only the API is used in this library. For users of this library it currently supports the java.util.logging Logger and Android logging. It should be very easy to write a facade implementation for another logging framework if it's not already provided.

implementation 'com.ealva:ealvalog:0.5.4'
implementation 'com.ealva:ealvalog-core:0.5.4'
implementation 'com.ealva:ealvalog-java:0.5.4'

Android

ProGuard

-keep class ealvatag.tag.id3.framebody.** { *; }
-keep class ealvatag.tag.datatype.** { *; }
-dontwarn java.awt.geom.AffineTransform
-dontwarn java.awt.Graphics2D
-dontwarn java.awt.Image
-dontwarn java.awt.image.BufferedImage
-dontwarn javax.imageio.ImageIO
-dontwarn javax.imageio.ImageWriter
-dontwarn javax.imageio.stream.ImageInputStream
-dontwarn javax.swing.filechooser.FileFilter
-dontwarn sun.security.action.GetPropertyAction
-dontwarn java.nio.file.Paths
-dontwarn java.nio.file.OpenOption
-dontwarn java.nio.file.Files

License

Copyright 2018 Eric A. Snell

eAlvaTag is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

eAlvaTag is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with eAlvaTag.  If not, see <http://www.gnu.org/licenses/>.

Some files copyright by the original authors (see file headers)

History

This library started as Entagged Audio Tag library which was forked into Jaudiotagger. Jaudiotagger is still under active development at this time (January 2017)

Jaudiotagger was forked into this library, eAlvaTag for 2 primary reasons: to upgrade the license to GNU LGPLv3 and to focus on Android compatibility. GNU LGPLv3 is necessary to link to Apache License Version 2.0 libraries. As for Android compatibility, the previous library was dependent on java.nio library components not available on Android versions in current use. Also, quite a bit of refactoring was needed to make the library more performant on the Android platform.

Versions

Version
0.4.6
0.4.3
0.4.2
0.4.1
0.1.0
0.0.2