logic

package
v0.0.0-...-1bf698f Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDownloadsToDownloadsInfo

func ConnectDownloadsToDownloadsInfo(ctx context.Context, dls *Downloads, dlInfoStor *StorageItem[DownloadsInfo], onError func(error))

Initializes dls to current data in dlInfoStor, then continually updates dlInfoStor if any changes occur in dls

func GetSeason

func GetSeason(ctx context.Context, season sp.Season) (episodes []sp.Episode, mgid string, err error)

func GetSeries

func GetSeries(ctx context.Context) (region sp.RegionInfo, seasons map[sp.Language][]Season, mgid string, err error)

Gets current region info and season metadata.

Types

type Cache

type Cache struct {
	Series map[sp.Host]Series
}

func NewCache

func NewCache() *Cache

type Config

type Config struct {
	DownloadPath        string
	ConcurrentDownloads int
	MaximumQuality      Quality
	OutputFilePattern   string
}

func NewConfig

func NewConfig() *Config

type Download

type Download struct {
	*asynctask.AsyncTask[struct{}, DownloadProgress, struct{}]
	// contains filtered or unexported fields
}

func (*Download) Params

func (dl *Download) Params() DownloadParams

func (*Download) Progress

func (dl *Download) Progress() DownloadProgress

func (*Download) ProgressBinding

func (dl *Download) ProgressBinding() *data.Binding[DownloadProgress]

type DownloadInfo

type DownloadInfo struct {
	Params DownloadParams
}

Used for caching downloads

type DownloadParams

type DownloadParams struct {
	Episode            sp.Episode
	MaxQuality         Quality
	TmpDirPath         string
	OutputVideoPath    string
	OutputSubtitlePath string
}

type DownloadProgress

type DownloadProgress struct {
	Status DownloadStatus
	Value  float64 // -1 if unable to determine
}

func (DownloadProgress) String

func (v DownloadProgress) String() string

type DownloadStatus

type DownloadStatus int
const (
	DownloadStatusWaiting DownloadStatus = iota
	DownloadStatusFetchingMetadata
	DownloadStatusDownloadingVideo
	DownloadStatusDownloadingSubtitles
	DownloadStatusPostprocessing
	DownloadStatusDone
	DownloadStatusInterrupted
)

type Downloads

type Downloads struct {
	*data.ListBinding[*Download]
	// contains filtered or unexported fields
}

func NewDownloads

func NewDownloads(cfgClient *data.Client[*Config], onError func(error)) *Downloads

func (*Downloads) Add

func (dls *Downloads) Add(ctx context.Context, params DownloadParams, onError func(error)) *Download

type DownloadsInfo

type DownloadsInfo []DownloadInfo

func NewDownloadsInfo

func NewDownloadsInfo() DownloadsInfo

type Quality

type Quality int
const (
	QualityBest  Quality = Quality(1 << 24) // big number
	Quality1080p Quality = 1080
	Quality720p  Quality = 720
	Quality540p  Quality = 540
	Quality432p  Quality = 432
	Quality360p  Quality = 360
	Quality288p  Quality = 288
	Quality216p  Quality = 216
)

func DefaultQualities

func DefaultQualities() []Quality

func (Quality) String

func (v Quality) String() string

type Season

type Season struct {
	sp.Season
	Region   sp.RegionInfo
	Index    int
	Episodes []sp.Episode
	MGID     string
}

type Series

type Series struct {
	Region  sp.RegionInfo
	Seasons map[sp.Language][]Season
	MGID    string
}

type Storage

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

func NewStorage

func NewStorage(pathBase string) (*Storage, error)

type StorageItem

type StorageItem[T any] struct {
	*data.Binding[T]
}

func NewStorageItem

func NewStorageItem[T any](s *Storage, id string, getDefault func() T, onError func(error)) (*StorageItem[T], error)

Jump to

Keyboard shortcuts

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