tidalapi

package module
v0.0.0-...-b74ba52 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LOGIN           = "login/username"
	FAVORITETRACKS  = "users/%v/favorites/tracks"
	TRACK           = "tracks/%v"
	TRACKURL        = "tracks/%v/streamUrl"
	TRACKRADIO      = "tracks/%v/radio"
	ARTIST          = "artists/%v"
	ARTISTTOPTRACKS = "artists/%v/toptracks"
	ARTISTRADIO     = "artists/%v/radio"
	ALBUM           = "albums/%v"
	ALBUMTRACKS     = "albums/%v/tracks"
	PLAYLIST        = "playlists/%v"
	PLAYLISTTRACKS  = "playlists/%v/tracks"
	USER            = "users/%v"
	SEARCH          = "search?query=%v"
	SESSIONS        = "sessions"
)
View Source
const (
	MASTER = iota
	LOSSLESS
	HIGH
	LOW
)
View Source
const (
	API_TOKEN = "wc8j_yBJd20zOmx0"
	CLIENT_ID = "ck3zaWMi8Ka_XdI0"
)

Variables

View Source
var (
	IMGPATH = "https://resources.tidal.com/images/%s/%dx%d.jpg"
)
View Source
var Quality = map[int]string{MASTER: "HI_RES", LOSSLESS: "LOSSLESS", HIGH: "HIGH", LOW: "LOW"}
View Source
var Types = map[string]interface{}{
	LOGIN: new(Login),
}

Functions

func ToMap

func ToMap(obj []byte, data interface{}) error

Types

type Album

type Album struct {
	Id             int    `json:"id"`
	Title          string `json:"title"`
	Cover          string `json:"cover"`
	NumberOfTracks int    `json:"numberOfTracks"`
	Duration       int    `json:"duration"`
	Artist         Artist `json:"artist"`
	ReleaseDate    string `json:"releaseDate"`
	Copyright      string `json:"copyright"`
	Upc            string `json:"ups"`

	Tracks *Tracks
	// contains filtered or unexported fields
}

type Artist

type Artist struct {
	Id         int    `json:"id"`
	Name       string `json:"name"`
	Popularity int    `json:popularity`
	Url        string `json:url`
	Picture    string `json:picture`
}

type Config

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

Config stores TIDAL client configuration

func (*Config) Init

func (c *Config) Init(quality int)

type Creator

type Creator struct {
	Id int `json:"id"`
}

type Error

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

type Item

type Item struct {
	Created string `json:"created"`
	Item    Track  `json:"item"`
}

type Login

type Login struct {
	SessionId   string  `json:"sessionId"`
	CountryCode string  `json:"countryCode"`
	UserId      float32 `json:"userId"`
}

type Playlist

type Playlist struct {
	UUID           string  `json:"uuid"`
	Title          string  `json:"title"`
	Description    string  `json:"description"`
	Creator        Creator `json:"creator"`
	Type           string  `json:"type"`
	IsPublic       bool    `json:"publicPlaylist"`
	Created        string  `json:"created"`
	LastUpdated    string  `json:"lastUpdated"`
	NumberOfTracks int     `json:"numberOfTracks"`
	Duration       int     `json:"duration"`
	Url            string  `json:"url"`
	Image          string  `json:"image"`
	SquareImage    string  `json:"squareImage"`
	Popularity     int     `json:"popularity"`
	Tracks         *Tracks
}
type Search struct {
	Items  []Album `json:"items"`
	Albums struct {
		Items []Album `json:"items"`
	} `json:"albums"`
	Artists struct {
		Items []Artist `json:"items"`
	} `json:"artists"`
	Tracks struct {
		Items []Track `json:"items"`
	} `json:"tracks"`
}

type Session

type Session struct {
	ClientUniqueKey string
	SessionID       string `json:"sessionId"`
	CountryCode     string `json:"countryCode"`
	UserID          int    `json:"userId"`
	ChannelID       int    `json:"channelId"`
	PartnerID       int    `json:"partnerId"`
	Quality         string
	CodeChallenge   string
	CodeVerifier    string
	Token           *oauth2.Token
	// contains filtered or unexported fields
}

func NewSession

func NewSession(quality int) *Session

func (*Session) DownloadImage

func (s *Session) DownloadImage(id string) ([]byte, error)

func (*Session) Get

func (s *Session) Get(what string, id interface{}, obj interface{}) error

func (*Session) GetOauth2URL

func (s *Session) GetOauth2URL() (authURL string)

func (*Session) IsValid

func (s *Session) IsValid() bool

func (*Session) LoadSession

func (s *Session) LoadSession(fn string) (err error)

func (*Session) Login

func (s *Session) Login(username, password string) error

func (*Session) LoginWithOauth2Code

func (s *Session) LoginWithOauth2Code(code string) (err error)

func (*Session) SaveSession

func (s *Session) SaveSession(fn string) (err error)

type Track

type Track struct {
	Duration        int           `json:"duration"`
	ReplayGain      float32       `json:"replayGain"`
	Copyright       string        `json:"copyright"`
	Artists         []Artist      `json:"artists"`
	URL             string        `json:"url"`
	ISRC            string        `json:"isrc"`
	Editable        bool          `json:"editable"`
	SurroundTypes   []interface{} `json:"surroundTypes"`
	Artist          Artist        `json:"artist"`
	Explicit        bool          `json:"explicit"`
	AudioQuality    string        `json:"audioQuality"`
	ID              int           `json:"id"`
	Peak            float32       `json:"peak"`
	StreamReady     bool          `json:"streamReady"`
	StreamStartDate string        `json:"streamStartDate"`
	Popularity      int           `json:"popularity"`
	Album           Album         `json:"album"`
	Title           string        `json:"title"`
	AllowStreaming  bool          `json:"allowStreaming"`
	TrackNumber     int           `json:"trackNumber"`
	VolumeNumber    int           `json:"volumeNumber"`
	Version         string        `json:"version"`
	Path            TrackPath
}

type TrackPath

type TrackPath struct {
	Url                   string `json:"Url"`
	TrackID               int    `json:"trackId"`
	PlayTimeLeftInMinutes int    `json:"playTimeLeftInMinutes"`
	SoundQuality          string `json:"soundQuality"`
	EncryptionKey         string `json:"encryptionKey"`
	Codec                 string `json:"codec"`
}

type Tracks

type Tracks struct {
	Limit              int     `json:"limit"`
	Offset             int     `json:"offset"`
	TotalNumberOfItems int     `json:"totalNumberOfItems"`
	Items              []Track `json:"items"`
}

type TracksFavorite

type TracksFavorite struct {
	Limit              int    `json:"limit"`
	Offset             int    `json:"offset"`
	TotalNumberOfItems int    `json:"totalNumberOfItems"`
	Items              []Item `json:"items"`
}

type User

type User struct {
	Id           int
	Username     string
	FirstName    string
	LastName     string
	Email        string
	CountryCode  string
	Created      string
	Picture      string
	Newsletter   bool
	AcceptedEULA bool
	Gender       bool
	DateOfBirth  string
	FacebookUid  int
}

Jump to

Keyboard shortcuts

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