Documentation
¶
Index ¶
Constants ¶
const ( NEW_TORRENTS_TIMESPAN = int64(15 * 60) // new torrents timespan during which will NOT be examined at all NEW_TORRENTS_STALL_EXEMPTION_TIMESPAN = int64(30 * 60) // new torrents timespan during which will NOT be stalled NO_PROCESS_TORRENT_DELETEION_TIMESPAN = int64(30 * 60) STALL_DOWNLOAD_SPEED = int64(10 * 1024) SLOW_UPLOAD_SPEED = int64(100 * 1024) RATIO_CHECK_MIN_DOWNLOAD_SPEED = int64(100 * 1024) SLOW_TORRENTS_CHECK_TIMESPAN = int64(15 * 60) STALL_TORRENT_DELETEION_TIMESPAN = int64(30 * 60) // stalled torrent will be deleted after this time passed BANDWIDTH_FULL_PERCENT = float64(0.8) DELETE_TORRENT_IMMEDIATELY_STORE = float64(99999) RESUME_TORRENTS_FREE_DISK_SPACE_TIER = int64(5 * 1024 * 1024 * 1024) // 5GB DELETE_TORRENTS_FREE_DISK_SPACE_TIER = int64(10 * 1024 * 1024 * 1024) // 10GB )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlgorithmAddTorrent ¶
type AlgorithmModifyTorrent ¶
type AlgorithmResult ¶
type AlgorithmResult struct { DeleteTorrents []AlgorithmOperationTorrent // torrents that will be removed from client StallTorrents []AlgorithmModifyTorrent // torrents that will stop downloading but still uploading ResumeTorrents []AlgorithmOperationTorrent // resume paused / errored torrents ModifyTorrents []AlgorithmModifyTorrent // modify meta info of these torrents AddTorrents []AlgorithmAddTorrent // new torrents that will be added to client CanAddMore bool // client is able to add more torrents FreeSpaceChange int64 // estimated free space change after apply above operations Msg string }
func Decide ¶
func Decide(clientStatus *client.Status, clientTorrents []client.Torrent, siteTorrents []site.Torrent, option *BrushOptionStruct) (result *AlgorithmResult)
* @todo : this function requires a major rework. It's a mess right now. * * Strategy (Desired) * Delete a torrent from client when (any of the the follow criterion matches): * a. Tt's uploading speed become SLOW enough AND free disk space insufficient * b. It's consuming too much downloading bandwidth and uploading / downloading speed ratio is too low * c. It's incomplete and been totally stalled (no uploading or downloading activity) for some time * d. It's incomplete and the free discount expired (or will soon expire) * Stall ALL incomplete torrent of client (limit download speed to 1B/s, so upload only) when free disk space insufficient * * This's somwwhat broken in qBittorrent for now (See https://github.com/qbittorrent/qBittorrent/issues/2185 ). * * Simply limiting downloading speed (to a very low tier) will also drop uploading speed to the same level * * Consider removing this behavior * Add new torrents to client when server uploading and downloading bandwidth is somewhat idle AND there is SOME free disk space *
type BrushOptionStruct ¶
type BrushOptionStruct struct { AllowNoneFree bool AllowPaid bool AllowHr bool AllowZeroSeeders bool MinDiskSpace int64 SlowUploadSpeedTier int64 TorrentUploadSpeedLimit int64 MaxDownloadingTorrents int64 MaxTorrents int64 MinRatio float64 DefaultUploadSpeedLimit int64 TorrentMinSizeLimit int64 TorrentMaxSizeLimit int64 Now int64 }