Skip to content

Commit

Permalink
Shorten Add*Frame funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
n10v committed Sep 27, 2018
1 parent 7e43476 commit c8c2e7f
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ func (tag *Tag) AddFrame(id string, f Framer) {

// AddAttachedPicture adds the picture frame to tag.
func (tag *Tag) AddAttachedPicture(pf PictureFrame) {
id := tag.CommonID("Attached picture")
tag.AddFrame(id, pf)
tag.AddFrame(tag.CommonID("Attached picture"), pf)
}

// AddCommentFrame adds the comment frame to tag.
func (tag *Tag) AddCommentFrame(cf CommentFrame) {
id := tag.CommonID("Comments")
tag.AddFrame(id, cf)
tag.AddFrame(tag.CommonID("Comments"), cf)
}

// AddTextFrame creates the text frame with provided encoding and text
Expand All @@ -67,20 +65,17 @@ func (tag *Tag) AddTextFrame(id string, encoding Encoding, text string) {
// AddUnsynchronisedLyricsFrame adds the unsynchronised lyrics/text frame
// to tag.
func (tag *Tag) AddUnsynchronisedLyricsFrame(uslf UnsynchronisedLyricsFrame) {
id := tag.CommonID("Unsynchronised lyrics/text transcription")
tag.AddFrame(id, uslf)
tag.AddFrame(tag.CommonID("Unsynchronised lyrics/text transcription"), uslf)
}

// AddUserDefinedTextFrame adds the custom frame (TXXX) to tag.
func (tag *Tag) AddUserDefinedTextFrame(uf UserDefinedTextFrame) {
id := tag.CommonID("User defined text information frame")
tag.AddFrame(id, uf)
func (tag *Tag) AddUserDefinedTextFrame(udtf UserDefinedTextFrame) {
tag.AddFrame(tag.CommonID("User defined text information frame"), udtf)
}

// AddUFIDFrame adds the unique file identifier frame (UFID) to tag.
func (tag *Tag) AddUFIDFrame(uf UFIDFrame) {
id := tag.CommonID("Unique file identifier")
tag.AddFrame(id, uf)
func (tag *Tag) AddUFIDFrame(ufid UFIDFrame) {
tag.AddFrame(tag.CommonID("Unique file identifier"), ufid)
}

// CommonID returns ID3v2.3 or ID3v2.4 (in appropriate to version of Tag) frame ID
Expand Down

0 comments on commit c8c2e7f

Please sign in to comment.