Giter Site home page Giter Site logo

ktaglib's Introduction

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.4
}

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

KTagLib().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 map to the file located at fileDescriptor. Existing tags with the same key are replaced.

Returns true if the tags are successfully updated.

ktaglib's People

Contributors

amcap1712 avatar paolovalerdi avatar timusus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ktaglib's Issues

Use HashMap for retrieving and writing tag fields

Instead of directly creating an AudioFile in the JNI from TagLib's PropertyMap, it is better to convert it into a Java/Kotlin HashMap.
The HashMap can be mapped in the Kotlin code to produce an AudioFile. This way any new tag fields can be supported or removed by only changing the Kotlin code. This is beneficial as the JNI code does not provide any compile time safety. Errors in the JNI code will lead to runtime crashes whereas the compiler will catch a large number of errors at the compile time. @timusus Thoughts ?

Overwrite / Save Artwork

I see we have the getArtwork method available but how do I replace or add a new artwork to the file?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.