Skip to content

Commit

Permalink
split code into library and binary
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikh committed May 21, 2013
1 parent 432dd4e commit b15fae5
Show file tree
Hide file tree
Showing 6 changed files with 412 additions and 269 deletions.
32 changes: 32 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package main

import (
"fmt"
"honnef.co/go/id3"
"os"
)

func main() {
id3.Logging = true
tags, err := id3.Open(os.Args[1])
if err != nil {
panic(err)
}

err = tags.Parse()
if err != nil {
panic(err)
}

tags.Clear() // Remove all existing tags
tags.SetArtists([]string{"dominikh", "some other güy"})
fmt.Println(tags.Save())
// tags.SetTitle("A test file.")
// tags.SetAlbum("Proud test productions")
// tags.SetArtist("dominikh")
// // tags.SetTrack(1)
// tags.SetRecordingTime(time.Date(2009, 11, 10, 23, 0, 0, 0, time.UTC))
// tags.SetPublisher("Gophers united")
// tags.SetBPM(200) // utz utz utz
// fmt.Println(tags.Save())
}
44 changes: 44 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
Foo bar.
Supported versions
This library supports reading v2.3 and v2.4 tags, but only writing
v2.4 tags.
The primary reason for not allowing writing older versions is that
they cannot represent all data that is available with v2.4, and
designing the API in a way that's both user friendly and able to
reject data is not worth the trouble.
Automatic upgrading
The library's internal representation of tags matches that of v2.4.
When tags with an older version are being read, they will be
automatically converted to v2.4.
One consequence of this is that when you read a file with v2.3 tags
and immediately save it, it will now be a file with valid v2.4 tags.
The upgrade process makes following changes to the tags:
- TYER, TDAT and TIME get replaced by TDRC
- TORY gets replaced by TDOR
- XDOR gets replaced by TDOR
- The slash as a separator for multiple values gets replaced by null bytes
One special case is the TRDA frame because there is no way to
automatically convert it to v2.4. The upgrade process will not
directly delete the frame, so that you can manually upgrade it if
desired, but it won't be written back to the file. In reality, the frame
should be both rarely used and insignifcant enough to be a big loss.
Accessing and manipulating frames
There are two ways to access frames: Using provided getter and setter
methods (there is one for every standard frame), and working directly
with the underlying frames.
*/
package id3
2 changes: 1 addition & 1 deletion frames.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package id3

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion genres.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package id3

var Genres = []string{
"Blues",
Expand Down
Loading

0 comments on commit b15fae5

Please sign in to comment.