pitcher

package module
v0.0.0-...-1c65ba8 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

README ¶

Pitcher 🎶

Track search and music metadata retrieval service, based on Musicbrainz data.

The main project's goal is to be able to match a simple Artist - Track string combination with full metadata retrieved from open databases, in a reasonably fast manner.

This repository includes :

  • The Pitcher microservice, which offers a simple API around music metadata search and retrieval.
  • A musicbrainz Helm chart to set up database import and replication Kubernetes jobs.
  • A SolrCloud core configuration with the search schema for track matching with Musicbrainz IDs.
  • Strimzi Kubernetes Custom Resources for the Kafka Connect setup allowing the Musicbrainz database and Solr track matching collection to stay in sync.

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

This section is empty.

Functions ¶

func CreateDB ¶

func CreateDB(config Config) (db *sqlx.DB, err error)

CreateDB returns database connection

func GetArtistData ¶

func GetArtistData(ctx context.Context, db *sqlx.DB, artistID string) (*pb.Artist, error)

GetArtistData returns Artist matching MusicBrainz ID

func GetArtistUrls ¶

func GetArtistUrls(ctx context.Context, db *sqlx.DB, artistID string) ([]*pb.URL, error)

GetArtistUrls return external urls for artists' releases

func GetArtistsData ¶

func GetArtistsData(ctx context.Context, db *sqlx.DB, artistIDs []string) ([]*pb.Artist, error)

GetArtistsData returns Artists matching a list of MusicBrainz IDs

func GetReleaseGroupUrls ¶

func GetReleaseGroupUrls(ctx context.Context, db *sqlx.DB, releaseGroupID string) ([]*pb.URL, error)

GetReleaseGroupUrls return external urls for release group's releases

func GetTrackData ¶

func GetTrackData(ctx context.Context, db *sqlx.DB, trackID string) (*pb.Track, error)

GetTrackData returns Track matching MusicBrainz ID

func GetTracksData ¶

func GetTracksData(ctx context.Context, db *sqlx.DB, trackIDs []string) ([]*pb.Track, error)

GetTracksData returns Tracks matching a list of MusicBrainz IDs

Types ¶

type Album ¶

type Album struct {
	ID          int          `db:"id" json:"-"`
	GID         string       `db:"gid" json:"mbid"`
	ReleaseGID  string       `db:"release_gid" json:"release_mbid"`
	Name        string       `db:"name" json:"name"`
	ReleaseDate *ReleaseDate `json:"release_date"`
}

Album structure

type Artist ¶

type Artist struct {
	GID  string `db:"gid" json:"mbid"`
	Name string `db:"name"json:"name"`
}

Artist structure

type Config ¶

type Config struct {
	Bind       string
	DbHost     string
	DbPort     string
	DbName     string
	DbUser     string
	DbPassword string
	SolrURL    string
}

type CoverFileInfo ¶

type CoverFileInfo struct {
	ID          int64  `db:"id"`
	Suffix      string `db:"suffix"`
	ReleaseMbID string `db:"-"`
}

func GetCoverFileInfoByReleaseGroup ¶

func GetCoverFileInfoByReleaseGroup(ctx context.Context, db *sqlx.DB, releaseGroupID string) (*CoverFileInfo, error)

GetCoverFileInfoByReleaseGroup returns image data for releaseGroupID

type NullInt64 ¶

type NullInt64 struct {
	sql.NullInt64
}

NullInt64 that can be marshalled with null value

func (NullInt64) MarshalJSON ¶

func (r NullInt64) MarshalJSON() ([]byte, error)

MarshalJSON that returns null-values on NULL sql columns

type PitcherServer ¶

type PitcherServer struct {
	pb.UnimplementedPitcherServer
	Config
	DB *sqlx.DB
}

func NewServer ¶

func NewServer(config Config) (*PitcherServer, error)

func (*PitcherServer) GetArtist ¶

func (s *PitcherServer) GetArtist(ctx context.Context, request *pb.ArtistRequest) (*pb.ArtistResponse, error)

func (*PitcherServer) GetArtistURLs ¶

func (s *PitcherServer) GetArtistURLs(ctx context.Context, request *pb.ArtistURLsRequest) (*pb.ArtistURLsResponse, error)

func (*PitcherServer) GetArtists ¶

func (s *PitcherServer) GetArtists(ctx context.Context, request *pb.ArtistsRequest) (*pb.ArtistsResponse, error)

func (*PitcherServer) GetCoverArt ¶

func (s *PitcherServer) GetCoverArt(ctx context.Context, request *pb.CoverArtRequest) (*pb.CoverArtResponse, error)

func (*PitcherServer) GetReleaseGroupURLs ¶

func (s *PitcherServer) GetReleaseGroupURLs(ctx context.Context, request *pb.ReleaseGroupURLsRequest) (*pb.ReleaseGroupURLsResponse, error)

func (*PitcherServer) GetTrack ¶

func (s *PitcherServer) GetTrack(ctx context.Context, request *pb.TrackRequest) (*pb.TrackResponse, error)

func (*PitcherServer) GetTracks ¶

func (s *PitcherServer) GetTracks(ctx context.Context, request *pb.TracksRequest) (*pb.TracksResponse, error)

func (*PitcherServer) MatchTrack ¶

func (s *PitcherServer) MatchTrack(ctx context.Context, request *pb.MatchingRequest) (*pb.MatchingResponse, error)

type PreferredCoverRelease ¶

type PreferredCoverRelease struct {
	MbID string `db:"mbid"`
}

type ReleaseDate ¶

type ReleaseDate struct {
	Year  NullInt64 `db:"date_year" json:"year"`
	Month NullInt64 `db:"date_month" json:"month"`
	Day   NullInt64 `db:"date_day" json:"day"`
}

ReleaseDate structure

type SolrDoc ¶

type SolrDoc struct {
	GID string `json:"gid"`
}

type SolrResponse ¶

type SolrResponse struct {
	Response SolrResponseBody `json:"response"`
}

type SolrResponseBody ¶

type SolrResponseBody struct {
	Docs []SolrDoc `json:"docs"`
}

type Track ¶

type Track struct {
	ID             int64   `db:"id" json:"id"`
	GID            string  `db:"gid" json:"mbid"`
	RecordingID    string  `db:"recording_id" json:"recording_mbid"`
	Name           string  `db:"name" json:"name"`
	MediumPosition int     `db:"medium_position" json:"medium_position"`
	Position       int     `db:"position" json:"position"`
	Length         int     `db:"length" json:"length"`
	Artist         *Artist `json:"artist"`
	Album          *Album  `json:"album"`
}

Track structure

Directories ¶

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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