common

package
v0.0.0-...-baf3466 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanFilename

func CleanFilename(name string) string

CleanFilename cleans the filename of any illegal file characters to prevent write errors

func Delete

func Delete(a ...string) error

Delete removes a file from the system

func GenerateEpisodeFilename

func GenerateEpisodeFilename(show string, season int, episode float64, desc string) string

GenerateEpisodeFilename constructs an episode filename and returns the filename fully sanitized

func Rename

func Rename(src, dst string, i int) error

Rename renames the source to the desired destination file name and recursively retries i times if there are any issues

Types

type Episode

type Episode interface {
	GetEpisodeInfo(client *HTTPClient, quality string) error
	Download(vp *VideoProcessor, testOnly bool) error
	DownloadSubtitles(client *HTTPClient, language, tempDir string) (string, error)
	GetFilename() string
}

Episode implements Episode functionality

type Episodes

type Episodes []Episode

Episodes is an aliased slice of Episodes

type Error

type Error struct {
	Msg string
	Err error
}

Error represents a generic anirip error

func NewError

func NewError(msg string, err error) *Error

NewError generates a new generic anirip error

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface

type HTTPClient

type HTTPClient struct {
	Client    *http.Client
	UserAgent string
}

HTTPClient performs

func NewHTTPClient

func NewHTTPClient() (*HTTPClient, error)

NewHTTPClient generates a new HTTPClient Requester that contains a random user-agent to emulate browser requests

func (*HTTPClient) Get

func (c *HTTPClient) Get(url string, header http.Header) (*http.Response, error)

Get performs a GET request using the passed url using the in-memory HTTPClient

func (*HTTPClient) Post

func (c *HTTPClient) Post(url string, header http.Header, body io.Reader) (*http.Response, error)

Post performs a POST request using the passed url and body using the in-memory HTTPClient

type Season

type Season interface {
	GetNumber() int
	GetEpisodes() Episodes
}

Season implements Season functionality

type Seasons

type Seasons []Season

Seasons is an aliased slice of Seasons

type Show

type Show interface {
	Scrape(client *HTTPClient, showURL string) error
	GetTitle() string
	GetSeasons() Seasons
}

Show implements Show functionality

type VideoProcessor

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

func NewVideoProcessor

func NewVideoProcessor(tempDir string) *VideoProcessor

NewVideoProcessor generates a new VideoProcessor that contains the location of our temporary directory

func (*VideoProcessor) DumpHLS

func (p *VideoProcessor) DumpHLS(url string) error

DumpHLS dumps an HLS Stream to the temporary directory

func (*VideoProcessor) MergeSubtitles

func (p *VideoProcessor) MergeSubtitles(audioLang, subtitleLang string) error

MergeSubtitles merges the VIDEO.mkv and the VIDEO.ass

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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