Documentation
¶
Index ¶
- Variables
- func CalculateCompletedSize(tFromStorage *Storage.TorrentLocal, activeTorrent *torrent.Torrent) int64
- func CalculateDownloadSize(tFromStorage *Storage.TorrentLocal, activeTorrent *torrent.Torrent) int64
- func CalculateTorrentETA(tSize int64, tBytesCompleted int64, c *ClientDB)
- func CalculateTorrentSpeed(t *torrent.Torrent, c *ClientDB, oc ClientDB, completedSize int64)
- func CalculateTorrentStatus(t *torrent.Torrent, c *ClientDB, config Settings.FullClientSettings, ...)
- func CalculateUploadRatio(t *torrent.Torrent, c *ClientDB) string
- func CheckTorrentWatchFolder(c *cron.Cron, db *storm.DB, tclient *torrent.Client, ...)
- func CopyFile(srcFile string, destFile string)
- func CreateInitialTorrentArray(tclient *torrent.Client, TorrentLocalArray []*Storage.TorrentLocal, ...)
- func CreateServerPushMessage(message ServerPushMessage, conn *websocket.Conn)
- func ForceRSSRefresh(db *storm.DB, RSSFeedStore Storage.RSSFeedStore)
- func HumanizeBytes(bytes float32) string
- func InitializeCronEngine() *cron.Cron
- func LogCronStatus(c *cron.Cron)
- func MakeRange(min, max int) []int
- func MoveAndLeaveSymlink(config Settings.FullClientSettings, tHash string, db *storm.DB, moveDone bool, ...) error
- func RefreshRSSCron(c *cron.Cron, db *storm.DB, tclient *torrent.Client, ...)
- func RefreshSingleRSSFeed(db *storm.DB, RSSFeed Storage.SingleRSSFeed) Storage.SingleRSSFeed
- func SetFilePriority(t *torrent.Client, db *storm.DB)
- func StartTorrent(clientTorrent *torrent.Torrent, torrentLocalStorage Storage.TorrentLocal, ...)
- func VerifyData(singleTorrent *torrent.Torrent)
- type AuthResponse
- type ClientDB
- type Message
- type PeerFileList
- type RSSFeedsNames
- type RSSJSONList
- type ServerPushMessage
- type SettingsFile
- type SingleRSSFeedMessage
- type TorrentFile
- type TorrentFileList
- type TorrentList
Constants ¶
This section is empty.
Variables ¶
var Config Settings.FullClientSettings
Config is the injected variable for the torrent config
var Conn *websocket.Conn
Conn is the injected variable for the websocket connection
var Logger *logrus.Logger
Logger is the injected variable for global logger
Functions ¶
func CalculateCompletedSize ¶ added in v0.3.0
func CalculateCompletedSize(tFromStorage *Storage.TorrentLocal, activeTorrent *torrent.Torrent) int64
CalculateCompletedSize will be used to calculate how much of the actual torrent we have completed minus the canceled files (even if they have been partially downloaded)
func CalculateDownloadSize ¶ added in v0.2.0
func CalculateDownloadSize(tFromStorage *Storage.TorrentLocal, activeTorrent *torrent.Torrent) int64
CalculateDownloadSize will calculate the download size once file priorities are sorted out
func CalculateTorrentETA ¶
CalculateTorrentETA is used to estimate the remaining dl time of the torrent based on the speed that the MB are being downloaded
func CalculateTorrentSpeed ¶
CalculateTorrentSpeed is used to calculate the torrent upload and download speed over time c is current clientdb, oc is last client db to calculate speed over time
func CalculateTorrentStatus ¶
func CalculateTorrentStatus(t *torrent.Torrent, c *ClientDB, config Settings.FullClientSettings, tFromStorage *storage.TorrentLocal, bytesCompleted int64, totalSize int64)
CalculateTorrentStatus is used to determine what the STATUS column of the frontend will display ll2
func CalculateUploadRatio ¶
CalculateUploadRatio calculates the download to upload ratio so you can see if you are being a good seeder
func CheckTorrentWatchFolder ¶ added in v0.2.0
func CheckTorrentWatchFolder(c *cron.Cron, db *storm.DB, tclient *torrent.Client, torrentLocalStorage Storage.TorrentLocal, config Settings.FullClientSettings)
CheckTorrentWatchFolder adds torrents from a watch folder //TODO see if you can use filepath.Abs instead of changing directory
func CopyFile ¶ added in v0.2.0
CopyFile takes a source file string and a destination file string and copies the file
func CreateInitialTorrentArray ¶ added in v0.4.0
func CreateInitialTorrentArray(tclient *torrent.Client, TorrentLocalArray []*Storage.TorrentLocal, db *storm.DB)
CreateInitialTorrentArray adds all the torrents on program start from the database
func CreateServerPushMessage ¶ added in v0.2.0
func CreateServerPushMessage(message ServerPushMessage, conn *websocket.Conn)
CreateServerPushMessage Pushes a message from the server to the client
func ForceRSSRefresh ¶
func ForceRSSRefresh(db *storm.DB, RSSFeedStore Storage.RSSFeedStore)
ForceRSSRefresh forces a refresh (in addition to the cron schedule) to add the new RSS feed
func HumanizeBytes ¶
HumanizeBytes returns a nice humanized version of bytes in either GB or MB
func InitializeCronEngine ¶
InitializeCronEngine initializes and starts the cron engine so we can add tasks as needed, returns pointer to the engine
func LogCronStatus ¶
LogCronStatus prints out the status of the cron jobs to the log
func MakeRange ¶ added in v0.4.0
MakeRange creates a range of pieces to set their priority based on a file
func MoveAndLeaveSymlink ¶
func MoveAndLeaveSymlink(config Settings.FullClientSettings, tHash string, db *storm.DB, moveDone bool, oldPath string) error
MoveAndLeaveSymlink takes the file from the default download dir and moves it to the user specified directory and then leaves a symlink behind.
func RefreshRSSCron ¶
func RefreshRSSCron(c *cron.Cron, db *storm.DB, tclient *torrent.Client, torrentLocalStorage Storage.TorrentLocal, config Settings.FullClientSettings)
RefreshRSSCron refreshes all of the RSS feeds on an hourly basis
func RefreshSingleRSSFeed ¶
func RefreshSingleRSSFeed(db *storm.DB, RSSFeed Storage.SingleRSSFeed) Storage.SingleRSSFeed
RefreshSingleRSSFeed refreshing a single RSS feed to send to the client (so no updating database) mainly by updating the torrent list to display any changes
func SetFilePriority ¶ added in v0.4.0
SetFilePriority sets the priorities for all of the files in all of the torrents
func StartTorrent ¶
func StartTorrent(clientTorrent *torrent.Torrent, torrentLocalStorage Storage.TorrentLocal, torrentDbStorage *storm.DB, torrentType, torrentFilePathAbs, torrentStoragePath, labelValue string, config Settings.FullClientSettings)
StartTorrent creates the storage.db entry and starts A NEW TORRENT and adds to the running torrent array
func VerifyData ¶ added in v0.5.1
VerifyData just verifies the data of a torrent by hash
Types ¶
type AuthResponse ¶ added in v0.4.0
AuthResponse is sent when the client fails to perform authentication correctly
type ClientDB ¶
type ClientDB struct {
TorrentHashString string //Passed to client for displaying hash and is used to uniquely identify all torrents
TorrentName string //String of the name of the torrent
DownloadedSize string //how much the client has downloaded total
Size string //total size of the torrent
DownloadSpeed string //the dl speed of the torrent
Status string //Passed to client for display
PercentDone string //Passed to client to show percent done
ActivePeers string //passed to client
UploadSpeed string //passed to client to show Uploadspeed
StoragePath string //Passed to client (and stored in stormdb)
DateAdded string //Passed to client (and stored in stormdb)
ETA string //Passed to client
TorrentLabel string //Passed to client and stored in stormdb
SourceType string //Stores whether the torrent came from a torrent file or a magnet link
KnownSwarm []torrent.Peer //Passed to client for Peer Tab
UploadRatio string //Passed to client, stores the string for uploadratio stored in stormdb
TotalUploadedSize string //Humanized version of TotalUploadedBytes to pass to the client
TotalUploadedBytes int64 `json:"-"` //includes bytes that happened before reboot (from stormdb)
BytesCompleted int64 `json:"-"` //Internal used for calculating the dl speed
DataBytesWritten int64 `json:"-"` //Internal used for calculating dl speed
DataBytesRead int64 `json:"-"` //Internal used for calculating dl speed
UpdatedAt time.Time `json:"-"` //Internal used for calculating speeds of upload and download
TorrentHash metainfo.Hash `json:"-"` //Used to create string for TorrentHashString... not sure why I have it... make that a TODO I guess
NumberofFiles int //Number of files in the torrent
NumberofPieces int //Total number of pieces in the torrent (Not currently used)
MaxConnections int //Used to stop the torrent by limiting the max allowed connections
// contains filtered or unexported fields
}
ClientDB struct contains the struct that is used to compose the torrentlist
func CreateRunningTorrentArray ¶
func CreateRunningTorrentArray(tclient *torrent.Client, TorrentLocalArray []*Storage.TorrentLocal, PreviousTorrentArray []ClientDB, config Settings.FullClientSettings, db *storm.DB) (RunningTorrentArray []ClientDB)
CreateRunningTorrentArray creates the entire torrent list to pass to client
type Message ¶
type Message struct {
MessageType string
Payload interface{}
}
Message contains the JSON messages from the client, we first unmarshal to get the messagetype, then pass it on to each module
type PeerFileList ¶
PeerFileList returns a slice of peers
func CreatePeerListArray ¶
func CreatePeerListArray(tclient *torrent.Client, selectedHash string) PeerFileList
CreatePeerListArray create a list of peers for the torrent and displays them
type RSSFeedsNames ¶
RSSFeedsNames stores all of the feeds by name and with URL
type RSSJSONList ¶
type RSSJSONList struct {
MessageType string
TotalRSSFeeds int
RSSFeeds []RSSFeedsNames //strings of the full rss feed
}
RSSJSONList is a slice of gofeed.Feeds sent to the client
type ServerPushMessage ¶ added in v0.2.0
type ServerPushMessage struct {
MessageType string
MessageLevel string //can be "success", "error", "warn", "info"
Payload string //the actual message
}
ServerPushMessage is information (usually logs and status messages) that the server pushes to the client
type SettingsFile ¶ added in v0.4.0
type SettingsFile struct {
MessageType string
Config Settings.FullClientSettings
}
type SingleRSSFeedMessage ¶ added in v0.4.0
type SingleRSSFeedMessage struct {
MessageType string
URL string //the URL of the individual RSS feed
Name string
TotalTorrents int
Torrents []Storage.SingleRSSTorrent //name of the torrents
}
SingleRSSFeedMessage contains the torrents/name/etc of a single torrent feed
type TorrentFile ¶
type TorrentFile struct {
TorrentHashString string //Used to tie the file to a torrent //TODO not sure if needed
FileName string //The name of the file
FilePath string //The relative filepath to the file
FileSize string //Humanized file size display
FilePercent string //String value of percent of individual file percent done
FilePriority string //Currently "High", "Normal", or "Cancel"
}
TorrentFile describes a single file that a torrent client is downloading for a single torrent
type TorrentFileList ¶
type TorrentFileList struct {
MessageType string
TotalFiles int `json:"TotalFiles"`
FileList []TorrentFile `json:"FileList"`
}
TorrentFileList supplies a list of files attached to a single torrent along with some additional information
func CreateFileListArray ¶
func CreateFileListArray(tclient *torrent.Client, selectedHash string, db *storm.DB, config Settings.FullClientSettings) TorrentFileList
CreateFileListArray creates a file list for a single torrent that is selected and sent to the server
type TorrentList ¶
type TorrentList struct {
MessageType string `json:"MessageType"`
Totaltorrents int `json:"total"`
ClientDBstruct []ClientDB `json:"data"`
}
TorrentList struct contains the torrent list that is sent to the client