client

package
v0.0.0-...-d83d4a1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const NetfliHistorySize = 20

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

ConfigDir returns the path to the config directory

Types

type Client

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

Client represents a client to interact with external services

func New

func New(slackWebhooks []string, history *History) *Client

New returns a new Client

func (*Client) FetchNetflixHistory

func (c *Client) FetchNetflixHistory(cfg NetflixConfig) error

FetchNetflixHistory returns the viewing history from Netflix

func (*Client) MarkAsWatched

func (c *Client) MarkAsWatched(conf TraktConfig)

MarkAsWatched mark as watched all the provided media

func (*Client) Report

func (c *Client) Report(msg string)

Report reports a message to Slack

type History

type History struct {
	ItemsSearch map[string]struct{} `json:"search"`
	Items       []string            `json:"items"`
	ToProcess   []*NetflixHistory   `json:"-"`
}

func NewHistory

func NewHistory() *History

func (*History) ClearNetflixHistory

func (h *History) ClearNetflixHistory()

func (*History) Has

func (h *History) Has(item string) bool

func (*History) Load

func (h *History) Load() error

func (*History) Push

func (h *History) Push(item string, r Reporter)

func (*History) Write

func (h *History) Write() error

type NetflixConfig

type NetflixConfig struct {
	AccountID string `env:"ACCOUNT_ID"`
	Cookie    string `env:"COOKIE,required"`
	URL       string `env:"URL,default=https://www.netflix.com/viewingactivity"`
}

NetflixConfig contains the configuration needed for Netflix

type NetflixHistory

type NetflixHistory struct {
	Date        string
	Title       string
	EpisodeName string
	IsShow      bool
}

NetflixHistory contains the data from Netflix

func (*NetflixHistory) SearchQuery

func (h *NetflixHistory) SearchQuery() string

SearchQuery returns the query string to use on trakt to search for the media

func (*NetflixHistory) String

func (h *NetflixHistory) String() string

type Reporter

type Reporter interface {
	Report(msg string)
}

type TraktConfig

type TraktConfig struct {
	CSRF   string `env:"CSRF,required"`
	Cookie string `env:"COOKIE,required"`
}

TraktConfig contains the configuration needed for Netflix

Jump to

Keyboard shortcuts

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