core

package
v0.0.0-...-34dd3eb Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package core is the core of Kirino Media Server. core is to Kirino as OpenRC or *cringes in disgust* systemd is to Linux.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeConfig

func DecodeConfig(path string)

func RunServices

func RunServices(c *Core)

RunServices starts up all services on Core c registered with RegisterService

Types

type Config

type Config struct {
	Port      int         `json:"port"`
	Services  []*Service  `json:"services"`
	Fetchers  []*Fetcher  `json:"fetchers"`
	Providers []*Provider `json:"providers"`
}

type Core

type Core struct {
	Config map[string]string
	// contains filtered or unexported fields
}

func New

func New() *Core

func (*Core) AddFetcher

func (c *Core) AddFetcher(fetcher *Fetcher)

Register Fetcher fetcher for Core c

func (*Core) AddTask

func (c *Core) AddTask(t *Task)

func (*Core) AddUser

func (c *Core) AddUser(u *User)

func (*Core) AnythingToPlay

func (c *Core) AnythingToPlay() bool

func (*Core) Fetch

func (c *Core) Fetch(l *Library)

Fetch anything new for Feed f

func (*Core) Fetcher

func (c *Core) Fetcher(id string) *Fetcher

Get Fetcher with ID id

func (*Core) Fetchers

func (c *Core) Fetchers() []*Fetcher

Get all Fetchers for Core c

func (*Core) Libraries

func (c *Core) Libraries() []*Library

Get all Libraries for Core c

func (*Core) Library

func (c *Core) Library(id int) *Library

Get Library with ID id

func (*Core) NewLibrary

func (c *Core) NewLibrary(l *Library)

Create new Library library

func (*Core) Play

func (c *Core) Play() string

func (*Core) Provider

func (c *Core) Provider(id string) *Provider

func (*Core) Providers

func (c *Core) Providers() []*Provider

func (*Core) RegisterProvider

func (c *Core) RegisterProvider(provider *Provider)

func (*Core) RegisterService

func (c *Core) RegisterService(service *Service)

Register a service with Core c

func (*Core) Start

func (c *Core) Start()

func (*Core) Task

func (c *Core) Task(id int) *Task

func (*Core) Tasks

func (c *Core) Tasks() []*Task

func (*Core) ToPlay

func (c *Core) ToPlay(thing string)

type Fetcher

type Fetcher struct {
	ID          string      `json:"id"`
	Type        LibraryType `json:"type"`
	Name        string      `json:"name"`
	Description string      `json:"description"`

	SearchFunc func(query string) []*Series `json:"-"`
	FetchFunc  func(series *Series)         `json:"-"`
}

A fetcher

type Item

type Item struct {
	OriginalID    string
	ID            int
	Title         string
	OriginalTitle string

	Path string
}

type Library

type Library struct {
	ID        int         `json:"id"`
	Type      LibraryType `json:"type"`
	Name      string      `json:"name"`
	MediaDirs []string    `json:"media_dirs"`

	Scanner  *Scanner `json:"scanner"`
	Provider string   `json:"provider"`
	Fetcher  string   `json:"Fetcher"`
	// contains filtered or unexported fields
}

A library

func (*Library) AddSeries

func (l *Library) AddSeries(s *Series)

func (*Library) AllSeries

func (l *Library) AllSeries() []*Series

func (*Library) Scan

func (l *Library) Scan()

Scan Library l

func (*Library) Series

func (l *Library) Series(id int) *Series

type LibraryType

type LibraryType string
const (
	LibraryTypeAnime      LibraryType = "anime"
	LibraryTypeManga      LibraryType = "manga"
	LibraryTypeMusic      LibraryType = "music"
	LibraryTypePodcasts   LibraryType = "podcasts"
	LibraryTypeTubeVideos LibraryType = "tube_videos"
)

Library types

type Provider

type Provider struct {
	ID          string      `json:"id"`
	Type        LibraryType `json:"type"`
	Name        string      `json:"name"`
	Description string      `json:"description"`

	QueryFunc func(query string) []types.Song `json:"-"`
}

type Scanner

type Scanner struct {
	ID   string      `json:"id"`
	Type LibraryType `json:"type"`
	Name string      `json:"name"`

	Func func(library *Library) `json:"-"`
}

type Series

type Series struct {
	OriginalID    string `json:"original_id"`
	ID            int    `json:"id"`
	Image         string `json:"image"`
	Title         string `json:"title"`
	OriginalTitle string `json:"original_title"`
	Description   string `json:"description"`

	Fetcher string `json:"Fetcher"`
	// contains filtered or unexported fields
}

func (*Series) AddItem

func (s *Series) AddItem(item *Item)

func (*Series) Item

func (s *Series) Item(id int) *Item

func (*Series) Items

func (s *Series) Items() []*Item

type Service

type Service struct {
	ID   string
	Name string
	Func func(c *Core) *http.ServeMux `json:"-"`
}

type Task

type Task struct {
	ID   int    `json:"id"`
	Name string `json:"name"`

	LastRun  time.Time     `json:"last_run"`
	RunEvery time.Duration `json:"run_every"`

	Func func(c *Core) `json:"-"`
}

type User

type User struct {
}

Jump to

Keyboard shortcuts

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