Coder Social home page Coder Social logo

gcottom / audiometa Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 1.0 56.85 MB

MP3, MP4(m4a, m4b), FLAC and OGG(Vorbis, Opus) meta data reader and writer for go

License: BSD 3-Clause "New" or "Revised" License

Go 100.00%
go mp3 mp4 ogg ogg-vorbis opus vorbis-comment flac m4a m4b metadata metadata-editor metadata-parser

audiometa's Introduction

audiometa

MP3/MP4/FLAC/OGG tag reader and writer for go

Go Reference Go Report Card Coverage Status

This package enables parsing and writing of ID tags for mp3, mp4 (m4a, m4b, m4p), FLAC, and ogg (Vorbis, OPUS) files.

All fields can be accessed via the provided accessor methods. Only supported fields per file type will return non zero data. The exception to this is that ogg files support a passthrough map. By setting kv pairs in the passthrough map, non-standard vorbis comment tags can be written to both ogg Vorbis and ogg OPUS files.

Parsable Fields Per FileType

MP3

Artist, AlbumArtist, Album, AlbumArt, BPM, ContentType, Comments, Composer, CopyrightMessage, Date, EncodedBy, FileType, Genre, Language, Length, Lyricist, PartOfSet, Publisher, Title, Year

MP4 & MP4 Types (m4a, m4b, m4p, mp4)

Artist, AlbumArtist, Album, AlbumArt, Comments, Composer, CopyrightMessage, EncodedBy, Genre, Title, Year

FLAC

Artist, Album, AlbumArt, Date, Genre, Title

OGG (Vorbis and OPUS within an ogg container)

Artist, AlbumArtist, Album, AlbumArt, Comment, Composer, Copyright, Date, Genre, Title, Publisher, (extended support for custom fields via passthrough map)

Writable Fields Per FileType

MP3

Artist, AlbumArtist, Album, AlbumArt, BPM, ContentType, Comments, Composer, CopyrightMessage, Date, EncodedBy, FileType, Genre, Language, Length, Lyricist, PartOfSet, Publisher, Title, Year

MP4 & MP4 Types (m4a, m4b, m4p, mp4)

Artist, AlbumArtist, Album, Comments, CopyrightMessage, Composer, Genre, Title, Year (AlbumArt is currently not writeable)

FLAC

Artist, Album, AlbumArt, Date, Genre, Title

OGG (Vorbis and OPUS within an ogg container)

Artist, AlbumArtist, Album, AlbumArt, Comment, Composer, Copyright, Date, Genre, Title, Publisher, (extended support for custom fields via passthrough map)

Usage

Open Tag For Reading From Path

tag, err := audiometa.OpenTagFromPath("./my-audio-file.mp3")
if err != nil{
    panic(err)
}

artist := tag.Artist()
album := tag.Album()
title := tag.Title()

Open Tag For Reading From io.ReadSeeker

f, err := os.Open("./my-audio-file.mp3")
tag, err := audiometa.Open(f, audiometa.ParseOptions{Format: audiometa.MP3}) //ParseOptions is only required if the file does not have an extension
if err != nil{
    panic(err)
}

artist := tag.Artist()
album := tag.Album()
title := tag.Title()

Update Tag

f, err := os.Open("./my-audio-file.mp3")
if err != nil{
    panic(err)
}
tag, err := audiometa.Open(f)
if err != nil{
    panic(err)
}
tag.SetArtist("Beyonce")
err = tag.Save(f)
if err != nil{
    panic(err)
}

Clear All Tags And Save

f, err := os.Open("./my-audio-file.mp3")
if err != nil{
    panic(err)
}
tag, err := audiometa.Open(f)
if err != nil{
    panic(err)
}
tag.ClearAllTags()
err = tag.Save(f)
if err != nil{
    panic(err)
}

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.