Latest 0.6.3
Homepage https://github.com/CrunchyBagel/OutcastID3
License MIT
Platforms ios 8.0, watchos 4.0, osx 10.11
Authors

CI Status
Version
License
Platform

A lightweight Swift library for reading and writing ID3 tags, including chapters.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Read an ID3 tag:

let url = Bundle.main.url(forResource: "MyFile", withExtension: "mp3")!

let mp3 = try MP3File(localUrl: url)
let tag = try x.readID3Tag()

let version = tag.tag.version

for frame in tag.tag.frames {
    switch frame {
    case let s as OutcastID3.Frame.StringFrame:
        print("(s.type.description): (s.str)")

    case let u as OutcastID3.Frame.UrlFrame:
        print("(u.type.description): (u.urlString)")

    case let comment as OutcastID3.Frame.CommentFrame:
        print("COMMENT: (comment)")

    case let transcription as OutcastID3.Frame.TranscriptionFrame:
        print("TRANSCRIPTION: (transcription)")

    case let picture as OutcastID3.Frame.PictureFrame:
        print("PICTURE: (picture)")

    case let f as OutcastID3.Frame.ChapterFrame:
        print("CHAPTER: (f)")

    case let toc as OutcastID3.Frame.TableOfContentsFrame:
        print("TOC: (toc)")

    case let rawFrame as OutcastID3.Frame.RawFrame:
        print("Unrecognised frame: (String(describing: rawFrame.frameIdentifier))")

    default:
        break
    }
}

Write an ID3 tag:


let frames: [OutcastID3TagFrame] = [
    OutcastID3.Frame.StringFrame(type: .title, encoding: .utf8, str: "Tag Writer Test")
]

let tag = OutcastID3.ID3Tag(
    version: .v2_4,
    frames: frames
)

let inputUrl = Bundle.main.url(forResource: "input", withExtension: "mp3")!

let outputUrl = Bundle.main.url(forResource: "output", withExtension: "mp3")!

let mp3File = try OutcastID3.MP3File(localUrl: inputUrl)

try mp3File.writeID3Tag(tag: tag, outputUrl: outputUrl)

Installation

OutcastID3 is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'OutcastID3'

Author

Crunchy Bagel, [email protected]

License

OutcastID3 is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "OutcastID3",
    "version": "0.6.3",
    "summary": "A simple Swift library to read ID3 tags from MP3s.",
    "description": "Read and write MP3 file ID3 data. Includes support for chapters.",
    "homepage": "https://github.com/CrunchyBagel/OutcastID3",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Crunchy Bagel": "[email protected]"
    },
    "source": {
        "git": "https://github.com/CrunchyBagel/OutcastID3.git",
        "tag": "0.6.3"
    },
    "social_media_url": "https://twitter.com/CrunchyBagel",
    "swift_version": "4.0",
    "platforms": {
        "ios": "8.0",
        "watchos": "4.0",
        "osx": "10.11"
    },
    "source_files": "OutcastID3/Classes/**/*"
}

Pin It on Pinterest

Share This