resources

package
v0.0.0-...-7c8f249 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2014 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Management and handling for music resources.

A resource is an artifact that is fetchable from a remote service provider of that type of resource for a specified music Track.

Index

Constants

This section is empty.

Variables

View Source
var (
	ResourceNotFound            = errors.New("The requested resource could not be found")
	ResourceCouldNotBeRetrieved = errors.New("The requested resource could not be retrieved")
)

Functions

This section is empty.

Types

type LastFMAlbumArtProvider

type LastFMAlbumArtProvider struct {
	// contains filtered or unexported fields
}

func (*LastFMAlbumArtProvider) GetResource

func (this *LastFMAlbumArtProvider) GetResource(track *Track) (io.ReadCloser, error)

func (*LastFMAlbumArtProvider) String

func (this *LastFMAlbumArtProvider) String() string

func (*LastFMAlbumArtProvider) Type

func (this *LastFMAlbumArtProvider) Type() ResourceType

type ResourceCache

type ResourceCache struct {
	// contains filtered or unexported fields
}

func NewResourceCache

func NewResourceCache() *ResourceCache

func (*ResourceCache) Delete

func (this *ResourceCache) Delete(track *Track, resourceType ResourceType)

func (*ResourceCache) Get

func (this *ResourceCache) Get(track *Track, resourceType ResourceType) (string, error)

Returns a local filesystem path to where the resource is cached

func (*ResourceCache) Has

func (this *ResourceCache) Has(track *Track, resourceType ResourceType) bool

func (*ResourceCache) Set

func (this *ResourceCache) Set(track *Track, resourceType ResourceType, resourceStream io.ReadCloser) error

type ResourceManager

type ResourceManager struct {
	// contains filtered or unexported fields
}

func NewResourceManager

func NewResourceManager() *ResourceManager

func (*ResourceManager) GetResourceAsFilePath

func (this *ResourceManager) GetResourceAsFilePath(track *Track, resourceType ResourceType) (string, error)

Returns a local filesystem path to a file where the resource is fully available, or returns one of ResourceNotFound or ResourceCouldNotBeRetrieved for errors.

type ResourceProvider

type ResourceProvider interface {

	// This should return the type which this provider provides
	Type() ResourceType

	// This should return the binary version of the resource
	GetResource(track *Track) (io.ReadCloser, error)

	String() string
}

A provider for a resource type

type ResourceType

type ResourceType string
const (
	ALBUM_ART ResourceType = "album_art"
	LYRICS    ResourceType = "lyrics"
)

type Track

type Track struct {
	*mpdinfo.CurrentSong
}

Jump to

Keyboard shortcuts

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