source_extensions

package module
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

README

Go Reference Go Report Go Version License Disgo Version Disgo Discord

source-extensions-plugin

source-extensions-plugin is a collection of additional source extension for disgolink

Getting Started

Installing
go get github.com/DisgoOrg/source-extensions-plugin

Usage

import (
    "github.com/DisgoOrg/disgolink/lavalink"
    "github.com/DisgoOrg/source-extensions-plugin"
)

// create new lavalink and add the spotify plugin
link := lavalink.New(
    lavalink.WithUserID("user_id_here"),
    lavalink.WithPlugins(
        source_extensions.NewNewSpotifyPlugin(),
        source_extensions.NewAppleMusicPlugin(),
    ),
)

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

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"
	SearchTypeAppleMusic lavalink.SearchType = "amsearch"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppleMusicPlugin

type AppleMusicPlugin struct {
	ISRCSourceExtension
}

func NewAppleMusicPlugin

func NewAppleMusicPlugin() *AppleMusicPlugin

func (*AppleMusicPlugin) SourceName

func (p *AppleMusicPlugin) SourceName() string

type ISRCAudioTrack

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

func (*ISRCAudioTrack) Clone

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

type ISRCSourceExtension

type ISRCSourceExtension struct{}

func (ISRCSourceExtension) Decode

func (p ISRCSourceExtension) Decode(info lavalink.AudioTrackInfo, r io.Reader) (isrcTrack lavalink.AudioTrack, err error)

func (ISRCSourceExtension) Encode

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

type SpotifyPlugin

type SpotifyPlugin struct {
	ISRCSourceExtension
}

func NewSpotifyPlugin

func NewSpotifyPlugin() *SpotifyPlugin

func (*SpotifyPlugin) SourceName

func (p *SpotifyPlugin) SourceName() string

Jump to

Keyboard shortcuts

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