Detect arithmetic progression

This commit is contained in:
Ben Sarmiento
2023-11-21 18:16:37 +01:00
parent a288f08ff7
commit 1995a86f29
5 changed files with 128 additions and 22 deletions

View File

@@ -15,6 +15,7 @@ import (
"github.com/debridmediamanager.com/zurg/internal/config"
"github.com/debridmediamanager.com/zurg/pkg/logutil"
"github.com/debridmediamanager.com/zurg/pkg/realdebrid"
"github.com/debridmediamanager.com/zurg/pkg/utils"
cmap "github.com/orcaman/concurrent-map/v2"
"github.com/panjf2000/ants/v2"
"go.uber.org/zap"
@@ -96,9 +97,7 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, p
}
}
anotherCt := 0
allTorrents.IterCb(func(accessKey string, torrent *Torrent) {
anotherCt++
// get IDs
var torrentIDs []string
for _, instance := range torrent.Instances {
@@ -293,11 +292,7 @@ func (t *TorrentManager) startRefreshJob() {
}
// get filenames
var filenames []string
torrent.SelectedFiles.IterCb(func(_ string, file *File) {
filenames = append(filenames, file.Path)
})
filenames := torrent.SelectedFiles.Keys()
// Map torrents to directories
switch t.cfg.GetVersion() {
case "v1":
@@ -593,7 +588,7 @@ func (t *TorrentManager) Repair(accessKey string) {
var links []string
streamableCount := 0
torrent.SelectedFiles.IterCb(func(_ string, file *File) {
if isStreamable(file.Path) {
if utils.IsStreamable(file.Path) {
streamableCount++
}
fileCopy := &File{