content

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomMin

func CustomMin(i int, j int) int

Types

type CacheTorrentRequest

type CacheTorrentRequest struct {
	DAppName string
	Path     string
	Magnet   string
}

var mainclient *torrent.Client

type ContentClient

type ContentClient struct {
	ContentLocation string

	//ClosingChannel chan bool
	CacheTorrentRequestChannel chan CacheTorrentRequest
	// contains filtered or unexported fields
}

func Newcontentclient

func Newcontentclient(ctx context.Context, applocation string) *ContentClient

func (*ContentClient) AddCacheTorrentRequest

func (contentclient *ContentClient) AddCacheTorrentRequest(tmpdappname string, tmppath string, tmpmagnet string)

func (*ContentClient) AddMagnetWithDownloadDir

func (contentclient *ContentClient) AddMagnetWithDownloadDir(uri string, downloadDir string) (*torrent.Torrent, error)

func (*ContentClient) CacheRawString

func (contentclient *ContentClient) CacheRawString(tmpdappname string, tmppath string, tmpfilename string, tmprawstring string)

func (*ContentClient) CacheTorrent

func (contentclient *ContentClient) CacheTorrent(tmpdappname string, tmppath string, tmpmagneturi string)

//////////////////

func (*ContentClient) DeleteFileSystemObject added in v0.2.6

func (contentclient *ContentClient) DeleteFileSystemObject(tmpdappname string, tmppath string) string

////////////////// //////////////////

func (*ContentClient) DropTorrent

func (contentclient *ContentClient) DropTorrent(tmpmagneturi string, tmpdappname string, tmpdirectory string, tmperasefilesflag bool) string

func (*ContentClient) GetTorrentDetails

func (contentclient *ContentClient) GetTorrentDetails(tmpmagneturi string) string

func (*ContentClient) Initcontentclient

func (contentclient *ContentClient) Initcontentclient()

func (*ContentClient) ProtorizeTorrentDurationPercentageInterval

func (contentclient *ContentClient) ProtorizeTorrentDurationPercentageInterval(tmpmagnet string, tmppath string, beginprioritizeddurationpercentage int, endprioritizeddurationpercentage int, cancelflag bool)

func (*ContentClient) ProtorizeTorrentPiecesInterval

func (contentclient *ContentClient) ProtorizeTorrentPiecesInterval(tmpmagnet string, tmppath string, beginprioritizedpiece int, endprioritizedpiece int, cancelflag bool)
func (contentclient *ContentClient)  ProtorizeTorrentAllPieces(tmpmagnet string, tmppath string) {
	tmpmagnetobj, perr := metainfo.ParseMagnetUri(tmpmagnet)
	if perr != nil {
		log.Println("Error ",perr)
		return
	}
	t, ok := contentclient.torrentclient.Torrent(tmpmagnetobj.InfoHash)
	if !ok {
		log.Println("Torrent not found ")
		return
	}
	files := t.Files()
	for _, filei := range files {
		if strings.Contains(filei.Path(), tmppath) {//tmppreviewfile == filei.Path() {
			firstpiece := int(filei.BeginPieceIndex())
			lastpiece := int(filei.EndPieceIndex())
			log.Println("Priority for ",firstpiece,lastpiece)
			t.DownloadPieces(firstpiece, lastpiece)
			t.CancelPieces(lastpiece, filei.EndPieceIndex())
		} else {
			filei.SetPriority(torrent.PiecePriorityNone)
		}
	}
}

func (*ContentClient) ScanDirectory added in v0.2.6

func (contentclient *ContentClient) ScanDirectory(tmpdappname string, tmppath string) string

type TorrentDetails

type TorrentDetails struct {
	Magnet        string            //    `json:"magnet"`
	Name          string            //  `json:"name"`
	Nbpeers       int               //     `json:"nbpeers"`
	FileInfoArray []TorrentFileInfo //interface{} `json:"name,omitempty"`
}

type TorrentFileInfo

type TorrentFileInfo struct {
	Path     string
	Size     int
	Progress int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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