Documentation ¶
Overview ¶
Package audiometa is an all in one solution for reading and writing audio meta data in Go. It's the only Go module available that can read and write OGG Vorbis and OGG Opus metadata. audiometa supports several different filetypes and a wide range of tags.
Index ¶
- Constants
- Variables
- func OggPageChecksumSet(og *oggPage)
- func SaveTag(tag *IDTag, w io.Writer) error
- type FileType
- type IDTag
- func (tag *IDTag) AdditionalTags() map[string]string
- func (tag *IDTag) Album() string
- func (tag *IDTag) AlbumArtist() string
- func (tag *IDTag) Artist() string
- func (tag *IDTag) BPM() string
- func (tag *IDTag) ClearAllTags(preserveUnknown ...bool)
- func (tag *IDTag) Comments() string
- func (tag *IDTag) Composer() string
- func (tag *IDTag) CopyrightMsg() string
- func (tag *IDTag) Date() string
- func (tag *IDTag) EncodedBy() string
- func (tag *IDTag) FileType() string
- func (tag *IDTag) Genre() string
- func (tag *IDTag) Language() string
- func (tag *IDTag) Length() string
- func (tag *IDTag) Lyricist() string
- func (tag *IDTag) PartOfSet() string
- func (tag *IDTag) Publisher() string
- func (tag *IDTag) Save(w io.Writer) error
- func (tag *IDTag) SetAdditionalTag(id string, value string)
- func (tag *IDTag) SetAlbum(album string)
- func (tag *IDTag) SetAlbumArtFromByteArray(albumArt []byte) error
- func (tag *IDTag) SetAlbumArtFromFilePath(filePath string) error
- func (tag *IDTag) SetAlbumArtFromImage(albumArt *image.Image)
- func (tag *IDTag) SetAlbumArtist(albumArtist string)
- func (tag *IDTag) SetArtist(artist string)
- func (tag *IDTag) SetBPM(bpm string)
- func (tag *IDTag) SetComments(comments string)
- func (tag *IDTag) SetComposer(composer string)
- func (tag *IDTag) SetCopyrightMsg(copyrightMsg string)
- func (tag *IDTag) SetDate(date string)
- func (tag *IDTag) SetEncodedBy(encodedBy string)
- func (tag *IDTag) SetFileType(fileType string)
- func (tag *IDTag) SetGenre(genre string)
- func (tag *IDTag) SetLanguage(language string)
- func (tag *IDTag) SetLength(length string)
- func (tag *IDTag) SetLyricist(lyricist string)
- func (tag *IDTag) SetPartOfSet(partOfSet string)
- func (tag *IDTag) SetPublisher(publisher string)
- func (tag *IDTag) SetTitle(title string)
- func (tag *IDTag) SetYear(year string)
- func (tag *IDTag) Title() string
- func (tag *IDTag) Year() string
- type MP4Delete
- type ParseOptions
Constants ¶
const ( // Continuation of packet COP byte = 1 << iota // Beginning of stream BOS = 1 << iota // End of stream EOS = 1 << iota )
const ( ALBUM string = "album" ARTIST string = "artist" DATE string = "date" TITLE string = "title" GENRE string = "genre" )
const MIMEType = "application/ogg"
The MIME type as defined in RFC 3534.
Variables ¶
var ( ErrFLACParse = errors.New("error parsing flac stream") ErrFLACCmtParse = errors.New("error parsing flac comment") ErrMP4AtomOutOfBounds = errors.New("mp4 atom out of bounds") ErrMP4InvalidAtomSize = errors.New("mp4 atom has invalid size") ErrMP4InvalidEncoding = errors.New("invalid encoding: got wrong number of bytes") ErrMP4IlstAtomMissing = errors.New("ilst atom is missing") ErrMP4InvalidCntntType = errors.New("invalid content type") ErrOggInvalidSgmtTblSz = errors.New("invalid segment table size") ErrOggInvalidHeader = errors.New("invalid ogg header") ErrOggInvalidCRC = errors.New("invalid CRC") ErrOggMissingCOP = errors.New("missing ogg COP packet") ErrOggImgConfigFail = errors.New("failed to get image config") ErrOggCodecNotSpprtd = errors.New("unsupported codec for ogg") ErrMP3ParseFail = errors.New("error parsing mp3") ErrNoMethodAvlble = errors.New("no method available for this filetype") )
Functions ¶
func OggPageChecksumSet ¶ added in v2.2.6
func OggPageChecksumSet(og *oggPage)
OggPageChecksumSet sets the checksum for the Ogg page
Types ¶
type FileType ¶
type FileType string
func GetFileType ¶
GetFileType returns the file type of the file pointed to by filepath. If the filetype is not supported, an error is returned.
type IDTag ¶
The IDTag represents all of the metadata that can be retrieved from a file. The IDTag contains all tags for all audio types. Some tags may not be applicable to all types. Only the valid types are written to the respective data files. Although a tag may be set, if the function to write that tag attribute doesn't exist, the tag attribute will be ignored and the save function will not produce an error.
func Open ¶
func Open(r io.ReadSeeker, p ParseOptions) (*IDTag, error)
Open opens the tag for the passed in reader. It does not have to be a file, it can be a bytes.Reader, or any other interface that implements io.ReadSeeker
func OpenTagFromPath ¶
func OpenTagFromPath(filepath string, p ...ParseOptions) (*IDTag, error)
OpenTagFromPath Opens the ID tag for the corresponding file as long as it is a supported filetype Use the OpenTagFromPath command and you will be able to access all metadata associated with the file If you don't pass ParseOptions this function will try to detect the filetype by the extension. If the extension can't be detected an error will occur.
func (*IDTag) AdditionalTags ¶
AdditionalTags gets all additional (unmapped) tags
func (*IDTag) AlbumArtist ¶
AlbumArtist gets the album artist for a tag
func (*IDTag) ClearAllTags ¶
ClearAllTags clears all tags except the fileUrl tag which is used to reference the file, takes an optional parameter "preserveUnkown": when this is true passThroughMap is not cleared and unknown tags are preserved
func (*IDTag) CopyrightMsg ¶
CopyrightMs gets the Copyright Messgae for a tag
func (*IDTag) Save ¶
Save writes the full ID Tag and audio to the io.Writer w. If w is of type *os.File, Save overwrites the existing file and when complete, w points to the end of the file.
func (*IDTag) SetAdditionalTag ¶
SetAdditionalTag sets an additional (unmapped) tag taking an id and value (id,value) (ogg only)
func (*IDTag) SetAlbumArtFromByteArray ¶
SetAlbumArtFromByteArray sets the album art by passing a byte array for the album art
func (*IDTag) SetAlbumArtFromFilePath ¶
SetAlbumArtFromFilePath sets the album art by passing a filepath as a string
func (*IDTag) SetAlbumArtFromImage ¶
SetAlbumArtFromImage sets the album art by passing an *image.Image as the album art
func (*IDTag) SetAlbumArtist ¶
SetAlbumArtist sets the album artist for a tag
func (*IDTag) SetComments ¶
SetComments sets the comments for a tag
func (*IDTag) SetComposer ¶
SetComposer sets the composer for a tag
func (*IDTag) SetCopyrightMsg ¶
SetCopyrightMsg sets the Copyright Message for a tag
func (*IDTag) SetEncodedBy ¶
SetEncodedBy sets who encoded the tag
func (*IDTag) SetFileType ¶
SetFileType sets the filtype of the tag
func (*IDTag) SetLanguage ¶
SetLanguage sets the lanuguage of the tag
func (*IDTag) SetLyricist ¶
SetLyricist sets the lyricist for the tag
func (*IDTag) SetPartOfSet ¶
SetPartOfSet sets if the track is part of a set
func (*IDTag) SetPublisher ¶
SetPublisher sets the publisher for the tag
type ParseOptions ¶
type ParseOptions struct {
Format FileType
}
ParseOptions is a struct that is passed when parsing a tag. If included, you should set the format to one of the existing FileTypes