metadata

package
v0.0.0-...-b88af98 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const BytesPerSector = 2352
View Source
const CDChannels = 2
View Source
const DataTrackGap = 11400
View Source
const DiscIDSize = 28
View Source
const Int16SamplesPerSector = BytesPerSector / (2 * CDChannels)
View Source
const SectorsPerSecond = 75
View Source
const TocIDSize = 28
View Source
const TocPregap = 150

Variables

View Source
var DefaultUserAgent = fmt.Sprintf("Mozilla/5.0 (compatible; METANOIA/%s; +https://git.gammaspectra.live/S.O.N.G/METANOIA) golang/%s (%s; %s; net/http; %s)", utilities.Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, runtime.Compiler)

DefaultUserAgent Follows most identification rules (Like for Musicbrainz, or Discogs)

Functions

func SetCacheStore

func SetCacheStore(store CacheStore)

Types

type Album

type Album struct {
	License                License
	SourceUniqueIdentifier string
	Name                   NameSlice
	Roles                  RoleSlice
	Art                    NameSlice
	Identifiers            NameSlice
	Tags                   NameSlice
	Links                  LinkSlice
	Discs                  []Disc
	ReleaseDate            time.Time
}

func (*Album) Copy

func (n *Album) Copy() *Album

func (*Album) Merge

func (n *Album) Merge(o *Album) (r *Album)

func (*Album) Normalize

func (n *Album) Normalize()

type AlbumNameSource

type AlbumNameSource interface {
	SourceMetadata
	FindByAlbumNames(names []Name) []*Album
}

type BadgerCacheStore

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

func NewBadgerCacheStore

func NewBadgerCacheStore(path string) (*BadgerCacheStore, error)

func (*BadgerCacheStore) Get

func (s *BadgerCacheStore) Get(request *http.Request) (response *http.Response, err error)

func (*BadgerCacheStore) Set

func (s *BadgerCacheStore) Set(request *http.Request, response *http.Response) (*http.Response, error)

type CDDB1

type CDDB1 uint32

func NewCDDB1FromString

func NewCDDB1FromString(cddb1 string) CDDB1

func (CDDB1) GetDuration

func (c CDDB1) GetDuration() time.Duration

func (CDDB1) GetStartTimeChecksum

func (c CDDB1) GetStartTimeChecksum() int

func (CDDB1) GetTrackNumber

func (c CDDB1) GetTrackNumber() int

func (CDDB1) String

func (c CDDB1) String() string

type CDDB1Source

type CDDB1Source interface {
	TOCSource
	FindByCDDB1(cddb CDDB1) []*Album
	FindByCDDB1Group(group []CDDB1) []*Album
}

type CacheStore

type CacheStore interface {
	Get(request *http.Request) (*http.Response, error)
	Set(request *http.Request, response *http.Response) (*http.Response, error)
}

type CachingClient

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

func NewCachingClient

func NewCachingClient(context string, rateLimit time.Duration) *CachingClient

func (*CachingClient) Request

func (c *CachingClient) Request(req *http.Request, lifetime time.Duration) (*http.Response, error)

type CatalogNumber

type CatalogNumber string

type CatalogSource

type CatalogSource interface {
	SourceMetadata
	FindByCatalogNumber(catalog CatalogNumber) []*Album
}

type Disc

type Disc struct {
	Name        NameSlice
	Identifiers NameSlice
	Links       LinkSlice
	Tracks      []Track
}

func (*Disc) Merge

func (n *Disc) Merge(o Disc) (r Disc)

func (*Disc) Normalize

func (n *Disc) Normalize()

type DiscID

type DiscID string

DiscID MusicBrainz Disc ID

type DiscIDSource

type DiscIDSource interface {
	TOCSource
	FindByDiscID(discId DiscID) []*Album
}

type LRCLyricTextEntry

type LRCLyricTextEntry struct {
	Start   time.Duration
	End     time.Duration
	Content string
}

type LRCLyrics

type LRCLyrics struct {
	Language    string
	Identifiers []Name
	Entries     []LRCLyricTextEntry
}

func NewLRCLyrics

func NewLRCLyrics(body, language string, identifiers []Name) *LRCLyrics

func (*LRCLyrics) GetContent

func (l *LRCLyrics) GetContent() string

func (*LRCLyrics) GetFormat

func (l *LRCLyrics) GetFormat() LyricsFormat

func (*LRCLyrics) GetIdentifiers

func (l *LRCLyrics) GetIdentifiers() []Name

func (*LRCLyrics) GetLanguage

func (l *LRCLyrics) GetLanguage() string

type License

type License struct {
	Attribution string
	Code        LicenseCode
	URL         string
}

type LicenseCode

type LicenseCode string
const (
	Unknown        LicenseCode = "Unknown"
	NC             LicenseCode = "NonCommercial"
	CC0            LicenseCode = "CC0"
	CC_BY_NC_SA_30 LicenseCode = "CC BY-NC-SA 3.0"
	CC_BY_SA_40    LicenseCode = "CC BY-SA 4.0"
)
type Link struct {
	Kind string
	Name NameSlice
}

func (*Link) Normalize

func (l *Link) Normalize()

type LinkSlice

type LinkSlice []Link

func (LinkSlice) Exists

func (s LinkSlice) Exists(role Link, loose bool) int

func (LinkSlice) MarshalJSON

func (s LinkSlice) MarshalJSON() ([]byte, error)

func (LinkSlice) Merge

func (s LinkSlice) Merge(o LinkSlice, loose bool) (r LinkSlice)

func (LinkSlice) Normalize

func (s LinkSlice) Normalize()

type LyricGetter

type LyricGetter func() []Lyrics

type Lyrics

type Lyrics interface {
	GetFormat() LyricsFormat
	GetIdentifiers() []Name
	GetLanguage() string
	GetContent() string
}

type LyricsFormat

type LyricsFormat string
const (
	ASS    LyricsFormat = "ASS"
	LRC    LyricsFormat = "LRC"
	WebVTT LyricsFormat = "WebVTT"
	SubRip LyricsFormat = "SubRip"
	Text   LyricsFormat = "Text"
)

type Name

type Name struct {
	Kind string
	Name string
}

func GenerateAlternateFromJapanese

func GenerateAlternateFromJapanese(text string) []Name

func (*Name) Normalize

func (n *Name) Normalize()

type NameSlice

type NameSlice []Name

func (NameSlice) AnyMatch

func (s NameSlice) AnyMatch(name NameSlice) bool

func (NameSlice) Exists

func (s NameSlice) Exists(name Name) int

func (NameSlice) GetKind

func (s NameSlice) GetKind(kind string) (result []string)

func (NameSlice) MarshalJSON

func (s NameSlice) MarshalJSON() ([]byte, error)

func (NameSlice) Match

func (s NameSlice) Match(name string) int

func (NameSlice) Merge

func (s NameSlice) Merge(o NameSlice) (r NameSlice)

func (NameSlice) Normalize

func (s NameSlice) Normalize()

type Role

type Role struct {
	Kind  string
	Name  NameSlice
	Group string
}

func (*Role) Normalize

func (n *Role) Normalize()

type RoleSlice

type RoleSlice []Role

func (RoleSlice) Exists

func (s RoleSlice) Exists(role Role, loose bool) int

func (RoleSlice) MarshalJSON

func (s RoleSlice) MarshalJSON() ([]byte, error)

func (RoleSlice) Merge

func (s RoleSlice) Merge(o RoleSlice, loose bool) (r RoleSlice)

func (RoleSlice) Normalize

func (s RoleSlice) Normalize()

type SourceMetadata

type SourceMetadata interface {
	GetName() string
	GetURL() string
	GetLicense() License
}

type TOC

type TOC []int

TOC includes a list, index 0 being total sectors/end, then start times follow, with TocPregap added

func NewTOCFromCTDB2String

func NewTOCFromCTDB2String(toc string) (r TOC)

func NewTOCFromCTDBString

func NewTOCFromCTDBString(toc string) (r TOC)

func NewTOCFromString

func NewTOCFromString(toc string, split ...string) (r TOC)

func (TOC) CDDBString

func (t TOC) CDDBString() string

func (TOC) CTDBString

func (t TOC) CTDBString() string

func (TOC) Equals

func (t TOC) Equals(o TOC) bool

func (TOC) GetAccurateRipData

func (t TOC) GetAccurateRipData() (byte, uint32, uint32, CDDB1)

func (TOC) GetCDDB1

func (t TOC) GetCDDB1() CDDB1

func (TOC) GetDiscID

func (t TOC) GetDiscID() DiscID

func (TOC) GetDuration

func (t TOC) GetDuration() time.Duration

func (TOC) GetTocID

func (t TOC) GetTocID() TocID

func (TOC) GetTrackDuration

func (t TOC) GetTrackDuration(index int) time.Duration

func (TOC) GetTrackNumber

func (t TOC) GetTrackNumber() int

func (TOC) MusicBrainzString

func (t TOC) MusicBrainzString() string

func (TOC) String

func (t TOC) String() string

type TOCSource

type TOCSource interface {
	SourceMetadata
	FindByTOC(toc TOC) []*Album
}

type TextLyrics

type TextLyrics struct {
	Language    string
	Identifiers []Name
	Entries     []string
}

func (*TextLyrics) GetContent

func (l *TextLyrics) GetContent() string

func (*TextLyrics) GetFormat

func (l *TextLyrics) GetFormat() LyricsFormat

func (*TextLyrics) GetIdentifiers

func (l *TextLyrics) GetIdentifiers() []Name

func (*TextLyrics) GetLanguage

func (l *TextLyrics) GetLanguage() string

type TocID

type TocID string

TocID CueTools CTDB TOCID

type TocIDSource

type TocIDSource interface {
	TOCSource
	FindByTocID(tocId TocID) []*Album
}

type Track

type Track struct {
	Name        NameSlice
	Identifiers NameSlice
	Roles       RoleSlice
	Links       LinkSlice
	Duration    time.Duration
	Lyrics      LyricGetter `json:"-"`
}

func (*Track) Merge

func (n *Track) Merge(o Track) (r Track)

func (*Track) Normalize

func (n *Track) Normalize()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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