deezer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ChunkSize = 2048

Variables

This section is empty.

Functions

func GetData

func GetData(r Resource, id string) error

Types

type Album

type Album struct {
	Data struct {
		Title               string `json:"ALB_TITLE"`
		Artist              string `json:"ART_NAME"`
		OriginalReleaseDate string `json:"ORIGINAL_RELEASE_DATE"`
		PhysicalReleaseDate string `json:"PHYSICAL_RELEASE_DATE"`
		Label               string `json:"LABEL_NAME"`
		ProducerLine        string `json:"PRODUCER_LINE"`
	} `json:"DATA"`
	Songs struct {
		Data []*Song `json:"data"`
	} `json:"SONGS"`
}

func (*Album) GetOutputPath

func (a *Album) GetOutputPath(outputDir string) string

func (*Album) GetSongs

func (a *Album) GetSongs() []*Song

func (*Album) GetTitle

func (a *Album) GetTitle() string

func (*Album) GetURL

func (a *Album) GetURL(id string) string

func (*Album) UnmarshalData

func (a *Album) UnmarshalData(data []byte) error

type Cipher

type Cipher struct {
	Type string `json:"type"`
}

type Media

type Media struct {
	Errors []MediaError `json:"errors"`
	Data   []struct {
		Media []struct {
			Type    string   `json:"media_type"`
			Cipher  Cipher   `json:"cipher"`
			Format  string   `json:"format"`
			Sources []Source `json:"sources"`
		}
		Errors []MediaError `json:"errors"`
	} `json:"data"`
}

func (*Media) Download

func (m *Media) Download(url, path, songID string) error

type MediaError

type MediaError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type Playlist

type Playlist struct {
	Data struct {
		Title     string `json:"TITLE"`
		Status    int    `json:"STATUS"`
		CollabKey string `json:"COLLAB_KEY"`
	} `json:"DATA"`
	Songs struct {
		Data []*Song `json:"data"`
	} `json:"SONGS"`
}

func (*Playlist) GetOutputPath

func (p *Playlist) GetOutputPath(outputDir string) string

func (*Playlist) GetSongs

func (p *Playlist) GetSongs() []*Song

func (*Playlist) GetTitle

func (p *Playlist) GetTitle() string

func (*Playlist) GetURL

func (p *Playlist) GetURL(id string) string

func (*Playlist) UnmarshalData

func (p *Playlist) UnmarshalData(data []byte) error

type Resource

type Resource interface {
	GetURL(id string) string
	UnmarshalData(data []byte) error
	GetSongs() []*Song
	GetOutputPath(outputDir string) string
	GetTitle() string
}

type Song

type Song struct {
	ID           string `json:"SNG_ID"`
	Artist       string `json:"ART_NAME"`
	Title        string `json:"SNG_TITLE"`
	Version      string `json:"VERSION"`
	Cover        string `json:"ALB_PICTURE"`
	Contributors struct {
		MainArtists []string `json:"main_artist"`
		Composers   []string `json:"composer"`
		Authors     []string `json:"author"`
	} `json:"SNG_CONTRIBUTORS"`
	Duration    string `json:"DURATION"`
	Gain        string `json:"GAIN"`
	ISRC        string `json:"ISRC"`
	TrackNumber string `json:"TRACK_NUMBER"`
	TrackToken  string `json:"TRACK_TOKEN"`
}

func (*Song) GetCoverImage

func (s *Song) GetCoverImage() ([]byte, error)

func (*Song) GetMediaData

func (s *Song) GetMediaData(quality string) (*Media, error)

type Source

type Source struct {
	URL      string `json:"url"`
	Provider string `json:"provider"`
}

Jump to

Keyboard shortcuts

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