actions

package
v0.0.0-...-6217932 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2016 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Background processing on songs is structured in terms of a workflow, where each song goes through a series of consecutive states or 'actions'. These actions are usually triggered upon import of a new song.

This has some advantages with respect to running everything sequentially in a background goroutine, most importantly that the song state machine can be easily restarted, making the processing components stateless.

Index

Constants

This section is empty.

Variables

View Source
var (
	NoOpAction = []string{}
)

Functions

func RegisterSongAction

func RegisterSongAction(name string, fn func(*SongActionBase) SongAction)

Types

type ActivateSongAction

type ActivateSongAction struct {
	*SongActionBase
}

ActivateSongAction makes a song 'active' in the db.

func (*ActivateSongAction) HandleSong

func (a *ActivateSongAction) HandleSong(session services.Session, song *api.Song, log io.Writer) error

type CheckMetadataAction

type CheckMetadataAction struct {
	*SongActionBase
}

CheckMetadataAction checks whether metadata for a song is sufficient, and triggers a check on last.fm if it isn't.

func (*CheckMetadataAction) HandleSong

func (a *CheckMetadataAction) HandleSong(session services.Session, song *api.Song, log io.Writer) error

type DeactivateSongAction

type DeactivateSongAction struct {
	*SongActionBase
}

DeactivateSongAction makes a song 'inactive' in the db.

func (*DeactivateSongAction) HandleSong

func (a *DeactivateSongAction) HandleSong(session services.Session, song *api.Song, log io.Writer) error

type EncodeMp3Action

type EncodeMp3Action struct {
	*SongActionBase
}

func (*EncodeMp3Action) HandleSong

func (a *EncodeMp3Action) HandleSong(session services.Session, song *api.Song, log io.Writer) error

type SongAction

type SongAction interface {
	GetDb() services.Database
	HandleSong(session services.Session, song *api.Song, w io.Writer) error
}

SongAction is the common interface for song actions.

type SongActionBase

type SongActionBase struct {
	Db      services.Database
	Index   services.Index
	Storage services.Storage
}

SongActionBase provides context to the song state machine actions.

func (*SongActionBase) GetDb

func (a *SongActionBase) GetDb() services.Database

type TimbreAnalysisAction

type TimbreAnalysisAction struct {
	*SongActionBase
}

TimbreAnalysisAction computes the timbre fingerprint of a song.

func (*TimbreAnalysisAction) HandleSong

func (a *TimbreAnalysisAction) HandleSong(session services.Session, song *api.Song, log io.Writer) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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