providers

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileNameCleaner

func FileNameCleaner(s string) string

FileNameCleaner return a safe file name from a given show name.

func Format2Digits

func Format2Digits(d string) string

Format2Digits return a number with 2 digits when there is only one digit

func List

func List() map[string]Provider

List of registered providers

func PathNameCleaner

func PathNameCleaner(s string) string

PathNameCleaner return a safe path name from a given show name.

func Register

func Register(p Provider)

Register is called by provider's init to register the provider

Types

type Config added in v0.8.0

type Config struct {
	Log       *mylog.MyLog // Logger
	KeepBonus bool         // Flag

}

Config carries the configuration to providers

type Media added in v0.7.0

type Media struct {
	ID       string                // Show ID
	ShowType ShowType              // Movie or Series?
	Metadata MetaDataHandler       // Carry metadata scrapped online
	Match    *matcher.MatchRequest // Matched request
	ShowPath string                // Path of the show/media
}

Media represents a media to be handled.

func (*Media) SetMetaData added in v0.7.0

func (m *Media) SetMetaData(info MetaDataHandler)

type MetaDataHandler added in v0.7.0

type MetaDataHandler interface {
	GetMediaInfo() *nfo.MediaInfo               // return a pointer to MediaInfo struct
	GetMediaPath(showPath string) string        // Returns mp4 path as showPath/.../file.mp4
	GetMediaPathMatcher(showPath string) string // Returns a name matcher for mis numbered episodes
	GetNFOPath(showPath string) string          // Returns nfo path as showPath/.../file.nfo
	WriteNFO(showPath string) error             // Write nfo file showPath/.../file.nfo
	Accepted(m *matcher.MatchRequest) bool      // TODO check if this is the right place ofr this
}

MetaDataHandler represents a struct for managing media's metadata

type Provider

type Provider interface {
	Configure(c Config)                                             // Pass general configuration
	Name() string                                                   // Provider's name
	MediaList(context.Context, []*matcher.MatchRequest) chan *Media // List of available shows that match one of MatchRequest
	GetMediaDetails(context.Context, *Media) error                  // Download more details when available
}

Provider is the interface for a provider

type ShowType added in v0.7.0

type ShowType int

ShowType says if the media is a movie (one time broadcast), TVShows (recurring show) or a series (with seasons and episodes)

const (
	Series ShowType = iota // Series has seasons and episodes
	Movie                  // Just one media

)

ShowType values

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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