deezer

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIEndPoint = "https://api.deezer.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ajax added in v0.18.0

type Ajax struct {
	Error   []interface{} `json:"error"`
	Results struct {
		Count int `json:"count"`
		Data  []struct {
			Duration            string              `json:"DURATION"`
			DiskNumber          string              `json:"DISK_NUMBER"`
			DigitalReleaseDate  string              `json:"DIGITAL_RELEASE_DATE"`
			PhysicalReleaseDate string              `json:"PHYSICAL_RELEASE_DATE"`
			ArtistName          string              `json:"ART_NAME"`
			AlbumID             string              `json:"ALB_ID"`
			AlbumPicture        string              `json:"ALB_PICTURE"`
			AlbumTitle          string              `json:"ALB_TITLE"`
			Md5                 string              `json:"MD5_ORIGIN"`
			SongID              string              `json:"SNG_ID"`
			SongTitle           string              `json:"SNG_TITLE"`
			Version             string              `json:"VERSION"`
			SongContributors    map[string][]string `json:"SNG_CONTRIBUTORS"`
			Status              int                 `json:"STATUS"`
			TrackNumber         string              `json:"TRACK_NUMBER"`
			FlacSize            string              `json:"FILESIZE_FLAC"`
			Type                int                 `json:"TYPE"`
			UserID              int                 `json:"USER_ID"`
			MediaVersion        string              `json:"MEDIA_VERSION"`
			TYPE2               string              `json:"__TYPE__"`
			ISRC                string              `json:"ISRC"`
		} `json:"data"`
		FilteredCount int `json:"filtered_count"`
		Total         int `json:"total"`
	} `json:"results"`
}

type Deezer

type Deezer struct {
	SidCookie string

	Client *http.Client
	// contains filtered or unexported fields
}

Deezer structure for querying its API

func New

func New(sid string) *Deezer

New Deezer structure. api key can be blank for now.

func (*Deezer) GetAjaxAlbumInfo added in v0.21.0

func (d *Deezer) GetAjaxAlbumInfo(id int) (*Ajax, error)

func (*Deezer) GetCover added in v0.18.0

func (d *Deezer) GetCover(id int) (string, error)

func (*Deezer) GetRelease added in v0.18.0

func (d *Deezer) GetRelease(id int) (*Release, error)

GetRelease from the API. Returns the complete response.

func (*Deezer) GetTrackIDsFromAlbumID

func (d *Deezer) GetTrackIDsFromAlbumID(id int) ([]int, error)

GetTrackIDsFromAlbumID returns a list of tracks ids.

type Release added in v0.18.0

type Release struct {
	Artist struct {
		ID            int    `json:"id"`
		Name          string `json:"name"`
		Picture       string `json:"picture"`
		PictureBig    string `json:"picture_big"`
		PictureMedium string `json:"picture_medium"`
		PictureSmall  string `json:"picture_small"`
		PictureXl     string `json:"picture_xl"`
		Tracklist     string `json:"tracklist"`
		Type          string `json:"type"`
	} `json:"artist"`
	Available    bool `json:"available"`
	Contributors []struct {
		ID            int    `json:"id"`
		Link          string `json:"link"`
		Name          string `json:"name"`
		Picture       string `json:"picture"`
		PictureBig    string `json:"picture_big"`
		PictureMedium string `json:"picture_medium"`
		PictureSmall  string `json:"picture_small"`
		PictureXl     string `json:"picture_xl"`
		Radio         bool   `json:"radio"`
		Role          string `json:"role"`
		Share         string `json:"share"`
		Tracklist     string `json:"tracklist"`
		Type          string `json:"type"`
	} `json:"contributors"`
	Cover                 string `json:"cover"`
	CoverBig              string `json:"cover_big"`
	CoverMedium           string `json:"cover_medium"`
	CoverSmall            string `json:"cover_small"`
	CoverXl               string `json:"cover_xl"`
	Duration              int    `json:"duration"`
	ExplicitContentCover  int    `json:"explicit_content_cover"`
	ExplicitContentLyrics int    `json:"explicit_content_lyrics"`
	ExplicitLyrics        bool   `json:"explicit_lyrics"`
	Fans                  int    `json:"fans"`
	GenreID               int    `json:"genre_id"`
	Genres                struct {
		Data []struct {
			ID      int    `json:"id"`
			Name    string `json:"name"`
			Picture string `json:"picture"`
			Type    string `json:"type"`
		} `json:"data"`
	} `json:"genres"`
	ID          int    `json:"id"`
	Label       string `json:"label"`
	Link        string `json:"link"`
	NbTracks    int    `json:"nb_tracks"`
	Rating      int    `json:"rating"`
	RecordType  string `json:"record_type"`
	ReleaseDate string `json:"release_date"`
	Share       string `json:"share"`
	Title       string `json:"title"`
	Tracklist   string `json:"tracklist"`
	Tracks      struct {
		Data []struct {
			Artist struct {
				ID        int    `json:"id"`
				Name      string `json:"name"`
				Tracklist string `json:"tracklist"`
				Type      string `json:"type"`
			} `json:"artist"`
			Duration              int    `json:"duration"`
			ExplicitContentCover  int    `json:"explicit_content_cover"`
			ExplicitContentLyrics int    `json:"explicit_content_lyrics"`
			ExplicitLyrics        bool   `json:"explicit_lyrics"`
			ID                    int    `json:"id"`
			Link                  string `json:"link"`
			Preview               string `json:"preview"`
			Rank                  int    `json:"rank"`
			Readable              bool   `json:"readable"`
			Title                 string `json:"title"`
			TitleShort            string `json:"title_short"`
			TitleVersion          string `json:"title_version"`
			Type                  string `json:"type"`
		} `json:"data"`
	} `json:"tracks"`
	Type string `json:"type"`
	Upc  string `json:"upc"`
}

func (*Release) ReleaseYear added in v0.18.0

func (r *Release) ReleaseYear() int

type UserData added in v0.18.0

type UserData struct {
	Error   []interface{} `json:"error"`
	Results struct {
		CheckForm string `json:"checkForm"`
	} `json:"results"`
}

Jump to

Keyboard shortcuts

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