Detect arithmetic progression
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -3,7 +3,6 @@ package torrent
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func getFileIDs(files []File) []string {
|
||||
@@ -16,14 +15,6 @@ func getFileIDs(files []File) []string {
|
||||
return fileIDs
|
||||
}
|
||||
|
||||
func isStreamable(filePath string) bool {
|
||||
return strings.HasSuffix(filePath, ".mkv") ||
|
||||
strings.HasSuffix(filePath, ".mp4") ||
|
||||
strings.HasSuffix(filePath, ".avi") ||
|
||||
strings.HasSuffix(filePath, ".wmv") ||
|
||||
strings.HasSuffix(filePath, ".m4v")
|
||||
}
|
||||
|
||||
func ensureDir(dirName string) error {
|
||||
if _, err := os.Stat(dirName); os.IsNotExist(err) {
|
||||
err := os.Mkdir(dirName, 0755)
|
||||
|
||||
Reference in New Issue
Block a user