providers

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: MIT Imports: 3 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 IsShowMatch added in v0.0.2

func IsShowMatch(mm []*MatchRequest, s *Show) bool

IsShowMatch is the generic implementation of show matcher. Criterions are tested in following order: - Provider - Show - Title - Pitch When there is a match, it adds MatchRequest.Destination into Show record. Criteria is ignored when it is empty in the MatchRequest When the list of MatchRequest is nil or empty, all show will match. Note: Playlist match isn't handled generically, it must be implemented in the provider's implementation

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 Configurer added in v0.0.2

type Configurer interface {
	SetConfig(map[string]interface{})
}

Configurer interface

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.

	// Destination name when found
	Destination string
}

MatchRequest holds criterions for selecting show

type Provider

type Provider interface {
	Name() string                           // Provider's name
	Shows([]*MatchRequest) ([]*Show, error) // List of available shows that match one of MatchRequest
	GetShowStreamURL(*Show) (string, error) // Give video stream url ofr a give show
	GetShowFileName(*Show) string           // Give a sensible name for the given show
	GetShowFileNameMatcher(*Show) string    // Give a file name matcher for searching duplicates having different episode number
}

Provider is the interface for a provider

type Show

type Show struct {
	ID           string        // Show ID
	Title        string        // Episode title
	Show         string        // Show name
	Pitch        string        // Pitch on the episode
	Season       string        // Season
	Episode      string        // Episode
	Channel      string        // Channel
	AirDate      time.Time     // Broadcasting date
	Duration     time.Duration // Duration of the show
	ShowURL      string        // url to the show page at provider
	StreamURL    string        // url of the video stream
	ThumbnailURL string        // direct url to the thumbnail of the show provided by the provider
	Detailed     bool          // False means some details can be requested
	DRM          bool          // True when video is protected with DRM
	Category     string        // Show's category
	Provider     string        // provider's name
	Destination  string        // Destination code taken from watch list
}

Show structure handle show details. It is shared among all packages

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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