render

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExtractionErr    = errors.New("No Image Extracted")
	ImageNotFoundErr = errors.New("Image Not Found")
	ImageWriteErr    = errors.New("Error Writing Image to File")
)

Functions

func DrawCover

func DrawCover(c mpd.Attrs, start bool)

func ExtractImage

func ExtractImage(path string, imagePath string) (string, error)

func GetImagePath

func GetImagePath(path string) string

GetImagePath This Function returns the path to the image that is to be rendered it checks first for the image in the cache else it adds the image to the cache and then extracts it and renders it.

func GetImg

func GetImg(uri string) (image.Image, error)

Gets the Image Struct from the provided path

func OpenImage

func OpenImage(path string, c chan string)

OpenImage Go Routine that will Be Called and will listen on the channel c for changes and on getting a string over the channel will open the Image and keep listening again. This will keep the image blocked ( i.e. no need to use time.Sleep() etc. ) and saves resources too.

Types

type Renderer

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

Renderer is just a channel on which we will send the Path to the song whose Image is to be Rendered. This channel is passed to the OpenImage which in turn is called by the Start() function as a go routine.

var (
	Rendr *Renderer
)

func NewRenderer

func NewRenderer() *Renderer

NewRenderer Returns a new Renderer with a string channel

func (*Renderer) Send

func (r *Renderer) Send(path string, start bool)

Send Image Path to Renderer Start Initialises the Renderer and calls the go routine OpenImage and passes the channel as argument.

Jump to

Keyboard shortcuts

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