Biggest file filter

This commit is contained in:
Ben Sarmiento
2023-12-07 22:34:25 +01:00
parent 7d5e5caf6e
commit 045c31a9f9
5 changed files with 33 additions and 6 deletions

View File

@@ -115,6 +115,16 @@ func (t *Torrent) ComputeTotalSize() int64 {
return totalSize
}
func (t *Torrent) ComputeBiggestFileSize() int64 {
biggestSize := int64(0)
t.SelectedFiles.IterCb(func(key string, value *File) {
if value.Bytes > biggestSize {
biggestSize = value.Bytes
}
})
return biggestSize
}
func (t *Torrent) OlderThanDuration(duration time.Duration) bool {
latestAdded, err := time.Parse(time.RFC3339, t.LatestAdded)
if err != nil {