torrentutil

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenameExportedTorrent added in v0.1.9

func RenameExportedTorrent(torrent client.Torrent, rename string) string

Get appropriate filename for exported .torrent file. available variable placeholders: [size], [infohash], [infohash16], [category], [name], [name128]

func RenameTorrent added in v0.1.9

func RenameTorrent(rename string, sitename string, id string, filename string, tinfo *TorrentMeta) string

Rename torrent (downloaded filename or name of torrent added to client) according to rename template. filename: original torrent filename (e.g. "abc.torrent"). available variable placeholders: [size], [id], [site], [filename], [filename128], [name], [name128]. tinfo is optional could may be nil.

Types

type TorrentMeta

type TorrentMeta struct {
	InfoHash          string
	Trackers          []string
	Size              int64
	SingleFileTorrent bool
	RootDir           string
	ContentPath       string // root folder or single file name
	Files             []TorrentMetaFile
	MetaInfo          *metainfo.MetaInfo
	Info              metainfo.Info
}

func ParseTorrent

func ParseTorrent(torrentdata []byte, fields int64) (*TorrentMeta, error)

fields: 0 - only infoHash; 1- infoHash + trackers; 2+ - all

func (*TorrentMeta) MagnetUrl added in v0.1.9

func (meta *TorrentMeta) MagnetUrl() string

Generate magnet: url of this torrent. Must be used on meta parsed from ParseTorrent with fields >= 2

func (*TorrentMeta) Print

func (meta *TorrentMeta) Print(name string, showAll bool)

func (*TorrentMeta) PrintFiles

func (meta *TorrentMeta) PrintFiles(addRootDirPrefix bool, useRawSize bool)

func (*TorrentMeta) Verify

func (meta *TorrentMeta) Verify(savePath string, contentPath string, checkHash int64) error

checkHash: 0 - none; 1 - quick; 2+ - full.

func (*TorrentMeta) XseedCheckWithClientTorrent

func (meta *TorrentMeta) XseedCheckWithClientTorrent(clientTorrentContents []client.TorrentContentFile) int64

return 0 if this torrent is equal with client torrent; return 1 if client torrent contains all files of this torrent. return -2 if the ROOT folder(file) of the two are different, but all innner files are SAME. return -1 if contents of the two torrents are NOT same.

type TorrentMetaFile

type TorrentMetaFile struct {
	Path string // full path joined by '/'
	Size int64
}

Jump to

Keyboard shortcuts

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