musicmeta

package module
v0.0.0-...-9063b11 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: MIT Imports: 10 Imported by: 0

README

Music Metadata Tools

Build Status Coverage Status

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AlbumTitleIgnoredPhrases = []*regexp.Regexp{
	regexp.MustCompile("(?i)\\s+(EP|LP)$"),
	regexp.MustCompile("(?i)\\s+\\([^)]*remaster[^)]*\\)$"),
	regexp.MustCompile("(?i)\\s+\\([^)]*deluxe[^)]*\\)$"),
	regexp.MustCompile("(?i)\\s+\\([^)]*version[^)]*\\)$"),
	regexp.MustCompile("(?i)parental\\s*advisory"),
}

AlbumTitleIgnoredPhrases is the arraty of regular expressions which will be stripped from album titles during the scrubbing process

View Source
var TrackTitleIgnoredPhrases = []*regexp.Regexp{
	regexp.MustCompile("(?i)\\([^)]*remaster[^)]*\\)$"),
	regexp.MustCompile("(?i)\\([^)]*version[^)]*\\)$"),
	regexp.MustCompile("(?i)\\([^)]*mix[^)]*\\)$"),
	regexp.MustCompile("(?i)\\([^)]*live[^)]*\\)$"),
	regexp.MustCompile("(?i)parental\\s*advisory"),
	regexp.MustCompile("(?i)(radio|deluxe|album|live|expanded)\\s*(edition|version|release|edit)?"),
}

TrackTitleIgnoredPhrases is the array of regular expressions which will be stripped from track titles during the scrubbing process

Functions

func CompareAlbumTitles

func CompareAlbumTitles(a, b string) (score, scrubbedScore float64)

CompareAlbumTitles calculates the similarity score (100 represents a perfect match) between the two submitted album titles. Two scores are returned. The first is the direct comparison, the second is the score after scrubbing noise words.

func CompareArtistName

func CompareArtistName(a, b string) (score, scrubbedScore float64)

CompareArtistName calculates the similarity score (100 represents a perfect match) between the two submitted artist names. Two scores are returned. The first is the direct comparison score. The second is the score after scrubbing noise words.

func CompareArtistNames

func CompareArtistNames(a, b []string) (score, scrubbedScore float64)

CompareArtistNames calculates the similarity score (100 represents a perfect match) between arrays of artist names. Each artist in the first slice is compared with each artist in the second. The best scores for each artist are kept, and the average match of all artists is returned.

func CompareDurations

func CompareDurations(a, b int) (score, scrubbedScore float64)

CompareDurations returns a score for the similarity of the durations of the two songs

func CompareTrackTitles

func CompareTrackTitles(a, b string) (score, scrubbedScore float64)

CompareTrackTitles calculates the similarity score (100 represents a perfect match) between the two submitted track titles. Two scores are returned. The first is the direct comparison, the second is the score after scrubbing noise words.

func DurationFromString

func DurationFromString(durStr string) time.Duration

DurationFromString converts a song length in string format (e.g. 00:00) and returns a time.Duration.

func DurationFromStringInSeconds

func DurationFromStringInSeconds(durStr string) int

DurationFromStringInSeconds converts a song length in string format (e.g. 00:00) and returns an integer representing the song's length in seconds.

func Scrub

func Scrub(original string) string

Scrub removes all punctuation and lowercases the word. If the original string was all punctuation, then it is returned to avoid losing vital information (there is a band called !!!, for example).

func ScrubAlbumTitle

func ScrubAlbumTitle(original string) string

ScrubAlbumTitle scrubs noise words for album titles, removes punctuation and lowercases

func ScrubArtistName

func ScrubArtistName(original string) string

ScrubArtistName scrubs noise words for artist names, removes punctuation and lowercases values

func ScrubTrackTitle

func ScrubTrackTitle(original string) string

ScrubTrackTitle scrubs noise words for song titles, removes punctuation and lowercases

Types

type ReleaseDate

type ReleaseDate struct {
	time.Time
}

ReleaseDate wraps a time.Time with application-specific XML and JSON Marshaling, and implements sql.Valuer

func DateFromString

func DateFromString(str string) ReleaseDate

DateFromString creates a Date by parsing the supplied string

func (ReleaseDate) MarshalJSON

func (date ReleaseDate) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding/json.Marshaler

func (*ReleaseDate) Scan

func (date *ReleaseDate) Scan(value interface{}) error

Scan implements the database/sql.Scanner interface

func (*ReleaseDate) ScanString

func (date *ReleaseDate) ScanString(s string)

ScanString is a helper for Scan() to handle string-based input parsing to time.Time.

func (ReleaseDate) String

func (date ReleaseDate) String() string

func (*ReleaseDate) UnmarshalJSON

func (date *ReleaseDate) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements encoding/json.Unmarshaler

func (*ReleaseDate) UnmarshalXML

func (date *ReleaseDate) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements encoding/xml.Unmarshaler

func (ReleaseDate) Value

func (date ReleaseDate) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer

Jump to

Keyboard shortcuts

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