clientmigrate

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: GPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.

Types

type ClientMigrater

type ClientMigrater interface {
	Migrate() error
}

type ClientType

type ClientType string
var (
	ClientTypeDeluge       ClientType = "deluge"
	ClientTypeRTorrent     ClientType = "rtorrent"
	ClientTypeTransmission ClientType = "transmission"
)

type DelugeImport

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

func NewDelugeImporter

func NewDelugeImporter(opts Options) *DelugeImport

func (*DelugeImport) Migrate

func (di *DelugeImport) Migrate() error

type Fastresume

type Fastresume struct {
	ActiveTime                int64      `bencode:"active_time"`
	AddedTime                 int64      `bencode:"added_time"`
	Allocation                string     `bencode:"allocation"`
	ApplyIPFilter             int64      `bencode:"apply_ip_filter"`
	AnnounceToDht             int64      `bencode:"announce_to_dht,omitempty"`
	AnnounceToLsd             int64      `bencode:"announce_to_lsd,omitempty"`
	AnnounceToTrackers        int64      `bencode:"announce_to_trackers,omitempty"`
	AutoManaged               int64      `bencode:"auto_managed"`
	CompletedTime             int64      `bencode:"completed_time"`
	DisableDHT                int64      `bencode:"disable_dht"`
	DisableLSD                int64      `bencode:"disable_lsd"`
	DisablePEX                int64      `bencode:"disable_pex"`
	DownloadRateLimit         int64      `bencode:"download_rate_limit"`
	FileFormat                string     `bencode:"file-format"`
	FileVersion               int64      `bencode:"file-version"`
	FilePriority              []int      `bencode:"file_priority"`
	FileSizes                 [][]int64  `bencode:"file sizes,omitempty"`
	FinishedTime              int64      `bencode:"finished_time"`
	HTTPSeeds                 []string   `bencode:"httpseeds,omitempty"`
	InfoHash                  []byte     `bencode:"info-hash"`
	LastDownload              int64      `bencode:"last_download"`
	LastSeenComplete          int64      `bencode:"last_seen_complete"`
	LastUpload                int64      `bencode:"last_upload"`
	LibTorrentVersion         string     `bencode:"libtorrent-version"`
	MaxConnections            int64      `bencode:"max_connections"`
	MaxUploads                int64      `bencode:"max_uploads"`
	Name                      string     `bencode:"name,omitempty"`
	NumComplete               int64      `bencode:"num_complete"`
	NumDownloaded             int64      `bencode:"num_downloaded"`
	NumIncomplete             int64      `bencode:"num_incomplete"`
	Paused                    int64      `bencode:"paused"`
	Pieces                    string     `bencode:"pieces"`
	PiecePriority             []byte     `bencode:"piece_priority"`
	Peers                     string     `bencode:"peers"`
	Peers6                    string     `bencode:"peers6"`
	QbtCategory               string     `bencode:"qBt-category"`
	QbtContentLayout          string     `bencode:"qBt-contentLayout"`
	QbtHasRootFolder          int64      `bencode:"qBt-hasRootFolder"`
	QbtFirstLastPiecePriority int64      `bencode:"qBt-firstLastPiecePriority"`
	QbtName                   string     `bencode:"qBt-name"`
	QbtRatioLimit             int64      `bencode:"qBt-ratioLimit"`
	QbtSavePath               string     `bencode:"qBt-savePath"`
	QbtSeedStatus             int64      `bencode:"qBt-seedStatus"`
	QbtSeedingTimeLimit       int64      `bencode:"qBt-seedingTimeLimit"`
	QbtTags                   []string   `bencode:"qBt-tags"`
	QbtQueuePosition          int        `bencode:"qBt-queuePosition,omitempty"`
	QbtTempPathDisabled       int64      `bencode:"qBt-tempPathDisabled,omitempty"`
	SavePath                  string     `bencode:"save_path"`
	SeedMode                  int64      `bencode:"seed_mode"`
	SeedingTime               int64      `bencode:"seeding_time"`
	SequentialDownload        int64      `bencode:"sequential_download"`
	ShareMode                 int64      `bencode:"share_mode"`
	StopWhenReady             int64      `bencode:"stop_when_ready"`
	SuperSeeding              int64      `bencode:"super_seeding"`
	TotalDownloaded           int64      `bencode:"total_downloaded"`
	TotalUploaded             int64      `bencode:"total_uploaded"`
	Trackers                  [][]string `bencode:"trackers,omitempty"`
	UploadMode                int64      `bencode:"upload_mode"`
	UploadRateLimit           int64      `bencode:"upload_rate_limit"`
	URLList                   []string   `bencode:"url-list"`
	Unfinished                *[]any     `bencode:"unfinished,omitempty"`
	TorrentFilePath           string     `bencode:"-"`
	MappedFiles               []string   `bencode:"mapped_files,omitempty"`
}

Fastresume represents a qBittorrent fastresume file

func (*Fastresume) ConvertFilePriority

func (fr *Fastresume) ConvertFilePriority(numFiles int)

ConvertFilePriority for each file set priority

func (*Fastresume) Encode

func (fr *Fastresume) Encode(path string) error

Encode qBittorrent fastresume file

type Migrater

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

func New

func New(opts Options) Migrater

func (Migrater) Backup

func (m Migrater) Backup() error

func (Migrater) Migrate

func (m Migrater) Migrate(ctx context.Context) error

type Options

type Options struct {
	Source     ClientType
	SourceDir  string
	QbitDir    string
	DryRun     bool
	SkipBackup bool
}

type RTorrentImport

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

func NewRTorrentImporter

func NewRTorrentImporter(opts Options) *RTorrentImport

func (*RTorrentImport) Migrate

func (i *RTorrentImport) Migrate() error

type RTorrentLibTorrentResumeFile

type RTorrentLibTorrentResumeFile struct {
	Bitfield any                       `bencode:"bitfield"`
	Files    []RTorrentResumeFileEntry `bencode:"files"`
	Trackers map[string]map[string]int `bencode:"trackers"`
}

type RTorrentResumeFileEntry

type RTorrentResumeFileEntry struct {
	Completed int64 `bencode:"completed"`
	Mtime     int64 `bencode:"mtime"`
	Priority  int64 `bencode:"priority"`
}

type RTorrentTorrentFile

type RTorrentTorrentFile struct {
	Complete int64 `bencode:"complete"`
	Custom   struct {
		AddTime     string `bencode:"addtime"`
		SeedingTime string `bencode:"seedingtime"`
	} `bencode:"custom"`
	Custom1           string `bencode:"custom1"`
	Directory         string `bencode:"directory"`
	State             int64  `bencode:"state"`
	TotalDownloaded   int64  `bencode:"total_downloaded"`
	TotalUploaded     int64  `bencode:"total_uploaded"`
	TimestampFinished int64  `bencode:"timestamp.finished"`
	TimestampStarted  int64  `bencode:"timestamp.started"`
}

type TransmissionImport

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

func NewTransmissionImporter

func NewTransmissionImporter(opts Options) *TransmissionImport

func (*TransmissionImport) Migrate

func (i *TransmissionImport) Migrate() error

type TransmissionResumeFile

type TransmissionResumeFile struct {
	Files                  []string                         `bencode:"files"`
	Name                   string                           `bencode:"name"`
	Corrupted              int64                            `bencode:"corrupt"`
	Destination            string                           `bencode:"destination"`
	IncompleteDir          string                           `bencode:"incomplete-dir"`
	Downloaded             int64                            `bencode:"downloaded"`
	Uploaded               int64                            `bencode:"uploaded"`
	Group                  string                           `bencode:"group"`
	BandwidthPriority      int                              `bencode:"bandwidth-priority"`
	Priority               []int                            `bencode:"priority"`
	DoneDate               int64                            `bencode:"done-date"`
	DownloadingTimeSeconds int64                            `bencode:"downloading-time-seconds"`
	Labels                 []string                         `bencode:"labels"`
	MaxPeers               int64                            `bencode:"max-peers"`
	Paused                 bool                             `bencode:"paused"`
	Peers                  string                           `bencode:"peers2"`
	ActivityDate           int64                            `bencode:"activity-date"`
	AddedDate              int64                            `bencode:"added-date"`
	Dnd                    []int                            `bencode:"dnd"`
	SeedingTimeSeconds     int64                            `bencode:"seeding-time-seconds"`
	Progress               TransmissionResumeFileProgress   `bencode:"progress"`
	IdleLimit              TransmissionResumeFileIdleLimit  `bencode:"idle-limit"`
	RatioLimit             TransmissionResumeFileRatioLimit `bencode:"ratio-limit"`
	SpeedLimitUp           TransmissionResumeFileSpeedLimit `bencode:"speed-limit-up"`
	SpeedLimitDown         TransmissionResumeFileSpeedLimit `bencode:"speed-limit-down"`
}

type TransmissionResumeFileIdleLimit

type TransmissionResumeFileIdleLimit struct {
	IdleLimit int64 `bencode:"idle-limit"`
	IdleMode  int   `bencode:"idle-mode"`
}

type TransmissionResumeFileProgress

type TransmissionResumeFileProgress struct {
	Blocks string  `bencode:"blocks"`
	Have   string  `bencode:"have"`
	MTimes []int64 `bencode:"mtimes"`
	Pieces string  `bencode:"pieces"`
}

type TransmissionResumeFileRatioLimit

type TransmissionResumeFileRatioLimit struct {
	RatioLimit string `bencode:"ratio-limit"`
	RatioMode  int    `bencode:"ratio-mode"`
}

type TransmissionResumeFileSpeedLimit

type TransmissionResumeFileSpeedLimit struct {
	SpeedBPS            int64 `bencode:"speed-Bps"`
	UseGlobalSpeedLimit int64 `bencode:"use-global-speed-limit"`
	UseSpeedLimit       int64 `bencode:"use-speed-limit"`
}

Jump to

Keyboard shortcuts

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