Create repair queue
This commit is contained in:
@@ -3,6 +3,7 @@ package torrent
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@@ -33,6 +34,7 @@ type TorrentManager struct {
|
||||
workerPool *ants.Pool
|
||||
repairPool *ants.Pool
|
||||
repairTrigger chan *Torrent
|
||||
repairSet mapset.Set[*Torrent]
|
||||
repairRunning bool
|
||||
repairRunningMu sync.Mutex
|
||||
log *logutil.Logger
|
||||
@@ -105,6 +107,14 @@ func (t *TorrentManager) GetKey(torrent *Torrent) string {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TorrentManager) GetPath(file *File) string {
|
||||
if t.Config.ShouldExposeFullPath() {
|
||||
filename := strings.TrimPrefix(file.Path, "/")
|
||||
return strings.ReplaceAll(filename, "/", " - ")
|
||||
}
|
||||
return filepath.Base(file.Path)
|
||||
}
|
||||
|
||||
func (t *TorrentManager) writeTorrentToFile(instanceID string, torrent *Torrent) {
|
||||
filePath := "data/" + instanceID + ".json"
|
||||
file, err := os.Create(filePath)
|
||||
|
||||
Reference in New Issue
Block a user