develop
Michael Yang 2013-12-30 16:04:01 -05:00
rodzic 6d884ff16b
commit 949d42fdd3
1 zmienionych plików z 9 dodań i 10 usunięć

Wyświetl plik

@ -36,20 +36,19 @@ It's also a good idea to ensure that the file is closed using `defer`.
# Accessing Frames # Accessing Frames
Some commonly used frames have fields in the file for easier access. These Some commonly used frames have methods in the tag for easier access. These
frames are `Title`, `Artist`, `Album`, and `Genre`. frames are for `Title`, `Artist`, `Album`, `Year`, and `Genre`.
mp3File.Artist = "Okasian" mp3File.SetArtist("Okasian")
fmt.Println(mp3File.Artist) fmt.Println(mp3File.Artist())
## Other Frames ## Other Frames
Other frames can be accessed directly by using the `Frames` field of the Other frames can be accessed directly by using the `Frame` or `Frames` method
file, which is a map, keyed by ID3 frame identifiers, of slices containing of the file, which return the first frame or a slice of frames as `Framer`
`Framer` interfaces. This interfaces allow read access to general details of interfaces. This interfaces allow read access to general details of the file.
the file.
lyricsFrame := mp3File.Frames["USLT"][0] lyricsFrame := mp3File.Frame("USLT")
lyrics := lyricsFrame.String() lyrics := lyricsFrame.String()
If more specific information is needed, or frame-specific write access is If more specific information is needed, or frame-specific write access is
@ -57,4 +56,4 @@ needed, then the interface must be cast into the appropriate underlying type.
The example provided does not check for errors, but it is recommended to do The example provided does not check for errors, but it is recommended to do
so. so.
lyricsFrame := mp3File.Frames["USLT"][0].(*id3.UnsynchTextFrame) lyricsFrame := mp3File.Frame("USLT").(*id3.UnsynchTextFrame)