Documentation
¶
Overview ¶
Package remotepath implements remote path mappings, as in Sonarr. A download client that runs in a container or on another machine reports paths as it sees them (/downloads/Show.S01E01); a mapping rewrites that prefix to the same folder as Pilot sees it (/mnt/media/downloads).
Remote paths may be Unix or Windows style (a client on Windows reports C:\Downloads\...). They are compared by path component, with either separator, and case-insensitively for Windows paths.
Index ¶
- Variables
- func Apply(mappings []Mapping, clientID, path string) string
- type Mapping
- type Request
- type Service
- func (s *Service) Create(ctx context.Context, req Request) (Mapping, error)
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) List(ctx context.Context) ([]Mapping, error)
- func (s *Service) Map(ctx context.Context, clientID, path string) string
- func (s *Service) Update(ctx context.Context, id string, req Request) (Mapping, error)
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("remote path mapping not found")
ErrNotFound is returned when a mapping ID doesn't exist.
Functions ¶
Types ¶
type Mapping ¶
type Mapping struct {
ID string
DownloadClientID string // "" = any client
RemotePath string
LocalPath string
}
Mapping is one remote path mapping.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service stores mappings and applies them.
type ValidationError ¶
type ValidationError struct{ Msg string }
ValidationError explains why a Request was rejected.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string