Browse Source

Now actually using constants

main
Unbewohnte 3 years ago
parent
commit
56823c4f0a
  1. 2
      id3v10.go
  2. 8
      id3v11.go

2
id3v10.go

@ -35,7 +35,7 @@ func GetID3v1Tags(rs io.ReadSeeker) (*ID3v1Tags, error) {
if !bytes.Equal(tag, []byte(ID3v1IDENTIFIER)) { if !bytes.Equal(tag, []byte(ID3v1IDENTIFIER)) {
// no TAG, given file does not use ID3v1 // no TAG, given file does not use ID3v1
return nil, fmt.Errorf("does not use ID3v1: expected %s; got %s", "TAG", tag) return nil, fmt.Errorf("does not use ID3v1: expected %s; got %s", ID3v1IDENTIFIER, tag)
} }
songname, err := readToString(rs, 30) songname, err := readToString(rs, 30)

8
id3v11.go

@ -32,9 +32,9 @@ func GetID3v11Tags(rs io.ReadSeeker) (*ID3v11Tags, error) {
return nil, err return nil, err
} }
if !bytes.Equal(tag, []byte("TAG")) { if !bytes.Equal(tag, []byte(ID3v1IDENTIFIER)) {
// no TAG, given file does not use ID3v1 // no TAG, given file does not use ID3v1
return nil, fmt.Errorf("does not use ID3v1: expected %s; got %s", "TAG", tag) return nil, fmt.Errorf("does not use ID3v1: expected %s; got %s", ID3v1IDENTIFIER, tag)
} }
songname, err := readToString(rs, 30) songname, err := readToString(rs, 30)
@ -111,7 +111,7 @@ func (tags *ID3v11Tags) Write(dst io.WriteSeeker) error {
dst.Seek(0, io.SeekEnd) dst.Seek(0, io.SeekEnd)
// TAG // TAG
_, err := dst.Write([]byte("TAG")) _, err := dst.Write([]byte(ID3v1IDENTIFIER))
if err != nil { if err != nil {
return fmt.Errorf("could not write to dst: %s", err) return fmt.Errorf("could not write to dst: %s", err)
} }
@ -189,7 +189,7 @@ func (tags *ID3v11Tags) WriteToFile(f *os.File) error {
return err return err
} }
if !bytes.Equal(tag, []byte("TAG")) { if !bytes.Equal(tag, []byte(ID3v1IDENTIFIER)) {
// no existing tag, just write given tags // no existing tag, just write given tags
err = tags.Write(f) err = tags.Write(f)
if err != nil { if err != nil {

Loading…
Cancel
Save