services

package
v0.0.0-...-f538ccb Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DJ is an injected MumbleDJ struct.

View Source
var Services []interfaces.Service

Services is a slice of enabled MumbleDJ services.

Functions

This section is empty.

Types

type GenericService

type GenericService struct {
	ReadableName  string
	Format        string
	TrackRegex    []*regexp.Regexp
	PlaylistRegex []*regexp.Regexp
}

GenericService is a generic struct that should be embedded in other service structs, as it provides useful helper methods and properties.

func (*GenericService) CheckURL

func (gs *GenericService) CheckURL(url string) bool

CheckURL matches the passed URL with a list of regex patterns for valid URLs associated with this service. Returns true if a match is found, false otherwise.

func (*GenericService) GetFormat

func (gs *GenericService) GetFormat() string

GetFormat returns the youtube-dl format for the service.

func (*GenericService) GetReadableName

func (gs *GenericService) GetReadableName() string

GetReadableName returns the readable name for the service.

type LocalStorage

type LocalStorage struct {
	*GenericService
}

LocalStorage is simple local file player.

func NewLocalStorageService

func NewLocalStorageService() *LocalStorage

NewLocalStorageService returns an initialized LocalStorage service object

func (*LocalStorage) CheckAPIKey

func (ls *LocalStorage) CheckAPIKey() error

CheckAPIKey performs a test API call with the API key provided in the configuration file to determine if the service should be enabled.

func (*LocalStorage) GetTracks

func (ls *LocalStorage) GetTracks(tag string, submitter *gumble.User) ([]interfaces.Track, error)

GetTracks uses the passed tag to find and return tracks associated with the tag (file name without extension). An error is returned if any error occurs during the API call.

type Mixcloud

type Mixcloud struct {
	*GenericService
}

Mixcloud is a wrapper around the Mixcloud API. https://www.mixcloud.com/developers/

func NewMixcloudService

func NewMixcloudService() *Mixcloud

NewMixcloudService returns an initialized Mixcloud service object.

func (*Mixcloud) CheckAPIKey

func (mc *Mixcloud) CheckAPIKey() error

CheckAPIKey performs a test API call with the API key provided in the configuration file to determine if the service should be enabled.

func (*Mixcloud) GetTracks

func (mc *Mixcloud) GetTracks(url string, submitter *gumble.User) ([]interfaces.Track, error)

GetTracks uses the passed URL to find and return tracks associated with the URL. An error is returned if any error occurs during the API call.

type SoundCloud

type SoundCloud struct {
	*GenericService
}

SoundCloud is a wrapper around the SoundCloud API. https://developers.soundcloud.com/docs/api/reference

func NewSoundCloudService

func NewSoundCloudService() *SoundCloud

NewSoundCloudService returns an initialized SoundCloud service object.

func (*SoundCloud) CheckAPIKey

func (sc *SoundCloud) CheckAPIKey() error

CheckAPIKey performs a test API call with the API key provided in the configuration file to determine if the service should be enabled.

func (*SoundCloud) GetTracks

func (sc *SoundCloud) GetTracks(url string, submitter *gumble.User) ([]interfaces.Track, error)

GetTracks uses the passed URL to find and return tracks associated with the URL. An error is returned if any error occurs during the API call.

type YouTube

type YouTube struct {
	*GenericService
}

YouTube is a wrapper around the YouTube Data API. https://developers.google.com/youtube/v3/docs/

func NewYouTubeService

func NewYouTubeService() *YouTube

NewYouTubeService returns an initialized YouTube service object.

func (*YouTube) CheckAPIKey

func (yt *YouTube) CheckAPIKey() error

CheckAPIKey performs a test API call with the API key provided in the configuration file to determine if the service should be enabled.

func (*YouTube) GetTracks

func (yt *YouTube) GetTracks(url string, submitter *gumble.User) ([]interfaces.Track, error)

GetTracks uses the passed URL to find and return tracks associated with the URL. An error is returned if any error occurs during the API call.

Jump to

Keyboard shortcuts

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