All Projects â†’ chicio â†’ Id3tageditor

chicio / Id3tageditor

Licence: mit
🎵🎞A Swift library to read and write ID3 Tag of any mp3 file. Supported ID3 tag version: 2.2, 2.3 and 2.4. Supported platform: iOS, macOS, tvOS, watchOS, Linux Ubuntu. 🎵🎞

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Id3tageditor

Web3.swift
A pure swift Ethereum Web3 library
Stars: ✭ 295 (+192.08%)
Mutual labels:  swift-linux, tvos, swift-package-manager
Queuer
Queuer is a queue manager, built on top of OperationQueue and Dispatch (aka GCD).
Stars: ✭ 964 (+854.46%)
Mutual labels:  tvos, swift-package-manager
Piano
🎹甚键盘8䞪键挔奏䞀銖蒲公英的纊定送给自己或月亮代衚我的心送给她
Stars: ✭ 850 (+741.58%)
Mutual labels:  music, mp3
Fontblaster
Programmatically load custom fonts into your iOS and tvOS app.
Stars: ✭ 1,000 (+890.1%)
Mutual labels:  tvos, swift-package-manager
Musicott
JavaFX application that manages and plays music files.
Stars: ✭ 97 (-3.96%)
Mutual labels:  music, mp3
Httpms
Media server with RESTful API and Web interface. Think of it as your very own Spotify!
Stars: ✭ 18 (-82.18%)
Mutual labels:  music, mp3
Sica
🊌 Simple Interface Core Animation. Run type-safe animation sequencially or parallelly
Stars: ✭ 980 (+870.3%)
Mutual labels:  tvos, swift-package-manager
Videoshow
Simple node.js utility to create video slideshows from images with optional audio and visual effects using ffmpeg
Stars: ✭ 618 (+511.88%)
Mutual labels:  music, mp3
Audiokit
Swift audio synthesis, processing, & analysis platform for iOS, macOS and tvOS
Stars: ✭ 8,827 (+8639.6%)
Mutual labels:  music, tvos
Musicdownloader
Material design YouTube mp3/mp4 downloader
Stars: ✭ 70 (-30.69%)
Mutual labels:  music, mp3
Deprecated Lame Mirror
[DEPRECATED] Old, Semi-official mirror of the CVS repository of the LAME MP3 encoder.
Stars: ✭ 73 (-27.72%)
Mutual labels:  music, mp3
Minimp3
Minimalistic MP3 decoder single header library
Stars: ✭ 898 (+789.11%)
Mutual labels:  music, mp3
Mutagen
Python module for handling audio metadata
Stars: ✭ 760 (+652.48%)
Mutual labels:  music, mp3
Alltomp3 App
Download and Convert YouTube, SoundCloud & Spotify in MP3 with full tags (title, artist, genre, cover, lyrics 🔥)
Stars: ✭ 920 (+810.89%)
Mutual labels:  music, mp3
Guitar
A Cross-Platform String and Regular Expression Library written in Swift.
Stars: ✭ 641 (+534.65%)
Mutual labels:  tvos, swift-package-manager
Audioworks
A cross-platform, multi-format audio conversion and tagging suite
Stars: ✭ 35 (-65.35%)
Mutual labels:  music, mp3
Yandex Music Download
Yandex Music Downloader
Stars: ✭ 94 (-6.93%)
Mutual labels:  music, mp3
Sablurimageview
You can use blur effect and it's animation easily to call only two methods.
Stars: ✭ 538 (+432.67%)
Mutual labels:  tvos, swift-package-manager
Spotify Downloader
Download your Spotify playlists and songs along with album art and metadata (from YouTube if a match is found).
Stars: ✭ 6,957 (+6788.12%)
Mutual labels:  music, mp3
Waterfallgrid
A waterfall grid layout view for SwiftUI.
Stars: ✭ 1,086 (+975.25%)
Mutual labels:  tvos, swift-package-manager

ID3TagEditor

Build iOS Build macOS Build watchOS Build tvOS Build Linux codebeat badge codecov Supported platform CocoaPods Version SwiftLint GitHub license

ID3TagEditor: A swift library to read and modify ID3 Tag of any mp3 file

A swift library to read and modify ID3 Tag of any mp3 file. Listed in the implementations section of the official ID3 standard website id3.org.


Installation

There are four ways to install ID3TagEditor in your project:

  • manual installation
  • framework
  • cocoapods
  • Swift Package Manager (with support for linux platform)

Manual installation

To manually install ID3TagEditor simply drag and drop all the file contained in the Source folder inside your project (except for the info.plist file).

Framework

ID3TagEditor is also available as a framework. You can follow the standard procedure to install a custom Cocoa Touch framework. Drag the ID3TagEditor.xcodeproj inside your project and add it to the Embedded Binaries/Linked Frameworks and Libraries section of your project. See the demo project for a complete example of the setup of the framework.

CocoaPods

ID3TagEditor is also available as a pod on CocoaPods. Add the dependency to your Podfile (choose the release version you prefer):

target 'MyApp' do
    pod 'ID3TagEditor', '~> 4.0'
end

and then run pod install (or pod update).

Swift Package Manager

ID3TagEditor is also available as a Swift Package for the Swift Package Manager. Add it to your dependecies in your Package.swift file. After that you can build your project with the command swift build, and eventually run you project (if it is an executable target) with the command swift run. If you want you can also run tests using swift test.

// swift-tools-version:5.0

import PackageDescription

let package = Package(
    name: "Demo Ubuntu",
    dependencies: [
        .package(url: "https://github.com/chicio/ID3TagEditor.git", from: "4.0.0")
    ],
    targets: [
        .target(
            name: "Demo Ubuntu",
            dependencies: ["ID3TagEditor"]
        )
    ]
)

Usage

ID3TagEditor is compatible with the following platforms:

  • iOS
  • MacOS
  • Apple Watch
  • Apple TV
  • Linux (on distros where Swift is available)

ID3TagEditor let you read and write ID3Tag to your mp3 files.

Read

To read the ID3 tag of an mp3 file you can choose between two API contained in the ID3TagEditor class:

  • public func read(from path: String) throws -> ID3Tag?
  • public func read(mp3: Data) throws -> ID3Tag?

Below you can find a sample code of the API usage.

do {
    let id3TagEditor = ID3TagEditor()

    if let id3Tag = try id3TagEditor.read(from: "<valid path to the mp3 file>") {
        // ...use the tag...
        // For example to read the title, album and artist content you can do something similar
        print((id3Tag.frames[.Title] as?  ID3FrameWithStringContent)?.content ?? "")
        print((id3Tag.frames[.Artist] as? ID3FrameWithStringContent)?.content ?? "")
        print((id3Tag.frames[.Album] as? ID3FrameWithStringContent)?.content ?? "")
    }
    
    if let id3Tag = try id3TagEditor.read(mp3: "<valid mp3 file passed as Data>") {
        // ...use the tag...
        // For example to read the title, album and artist content you can do something similar
        print((id3Tag.frames[.Title] as?  ID3FrameWithStringContent)?.content ?? "")
        print((id3Tag.frames[.Artist] as? ID3FrameWithStringContent)?.content ?? "")
        print((id3Tag.frames[.Album] as? ID3FrameWithStringContent)?.content ?? "")
    }    
} catch {
    print(error)
}  

To write a new ID3 tag into an mp3 file you can choose between two API contained in the ID3TagEditor class:

  • public func write(tag: ID3Tag, to path: String, andSaveTo newPath: String? = nil) throws
  • public func write(tag: ID3Tag, mp3: Data) throws -> Data

The only way to create a valid ID3Tag you can use one of the tag builder available:

  • ID32v2TagBuilder, a builder useful to create ID3 tag version 2.2
  • ID32v3TagBuilder, a builder useful to create ID3 tag version 2.3
  • ID32v4TagBuilder, a builder useful to create ID3 tag version 2.3

You can't create an instance of ID3Tag without one of the builders above. Below you can find a sample code that will write an ID3Tag version 3 with all the frames supported by ID3TagEditor to an mp3 file.

do {
    let id3Tag = ID32v3TagBuilder()
        .title(frame: ID3FrameWithStringContent(content: "title V3"))
        .album(frame: ID3FrameWithStringContent(content: "album V3"))
        .albumArtist(frame: ID3FrameWithStringContent(content: "album artist V3"))
        .artist(frame: ID3FrameWithStringContent(content: "artist V3"))
        .composer(frame: ID3FrameWithStringContent(content: "composer V3"))
        .conductor(frame: ID3FrameWithStringContent(content: "conductor V3"))
        .contentGrouping(frame: ID3FrameWithStringContent(content: "ContentGrouping V3"))
        .copyright(frame: ID3FrameWithStringContent(content: "Copyright V3"))
        .encodedBy(frame: ID3FrameWithStringContent(content: "EncodedBy V3"))
        .encoderSettings(frame: ID3FrameWithStringContent(content: "EncoderSettings V3"))
        .fileOwner(frame: ID3FrameWithStringContent(content: "FileOwner V3"))
        .lyricist(frame: ID3FrameWithStringContent(content: "Lyricist V3"))
        .mixArtist(frame: ID3FrameWithStringContent(content: "MixArtist V3"))
        .publisher(frame: ID3FrameWithStringContent(content: "Publisher V3"))
        .subtitle(frame: ID3FrameWithStringContent(content: "Subtitle V3"))
        .beatsPerMinute(frame: ID3FrameWithIntegerContent(value: 50))
        .originalFilename(frame: ID3FrameWithStringContent(content: "filenameV3.mp3"))
        .lengthInMilliseconds(frame: ID3FrameWithIntegerContent(value: 9000))
        .sizeInBytes(frame: ID3FrameWithIntegerContent(value: 1500))
        .genre(frame: ID3FrameGenre(genre: .metal, description: "Metalcore"))
        .discPosition(frame: ID3FramePartOfTotal(part: 1, total: 3))
        .trackPosition(frame: ID3FramePartOfTotal(part: 2, total: 9))
        .recordingDayMonth(frame: ID3FrameRecordingDayMonth(day: 5, month: 8))
        .recordingYear(frame: ID3FrameRecordingYear(year: 2020))
        .recordingHourMinute(frame: ID3FrameRecordingHourMinute(hour: 15, minute: 39))
        .attachedPicture(pictureType: .frontCover, frame: ID3FrameAttachedPicture(picture: <picture as Data object>, type: .frontCover, format: .jpeg))
        .attachedPicture(pictureType: .backCover, frame: ID3FrameAttachedPicture(picture: <picture as Data object>, type: .backCover, format: .jpeg))
        .unsynchronisedLyrics(language: .ita, frame: ID3FrameWithLocalizedContent(language: ID3FrameContentLanguage.ita, contentDescription: "CD", content: "v3 ita unsync lyrics"))
        .unsynchronisedLyrics(language: .eng, frame: ID3FrameWithLocalizedContent(language: ID3FrameContentLanguage.eng, contentDescription: "CD", content: "v3 eng unsync lyrics"))
        .iTunesGrouping(frame: ID3FrameWithStringContent(content: "ItunesGrouping V3"))
        .iTunesMovementName(frame: ID3FrameWithStringContent(content: "MovementName V3"))
        .iTunesMovementIndex(frame: ID3FrameWithIntegerContent(value: 6))
        .iTunesMovementCount(frame: ID3FrameWithIntegerContent(value: 13))
        .iTunesPodcastCategory(frame: ID3FrameWithStringContent(content: "PodcastCategory V3"))
        .iTunesPodcastDescription(frame: ID3FrameWithStringContent(content: "PodcastDescription V3"))
        .iTunesPodcastID(frame: ID3FrameWithStringContent(content: "PodcastID V3"))
        .iTunesPodcastKeywords(frame: ID3FrameWithStringContent(content: "PodcastKeywords V3"))
        .build()
    
    try id3TagEditor.write(tag: id3Tag, to: "<valid path to the mp3 file that will be overwritten>")
    try id3TagEditor.write(tag: id3Tag, 
                           to: "<valid path to the mp3 file>",
                           andSaveTo: "<new path where you want to save the mp3>")
    let newMp3: Data = try id3TagEditor.write(tag: id3Tag, mp3: <valid mp3 file passed as Data>)                          
} catch {
    print(error)
}    

Below you can find the list of the official ID3 frames supported by ID3TagEditor (see the enum FrameName and the builders shown above):

  • .title
  • .album
  • .albumArtist
  • .artist
  • .composer
  • .conductor
  • .contentGrouping
  • .copyright
  • .encodedBy
  • .encoderSettings
  • .fileOwner, available only for ID3 v2.3/v2.4
  • .lyricist
  • .mixArtist
  • .publisher
  • .subtitle
  • .beatsPerMinute
  • .originalFilename
  • .lengthInMilliseconds
  • .sizeInBytes, available only for ID3 v2.2/v2.3
  • .genre
  • .discPosition
  • .trackPosition
  • .recordingDayMonth, available only for ID3 v2.2/v2.3
  • .recordingYear, available only for ID3 v2.2/v2.3
  • .recordingHourMinute, available only for ID3 v2.2/v2.3
  • .recordingDateTime, available only for ID3 v2.4
  • .attachedPicture(_ pictureType: ID3PictureType), with support for multiple frames in the same tag distinguished by ID3PictureType
  • .unsynchronizedLyrics(_ language: ID3FrameContentLanguage), with support for multiple frames in the same tag distinguished by ID3FrameContentLanguage

In addition, ID3TagEditor supports the following iTunes unofficial frames:

  • .iTunesGrouping, available only for ID3 v2.3/v2.4
  • .iTunesMovementName, available only for ID3 v2.3/v2.4
  • .iTunesMovementIndex, available only for ID3 v2.3/v2.4
  • .iTunesMovementCount, available only for ID3 v2.3/v2.4
  • .iTunesPodcastCategory, available only for ID3 v2.3/v2.4
  • .iTunesPodcastDescription, available only for ID3 v2.3/v2.4
  • .iTunesPodcastID, available only for ID3 v2.3/v2.4
  • .iTunesPodcastKeyword, available only for ID3 v2.3/v2.4

All frames are encoded/formatted following the specification:

  • text frames (frames with identifier starting with a capital T) uses UTF-16 to encode text
  • frames with ad hoc encoding/formatting are supported (for example recordingDateTime must always be a ISO88591 string)
  • frames with localized content (e.g. .unsynchronizedLyrics) support all the languages identifier contained in the ISO-639-2 (see ID3FrameContentLanguage for the complete list of supported languages).
    Refer to the id3 specification for additional details.

Documentation

You can find the complete API documentation on fabrizioduroni.it.


Examples

In the following screenshots you can find examples of the data extracted/updated. In the demo project you will find an example for each supported target. You can also find more usage example in the read/write acceptance test.


Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].