internal

package
v0.0.0-...-ac01db9 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const CompilationKeyword = "compilations"

!! Changing this value is a breaking change !!

Variables

This section is empty.

Functions

func ComputeChecksum

func ComputeChecksum(filepath string) (string, error)

func Contains

func Contains[T comparable](s []T, e T) bool

func Filter

func Filter[T any](ss []T, test func(T) bool) (ret []T)

func Fmap

func Fmap[T, U any](ts []T, f func(T, int) U) []U

Applies `f` to each element of ts

func GetFileAcousticFingerprint

func GetFileAcousticFingerprint(filepath string) (string, error)

func IsNumeric

func IsNumeric(s string) bool

func PrettifyValidationError

func PrettifyValidationError(validationsErrs error, prefix string) []error

Parameters should be the returned error from validator.New().Struct(..) prefix will be added at the beginning of every returned errors

func SanitizeAndValidateMetadata

func SanitizeAndValidateMetadata(m *Metadata) []error

Types

type Fingerprint

type Fingerprint struct {
	Fingerprint string `json:"fingerprint"`
}

type IllustrationLocation

type IllustrationLocation string
const (
	Embedded IllustrationLocation = "Embedded"
	Inline   IllustrationLocation = "Inline"
)

type Lyrics

type Lyrics interface {
	// contains filtered or unexported methods
}

func ParseLyrics

func ParseLyrics(s string) Lyrics

type Metadata

type Metadata struct {
	// True if the track is from a compilation album
	IsCompilation bool
	// Name of the artist of the track
	Artist string `validate:"required"`
	// Sort Name of the artist of the track
	SortArtist string
	// Name of the artist of the parent album
	AlbumArtist string
	// Sort Name of the album artist
	SortAlbumArtist string
	// Plain Lyrics of the song. One string == one line. Empty lines are line jumps
	PlainLyrics  PlainLyrics
	SyncedLyrics SyncedLyrics
	// Name of the album of the track
	Album string
	// Sort name of the album
	SortAlbum string
	// Name of the release of the track
	Release string
	// Name of the track
	Name string `validate:"required"`
	// Sort name of the track
	SortName string
	// Release date of the album
	AlbumReleaseDate *time.Time
	// Release date of the release
	ReleaseReleaseDate *time.Time
	// Index of the track on the disc
	Index int64
	// Index of the disc the track is on
	DiscIndex int64
	// Name of the disc
	DiscName string
	// Bitrate of the file, in kbps
	Bitrate int64 `validate:"gte=0"`
	Bpm     float64
	// Duration, in seconds
	Duration int64 `validate:"gte=0"`
	// Type of the track
	Type TrackType `validate:"required"`
	// Genres of the track
	Genres []string
	// Discogs ID of the parent release
	DiscogsId string
	// Name of the label that published thed release
	Label                   string
	IllustrationLocation    IllustrationLocation
	IllustrationStreamIndex int
	IllustrationPath        string
	RegistrationDate        time.Time `validate:"required"`
	Checksum                string    `validate:"required"`
	Path                    string    `validate:"required"`
	Fingerprint             *string
}

func Merge

func Merge(m1 Metadata, m2 Metadata) (Metadata, error)

Will override m1's values m2's if m1's is empty

type PlainLyrics

type PlainLyrics []string

type SyncedLyric

type SyncedLyric struct {
	// In seconds
	Timestamp float64 `json:"timestamp"`
	Content   string  `json:"content"`
}

type SyncedLyrics

type SyncedLyrics []SyncedLyric

func (SyncedLyrics) ToPlain

func (l SyncedLyrics) ToPlain() PlainLyrics

type TrackType

type TrackType string
const (
	Audio TrackType = "Audio"
	Video TrackType = "Video"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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