providers

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: MIT Imports: 4 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 MatchRequest

type MatchRequest struct {
	// Fields for matching
	Show        string
	ShowID      string // Future use
	Title       string
	TitleID     string // Future use
	Pitch       string
	Provider    string
	Playlist    string // Playlist search is implemented in providers.
	MaxAgedDays int    // Retrive media younger than MaxAgedDays when not zero

	// Destination name when found
	Destination   string
	RetentionDays int // Media retention time, when not zero the system will delete old files
}

MatchRequest holds criterions for selecting show

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    *MatchRequest   // Matched request
}

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
	GetNFOPath(destination string) string
	GetSeasonNFOPath(destination string) string
	GetShowNFOPath(destination string) string
	GetSeriesPath(destination string) string
	GetMediaPath(destination string) string
	GetSeasonPath(destination string) string
	GetMediaPathMatcher(destination string) string
	WriteNFO(destination string) error
}

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, []*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