Documentation
¶
Overview ¶
Package tdarr talks to someone's own Tdarr server over its HTTP API, which is documented at docs.tdarr.io. Tdarr is a separate program with its own licence. Nothing of it is included here, and this never downloads or installs it. See docs/LIBRARY-TRANSCODING.md.
The API's answers aren't described in detail by its public reference, so they're read with care: an unexpected shape gives empty fields and never an error. Only the status call decides whether this is a Tdarr server at all.
Index ¶
- Variables
- func CleanAddress(address string) (string, error)
- func Translate(path, from, to string) (string, bool)
- func WrapsLinkLocal(ip net.IP) bool
- type Client
- func (c *Client) GetLibraries(ctx context.Context) ([]Library, error)
- func (c *Client) GetNodes(ctx context.Context) ([]Node, error)
- func (c *Client) GetStatus(ctx context.Context) (*Status, error)
- func (c *Client) ScanLibrary(ctx context.Context, id, folder string) error
- func (c *Client) SendFiles(ctx context.Context, id string, paths []string) error
- type Library
- type Node
- type Status
- type Worker
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadAddress = errors.New("that isn't an address this can use: it needs to start with http:// or https://, with no user name or password in it") ErrUnreachable = errors.New("nothing answered at that address. Check that Tdarr is running, and that the address and its server port (8266 by default) are right") ErrNotTdarr = errors.New("something answered at that address, but it doesn't look like a Tdarr server") ErrKey = errors.New("Tdarr refused the API key. Make one in Tdarr under Tools, API Keys") ErrRefused = errors.New("Tdarr said no to that request") )
Problems a person can do something about.
Functions ¶
func CleanAddress ¶
CleanAddress tidies an address typed by a person.
func Translate ¶
Translate writes a path the way Tdarr knows it: the part the two have different names for replaced. A path that isn't under from can't be sent.
func WrapsLinkLocal ¶
WrapsLinkLocal: an IPv6 address that carries an IPv4 one, for a gateway to unwrap, carrying the address cloud machines keep their credentials at.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a connection to one Tdarr server. It holds nothing open.
func New ¶
New checks an address and makes a client. Reaching a machine on the home network is the point, so private addresses are fine. The address where cloud machines keep their credentials isn't, and redirects aren't followed, so a key is only ever sent to the address the owner typed.
func (*Client) GetLibraries ¶
GetLibraries lists Tdarr's libraries.
func (*Client) ScanLibrary ¶
ScanLibrary asks Tdarr to look through one of its libraries for files it hasn't seen.
type Library ¶
type Library struct {
ID string `json:"id"`
Name string `json:"name"`
Folder string `json:"folder"`
}
Library is a library set up in Tdarr.
type Node ¶
type Node struct {
ID string `json:"id"`
Name string `json:"name"`
Paused bool `json:"paused"`
Workers []Worker `json:"workers"`
}
Node is a stock Tdarr node attached to that server.