KTagLib
Kotlin bindings for TagLib
Gradle:
Step 1. Add the Jitpack repository to the root build.gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation("com.github.timusus:KTagLib:release-SNAPSHOT") // or kTagLib:1.1
}
See the sample app for an example of reading tags, using the Storage Access Framework.
Usage
Read Tags
Read the tags from a file descriptor:
KTagLib.getMetadata(fileDescriptor: Int)
This returns a Metadata object, containing the tags and audio properties of the audio file located at fileDescriptor, or null if none are found
Retrieve Artwork
getArtwork(fileDescriptor: Int)
Returns a ByteArray (or null) representing the image data of the largest image found.
Write Tags
fun writeMetadata(
fileDescriptor: Int,
properties : HashMap<String, ArrayList<String>>
): Boolean
Attempts to write the tags supplied via the HashMap to the file located at fileDescriptor. Existing tags with the same key are replaced.
Returns true if the tags are successfully updated.