Documentation
¶
Index ¶
- Constants
- Variables
- func DebugAll(s *Service) gin.HandlerFunc
- func DebugBundle(s *Service) gin.HandlerFunc
- func EpisodeFromFileName(fileName string) (show string, season, episode int, ok bool)
- func IsWatchedFile(path string, size int64) bool
- func MatchEpisodeFilename(s, e int, isSingleSeason bool, activeSeason int, show *tmdb.Show, ...) (index, found int)
- func SetWatchedFile(path string, size int64, watched bool)
- func TrimChoices(choices []*CandidateFile)
- func URLForXBMC(pattern string, args ...any) string
- func URLQuery(route string, query ...string) string
- func UpdateDefaultTrackers()
- type Action
- type AddOptions
- type Alert
- type AnnounceRequest
- type AnnounceResponse
- type Bitfield
- type CandidateFile
- type ConnectionResponse
- type File
- type MemoryFile
- func (mf *MemoryFile) Close() (err error)
- func (mf *MemoryFile) IsDir() bool
- func (mf *MemoryFile) ModTime() time.Time
- func (mf *MemoryFile) Mode() os.FileMode
- func (mf *MemoryFile) Name() string
- func (mf *MemoryFile) Read(b []byte) (n int, err error)
- func (mf *MemoryFile) ReadPiece(b []byte, piece int, pieceOffset int) (n int, err error)
- func (mf *MemoryFile) Readdir(count int) (ret []os.FileInfo, err error)
- func (mf *MemoryFile) Seek(off int64, whence int) (ret int64, err error)
- func (mf *MemoryFile) Size() int64
- func (mf *MemoryFile) Stat() (ret os.FileInfo, err error)
- func (mf *MemoryFile) Sys() any
- type NextEpisode
- type Peer
- type PieceRange
- type Player
- func (btp *Player) Buffer() error
- func (btp *Player) Close()
- func (btp *Player) DownloadSubtitles()
- func (btp *Player) FetchStoredResume()
- func (btp *Player) GetIdent()
- func (btp *Player) GetTorrent() *Torrent
- func (btp *Player) GetXBMCHost() *xbmc.XBMCHost
- func (btp *Player) HasChosenFile() bool
- func (btp *Player) InitAudio()
- func (btp *Player) InitSubtitles()
- func (btp *Player) IsClosed() bool
- func (btp *Player) IsWatched() bool
- func (btp *Player) Params() *PlayerParams
- func (btp *Player) PlayURL() string
- func (btp *Player) SaveStoredResume()
- func (btp *Player) SetSubtitles()
- func (btp *Player) SetTorrent(t *Torrent)
- func (btp *Player) UpdateWatched()
- type PlayerParams
- type PortMapping
- type Queue
- type RemoveOptions
- type ScrapeResponseEntry
- type Service
- func (s *Service) AddTorrent(xbmcHost *xbmc.XBMCHost, options AddOptions) (_ *Torrent, retErr error)
- func (s *Service) Alerts() (<-chan *Alert, chan<- any)
- func (s *Service) AttachPlayer(p *Player)
- func (s *Service) ClientInfo(ctx *gin.Context)
- func (s *Service) Close(isShutdown bool)
- func (s *Service) CloseSession()
- func (s *Service) DetachPlayer(p *Player)
- func (s *Service) GetActivePlayer() *Player
- func (s *Service) GetBufferSize() int64
- func (s *Service) GetListenIP(network string) string
- func (s *Service) GetMemorySize() int64
- func (s *Service) GetMemoryStats() (int64, int64)
- func (s *Service) GetPlayer(kodiID int, tmdbID int) *Player
- func (s *Service) GetSeedTime() int64
- func (s *Service) GetSettingStr(name string) (ret string)
- func (s *Service) GetStorageType() int
- func (s *Service) GetTorrentByHash(hash string) *Torrent
- func (s *Service) GetTorrentByURI(uri string) *Torrent
- func (s *Service) GetTorrents() []*Torrent
- func (s *Service) HasTorrentByEpisode(tmdbID int, season, episode int) *Torrent
- func (s *Service) HasTorrentByFakeID(query string) *Torrent
- func (s *Service) HasTorrentByID(tmdbID int) *Torrent
- func (s *Service) HasTorrentByName(query string) *Torrent
- func (s *Service) HasTorrentByQuery(query string) *Torrent
- func (s *Service) HasTorrentBySeason(tmdbID int, season int) *Torrent
- func (s *Service) IsMemoryStorage() bool
- func (s *Service) IsPaused() (paused bool)
- func (s *Service) Pause()
- func (s *Service) PlayerSeek()
- func (s *Service) PlayerStop()
- func (s *Service) Reconfigure()
- func (s *Service) RemoveTorrent(xbmcHost *xbmc.XBMCHost, t *Torrent, flags RemoveOptions) bool
- func (s *Service) RestoreLimits()
- func (s *Service) Resume()
- func (s *Service) SetBufferingLimits()
- func (s *Service) SetDownloadLimit(i int)
- func (s *Service) SetUploadLimit(i int)
- func (s *Service) StopNextFiles()
- type Torrent
- func (t *Torrent) AdjustMemorySize(ms int64)
- func (t *Torrent) AlertFinished()
- func (t *Torrent) Buffer(file *File, isStartup bool)
- func (t *Torrent) ChooseFile(btp *Player, xbmcHost *xbmc.XBMCHost) (*File, int, error)
- func (t *Torrent) ClearDeadlines()
- func (t *Torrent) CloseReaders()
- func (t *Torrent) DownloadAllFiles()
- func (t *Torrent) DownloadFile(addFile *File)
- func (t *Torrent) DownloadFileWithPriority(addFile *File, priority int)
- func (t *Torrent) DownloadFiles(files []*File)
- func (t *Torrent) Drop(removeFiles, removeData bool)
- func (t *Torrent) FetchDBItem() *database.BTItem
- func (t *Torrent) ForceRecheck()
- func (t *Torrent) GetAddedTime() time.Time
- func (t *Torrent) GetBufferProgress() float64
- func (t *Torrent) GetCandidateFileForIndex(idx int) *CandidateFile
- func (t *Torrent) GetCandidateFiles(btp *Player) ([]*CandidateFile, int, error)
- func (t *Torrent) GetConnections() (int, int, int, int)
- func (t *Torrent) GetDBItem() *database.BTItem
- func (t *Torrent) GetFileByIndex(q int) *File
- func (t *Torrent) GetFileByPath(q string) *File
- func (t *Torrent) GetFilePieces(files lt.FileStorage, idx int) (ret PieceRange)
- func (t *Torrent) GetFiles() []*File
- func (t *Torrent) GetHumanizedSpeeds() (down, up string)
- func (t *Torrent) GetMetadata() []byte
- func (t *Torrent) GetNextEpisodeFile(season, episode int) *File
- func (t *Torrent) GetNextSingleEpisodeFile(episode int) *File
- func (t *Torrent) GetOldTorrent() (*TorrentFile, error)
- func (t *Torrent) GetPaused() bool
- func (t *Torrent) GetPlayURL(fileIndex string) string
- func (t *Torrent) GetProgress() float64
- func (t *Torrent) GetReadaheadSize() (ret int64)
- func (t *Torrent) GetRealProgress() float64
- func (t *Torrent) GetSelectedSize() int64
- func (t *Torrent) GetSmartState() int
- func (t *Torrent) GetSpeeds() (down, up int)
- func (t *Torrent) GetState() int
- func (t *Torrent) GetStatus() *TorrentStatus
- func (t *Torrent) GotInfo() <-chan struct{}
- func (t *Torrent) HasAvailableFiles() bool
- func (t *Torrent) HasMetadata() bool
- func (t *Torrent) HasReaders() bool
- func (t *Torrent) InfoHash() string
- func (t *Torrent) IsMemoryStorage() bool
- func (t *Torrent) Length() int64
- func (t *Torrent) MakeFiles()
- func (t *Torrent) Name() string
- func (t *Torrent) Pause()
- func (t *Torrent) PrioritizePiece(piece int)
- func (t *Torrent) PrioritizePieces()
- func (t *Torrent) ReadersReadaheadSum() int64
- func (t *Torrent) ResetBuffering()
- func (t *Torrent) ResetReaders()
- func (t *Torrent) Resume()
- func (t *Torrent) SaveDBFiles()
- func (t *Torrent) SaveMetainfo(path string) (string, error)
- func (t *Torrent) SelectDownloadFiles(btp *Player)
- func (t *Torrent) Storage() (storage lt.StorageInterface)
- func (t *Torrent) SyncSelectedFiles() []string
- func (t *Torrent) Title() string
- func (t *Torrent) TorrentInfo(xbmcHost *xbmc.XBMCHost, w io.Writer, showTrackers, showPieces bool)
- func (t *Torrent) UnDownloadAllFiles()
- func (t *Torrent) UnDownloadFile(addFile *File) bool
- func (t *Torrent) UndownloadFiles(files []*File)
- func (t *Torrent) UpdateDatabaseMetadata(in []byte) ([]byte, error)
- func (t *Torrent) UpdateMetadataTitle(title string, in []byte) []byte
- func (t *Torrent) UpdateStatus(maxAge time.Duration)
- func (t *Torrent) UpdateTorrentMetadata() error
- func (t *Torrent) WaitForMetadata(xbmcHost *xbmc.XBMCHost, infoHash string) (err error)
- func (t *Torrent) Watch()
- type TorrentFS
- type TorrentFSEntry
- func (tf *TorrentFSEntry) Close() error
- func (tf *TorrentFSEntry) IsActive() bool
- func (tf *TorrentFSEntry) IsHead() bool
- func (tf *TorrentFSEntry) IsIdle() bool
- func (tf *TorrentFSEntry) Pos() (int64, error)
- func (tf *TorrentFSEntry) Read(data []byte) (n int, err error)
- func (tf *TorrentFSEntry) Readahead() int64
- func (tf *TorrentFSEntry) ReaderPiecesRange() (ret PieceRange)
- func (tf *TorrentFSEntry) Seek(offset int64, whence int) (int64, error)
- func (tf *TorrentFSEntry) SetActive(is bool) (res bool)
- type TorrentFile
- func (t *TorrentFile) Download() ([]byte, error)
- func (t *TorrentFile) EnrichTrackers()
- func (t *TorrentFile) GenerateFileName() string
- func (t *TorrentFile) IsMagnet() bool
- func (t *TorrentFile) IsValidMagnet() (err error)
- func (t *TorrentFile) LoadFromBytes(in []byte) error
- func (t *TorrentFile) Magnet(firstTime bool)
- func (t *TorrentFile) MarshalJSON() ([]byte, error)
- func (t *TorrentFile) Resolve() error
- func (t *TorrentFile) SaveToFile(b []byte) error
- func (t *TorrentFile) StreamInfo() *xbmc.StreamInfo
- func (t *TorrentFile) UnmarshalJSON(b []byte) error
- func (t *TorrentFile) UpdateTorrentTrackers() error
- type TorrentFileRaw
- type TorrentStatus
- type Tracker
- type TrackerRequest
- type TrackerResponse
Constants ¶
const ( // ResumeEmpty ... ResumeEmpty = iota // ResumeYes ... ResumeYes // ResumeNo ... ResumeNo // ResumeNever is set by external add-ons (doresume=never) to skip the resume dialog and start from the beginning ResumeNever )
const ( // ResolutionUnknown ... ResolutionUnknown = iota // Resolution240p ... Resolution240p // Resolution480p ... Resolution480p // Resolution720p ... Resolution720p // Resolution1080p ... Resolution1080p // Resolution2K ... Resolution2K // Resolution4k ... Resolution4k )
const ( // RipUnknown ... RipUnknown = iota // RipCam ... RipCam // RipTS ... RipTS // RipTC ... RipTC // RipScr ... RipScr // RipDVDScr ... RipDVDScr // RipDVD ... RipDVD // RipHDTV ... RipHDTV // RipWeb ... RipWeb // RipBluRay ... RipBluRay )
const ( // RatingUnkown ... RatingUnkown = iota // RatingProper ... RatingProper // RatingNuked ... RatingNuked )
const ( // CodecUnknown ... CodecUnknown = iota // CodecXVid ... CodecXVid // CodecH264 ... CodecH264 // CodecH265 ... CodecH265 // CodecMp3 ... CodecMp3 // CodecAAC ... CodecAAC // CodecAC3 ... CodecAC3 // CodecDTS ... CodecDTS // CodecDTSHD ... CodecDTSHD // CodecDTSHDMA ... CodecDTSHDMA )
const ( // DownloadFilePlaying ... DownloadFilePlaying int = iota // DownloadFileSeason ... DownloadFileSeason // DownloadFileAll ... DownloadFileAll )
const ( // StatusQueued ... StatusQueued = iota // StatusChecking ... StatusChecking // StatusFinding ... StatusFinding // StatusDownloading ... StatusDownloading // StatusFinished ... StatusFinished // StatusSeeding ... StatusSeeding // StatusAllocating ... StatusAllocating // StatusStalled ... StatusStalled // StatusPaused ... StatusPaused // StatusBuffering ... StatusBuffering // StatusPlaying ... StatusPlaying )
const ( // Remove ... Remove = iota // Active ... Active )
const ( // ProxyTypeNone ... ProxyTypeNone = iota // ProxyTypeSocks4 ... ProxyTypeSocks4 // ProxyTypeSocks5 ... ProxyTypeSocks5 // ProxyTypeSocks5Password ... ProxyTypeSocks5Password // ProxyTypeSocksHTTP ... ProxyTypeSocksHTTP // ProxyTypeSocksHTTPPassword ... ProxyTypeSocksHTTPPassword // ProxyTypeI2PSAM ... ProxyTypeI2PSAM )
Variables ¶
var ( // Resolutions ... Resolutions = []string{"", "240p", "480p", "720p", "1080p", "2K", "4K"} // Colors ... Colors = []string{"", "FFFC3401", "FFA56F01", "FF539A02", "FF0166FC", "FFF15052", "FF6BB9EC"} )
var ( // Codecs ... Codecs = []string{"", "Xvid", "H.264", "H.265", "MP3", "AAC", "AC3", "DTS", "DTS HD", "DTS HD MA"} )
var ( // Rips ... Rips = []string{"", "CamRip", "TeleSync", "TeleCine", "Screener", "DVD Screener", "DVDRip", "HDTV", "WebDL", "Blu-Ray"} )
var StatusStrings = []string{
"LOCALIZE[30621]",
"LOCALIZE[30622]",
"LOCALIZE[30623]",
"LOCALIZE[30624]",
"LOCALIZE[30625]",
"LOCALIZE[30626]",
"LOCALIZE[30627]",
"LOCALIZE[30628]",
"LOCALIZE[30629]",
"LOCALIZE[30630]",
"LOCALIZE[30631]",
}
StatusStrings ...
Functions ¶
func DebugAll ¶
func DebugAll(s *Service) gin.HandlerFunc
func EpisodeFromFileName ¶ added in v0.1.117
EpisodeFromFileName parses a file name like "Show.Name.S01E02.mkv" or "Show Name 1x02.mkv" into show name, before the episode marker, and season/episode numbers.
func MatchEpisodeFilename ¶
func MatchEpisodeFilename(s, e int, isSingleSeason bool, activeSeason int, show *tmdb.Show, episode *tmdb.Episode, tvdbShow *tvdb.Show, choices []*CandidateFile) (index, found int)
MatchEpisodeFilename matches season and episode in the filename to get ocurrence
func TrimChoices ¶
func TrimChoices(choices []*CandidateFile)
TrimChoices clears redundant folder names from files list and sorts remaining records.
func UpdateDefaultTrackers ¶
func UpdateDefaultTrackers()
UpdateDefaultTrackers fetches extra trackers from predefined page
Types ¶
type AddOptions ¶
type AddOptions struct {
URI string
Paused bool
DownloadStorage int
FirstTime bool
AddedTime time.Time
}
AddOptions is setting options for different torrent add procedures
type Alert ¶
type Alert struct {
Type int
Category int
What string
Message string
Name string
Entry lt.Entry
InfoHash string
State int
}
Alert is a Go copy of a libtorrent alert. libtorrent frees alerts on the next PopAlerts(), so consumers must not get the raw pointer.
type AnnounceRequest ¶
type AnnounceRequest struct {
InfoHash [20]byte
PeerID [20]byte
Downloaded int64
Left int64
Uploaded int64
Event int32
IPAddress int32
Key int32
NumWant int32
Port int16
}
AnnounceRequest ...
type AnnounceResponse ¶
AnnounceResponse ...
type CandidateFile ¶
CandidateFile ...
type ConnectionResponse ¶
type ConnectionResponse struct {
ConnectionID int64
}
ConnectionResponse ...
type File ¶
type File struct {
Selected bool
Index int
Name string
Size int64
Path string
Offset int64
PieceStart int
PieceEnd int
}
File ...
type MemoryFile ¶
type MemoryFile struct {
// contains filtered or unexported fields
}
MemoryFile ...
func NewMemoryFile ¶
func NewMemoryFile(t *Torrent, tf *TorrentFS, storage lt.MemoryStorage, file *File, path string) *MemoryFile
NewMemoryFile ...
func (*MemoryFile) Readdir ¶
func (mf *MemoryFile) Readdir(count int) (ret []os.FileInfo, err error)
Readdir ...
type NextEpisode ¶
type NextEpisode struct {
// contains filtered or unexported fields
}
NextEpisode ...
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
Player ...
func NewPlayer ¶
func NewPlayer(bts *Service, params PlayerParams, xbmcHost *xbmc.XBMCHost) *Player
NewPlayer ...
func (*Player) GetIdent ¶
func (btp *Player) GetIdent()
GetIdent tries to find playing item in Kodi library
func (*Player) GetXBMCHost ¶
func (*Player) Params ¶
func (btp *Player) Params() *PlayerParams
Params returns Params for external use
func (*Player) UpdateWatched ¶
func (btp *Player) UpdateWatched()
UpdateWatched is updating watched progress is Kodi
type PlayerParams ¶
type PlayerParams struct {
Playing bool
Paused bool
Seeked bool
WasPlaying bool
WasSeeked bool
DoneAudio bool
DoneSubtitles bool
Background bool
UpNextOff bool
KodiPosition int
WatchedProgress float64
WatchedTime float64
VideoDuration float64
URI string
OriginalIndex int
FileIndex int
NextOriginalIndex int
NextFileIndex int
ResumeToken string
ResumeHash string
ResumePlayback int
TraktScrobbled bool
ContentType string
KodiID int
TMDBId int
ShowID int
Season int
Episode int
AbsoluteNumber int
Query string
FileMatch string
SkipFileDialog bool
MinSize int64
SizeAtStart bool
UpNextSent bool
UIDs *uid.UniqueIDs
Resume *uid.Resume
StoredResume *uid.Resume
}
PlayerParams ...
type PortMapping ¶ added in v0.1.107
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue represents list of torrents inside of a session
func (*Queue) All ¶
All returns a snapshot of the queue, safe to iterate while torrents are added or removed
func (*Queue) Clean ¶
func (q *Queue) Clean()
Clean would cleanup torrents list, should be used in case of a service reload
func (*Queue) FindByHash ¶
FindByHash checks if torrent with infohash is in the queue
type RemoveOptions ¶
type RemoveOptions struct {
ForceKeepTorrentData bool
ForceDrop bool
ForceDelete bool
ForceConfirmation bool
IsWatched bool
}
RemoveOptions is setting options for different torrent removal procedures
type ScrapeResponseEntry ¶
ScrapeResponseEntry ...
type Service ¶
type Service struct {
Session lt.SessionHandle
SessionGlobal lt.Session
PackSettings lt.SettingsPack
Players map[string]*Player
SpaceChecked map[string]bool
UserAgent string
PeerID string
ListenIP string
ListenIPv6 string
ListenPort int
DisableIPv6 bool
Closer event.Event
CloserNotifier event.Event
// contains filtered or unexported fields
}
Service ...
func (*Service) AddTorrent ¶
func (s *Service) AddTorrent(xbmcHost *xbmc.XBMCHost, options AddOptions) (_ *Torrent, retErr error)
AddTorrent ...
func (*Service) AttachPlayer ¶
AttachPlayer adds Player instance to service
func (*Service) CloseSession ¶
func (s *Service) CloseSession()
CloseSession tries to close libtorrent session with a timeout, because it takes too much to close and Kodi hangs.
func (*Service) DetachPlayer ¶
DetachPlayer removes Player instance
func (*Service) GetActivePlayer ¶
GetActivePlayer searches for player that is Playing anything
func (*Service) GetListenIP ¶
GetListenIP returns calculated IP for TCP/TCP6
func (*Service) GetMemoryStats ¶
GetMemoryStats returns total and free memory sizes for this OS
func (*Service) GetSettingStr ¶ added in v0.1.115
GetSettingStr returns a string setting from the shared settings pack
func (*Service) GetTorrentByHash ¶
GetTorrentByHash ...
func (*Service) GetTorrentByURI ¶
GetTorrentByURI ...
func (*Service) GetTorrents ¶
GetTorrents return all active torrents
func (*Service) HasTorrentByEpisode ¶
HasTorrentByEpisode checks whether there is active torrent for queried episode
func (*Service) HasTorrentByFakeID ¶
HasTorrentByFakeID checks whether there is active torrent with fake id
func (*Service) HasTorrentByID ¶
HasTorrentByID checks whether there is active torrent for queried tmdb id
func (*Service) HasTorrentByName ¶
HasTorrentByName checks whether there is active torrent for queried name
func (*Service) HasTorrentByQuery ¶
HasTorrentByQuery checks whether there is active torrent with searches query
func (*Service) HasTorrentBySeason ¶
HasTorrentBySeason checks whether there is active torrent for queried season
func (*Service) IsMemoryStorage ¶
IsMemoryStorage is a shortcut for checking whether we run memory storage
func (*Service) Reconfigure ¶
func (s *Service) Reconfigure()
Reconfigure fired every time addon configuration has changed and Kodi sent a notification about that. Should reassemble Service configuration and restart everything. For non-memory storage it should also load old torrent files.
func (*Service) RemoveTorrent ¶
RemoveTorrent ...
func (*Service) Resume ¶ added in v0.1.115
func (s *Service) Resume()
Resume resumes the whole session
func (*Service) StopNextFiles ¶
func (s *Service) StopNextFiles()
StopNextFiles stops all torrents that wait for "next" playback
type Torrent ¶
type Torrent struct {
DownloadStorage int
ChosenFiles []*File
Service *Service
BufferLength int64
BufferProgress float64
BufferProgressPrevious float64
BufferPiecesLength int64
BufferPiecesProgress map[int]float64
MemorySize int64
IsMoveInProgress atomic.Bool
IsMarkedToMove atomic.Bool
IsPlaying atomic.Bool
IsPaused atomic.Bool
IsBuffering atomic.Bool
IsBufferingFinished atomic.Bool
IsSeeding atomic.Bool
IsRarArchive atomic.Bool
IsNextFile atomic.Bool
IsNeedFinishNotification atomic.Bool
HasNextFile atomic.Bool
PlayerAttached atomic.Int32
DBItem *database.BTItem
Closer event.Event
// contains filtered or unexported fields
}
Torrent ...
func NewTorrent ¶
func NewTorrent(service *Service, handle lt.TorrentHandle, info lt.TorrentInfo, path string, downloadStorage int) *Torrent
NewTorrent ...
func (*Torrent) AdjustMemorySize ¶
AdjustMemorySize ...
func (*Torrent) AlertFinished ¶
func (t *Torrent) AlertFinished()
AlertFinished sends notification to user that this torrent is successfully downloaded
func (*Torrent) Buffer ¶
Buffer defines buffer pieces for downloading prior to sending file to Kodi. Kodi sends two requests, one for onecoming file read handler, another for a piece of file from the end (probably to get codec descriptors and so on) We set it as post-buffer and include in required buffer pieces array.
func (*Torrent) ChooseFile ¶
ChooseFile opens file selector if not provided with Player, otherwise tries to detect what to open.
func (*Torrent) DownloadFileWithPriority ¶
DownloadFileWithPriority ...
func (*Torrent) DownloadFiles ¶
DownloadFiles sets priority 1 to list of files
func (*Torrent) ForceRecheck ¶ added in v0.1.110
func (t *Torrent) ForceRecheck()
ForceRecheck re-checks torrent's data
func (*Torrent) GetBufferProgress ¶
GetBufferProgress ...
func (*Torrent) GetCandidateFileForIndex ¶
func (t *Torrent) GetCandidateFileForIndex(idx int) *CandidateFile
GetCandidateFileForIndex returns CandidateFile for specific int index
func (*Torrent) GetCandidateFiles ¶
func (t *Torrent) GetCandidateFiles(btp *Player) ([]*CandidateFile, int, error)
GetCandidateFiles returns all the files for selecting by user
func (*Torrent) GetConnections ¶
GetConnections returns connected and overall number of peers
func (*Torrent) GetFilePieces ¶
func (t *Torrent) GetFilePieces(files lt.FileStorage, idx int) (ret PieceRange)
GetFilePieces ...
func (*Torrent) GetHumanizedSpeeds ¶
GetHumanizedSpeeds returns humanize download and upload speeds
func (*Torrent) GetNextEpisodeFile ¶
GetNextEpisodeFile ...
func (*Torrent) GetNextSingleEpisodeFile ¶
GetNextSingleEpisodeFile ...
func (*Torrent) GetOldTorrent ¶
func (t *Torrent) GetOldTorrent() (*TorrentFile, error)
GetOldTorrent gets old torrent from the database
func (*Torrent) GetPlayURL ¶
GetPlayURL returns url ready for Kodi
func (*Torrent) GetReadaheadSize ¶
GetReadaheadSize ...
func (*Torrent) GetRealProgress ¶
GetRealProgress returns progress of downloading in libtorrent. Should be taken in mind that for memory storage it's a progress of downloading currently active pieces, not the whole torrent.
func (*Torrent) GetSelectedSize ¶
GetSelectedSize returns size of all chosen files
func (*Torrent) GetStatus ¶
func (t *Torrent) GetStatus() *TorrentStatus
GetStatus returns latest cached status, it is never nil.
func (*Torrent) HasAvailableFiles ¶
HasAvailableFiles ...
func (*Torrent) HasReaders ¶ added in v0.1.117
HasReaders reports whether any HTTP reader has the torrent's files open
func (*Torrent) IsMemoryStorage ¶
IsMemoryStorage is a shortcut for checking whether we run memory storage
func (*Torrent) MakeFiles ¶
func (t *Torrent) MakeFiles()
MakeFiles must be called inside withHandle()
func (*Torrent) ReadersReadaheadSum ¶
ReadersReadaheadSum ...
func (*Torrent) ResetBuffering ¶
func (t *Torrent) ResetBuffering()
ResetBuffering resets all fields related to buffering
func (*Torrent) SaveMetainfo ¶
SaveMetainfo ...
func (*Torrent) SelectDownloadFiles ¶
SelectDownloadFiles selects files for download, according to setting
func (*Torrent) SyncSelectedFiles ¶
SyncSelectedFiles iterates through torrent files and choosing selected files
func (*Torrent) Title ¶
Title returns name of a torrent, or, if present, how it looked in plugin that found it.
func (*Torrent) TorrentInfo ¶
TorrentInfo writes torrent status to io.Writer
func (*Torrent) UnDownloadFile ¶
UnDownloadFile ...
func (*Torrent) UndownloadFiles ¶
UndownloadFiles sets priority 0 to list of files
func (*Torrent) UpdateDatabaseMetadata ¶
UpdateDatabaseMetadata in decoding torrent bencoded, adding proper Title and then returning encoded bencoded.
func (*Torrent) UpdateMetadataTitle ¶
UpdateMetadataTitle ...
func (*Torrent) UpdateStatus ¶ added in v0.1.115
UpdateStatus refreshes cached status from libtorrent, unless it is younger than maxAge.
func (*Torrent) UpdateTorrentMetadata ¶
UpdateTorrentMetadata updates metadata for specific TMDB id
func (*Torrent) WaitForMetadata ¶
WaitForMetadata waits for getting torrent information or cancels if torrent is closed
type TorrentFSEntry ¶
TorrentFSEntry ...
func NewTorrentFSEntry ¶
func NewTorrentFSEntry(file http.File, tfs *TorrentFS, t *Torrent, f *File, name string) (*TorrentFSEntry, error)
NewTorrentFSEntry ...
func (*TorrentFSEntry) Pos ¶
func (tf *TorrentFSEntry) Pos() (int64, error)
Pos returns current file position
func (*TorrentFSEntry) Read ¶
func (tf *TorrentFSEntry) Read(data []byte) (n int, err error)
Read ...
func (*TorrentFSEntry) Readahead ¶
func (tf *TorrentFSEntry) Readahead() int64
Readahead returns current reader readahead
func (*TorrentFSEntry) ReaderPiecesRange ¶
func (tf *TorrentFSEntry) ReaderPiecesRange() (ret PieceRange)
ReaderPiecesRange ...
func (*TorrentFSEntry) Seek ¶
func (tf *TorrentFSEntry) Seek(offset int64, whence int) (int64, error)
Seek ...
func (*TorrentFSEntry) SetActive ¶
func (tf *TorrentFSEntry) SetActive(is bool) (res bool)
SetActive ...
type TorrentFile ¶
type TorrentFile struct {
URI string `json:"uri"`
InfoHash string `json:"info_hash"`
Title string `json:"title"`
Name string `json:"name"`
Trackers []string `json:"trackers"`
Size string `json:"size"`
SizeParsed uint64 `jsin:"-"`
Seeds int64 `json:"seeds"`
Peers int64 `json:"peers"`
IsPrivate bool `json:"is_private"`
Provider string `json:"provider"`
Icon string `json:"icon"`
Multi bool
Resolution int `json:"resolution"`
VideoCodec int `json:"video_codec"`
AudioCodec int `json:"audio_codec"`
Language string `json:"language"`
RipType int `json:"rip_type"`
SceneRating int `json:"scene_rating"`
// contains filtered or unexported fields
}
TorrentFile represents a physical torrent file
func (*TorrentFile) Download ¶
func (t *TorrentFile) Download() ([]byte, error)
Download takes care about torrent's URI and downloads or reads cached file
func (*TorrentFile) GenerateFileName ¶
func (t *TorrentFile) GenerateFileName() string
GenerateFileName ...
func (*TorrentFile) IsValidMagnet ¶
func (t *TorrentFile) IsValidMagnet() (err error)
IsValidMagnet Taken from anacrolix/torrent
func (*TorrentFile) LoadFromBytes ¶
func (t *TorrentFile) LoadFromBytes(in []byte) error
LoadFromBytes ...
func (*TorrentFile) MarshalJSON ¶
func (t *TorrentFile) MarshalJSON() ([]byte, error)
MarshalJSON ...
func (*TorrentFile) SaveToFile ¶
func (t *TorrentFile) SaveToFile(b []byte) error
SaveToFile will save torrent to .torrent file for libtorrent
func (*TorrentFile) UnmarshalJSON ¶
func (t *TorrentFile) UnmarshalJSON(b []byte) error
UnmarshalJSON ...
func (*TorrentFile) UpdateTorrentTrackers ¶
func (t *TorrentFile) UpdateTorrentTrackers() error
UpdateTorrentTrackers updates raw torrent file trackers
type TorrentFileRaw ¶
type TorrentFileRaw struct {
Title string `bencode:"title"`
Announce string `bencode:"announce"`
AnnounceList [][]string `bencode:"announce-list"`
Info map[string]any `bencode:"info"`
}
TorrentFileRaw ...
func (TorrentFileRaw) HasAnnounce ¶
func (t TorrentFileRaw) HasAnnounce(tracker string) bool
HasAnnounce checks AnnounceList for specific tracker
type TorrentStatus ¶ added in v0.1.115
type TorrentStatus struct {
InfoHash string
Name string
SavePath string
State int
Progress float64
Paused bool
AutoManaged bool
SequentialDownload bool
NeedSaveResume bool
IsSeeding bool
IsFinished bool
HasMetadata bool
HasIncoming bool
MovingStorage bool
AnnouncingToTrackers bool
AnnouncingToLsd bool
AnnouncingToDht bool
DownloadRate int
UploadRate int
DownloadPayloadRate int
UploadPayloadRate int
NumSeeds int
NumPeers int
NumComplete int
NumIncomplete int
ListSeeds int
ListPeers int
NumConnections int
BlockSize int
TotalDone int64
TotalWanted int64
TotalWantedDone int64
AllTimeDownload int64
AllTimeUpload int64
ActiveTime int
FinishedTime int
SeedingTime int
Pieces Bitfield
UpdatedAt time.Time
}
TorrentStatus is a Go copy of libtorrent's torrent_status. It holds no libtorrent memory, so it is safe to read at any time, even after the torrent is removed.
type Tracker ¶
Tracker ...
func (*Tracker) Scrape ¶
func (tracker *Tracker) Scrape(torrents []*TorrentFile) []ScrapeResponseEntry
Scrape ...
type TrackerRequest ¶
TrackerRequest ...
type TrackerResponse ¶
TrackerResponse ...