spotify

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

README

Go Reference Go Report Go Version License Disgo Version Disgo Discord

spotify-plugin

spotify-plugin is a Lavalink Client which supports the latest Lavalink 3.4 release

Getting Started

Installing
go get github.com/DisgoOrg/spotify-plugin

Usage

import (
    "github.com/DisgoOrg/disgolink/lavalink"
    "github.com/DisgoOrg/spotify-plugin"
)
// create new lavalink and add the spotify plugin
link := lavalink.New(
    lavalink.WithUserID("user_id_here"),
    lavalink.WithPlugins(spotify.New()),
)

// when loading track you can type cast the track to a spotify track to access extra data
_ = link.BestRestClient().LoadItemHandler("https://open.spotify.com/track/3yk51U329nwdpeIHV0O5ez", lavalink.NewResultHandler(
    func (track lavalink.AudioTrack) {
        if spotifyTrack, ok := track.(*spotify.AudioTrack); ok {
            println("ISRC: ", spotifyTrack.AudioTrackInfo.ISRC)
            println("ArtworkURL: ", spotifyTrack.AudioTrackInfo.ArtworkURL)
        }
    },
    func (playlist lavalink.AudioPlaylist) {},
    func (tracks []lavalink.AudioTrack) {},
    func () {},
    func (ex lavalink.FriendlyException) {},
))

Example

You can find an example under _example

Troubleshooting

For help feel free to open an issues or reach out on Discord

Contributing

Contributions are welcomed but for bigger changes please first reach out via Discord or create an issue to discuss your intentions and ideas.

License

Distributed under the License. See LICENSE for more information.

Documentation

Index

Constants

View Source
const SearchTypeSpotify lavalink.SearchType = "spsearch"

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioTrack

type AudioTrack struct {
	AudioTrackInfo lavalink.AudioTrackInfo `json:"info"`
	ISRC           *string                 `json:"isrc"`
	ArtworkURL     *string                 `json:"artwork_url"`
}

func (*AudioTrack) Clone added in v1.0.1

func (t *AudioTrack) Clone() lavalink.AudioTrack

func (*AudioTrack) Info

func (*AudioTrack) SetPosition added in v1.0.1

func (t *AudioTrack) SetPosition(position time.Duration)

type Plugin

type Plugin struct{}

func New

func New() *Plugin

func (*Plugin) Decode

func (p *Plugin) Decode(info lavalink.AudioTrackInfo, r io.Reader) (spotifyTrack lavalink.AudioTrack, err error)

func (*Plugin) Encode

func (p *Plugin) Encode(track lavalink.AudioTrack, w io.Writer) (err error)

func (*Plugin) SourceName

func (p *Plugin) SourceName() string

Jump to

Keyboard shortcuts

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