taglib

package module
v0.0.0-...-79209c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2021 License: BSD-3-Clause Imports: 6 Imported by: 27

README

go-taglib

Go wrapper for taglib Build Status

Dependencies

You must have the static taglib libraries installed in order to compile go-taglib.

OSX:
brew install taglib
Ubuntu:
sudo apt-get install libtagc0-dev

Install

go get github.com/wtolson/go-taglib

Documentation

Checkout the documentation at http://godoc.org/github.com/wtolson/go-taglib

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalid = errors.New("invalid file")
)

Functions

func GetCCharPointer

func GetCCharPointer(s string) *C.char

Types

type File

type File struct {
	// contains filtered or unexported fields
}

func Read

func Read(filename string) (*File, error)

Reads and parses a music file. Returns an error if the provided filename is not a valid file.

func (*File) Album

func (file *File) Album() string

Returns a string with this tag's album name.

func (*File) Artist

func (file *File) Artist() string

Returns a string with this tag's artist.

func (*File) Bitrate

func (file *File) Bitrate() int

Returns the bitrate of the file in kb/s.

func (*File) Channels

func (file *File) Channels() int

Returns the number of channels in the audio stream.

func (*File) Close

func (file *File) Close()

Close and free the file.

func (*File) Comment

func (file *File) Comment() string

Returns a string with this tag's comment.

func (*File) Genre

func (file *File) Genre() string

Returns a string with this tag's genre.

func (*File) Length

func (file *File) Length() time.Duration

Returns the length of the file.

func (*File) Samplerate

func (file *File) Samplerate() int

Returns the sample rate of the file in Hz.

func (*File) Save

func (file *File) Save() error

Saves the \a file to disk.

func (*File) SetAlbum

func (file *File) SetAlbum(s string)

Sets the tag's album.

func (*File) SetArtist

func (file *File) SetArtist(s string)

Sets the tag's artist.

func (*File) SetComment

func (file *File) SetComment(s string)

Sets the tag's comment.

func (*File) SetGenre

func (file *File) SetGenre(s string)

Sets the tag's genre.

func (*File) SetTag

func (file *File) SetTag(tagname TagName, tagvalue string)

Sets the tag.

func (*File) SetTitle

func (file *File) SetTitle(s string)

Sets the tag's title.

func (*File) SetTrack

func (file *File) SetTrack(i int)

Sets the tag's track number. 0 indicates that this field should be cleared.

func (*File) SetYear

func (file *File) SetYear(i int)

Sets the tag's year. 0 indicates that this field should be cleared.

func (*File) Tag

func (file *File) Tag(tagname TagName) (tagvalue string)

Returns a string with this tag's comment.

func (*File) Title

func (file *File) Title() string

Returns a string with this tag's title.

func (*File) Track

func (file *File) Track() int

Returns the tag's track number or 0 if track number is not set.

func (*File) Year

func (file *File) Year() int

Returns the tag's year or 0 if year is not set.

type TagName

type TagName int
const (
	Album TagName = iota
	Artist
	Bitrate
	Channels
	Comments
	Genre
	Length
	Samplerate
	Title
	Track
	Year
)

Tag names

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL