Code Monkey home page Code Monkey logo

taglibkit's Introduction

TagLibKit: An SPM package for:

TaglibWrapper

A simple Objective C++ wrapper to call Taglib from Swift. This implies that you have already built and added the tag.framework to your project.

Simply add https://github.com/NCrusher74/TagLibKit.git branch: master to your Swift Package Dependencies.

Examples:

Get MP3 Chapters:

if let array = TaglibWrapper.getChapters(audioURL.path) as? [String] { ... }

Save MP3 Chapters: Pass an array of strings formatted like: "CHAPTER_TITLE@TIME_IN_MILLISECONDS"

let array = markers.map({ marker -> String in
    marker.name + "@" + String(Int(marker.time * 1000))
})
TaglibWrapper.setChapters(url.path, array: array)

Get metadata as NSDictionary:

guard let tag = TaglibWrapper.getMetadata(audioURL.path) else { ... }

Set metadata from Dictionary:

var dict = [String: String]()
dict["COMMENT"] = "Hi"

// general common tags
dict["TITLE"] = metadata.title
dict["ARTIST"] = metadata.composer
dict["COMPOSER"] = metadata.composer
dict["ALBUM"] = metadata.album
dict["GENRE"] = metadata.genre
dict["PUBLISHER"] = metadata.publisher
dict["BPM"] = String(metadata.bpm)

TaglibWrapper.setMetadata(path, dictionary: dict)

Some common key constants you could use in Swift:

public enum TaglibKeys {
	public static let comment = "COMMENT"
	public static let album = "ALBUM"
	public static let bpm = "BPM"
	public static let composer = "COMPOSER"
	public static let arranger = "ARRANGER"
	public static let genre = "GENRE"
	public static let grouping = "CONTENTGROUP"
	public static let title = "TITLE"
	public static let artist = "ARTIST"
	public static let publisher = "LABEL"
	public static let isrc = "ISRC"
	public static let contentGroup = "CONTENTGROUP"
	public static let chapter = "CHAP"
	public static let albumArtist = "ALBUMARTIST"
	public static let owner = "OWNER"
	public static let copyright = "COPYRIGHT"
	public static let subtitle = "SUBTITLE"
	public static let key = "INITIALKEY"
}

taglibkit's People

Contributors

ryanfrancesconi avatar katoemba avatar ncrusher74 avatar sdggiesbrecht avatar

Watchers

James Cloos avatar

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.