Documentation ¶
Index ¶
- func Breakpoint(vars ...any)
- func Contains[T comparable](array []T, value T) bool
- func Curl[R Request | string](_request R) (string, bool, map[string][]string)
- func DebugLog(vars ...any)
- func EpisodatePopulateEpisodesMetadata(show *Show)
- func EpisodatePopulateShowMetadata(show *Show)
- func GetJson[T any](request Request, data T) T
- func IndexOf[T comparable](array []T, value T) int
- func Invert[T any](array []T) []T
- func IsDefault[T Number | string | bool](v T) bool
- func Keys[K comparable, V any](m map[K]V) []K
- func Map[T Number, O Number](vars []T, f func(v T) O) []O
- func MapCopy[T comparable, O any](m map[T]O) map[T]O
- func Max[T Number](vars ...T) T
- func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V
- func Min[T Number](vars ...T) T
- func Perform(request Request) (*http.Response, bool)
- func Repeat(s string, times int) string
- func SanitizeFilename(filename string) string
- func ScrapePage(request Request, selector string, handler func(int, *goquery.Selection))
- func Soup(text string, selector string, handler func(int, *goquery.Selection))
- func Sum[T Number](vars ...T) T
- func Timeout[R any](timeout int, f func() R) (R, bool)
- func WrapString(s string, wantedWidth uint) string
- func WrapStringReguardlessly(s string, wantedWidth int) string
- type Episode
- type Metadata
- type Number
- type ProviderInfo
- type Request
- type Show
- type Video
- type VideoProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Breakpoint ¶ added in v0.0.8
func Breakpoint(vars ...any)
Hacky breakpoint that prints a message
func Contains ¶ added in v0.0.8
func Contains[T comparable](array []T, value T) bool
Check if an array contains value
func DebugLog ¶ added in v0.0.7
func DebugLog(vars ...any)
hacky debug log that writes to /tmp/debug.txt tail -f /tmp/debug.txt
func EpisodatePopulateEpisodesMetadata ¶ added in v0.0.4
func EpisodatePopulateEpisodesMetadata(show *Show)
Gets episode description from episodate api Fills in the episodes metadata of the show.Episodes array
func EpisodatePopulateShowMetadata ¶ added in v0.0.4
func EpisodatePopulateShowMetadata(show *Show)
Gets show description from episodate api Fills in the show metadata
func IndexOf ¶ added in v0.0.8
func IndexOf[T comparable](array []T, value T) int
Find index in array
func Keys ¶ added in v0.0.5
func Keys[K comparable, V any](m map[K]V) []K
Return list of keys of a map
func MapCopy ¶ added in v0.0.17
func MapCopy[T comparable, O any](m map[T]O) map[T]O
Create the copy of a map
func Max ¶ added in v0.0.7
func Max[T Number](vars ...T) T
Finds the maximum value among the arguments
func MergeMaps ¶
func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V
func Min ¶ added in v0.0.7
func Min[T Number](vars ...T) T
Finds the minimum value among the arguments
func SanitizeFilename ¶ added in v0.0.4
func ScrapePage ¶
func Timeout ¶ added in v0.0.9
Run a function and return nil, false if it timeouts. otherwise returns f(), true timeout in seconds
func WrapString ¶ added in v0.0.4
WrapString wraps the given string within lim width in characters.
Wrapping is currently naive and only happens at white-space. A future version of the library will implement smarter wrapping. This means that pathological cases can dramatically reach past the limit, such as a very long word.
func WrapStringReguardlessly ¶ added in v0.0.4
Wrap reguardles of spaces
Types ¶
type Episode ¶
type Episode struct { // Title of the episode Title string // Unique Number of the episode that follows the order of the series Number int // Url to the episode in the providers website Url string // Video struct for this episode Video Video // Metadata for this episode Metadata Metadata }
An episode of a tv show
type Number ¶ added in v0.0.7
type Number interface { constraints.Integer | constraints.Float }
type ProviderInfo ¶ added in v0.0.7
type ProviderInfo struct { // Name of the provider Name string // Url to the providers website Url string // Description for the provider Description string // If true, then better use curl-impersonate Cloudflared bool }
Information for providers, similar to Metadata for episodes
type Request ¶
type Request struct { // url for the request Url string // method for the request Method string // headers for the request Headers map[string]string // body for the request Body map[string]string // If set to true will use curl instead of go's stdlib http module // Useful in the cases there is a basic cloudflare protection and // curl-impersonate can be used Curl bool // If set to true will print body and request to stdout. // Usefult for when writting provider plugins, do not let this on in production. Debug bool }
func (Request) New ¶ added in v0.0.5
Create a new request from an existing one, appending to the url
func (Request) ToCurlString ¶ added in v0.0.18
Converts this request to a curl command. Useful for debugging.
type Show ¶
type Show struct { // Title of the show Title string // Url to the show in the providers website Url string // List of episodes for this show Episodes []Episode // If set to true it is a movie provider, meaning there are no episodes and shows // are movies. By default it will be a show, meaning it has episodes. IsMovie bool // Metadata for this show Metadata Metadata }
Can represent a Tv Show or a Movie
type Video ¶
type Video struct { // Name of the video file to be downloaded Name string // Format of the video file Format string // Request to the providers api to fetch the video Request Request // Metadata for the video Metadata Metadata }
Packages a request to the providers api to fetch the video for an episode or movie Also information about the file to be downloaded
type VideoProvider ¶
type VideoProvider interface { // Get the list of shows for this provider. // If the provider is a movie provider, this will alerady be the movie list SearchShows(string) []Show // Get the list of episodes for a show and populates Show.Episodes. // If show.IsMovie then should return a single episode in the list, others // will be ignored. GetEpisodes(*Show) []Episode // Get the video for an episode and populates Episode.Video GetVideo(*Episode) Video // Get the provider information. Info() ProviderInfo }
Interface for video providers