flac

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: MIT Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// TagTitle Track/Work name
	TagTitle = "TITLE"
	// TagVersion The version field may be used to differentiate multiple versions of the same track title in a single collection. (e.g. remix info)
	TagVersion = "VERSION"
	// TagRemixer is the tracker remixer
	TagRemixer = "REMIXER"
	// TagAlbum The collection name to which this track belongs
	TagAlbum = "ALBUM"
	// TagArtist The artist generally considered responsible for the work.
	TagArtist = "ARTIST"
	// TagAlbumArtist is the main album artist
	TagAlbumArtist = "ALBUMARTIST"
	// TagTrackNumber The track number of this piece if part of a specific larger collection or album
	TagTrackNumber = "TRACKNUMBER"
	// TagDiscNumber is the disc number, for multi-disc releases
	TagDiscNumber = "DISCNUMBER"
	// TagDiscTotal is the total number of discs, for multi-disc releases
	TagDiscTotal = "DISCTOTAL"
	// TagDiscTotal2 is an alternative to DISCTOTAL
	TagDiscTotal2 = "TOTALDISCS"
	// TagTrackTotal is the total number of tracks for the current disc
	TagTrackTotal = "TRACKTOTAL"
	// TagTrackTotal2 is an alternative to TRACKTOTAL
	TagTrackTotal2 = "TOTALTRACKS"
	// TagPerformer The artist(s) who performed the work. In classical music this would be the conductor, orchestra, soloists.
	TagPerformer = "PERFORMER"
	// TagComposer is the composer (mainly for classical music)
	TagComposer = "COMPOSER"
	// TagAuthor is the author of the release
	TagAuthor = "AUTHOR"
	// TagConductor is the conductor (mainly for classical music)
	TagConductor = "CONDUCTOR"
	// TagMedia is the type of media (Digital WEB release, CD, etc)
	TagMedia = "MEDIA"
	// TagCopyright Copyright attribution
	TagCopyright = "COPYRIGHT"
	// TagLicense License information, eg, 'All Rights Reserved', 'Any Use Permitted', a URL to a license such as a Creative Commons license.
	TagLicense = "LICENSE"
	// TagRecordLabel Name of the organization producing the track (i.e. the 'record label')
	TagRecordLabel = "ORGANIZATION"
	// TagRecordLabel2 is an alternative for TagRecordLabel
	TagRecordLabel2 = "LABEL"
	// TagDescription A short text description of the contents
	TagDescription = "DESCRIPTION"
	// TagGenre A short text indication of music genre
	TagGenre = "GENRE"
	// TagDate Date the track was released
	TagDate = "DATE"
	// TagYear Year the track was released
	TagYear = "YEAR"
	// TagLocation Location where track was recorded
	TagLocation = "LOCATION"
	// TagContact Contact information for the creators or distributors of the track.
	TagContact = "CONTACT"
	// TagISRC ISRC number for the track.
	TagISRC = "ISRC"
	// TagUPC Universal Product Code for this release
	TagUPC = "UPC"
	// TagBarcode for this release
	TagBarcode = "BARCODE"
	// TagDuration of the track
	TagDuration = "DURATION"
)
View Source
const (
	FlacExt = ".flac"
)

Variables

View Source
var (
	ErrNoFlacHeader   = errors.New("fLaC head incorrect, possibly because of id3v2 tags")
	ErrorUncompressed = errors.New("flac seems to be uncompressed")
	ErrorID3v1Tag     = errors.New("id3v1 tag detected at end of file")
	ErrorMetadataSize = errors.New("excessive metadata blocks size")
)
View Source
var (
	ErrorNotVorbisComment = errors.New("not a vorbis comment metadata block")
	ErrorUnexpectedEof    = errors.New("unexpected end of stream")
	ErrorInvalidFieldName = errors.New("malformed Field Name")
	ErrorID3v2Header      = errors.New("found id3v2 tags, invalid FLAC file")
	ErrorFlacHeader       = errors.New("invalid fLaC header")
)

Functions

func CheckFLACHead added in v0.37.3

func CheckFLACHead(path string) error

func IsValidTag added in v0.34.0

func IsValidTag(tagName string) bool

func SmartArtistList

func SmartArtistList(artists []string) string

SmartArtistList returns a "a1, a2, & a3" list of artists.

Types

type Flac

type Flac struct {
	Path string

	OriginalVendor  string
	SampleRate      int
	BitDepth        int
	SampleCount     int64
	DurationSeconds float32
	Duration        string
	Size            int64
	AverageBitRate  int
	MD5             string
	HasCover        bool
	CoverSize       int
	// contains filtered or unexported fields
}

func New

func New(path string) (*Flac, error)

func NewFromReader added in v0.33.0

func NewFromReader(r io.Reader, path string) (*Flac, error)

func (*Flac) AddCover

func (f *Flac) AddCover(cover string, maxSizeKb int) error

func (*Flac) AddCoverFromBytes added in v0.33.0

func (f *Flac) AddCoverFromBytes(coverData []byte) error

AddCoverFromBytes assumes the cover is of valid size.

func (*Flac) AddTag

func (f *Flac) AddTag(field string, value string) error

func (*Flac) ApplyTags

func (f *Flac) ApplyTags(t *Tags) error

func (*Flac) Check

func (f *Flac) Check() error

Check flac integrity.

func (*Flac) CheckCompression

func (f *Flac) CheckCompression() error

func (*Flac) CheckDiscNumberInFilename

func (f *Flac) CheckDiscNumberInFilename() bool

func (*Flac) CheckFilenameContainsStartOfTitle

func (f *Flac) CheckFilenameContainsStartOfTitle(minTitleSize int) bool

func (*Flac) CheckForID3v1Tags added in v0.32.0

func (f *Flac) CheckForID3v1Tags() error

func (*Flac) CheckForMQAMetadata added in v0.38.0

func (f *Flac) CheckForMQAMetadata() bool

func (*Flac) CheckForMQASyncword added in v0.38.0

func (f *Flac) CheckForMQASyncword() (bool, error)

func (*Flac) CheckMetadataSize added in v0.32.0

func (f *Flac) CheckMetadataSize(maxSize int) error

func (*Flac) CheckTrackNumberInFilename

func (f *Flac) CheckTrackNumberInFilename() bool

func (*Flac) ClearMetadata

func (f *Flac) ClearMetadata()

func (*Flac) CommonTags

func (f *Flac) CommonTags() *Tags

func (*Flac) CompareBitDepth

func (f *Flac) CompareBitDepth(o *Flac) bool

func (*Flac) CompareEncoding

func (f *Flac) CompareEncoding(o *Flac) bool

func (*Flac) CompareSampleRate

func (f *Flac) CompareSampleRate(o *Flac) bool

func (*Flac) HasMinimalTags

func (f *Flac) HasMinimalTags() bool

func (*Flac) OverwriteTags

func (f *Flac) OverwriteTags(t *Tags) error

func (*Flac) RawTags added in v0.37.2

func (f *Flac) RawTags() map[string][]string

func (*Flac) SaveTags

func (f *Flac) SaveTags() error

func (*Flac) SetAlbum

func (f *Flac) SetAlbum(value string) error

func (*Flac) SetAlbumArtists

func (f *Flac) SetAlbumArtists(values []string, separateTags bool) error

func (*Flac) SetArtists

func (f *Flac) SetArtists(values []string, separateTags bool) error

func (*Flac) SetAuthors

func (f *Flac) SetAuthors(values []string, separateTags bool) error

func (*Flac) SetComposers

func (f *Flac) SetComposers(values []string, separateTags bool) error

func (*Flac) SetConductors

func (f *Flac) SetConductors(values []string, separateTags bool) error

func (*Flac) SetDescription

func (f *Flac) SetDescription(value string) error

func (*Flac) SetDiscNumber

func (f *Flac) SetDiscNumber(current, total string) error

func (*Flac) SetDuration

func (f *Flac) SetDuration(value string) error

func (*Flac) SetGenre

func (f *Flac) SetGenre(value string) error

func (*Flac) SetISRC

func (f *Flac) SetISRC(isrc string) error

func (*Flac) SetMedia

func (f *Flac) SetMedia(value string) error

func (*Flac) SetPerformers

func (f *Flac) SetPerformers(values []string, separateTags bool) error

func (*Flac) SetRecordLabel

func (f *Flac) SetRecordLabel(label string) error

func (*Flac) SetReleaseDate

func (f *Flac) SetReleaseDate(value string) error

func (*Flac) SetRemixers

func (f *Flac) SetRemixers(values []string, separateTags bool) error

func (*Flac) SetTag

func (f *Flac) SetTag(field string, value []string) error

func (*Flac) SetTitle

func (f *Flac) SetTitle(title, version string) error

func (*Flac) SetTrackNumber

func (f *Flac) SetTrackNumber(current, total string) error

func (*Flac) SetUPC

func (f *Flac) SetUPC(upc string) error

func (*Flac) String

func (f *Flac) String() string

func (*Flac) TotalPaddingSize added in v0.32.0

func (f *Flac) TotalPaddingSize() int

func (*Flac) Vendor

func (f *Flac) Vendor() string

type MetaDataBlockVorbisTags

type MetaDataBlockVorbisTags struct {
	Vendor string
	Tags   map[string][]string
}

func NewTags

func NewTags(vendor string) *MetaDataBlockVorbisTags

New creates a new MetaDataBlockVorbisTags.

func (*MetaDataBlockVorbisTags) Add

func (c *MetaDataBlockVorbisTags) Add(key string, val string) error

Add adds a key-val pair to the comments.

func (*MetaDataBlockVorbisTags) Get

func (c *MetaDataBlockVorbisTags) Get(key string) ([]string, error)

Get get all comments with field name specified by the key parameter.

func (MetaDataBlockVorbisTags) Marshal

func (c MetaDataBlockVorbisTags) Marshal() (flac.MetaDataBlock, error)

Marshal marshals this block back into a flac.MetaDataBlock.

func (*MetaDataBlockVorbisTags) Set

func (c *MetaDataBlockVorbisTags) Set(key string, val []string) error

Set adds a key-val pair to the comments.

type Tags

type Tags struct {
	TrackNumber string
	TotalTracks string
	DiscNumber  string
	TotalDiscs  string
	Artist      []string
	AlbumArtist []string
	Performer   []string
	Conductor   []string
	Author      []string
	Composer    []string
	Remixer     []string
	Guest       []string
	Title       string
	Description string
	Date        string
	Year        string
	Genre       string
	Album       string
	Label       string
	Version     string
	ISRC        string
	UPC         string
	Media       string
	Duration    string
	OtherTags   map[string]string
}

func (*Tags) PaddedNumber

func (t *Tags) PaddedNumber() string

PaddedNumber for track.

func (*Tags) SpecificTagsOnly added in v0.34.0

func (t *Tags) SpecificTagsOnly(tagsWanted []string)

func (*Tags) String

func (t *Tags) String() string

Jump to

Keyboard shortcuts

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