helper

package
v0.0.0-...-7d835c8 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTorrentNotFound = errors.New("torrent not found")

Functions

func HumanReadableSize

func HumanReadableSize(sizeInit int64) string

HumanReadableSize Convert a size in bytes to a human-readable size

Types

type BtServerInterface

type BtServerInterface interface {
	Login(username string, password string) error
	GetAPIVersion(ctx context.Context) (string, error)
	GetTorrents(ctx context.Context) ([]*Torrent, error)
	GetTorrent(ctx context.Context, hash string) (*Torrent, error)
	AddTorrentByURL(ctx context.Context, url string, torrent *torrentv1alpha1.Torrent) error
	StopTorrent(ctx context.Context, hash string) error
	ResumeTorrent(ctx context.Context, hash string) error
	DeleteTorrent(ctx context.Context, hash string, keepFiles bool) error
	RenameTorrent(ctx context.Context, hash string, name string) error
	MoveTorrent(ctx context.Context, hash string, destination string) error
	GetTorrentStatus(ctx context.Context, hash string) (*torrentv1alpha1.TorrentStatus, error)
}

type QBittorrentServer

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

func NewQBittorrentServer

func NewQBittorrentServer(btServerSpec torrentv1alpha1.BtServerSpec) *QBittorrentServer

func (*QBittorrentServer) AddTorrentByURL

func (q *QBittorrentServer) AddTorrentByURL(ctx context.Context, torrentUrl string, torrent *torrentv1alpha1.Torrent) error

func (*QBittorrentServer) DeleteTorrent

func (q *QBittorrentServer) DeleteTorrent(ctx context.Context, hash string, keepFiles bool) error

func (*QBittorrentServer) GetAPIVersion

func (q *QBittorrentServer) GetAPIVersion(ctx context.Context) (string, error)

func (*QBittorrentServer) GetTorrent

func (q *QBittorrentServer) GetTorrent(ctx context.Context, hash string) (*Torrent, error)

func (*QBittorrentServer) GetTorrentStatus

func (q *QBittorrentServer) GetTorrentStatus(ctx context.Context, hash string) (*torrentv1alpha1.TorrentStatus, error)

func (*QBittorrentServer) GetTorrents

func (q *QBittorrentServer) GetTorrents(ctx context.Context) ([]*Torrent, error)

func (*QBittorrentServer) Login

func (q *QBittorrentServer) Login(username string, password string) error

func (*QBittorrentServer) MoveTorrent

func (q *QBittorrentServer) MoveTorrent(ctx context.Context, hash string, destination string) error

func (*QBittorrentServer) RenameTorrent

func (q *QBittorrentServer) RenameTorrent(ctx context.Context, hash string, name string) error

func (*QBittorrentServer) ResumeTorrent

func (q *QBittorrentServer) ResumeTorrent(ctx context.Context, hash string) error

func (*QBittorrentServer) StopTorrent

func (q *QBittorrentServer) StopTorrent(ctx context.Context, hash string) error

type Torrent

type Torrent struct {
	Hash        string
	Tags        string
	Name        string
	DownloadDir string
	IsPaused    bool
}

type TorrentState

type TorrentState string
const (
	// StateError represent a torrent in error state
	StateError TorrentState = "Error"
	// StateDownloading represent a torrent in downloading state
	StateDownloading TorrentState = "Downloading"
	// StateSeeding represent a torrent in seeding state
	StateSeeding TorrentState = "Seeding"
	// StatePaused represent a torrent in paused state
	StatePaused TorrentState = "Paused"
	// StateChecking represent a torrent in checking state
	StateChecking TorrentState = "Checking"
	// StateWarming represent a torrent in warming state
	StateWarming TorrentState = "Warming"
	// StateUnknown represent a torrent in unknown state
	StateUnknown TorrentState = "Unknown"
)

func (TorrentState) String

func (s TorrentState) String() string

type TransmissionServer

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

func NewTransmissionServer

func NewTransmissionServer(btServerSpec torrentv1alpha1.BtServerSpec) *TransmissionServer

func (*TransmissionServer) AddTorrentByURL

func (s *TransmissionServer) AddTorrentByURL(ctx context.Context, torrentUrl string, torrent *torrentv1alpha1.Torrent) error

func (*TransmissionServer) DeleteTorrent

func (s *TransmissionServer) DeleteTorrent(ctx context.Context, hash string, keepFiles bool) error

func (*TransmissionServer) GetAPIVersion

func (s *TransmissionServer) GetAPIVersion(ctx context.Context) (string, error)

func (*TransmissionServer) GetTorrent

func (s *TransmissionServer) GetTorrent(ctx context.Context, hash string) (*Torrent, error)

func (*TransmissionServer) GetTorrentStatus

func (s *TransmissionServer) GetTorrentStatus(ctx context.Context, hash string) (*torrentv1alpha1.TorrentStatus, error)

func (*TransmissionServer) GetTorrents

func (s *TransmissionServer) GetTorrents(ctx context.Context) ([]*Torrent, error)

func (*TransmissionServer) Login

func (s *TransmissionServer) Login(username string, password string) error

func (*TransmissionServer) MoveTorrent

func (s *TransmissionServer) MoveTorrent(ctx context.Context, hash string, destination string) error

func (*TransmissionServer) RenameTorrent

func (s *TransmissionServer) RenameTorrent(ctx context.Context, hash string, name string) error

func (*TransmissionServer) ResumeTorrent

func (s *TransmissionServer) ResumeTorrent(ctx context.Context, hash string) error

func (*TransmissionServer) StopTorrent

func (s *TransmissionServer) StopTorrent(ctx context.Context, hash string) error

Jump to

Keyboard shortcuts

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