Documentation ¶
Index ¶
- Constants
- type Album
- type AuthURL
- type Client
- func (c *Client) Album(id ID) (*Album, error)
- func (c *Client) AlbumTracks(uri string) ([]*track.Track, error)
- func (c *Client) LibraryTracks() ([]*track.Track, error)
- func (c *Client) Playlist(uri string) (*Playlist, error)
- func (c *Client) PlaylistTracks(uri string) ([]*track.Track, error)
- func (c *Client) RemoveLibraryTracks(ids []ID) error
- func (c *Client) RemovePlaylistTracks(uri string, ids []ID) error
- func (c *Client) User() (string, string)
- type ID
- type Playlist
- type Track
Constants ¶
const ( // SpotifyClientID : Spotify app client ID SpotifyClientID = ":SPOTIFY_CLIENT_ID:" // SpotifyClientSecret : Spotify app client secret key SpotifyClientSecret = ":SPOTIFY_CLIENT_SECRET:" )
const ( // SpotifyRedirectURL : Spotify app redirect URL SpotifyRedirectURL = "http://%s:8080/callback" // SpotifyFaviconURL : Spotify app redirect URL's favicon SpotifyFaviconURL = "https://spotify.com/favicon.ico" // SpotifyHTMLAutoCloseTimeout : Spotify app redirect URL's autoclose timeout SpotifyHTMLAutoCloseTimeout = "5" // s // SpotifyHTMLAutoCloseTimeoutMs : Spotify app redirect URL's autoclose timeout in ms (automatically parsed from SpotifyHTMLAutoCloseTimeout) SpotifyHTMLAutoCloseTimeoutMs = SpotifyHTMLAutoCloseTimeout + "000" // ms // SpotifyHTMLSigAuthor : Spotify app redirect URL's footer quoted author SpotifyHTMLSigAuthor = "streambinder" // SpotifyHTMLSigIcon : Spotify app redirect URL's footer quoted author icon SpotifyHTMLSigIcon = "" /* 9092-byte string literal not displayed */ // SpotifyHTMLTemplate : Spotify app redirect URLS's template SpotifyHTMLTemplate = `<!DOCTYPE html> <html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> <title>SpotiTube</title> <link rel="icon" href="` + SpotifyFaviconURL + `" type="image/x-icon" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Condensed" /> <style> body { font: 20px 'Roboto Condensed', sans-serif; text-align: center; margin: 75px 0; padding: 50px; color: #333; border: solid 5px #1ED760; border-left: none; border-right: none; } body * { text-align: center; } h1 { font-size: 40px; text-transform: uppercase; } h1>i.fa { margin: auto 10px; } article { display: block; text-align: left; width: 650px; margin: 0 auto 50px; } a { color: #dc8100; text-decoration: none; } a:hover { color: #333; text-decoration: none; } p.timer { font-size: 14px; color: #A0A0A0; text-align: center; text-transform: uppercase; } div.signature { border: 1px solid rgba(0, 0, 0, 0.05); border-radius: 5px; text-align: center; } div.signature>img { width: 35px; vertical-align: middle; } div.signature>span { font-size: 15px; color: #505050; } </style> <script type="text/javascript"> var timeleft = ` + SpotifyHTMLAutoCloseTimeout + `; var downloadTimer = setInterval(function() { timeleft--; document.getElementById("timer").textContent = timeleft; if(timeleft <= 0) clearInterval(downloadTimer); }, 1000); function setAutoClose() { window.setTimeout(autoClose, ` + SpotifyHTMLAutoCloseTimeoutMs + `); } function autoClose() { window.close(); } </script> </head> <body onLoad="setAutoClose()"> <article> <h1><i class="fa fa-thumbs-up" aria-hidden="true"></i><br>%s</h1> <div> <h3>%s</h3> <br><br><br> <p class="timer">Window will attempt to close in <span id="timer">` + SpotifyHTMLAutoCloseTimeout + `</span> seconds.</p> <br> <div class="signature"> <img src="` + SpotifyHTMLSigIcon + `"/> <span>` + SpotifyHTMLSigAuthor + `</span> </div> </div> </article> </body> </html>` )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthURL ¶
AuthURL : struct object containing both the full authentication URL provided by Spotify and the shortened one using TinyURL
func BuildAuthURL ¶
BuildAuthURL : generate new authentication URL
type Client ¶
Client : struct object containing all the informations needed to authenticate and fetch from Spotify
func Auth ¶
Auth : start local callback server to handle xdg-preferred browser authentication redirection
func (*Client) AlbumTracks ¶
AlbumTracks returns the array of tracks contained in it
func (*Client) LibraryTracks ¶
LibraryTracks : return array of Spotify FullTrack of all authenticated user library songs
func (*Client) PlaylistTracks ¶
PlaylistTracks : return array of Spotify FullTrack of all input string playlistURI identified playlist
func (*Client) RemoveLibraryTracks ¶
RemoveLibraryTracks : remove an array of tracks by their IDs from library
func (*Client) RemovePlaylistTracks ¶
RemovePlaylistTracks : remove an array of tracks by their IDs from playlist