rtorrent

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LibtorrentResume

type LibtorrentResume struct {
	Bitfield string `bencode:"bitfield"`
	Files    []struct {
		Mtime    int64 `bencode:"mtime"`
		Priority int   `bencode:"priority"`
	} `bencode:"files"`
	Peers           string `bencode:"peers,omitempty"`
	Peers6          string `bencode:"peers6,omitempty"`
	TotalUploaded   int64  `bencode:"total_uploaded"`
	TotalDownloaded int64  `bencode:"total_downloaded"`
	ActiveTime      int64  `bencode:"active_time"`
	SeedingTime     int64  `bencode:"seeding_time"`
	FinishedTime    int64  `bencode:"finished_time"`
}

LibtorrentResume represents the libtorrent_resume file data

type Session

type Session struct {
	TorrentPath    string
	SessionPath    string
	ResumeDataPath string

	Torrent     TorrentFile
	SessionData SessionData
	ResumeData  LibtorrentResume
	InfoHash    []byte
}

Session represents a complete rTorrent session entry

func LoadSession

func LoadSession(sessionDir, torrentFile string) (*Session, error)

LoadSession loads all session data for a torrent from the rTorrent session directory

func (*Session) GetLabel

func (s *Session) GetLabel() string

GetLabel returns the category/label (from custom1)

func (*Session) GetSavePath

func (s *Session) GetSavePath() string

GetSavePath returns the save path/directory for the torrent data

func (*Session) IsComplete

func (s *Session) IsComplete() bool

IsComplete returns true if the torrent download is complete

func (*Session) IsMultiFile

func (s *Session) IsMultiFile() bool

IsMultiFile returns true if this is a multi-file torrent

type SessionData

type SessionData struct {
	// Core fields from libtorrent resume
	Bitfield        string `bencode:"bitfield"`
	TotalUploaded   int64  `bencode:"total_uploaded"`
	TotalDownloaded int64  `bencode:"total_downloaded"`

	// Path information
	Directory  string `bencode:"directory"`
	LoadedFile string `bencode:"loaded_file"`
	TiedToFile string `bencode:"tied_to_file"`

	// State
	State    int `bencode:"state"`
	Priority int `bencode:"priority"`

	// Timestamps
	TimestampStarted  int64 `bencode:"timestamp.started"`
	TimestampFinished int64 `bencode:"timestamp.finished"`

	// Custom fields (often used for labels/categories)
	Custom1 string `bencode:"custom1"`
	Custom2 string `bencode:"custom2"`
	Custom3 string `bencode:"custom3"`
	Custom4 string `bencode:"custom4"`
	Custom5 string `bencode:"custom5"`

	// Hashing state
	Hashing int `bencode:"hashing"`

	// Chunks/pieces info
	ChunksWanted int `bencode:"chunks_wanted"`
	ChunksDone   int `bencode:"chunks_done"`

	// Connection limits
	MaxUploads int `bencode:"max_uploads"`

	// Views
	Views []string `bencode:"views"`
}

SessionData represents the data stored in an rTorrent .rtorrent session file

type TorrentFile

type TorrentFile struct {
	Announce     string      `bencode:"announce,omitempty"`
	AnnounceList [][]string  `bencode:"announce-list,omitempty"`
	Comment      string      `bencode:"comment,omitempty"`
	CreatedBy    string      `bencode:"created by,omitempty"`
	CreationDate int64       `bencode:"creation date,omitempty"`
	Info         TorrentInfo `bencode:"info"`
}

TorrentFile represents a full .torrent file

type TorrentInfo

type TorrentInfo struct {
	Name        string `bencode:"name"`
	PieceLength int64  `bencode:"piece length"`
	Pieces      string `bencode:"pieces"`
	Length      int64  `bencode:"length,omitempty"` // Single file mode
	Files       []struct {
		Length int64    `bencode:"length"`
		Path   []string `bencode:"path"`
	} `bencode:"files,omitempty"` // Multi-file mode
	Private int `bencode:"private,omitempty"`
}

TorrentInfo represents the info dictionary from a .torrent file

Jump to

Keyboard shortcuts

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