spotigo

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

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 8 Imported by: 0

README

spotigo

Single file library for accessing SpotigoWeb (currently not publicly accessible)

Installing

go get github.com/JoshuaDoes/spotigo

Example

package main

import "fmt"
import "github.com/JoshuaDoes/spotigo"

func main() {
	//Initialize a new client
	c := &spotigo.Client{Host: "spotigo host here", pass: "spotigo pass key here"}

	//Get metadata and an audio URL
	res, err := c.GetTrackInfo("https://open.spotify.com/track/1Czngy8R5LkQPs3CCkuKjF")

	if err != nil {
		panic(err)
	}
	
	fmt.Println("Track ID: " + res.TrackID)
	fmt.Println("Title: " + res.Title)
	fmt.Println("Artist(s): " + res.Artist)
	fmt.Println("Stream URL: " + res.StreamURL)
	fmt.Println("Artwork URL: " + res.ArtURL)
}
Output
> go run main.go

< Track ID
< Title
< Artist(s)
< Stream URL
< Artwork URL

License

The source code for spotigo is released under the MIT License. See LICENSE for more details.

Donations

All donations are appreciated and helps me stay awake at night to work on this more. Even if it's not much, it helps a lot in the long run! You can find the donation link here: Donation Link

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertTo62

func ConvertTo62(raw []byte) string

Types

type Album

type Album struct {
	Title   string
	Artist  string
	Artists []Artist
	Discs   []*Disc
	ArtURL  string
	AlbumID string
	URI     string
}

type Artist

type Artist struct {
	Name      string
	TopTracks []*Track
	Albums    []*Album
	Singles   []*Album
	ArtURL    string
	ArtistID  string
	URI       string
}

type Client

type Client struct {
	Host string
	Pass string
}

func (*Client) GetAlbumInfo

func (c *Client) GetAlbumInfo(url string) (*Album, error)

func (*Client) GetArtistInfo

func (c *Client) GetArtistInfo(url string) (*Artist, error)

func (*Client) GetPlaylist

func (c *Client) GetPlaylist(url string) (*SpotigoPlaylist, error)

func (*Client) GetTrackInfo

func (c *Client) GetTrackInfo(url string) (*Track, error)

func (*Client) Search

func (c *Client) Search(query string) (*SpotigoSearch, error)

type Disc

type Disc struct {
	Number int
	Tracks []*Track
}

type SpotigoAlbumInfo

type SpotigoAlbumInfo struct {
	Gid    string              `json:"gid"`
	Name   string              `json:"name"`   //Album name
	Artist []SpotigoArtistInfo `json:"artist"` //Artist list (main, ft.)
	Discs  []SpotigoDisc       `json:"disc"`   //Virtual CD list
	Date   SpotigoDate         `json:"date"`   //Album release date
}

type SpotigoAlbums

type SpotigoAlbums struct {
	Albums []SpotigoGid `json:"album"`
}

type SpotigoArtistInfo

type SpotigoArtistInfo struct {
	Gid       string             `json:"gid"`
	Name      string             `json:"name"`         //Artist name
	TopTracks []SpotigoTopTracks `json:"top_track"`    //Top tracks
	Albums    []SpotigoAlbums    `json:"album_group"`  //Albums
	Singles   []SpotigoAlbums    `json:"single_group"` //Single tracks inside albums
}

type SpotigoDate

type SpotigoDate struct {
	Year  int
	Month int
	Day   int
}

type SpotigoDisc

type SpotigoDisc struct {
	Number int          `json:"number"` //Virtual CD number
	Tracks []SpotigoGid `json:"track"`  //Virtual CD track list
}

type SpotigoEmbed

type SpotigoEmbed struct {
	ThumbnailURL string `json:"thumbnail_url"` //Thumbnail
}

type SpotigoGid

type SpotigoGid struct {
	Gid string //Spotify GID
	ID  string
}

func (*SpotigoGid) GetID

func (gid *SpotigoGid) GetID() (string, error)

type SpotigoPlaylist

type SpotigoPlaylist struct {
	Gid        string                    `json:"gid"`
	Length     int                       `json:"length"`
	Attributes SpotigoPlaylistAttributes `json:"attributes"`
	Contents   SpotigoPlaylistContents   `json:"contents"`

	//Additional data added by Spotigo
	UserID      string `json:"-"`
	PlaylistID  string `json:"-"`
	PlaylistURI string `json:"-"`
	ImageURL    string `json:"-"`
}

type SpotigoPlaylistAttributes

type SpotigoPlaylistAttributes struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type SpotigoPlaylistContents

type SpotigoPlaylistContents struct {
	Position  int                   `json:"pos"`
	Truncated bool                  `json:"truncated"`
	Items     []SpotigoPlaylistItem `json:"items"`
}

type SpotigoPlaylistItem

type SpotigoPlaylistItem struct {
	TrackURI   string                        `json:"uri"`
	Attributes SpotigoPlaylistItemAttributes `json:"attributes"`
}

type SpotigoPlaylistItemAttributes

type SpotigoPlaylistItemAttributes struct {
	AddedBy   string `json:"added_by"`
	Timestamp int64  `json:"timestamp"`
}

type SpotigoSearch

type SpotigoSearch struct {
	Results SpotigoSearchResults `json:"results"` //Search results
}

type SpotigoSearchHit

type SpotigoSearchHit struct {
	Album          SpotigoSearchHitAlbum    `json:"album"`
	Artists        []SpotigoSearchHitArtist `json:"artists"`
	ImageURL       string                   `json:"image"`
	Name           string                   `json:"name"`
	URI            string                   `json:"uri"`
	ID             string                   `json:"-"` //Track ID, album ID, etc
	Duration       int                      `json:"duration"`
	FollowersCount int                      `json:"followersCount"`
	Author         string                   `json:"author"`
}

func (*SpotigoSearchHit) GetID

func (hit *SpotigoSearchHit) GetID() []string

func (*SpotigoSearchHit) GetType

func (hit *SpotigoSearchHit) GetType() string

type SpotigoSearchHitAlbum

type SpotigoSearchHitAlbum struct {
	//Artists //Unknown data type
	ImageURL string `json:"image"`
	Name     string `json:"name"`
	URI      string `json:"uri"`
}

type SpotigoSearchHitArtist

type SpotigoSearchHitArtist struct {
	ImageURL string `json:"image"`
	Name     string `json:"name"`
	URI      string `json:"uri"`
}

type SpotigoSearchHits

type SpotigoSearchHits struct {
	Hits []SpotigoSearchHit `json:"hits"` //Hits
}

type SpotigoSearchResults

type SpotigoSearchResults struct {
	Tracks    SpotigoSearchHits `json:"tracks"`    //Tracks
	Albums    SpotigoSearchHits `json:"albums"`    //Albums
	Artists   SpotigoSearchHits `json:"artists"`   //Artists
	Playlists SpotigoSearchHits `json:"playlists"` //Playlists
}

type SpotigoTopTracks

type SpotigoTopTracks struct {
	Tracks []SpotigoGid `json:"track"`
}

type SpotigoTrackInfo

type SpotigoTrackInfo struct {
	Gid         string              `json:"gid"`
	Name        string              `json:"name"`        //Track name
	TrackNumber int                 `json:"number"`      //Track number
	DiscNumber  int                 `json:"disc_number"` //Disc number
	Duration    int                 `json:"duration"`    //Track duration in milliseconds
	Album       SpotigoAlbumInfo    `json:"album"`       //Album
	Artist      []SpotigoArtistInfo `json:"artist"`      //Artist
}

type Track

type Track struct {
	Artist    string
	Artists   []Artist
	Title     string
	Duration  int
	StreamURL string
	ArtURL    string
	TrackID   string
	URI       string
}

Jump to

Keyboard shortcuts

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