Browse Source

Added information to README

main
Unbewohnte 3 years ago
parent
commit
fe2a273115
  1. 49
      README.md

49
README.md

@ -30,7 +30,7 @@ go install github.com/Unbewohnte/id3ed/...
# ∙ Examples
## ⚬ Decoding ID3v1
## ⚬ Reading ID3v1
```
package main
@ -45,24 +45,25 @@ func main() {
panic(err)
}
// extract ID3v1.1 tags
mp3tags, err := id3v1.Getv1Tag(mp3file)
// extract ID3v1.1 tag
mp3tag, err := id3v1.Readv1Tag(mp3file)
if err != nil {
panic(err)
}
// print all tags
fmt.Printf("%+v",mp3tags)
// print the whole tag
fmt.Printf("%+v",mp3tag)
songname := mp3tags.SongName
// get certain fields
songname := mp3tag.SongName
genre := mp3tags.Genre
genre := mp3tag.Genre
// etc.
}
```
## ⚬ Encoding ID3v1
## ⚬ Writing ID3v1
```
package main
@ -97,6 +98,38 @@ func main() {
}
```
## ⚬ Reading ID3v2
```
package main
import(
"fmt"
id3v2 "github.com/Unbewohnte/id3ed/v2"
)
func main() {
mp3file, err := os.Open("/path/to/mp3/myMP3.mp3")
if err != nil {
panic(err)
}
// extract ID3v2 tag
mp3tag, err := id3v2.Readv2Tag(mp3file)
if err != nil {
panic(err)
}
if mp3tag.Header.Version == id3v2.V2_3 {
// get certain frame by identifier
title := mp3tag.Frames["TIT2"]
artist := mp3tag.Frames["TPE1"]
}
// etc.
```
---
# ∙ Testing

Loading…
Cancel
Save