engine

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const NowPlayingExpire = 60 * time.Minute

Variables

Functions

This section is empty.

Types

type Browser

type Browser interface {
	MediaFolders(ctx context.Context) (model.MediaFolders, error)
	Indexes(ctx context.Context, mediaFolderId string, ifModifiedSince time.Time) (model.ArtistIndexes, time.Time, error)
	Directory(ctx context.Context, id string) (*DirectoryInfo, error)
	Artist(ctx context.Context, id string) (*DirectoryInfo, error)
	Album(ctx context.Context, id string) (*DirectoryInfo, error)
	GetSong(ctx context.Context, id string) (*Entry, error)
	GetGenres(ctx context.Context) (model.Genres, error)
}

func NewBrowser

func NewBrowser(ds model.DataStore) Browser

type Cover

type Cover interface {
	Get(ctx context.Context, id string, size int, out io.Writer) error
}

func NewCover

func NewCover(ds model.DataStore) Cover

type DirectoryInfo

type DirectoryInfo struct {
	Id         string
	Name       string
	Entries    Entries
	Parent     string
	Starred    time.Time
	PlayCount  int32
	UserRating int
	AlbumCount int
	CoverArt   string
	Artist     string
	ArtistId   string
	SongCount  int
	Duration   int
	Created    time.Time
	Year       int
	Genre      string
}

type Entries

type Entries []Entry

func FromAlbums

func FromAlbums(albums model.Albums) Entries

func FromArtists

func FromArtists(ars model.Artists) Entries

func FromMediaFiles

func FromMediaFiles(mfs model.MediaFiles) Entries

type Entry

type Entry struct {
	Id          string
	Title       string
	IsDir       bool
	Parent      string
	Album       string
	Year        int
	Artist      string
	Genre       string
	CoverArt    string
	Starred     time.Time
	Track       int
	Duration    int
	Size        int
	Suffix      string
	BitRate     int
	ContentType string
	Path        string
	PlayCount   int32
	DiscNumber  int
	Created     time.Time
	AlbumId     string
	ArtistId    string
	Type        string
	UserRating  int
	SongCount   int

	UserName   string
	MinutesAgo int
	PlayerId   int
	PlayerName string
	AlbumCount int

	AbsolutePath string
}

func FromAlbum

func FromAlbum(al *model.Album) Entry

func FromArtist

func FromArtist(ar *model.Artist) Entry

func FromMediaFile

func FromMediaFile(mf *model.MediaFile) Entry

type ListGenerator

type ListGenerator interface {
	GetNewest(ctx context.Context, offset int, size int) (Entries, error)
	GetRecent(ctx context.Context, offset int, size int) (Entries, error)
	GetFrequent(ctx context.Context, offset int, size int) (Entries, error)
	GetHighest(ctx context.Context, offset int, size int) (Entries, error)
	GetRandom(ctx context.Context, offset int, size int) (Entries, error)
	GetByName(ctx context.Context, offset int, size int) (Entries, error)
	GetByArtist(ctx context.Context, offset int, size int) (Entries, error)
	GetStarred(ctx context.Context, offset int, size int) (Entries, error)
	GetAllStarred(ctx context.Context) (artists Entries, albums Entries, mediaFiles Entries, err error)
	GetNowPlaying(ctx context.Context) (Entries, error)
	GetRandomSongs(ctx context.Context, size int, genre string) (Entries, error)
}

func NewListGenerator

func NewListGenerator(ds model.DataStore, npRepo NowPlayingRepository) ListGenerator

type MediaStreamer added in v0.6.0

type MediaStreamer interface {
	NewStream(ctx context.Context, id string, maxBitRate int, format string) (mediaStream, error)
}

func NewMediaStreamer added in v0.6.0

func NewMediaStreamer(ds model.DataStore) MediaStreamer

type MockNowPlaying

type MockNowPlaying struct {
	NowPlayingRepository
	// contains filtered or unexported fields
}

func CreateMockNowPlayingRepo

func CreateMockNowPlayingRepo() *MockNowPlaying

func (*MockNowPlaying) ClearAll

func (m *MockNowPlaying) ClearAll()

func (*MockNowPlaying) Count

func (m *MockNowPlaying) Count(playerId int) (int64, error)

func (*MockNowPlaying) Dequeue

func (m *MockNowPlaying) Dequeue(playerId int) (*NowPlayingInfo, error)

func (*MockNowPlaying) Enqueue

func (m *MockNowPlaying) Enqueue(info *NowPlayingInfo) error

func (*MockNowPlaying) GetAll

func (m *MockNowPlaying) GetAll() ([]*NowPlayingInfo, error)

func (*MockNowPlaying) Head

func (m *MockNowPlaying) Head(playerId int) (*NowPlayingInfo, error)

func (*MockNowPlaying) OverrideNow

func (m *MockNowPlaying) OverrideNow(t time.Time)

func (*MockNowPlaying) SetError

func (m *MockNowPlaying) SetError(err bool)

func (*MockNowPlaying) Tail

func (m *MockNowPlaying) Tail(playerId int) (*NowPlayingInfo, error)

type MockProperty

type MockProperty struct {
	model.PropertyRepository
	// contains filtered or unexported fields
}

func CreateMockPropertyRepo

func CreateMockPropertyRepo() *MockProperty

func (*MockProperty) DefaultGet

func (m *MockProperty) DefaultGet(id string, defaultValue string) (string, error)

func (*MockProperty) Get

func (m *MockProperty) Get(id string) (string, error)

func (*MockProperty) Put

func (m *MockProperty) Put(id string, value string) error

func (*MockProperty) SetError

func (m *MockProperty) SetError(err bool)

type NowPlayingInfo

type NowPlayingInfo struct {
	TrackID    string
	Start      time.Time
	Username   string
	PlayerId   int
	PlayerName string
}

type NowPlayingRepository

type NowPlayingRepository interface {
	// Insert at the head of the queue
	Enqueue(*NowPlayingInfo) error

	// Removes and returns the element at the end of the queue
	Dequeue(playerId int) (*NowPlayingInfo, error)

	// Returns the element at the head of the queue (last inserted one)
	Head(playerId int) (*NowPlayingInfo, error)

	// Returns the element at the end of the queue (first inserted one)
	Tail(playerId int) (*NowPlayingInfo, error)

	// Size of the queue for the playerId
	Count(playerId int) (int64, error)

	// Returns all heads from all playerIds
	GetAll() ([]*NowPlayingInfo, error)
}

This repo must have the semantics of a FIFO queue, for each playerId

func NewNowPlayingRepository

func NewNowPlayingRepository() NowPlayingRepository

type PlaylistInfo

type PlaylistInfo struct {
	Id        string
	Name      string
	Entries   Entries
	SongCount int
	Duration  int
	Public    bool
	Owner     string
	Comment   string
}

type Playlists

type Playlists interface {
	GetAll(ctx context.Context) (model.Playlists, error)
	Get(ctx context.Context, id string) (*PlaylistInfo, error)
	Create(ctx context.Context, playlistId, name string, ids []string) error
	Delete(ctx context.Context, playlistId string) error
	Update(ctx context.Context, playlistId string, name *string, idsToAdd []string, idxToRemove []int) error
}

func NewPlaylists

func NewPlaylists(ds model.DataStore) Playlists

type Ratings

type Ratings interface {
	SetStar(ctx context.Context, star bool, ids ...string) error
	SetRating(ctx context.Context, id string, rating int) error
}

func NewRatings

func NewRatings(ds model.DataStore) Ratings

type Scrobbler

type Scrobbler interface {
	Register(ctx context.Context, playerId int, trackId string, playDate time.Time) (*model.MediaFile, error)
	NowPlaying(ctx context.Context, playerId int, playerName, trackId, username string) (*model.MediaFile, error)
}

func NewScrobbler

func NewScrobbler(ds model.DataStore, npr NowPlayingRepository) Scrobbler
type Search interface {
	SearchArtist(ctx context.Context, q string, offset int, size int) (Entries, error)
	SearchAlbum(ctx context.Context, q string, offset int, size int) (Entries, error)
	SearchSong(ctx context.Context, q string, offset int, size int) (Entries, error)
}

func NewSearch

func NewSearch(ds model.DataStore) Search

type Users

type Users interface {
	Authenticate(ctx context.Context, username, password, token, salt, jwt string) (*model.User, error)
}

func NewUsers

func NewUsers(ds model.DataStore) Users

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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