tdarr

package
v0.8.0-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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

func CleanAddress(address string) (string, error)

CleanAddress tidies an address typed by a person.

func Translate

func Translate(path, from, to string) (string, bool)

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

func WrapsLinkLocal(ip net.IP) bool

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

func New(address, key string) (*Client, error)

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

func (c *Client) GetLibraries(ctx context.Context) ([]Library, error)

GetLibraries lists Tdarr's libraries.

func (*Client) GetNodes

func (c *Client) GetNodes(ctx context.Context) ([]Node, error)

GetNodes lists the nodes attached to the server and what they're doing.

func (*Client) GetStatus

func (c *Client) GetStatus(ctx context.Context) (*Status, error)

GetStatus asks the server how it is. It's how a connection is tested.

func (*Client) ScanLibrary

func (c *Client) ScanLibrary(ctx context.Context, id, folder string) error

ScanLibrary asks Tdarr to look through one of its libraries for files it hasn't seen.

func (*Client) SendFiles

func (c *Client) SendFiles(ctx context.Context, id string, paths []string) error

SendFiles asks Tdarr to look at these files, by the names it knows them by.

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.

type Status

type Status struct {
	Status  string `json:"status"`
	Version string `json:"version"`
	IsAuth  bool   `json:"isAuthenticated"`
	OS      string `json:"os"`
	Uptime  int64  `json:"uptime"`
}

Status is what the server says about itself.

type Worker

type Worker struct {
	ID      string  `json:"id"`
	File    string  `json:"file"`
	Percent float64 `json:"percent"`
	Mode    string  `json:"mode"`
	FPS     float64 `json:"fps"`
	ETA     string  `json:"eta"`
}

Worker is one job on a node. An idle worker has no file.

Jump to

Keyboard shortcuts

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