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 # ∙ Examples
## ⚬ Decoding ID3v1 ## ⚬ Reading ID3v1
``` ```
package main package main
@ -45,24 +45,25 @@ func main() {
panic(err) panic(err)
} }
// extract ID3v1.1 tags // extract ID3v1.1 tag
mp3tags, err := id3v1.Getv1Tag(mp3file) mp3tag, err := id3v1.Readv1Tag(mp3file)
if err != nil { if err != nil {
panic(err) panic(err)
} }
// print all tags // print the whole tag
fmt.Printf("%+v",mp3tags) fmt.Printf("%+v",mp3tag)
songname := mp3tags.SongName // get certain fields
songname := mp3tag.SongName
genre := mp3tags.Genre genre := mp3tag.Genre
// etc. // etc.
} }
``` ```
## ⚬ Encoding ID3v1 ## ⚬ Writing ID3v1
``` ```
package main 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 # ∙ Testing

Loading…
Cancel
Save