⬥ ID3 encoding/decoding library in Go ⬥
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Unbewohnte 34ae10f72d Updated README 3 years ago
testData Added checks for already existing ID3v1.x tags 3 years ago
LICENSE Dirty and minimal ID3v1 reading support 3 years ago
README.md Updated README 3 years ago
constants.go Moved constant values into their own file, started working on ID3v2 3 years ago
go.mod Dirty and minimal ID3v1 reading support 3 years ago
id3v1genres.go id3v1genres map is unexported now 3 years ago
id3v10.go Moved constant values into their own file, started working on ID3v2 3 years ago
id3v10_test.go Less verbose and more understandable function names 3 years ago
id3v11.go Moved constant values into their own file, started working on ID3v2 3 years ago
id3v11_test.go Less verbose and more understandable function names 3 years ago
id3v20.go Moved constant values into their own file, started working on ID3v2 3 years ago
metadata.go Less verbose and more understandable function names 3 years ago
util.go Fixed poor English 3 years ago

README.md

ID3ED (ID3 - Encoder - Decoder)

Library for encoding/decoding ID3 tags


Under construction !


Installation

go get github.com/Unbewohnte/id3ed

Usage

Decoding ID3v1.1

package main

import(
    "fmt"
    "github.com/Unbewohnte/id3ed"
)

func main() {
    mp3file, err := os.Open("/path/to/mp3/myMP3.mp3")
    if err != nil {
        panic(err)
    }

    // extract ID3v1.1 tags 
    mp3tags, err := GetID3v11Tags(mp3file)
    if err != nil {
       panic(err)
    }

    // print all tags
    fmt.Printf("%+v",mp3tags)

    songname := mp3tags.SongName

    genre := mp3tags.Genre

    // etc.
}

Encoding ID3v1.1

	f, err := os.OpenFile("/path/to/file/myfile.mp3",os.O_WRONLY, os.ModePerm)
	if err != nil {
		panic(err)
	}
	defer f.Close()

    // create your tags struct
	tags := &ID3v11Tags{
		SongName: "mysong",
		Artist:   "me",
		Album:    "my album",
		Year:     2021,
		Comment:  "Cool song",
        Track:    1,
		Genre:    "Christian Gangsta Rap", // list of genres see "id3v1genres.go"
	}

    // write tags to file
	err = tags.WriteToFile(f)
	if err != nil {
		panic(err)
	}

Testing

go test

or

go test -v

to get a verbose output


License

MIT LICENSE