tag

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package tag reads and writes audio metadata (tags, cover art, and lyrics) across the formats Shadowbox produces: Opus, MP3, M4A/MP4, and FLAC.

All writers are pure Go so the resulting binary links statically without CGO. Opus and FLAC are handled by rewriting Vorbis comments and embedded pictures directly; MP3 uses ID3v2 frames; MP4 uses iTunes-style atoms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(path string, m *Metadata) error

Write applies the metadata to the file at path, dispatching by extension.

Types

type ErrUnsupportedFormat

type ErrUnsupportedFormat struct{ Ext string }

ErrUnsupportedFormat is returned for file extensions Shadowbox cannot tag.

func (*ErrUnsupportedFormat) Error

func (e *ErrUnsupportedFormat) Error() string

type Metadata

type Metadata struct {
	Title       string
	Artist      string
	Album       string
	AlbumArtist string
	Date        string // year (YYYY)
	Genre       string
	TrackNumber string
	TotalTracks string
	DiscNumber  string
	TotalDiscs  string
	Composer    string
	Performer   string

	// Lyrics is plain-text, unsynchronised lyrics.
	Lyrics string

	// Cover is raw image bytes (JPEG or PNG). CoverMIME describes its type.
	Cover     []byte
	CoverMIME string
}

Metadata holds the tag fields Shadowbox can read or write. Empty fields are left untouched on write where the underlying format allows it.

func Read

func Read(path string) (*Metadata, error)

Read extracts metadata from the file at path, dispatching by extension.

func (*Metadata) HasCover

func (m *Metadata) HasCover() bool

HasCover reports whether cover image data is present.

Jump to

Keyboard shortcuts

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