kopia lustrzana https://github.com/jcs/id3-go
Add text framer interface
rodzic
fdedb80c8d
commit
b312beddc1
9
frame.go
9
frame.go
|
@ -84,6 +84,15 @@ func (f DataFrame) Bytes() []byte {
|
|||
return f.data
|
||||
}
|
||||
|
||||
// TextFramer represents frames that contain encoded text
|
||||
type TextFramer interface {
|
||||
Framer
|
||||
Encoding() string
|
||||
SetEncoding(string) error
|
||||
Text() string
|
||||
SetText(string) error
|
||||
}
|
||||
|
||||
// TextFrame represents frames that contain encoded text
|
||||
type TextFrame struct {
|
||||
FrameHead
|
||||
|
|
8
id3v2.go
8
id3v2.go
|
@ -197,12 +197,10 @@ func (t *Tag) SetGenre(text string) {
|
|||
t.setTextFrameText(t.commonMap["Genre"], text)
|
||||
}
|
||||
|
||||
func (t *Tag) textFrame(id string) *TextFrame {
|
||||
func (t *Tag) textFrame(id string) TextFramer {
|
||||
if frame := t.Frame(id); frame != nil {
|
||||
switch frame.(type) {
|
||||
case (*TextFrame):
|
||||
return frame.(*TextFrame)
|
||||
default:
|
||||
if textFramer, ok := frame.(TextFramer); ok {
|
||||
return textFramer
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue