discogs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeArtists = iota
	ModeArtistsAliases
	ModeArtistsMemberships
	ModeLabels
	ModeMasters
	ModeMastersArtists
	ModeReleases
	ModeReleasesArtists
	ModeReleasesExtraArtists
	ModeReleasesLabels
)

Variables

View Source
var Tables = map[int]pgx.Identifier{
	ModeArtists:              pgx.Identifier{"discogs_artists"},
	ModeArtistsAliases:       pgx.Identifier{"discogs_artists_aliases"},
	ModeArtistsMemberships:   pgx.Identifier{"discogs_artists_members"},
	ModeLabels:               pgx.Identifier{"discogs_labels"},
	ModeMasters:              pgx.Identifier{"discogs_masters"},
	ModeMastersArtists:       pgx.Identifier{"discogs_master_artists"},
	ModeReleases:             pgx.Identifier{"discogs_releases"},
	ModeReleasesArtists:      pgx.Identifier{"discogs_release_artists"},
	ModeReleasesExtraArtists: pgx.Identifier{"discogs_release_extra_artists"},
	ModeReleasesLabels:       pgx.Identifier{"discogs_release_labels"},
}

Functions

This section is empty.

Types

type Artist

type Artist struct {
	ID          int64  `xml:"id"`
	Name        string `xml:"name"`
	RealName    string `xml:"realname"`
	Profile     string `xml:"profile"`
	DataQuality string `xml:"data_quality"`

	URLs           []string `xml:"urls>url"`
	Aliases        []Name   `xml:"aliases>name"`
	NameVariations []string `xml:"namevariations>name"`
	Members        []Name   `xml:"members>name"`
	Groups         []Name   `xml:"groups>name"`
}

func (Artist) AliasesColumns

func (a Artist) AliasesColumns() []string

func (Artist) Columns

func (a Artist) Columns() []string

func (Artist) MembershipsColumns

func (a Artist) MembershipsColumns() []string

func (*Artist) ToAliasesRecords

func (a *Artist) ToAliasesRecords() [][]any

func (*Artist) ToMembershipsRecords

func (a *Artist) ToMembershipsRecords() [][]any

func (*Artist) ToRecord

func (a *Artist) ToRecord() []any

type Company

type Company struct {
	ID             int64  `xml:"id"`
	Name           string `xml:"name"`
	EntityType     int64  `xml:"entity_type"`
	EntityTypeName string `xml:"entity_type_name"`
	ResourceURL    string `xml:"resource_url"`
}

type CopyFromDump

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

func NewCopyFromDump

func NewCopyFromDump(filename string, mode int) (ds *CopyFromDump, err error)

NewCopyFromDump opens a Discogs dump file and returns a CopyFromDump.

func (*CopyFromDump) Close

func (ds *CopyFromDump) Close() error

func (*CopyFromDump) Columns

func (ds *CopyFromDump) Columns() []string

func (*CopyFromDump) Err

func (ds *CopyFromDump) Err() error

See pgx.CopyFromSource interface for more details.

func (*CopyFromDump) Next

func (ds *CopyFromDump) Next() bool

Next returns true if there is another row and makes the next row data available to Values(). When there are no more rows available or an error has occurred it returns false. See pgx.CopyFromSource interface for more details.

func (*CopyFromDump) Table

func (ds *CopyFromDump) Table() pgx.Identifier

Table returns the name of the table the data should be copied to.

func (*CopyFromDump) Values

func (ds *CopyFromDump) Values() (value []any, err error)

Values returns the values for the current row. See pgx.CopyFromSource interface for more details.

type CopyFromRecordChannel

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

CopyFromRecordChannel implements pgx.CopyFromSource for channel-based data

func NewCopyFromRecordChannel

func NewCopyFromRecordChannel(recordChan <-chan []any) *CopyFromRecordChannel

func (*CopyFromRecordChannel) Err

func (c *CopyFromRecordChannel) Err() error

func (*CopyFromRecordChannel) Next

func (c *CopyFromRecordChannel) Next() bool

func (*CopyFromRecordChannel) Values

func (c *CopyFromRecordChannel) Values() ([]any, error)

type Dump

type Dump struct {
	Decoder *xml.Decoder
	// contains filtered or unexported fields
}

Dump is a wrapper around a discogs dump file. Dump implements the io.ReadCloser interface.

func OpenDumpFile

func OpenDumpFile(filename string) (*Dump, error)

OpenDiscogsDump creates a new DiscogsDump.

func (*Dump) Close

func (dd *Dump) Close() error

Close closes the dump file.

func (*Dump) Read

func (dd *Dump) Read(p []byte) (n int, err error)

type DumpFilename

type DumpFilename string

func (DumpFilename) Gzipped

func (fn DumpFilename) Gzipped() bool

func (DumpFilename) Month

func (fn DumpFilename) Month() string

func (DumpFilename) String

func (fn DumpFilename) String() string

func (DumpFilename) Type

func (fn DumpFilename) Type() string

func (DumpFilename) Year

func (fn DumpFilename) Year() string

type ExtraArtist

type ExtraArtist struct {
	ID   int64  `xml:"id"`
	Name string `xml:"name"`
	Anv  string `xml:"anv"`
	Role string `xml:"role"`
}

type Identifier

type Identifier struct {
	Type        string `xml:"type,attr"`
	Description string `xml:"description,attr"`
	Value       string `xml:"value,attr"`
}

type Label

type Label struct {
	ID          int64      `xml:"id"`
	Name        string     `xml:"name"`
	ContactInfo string     `xml:"contactinfo"`
	Profile     string     `xml:"profile"`
	DataQuality string     `xml:"data_quality"`
	URLs        []string   `xml:"urls>url"`
	ParentLabel SubLabel   `xml:"parentlabel>label"`
	SubLabels   []SubLabel `xml:"sublabels>label"`
}

func (Label) Columns

func (l Label) Columns() []string

func (*Label) ToRecord

func (l *Label) ToRecord() []any

type Master

type Master struct {
	ID          int64          `xml:"id,attr"`
	Artists     []MasterArtist `xml:"artists>artist"`
	MainRelease int64          `xml:"mainrelease"`
	DataQuality string         `xml:"data_quality"`
	Videos      []Video        `xml:"videos>video"`
	Title       string         `xml:"title"`
	Year        int32          `xml:"year"`
	Genres      []string       `xml:"genres>genre"`
	Styles      []string       `xml:"styles>style"`
}

func (Master) ArtistsColumns

func (m Master) ArtistsColumns() []string

func (Master) Columns

func (m Master) Columns() []string

func (*Master) ToArtistsRecords

func (m *Master) ToArtistsRecords() [][]any

func (*Master) ToRecord

func (m *Master) ToRecord() []any

type MasterArtist

type MasterArtist struct {
	ID   int64  `xml:"id"`
	Name string `xml:"name"`
	Anv  string `xml:"anv"`
	Join string `xml:"join"`
}

type MasterID

type MasterID struct {
	IsMainRelease bool  `xml:"is_main_release,attr"`
	ID            int64 `xml:",chardata"`
}

type MultiTableXMLParser

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

MultiTableXMLParser parses XML once and distributes records to multiple channels

func NewMultiTableXMLParser

func NewMultiTableXMLParser(filename string, channelMap map[int]chan []any, wg *sync.WaitGroup) (*MultiTableXMLParser, error)

func (*MultiTableXMLParser) Close

func (p *MultiTableXMLParser) Close() error

func (*MultiTableXMLParser) ParseAndDistribute

func (p *MultiTableXMLParser) ParseAndDistribute() error

type Name

type Name struct {
	ID   int64  `xml:"id,attr"`
	Name string `xml:",chardata"`
}

type Release

type Release struct {
	ID           int64           `xml:"id,attr"`
	MasterID     MasterID        `xml:"master_id"`
	Status       string          `xml:"status,attr"`
	Artists      []MasterArtist  `xml:"artists"`
	ExtraArtists []ExtraArtist   `xml:"extraartists>artist"`
	Title        string          `xml:"title"`
	Labels       []ReleaseLabel  `xml:"labels>label"`
	Country      string          `xml:"country"`
	Released     string          `xml:"released"`
	Notes        string          `xml:"notes"`
	DataQuality  string          `xml:"data_quality"`
	Genres       []string        `xml:"genres>genre"`
	Styles       []string        `xml:"styles>style"`
	Identifiers  []Identifier    `xml:"identifiers>identifier"`
	Videos       []Video         `xml:"videos>video"`
	Formats      []ReleaseFormat `xml:"formats>format"`
	Tracklist    []Track         `xml:"tracklist>track"`
	Companies    []Company       `xml:"companies>company"`
	Series       []Serie         `xml:"series>serie"`
}

func (Release) ArtistsColumns

func (r Release) ArtistsColumns() []string

func (Release) Columns

func (r Release) Columns() []string

func (Release) ExtraArtistsColumns

func (r Release) ExtraArtistsColumns() []string

func (Release) LabelsColumns

func (r Release) LabelsColumns() []string

func (*Release) ToArtistsRecords

func (r *Release) ToArtistsRecords() [][]any

func (*Release) ToExtraArtistsRecords

func (r *Release) ToExtraArtistsRecords() [][]any

func (*Release) ToLabelsRecords

func (r *Release) ToLabelsRecords() [][]any

func (*Release) ToRecord

func (r *Release) ToRecord() []any

type ReleaseFormat

type ReleaseFormat struct {
	Name         string   `xml:"name,attr"`
	Qty          string   `xml:"qty,attr"`
	Text         string   `xml:"text,attr"`
	Descriptions []string `xml:"descriptions>description"`
}

type ReleaseLabel

type ReleaseLabel struct {
	ID    int64  `xml:"id,attr"`
	Name  string `xml:"name,attr"`
	Catno string `xml:"catno,attr"`
}

type Serie

type Serie struct {
	Name  string `xml:"name,attr"`
	ID    int64  `xml:"id,attr"`
	Catno string `xml:"catno,attr"`
}

type SubLabel

type SubLabel struct {
	ID   int64  `xml:"id,attr"`
	Name string `xml:",chardata"`
}

type Track

type Track struct {
	Artists  []Artist `xml:"artists>artist"`
	Position string   `xml:"position,attr"`
	Title    string   `xml:"title"`
	Duration string   `xml:"duration"`
}

type Video

type Video struct {
	Src         string `xml:"src,attr" json:"src"`
	Duration    int32  `xml:"duration,attr" json:"duration"`
	Embed       string `xml:"embed,attr" json:"embed"`
	Title       string `xml:"title" json:"title"`
	Description string `xml:"description" json:"description"`
}

Jump to

Keyboard shortcuts

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