Fix directory iteration issues
This commit is contained in:
@@ -56,7 +56,7 @@ func (z *ZurgConfigV1) GetVersion() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (z *ZurgConfigV1) GetDirectories() []string {
|
func (z *ZurgConfigV1) GetDirectories() []string {
|
||||||
rootDirectories := make([]string, len(z.Directories))
|
rootDirectories := []string{}
|
||||||
for directory := range z.Directories {
|
for directory := range z.Directories {
|
||||||
rootDirectories = append(rootDirectories, directory)
|
rootDirectories = append(rootDirectories, directory)
|
||||||
}
|
}
|
||||||
@@ -531,7 +531,7 @@ func checkArithmeticSequenceInFilenames(files []string) bool {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
numList := make([]int, 0, len(numSet))
|
numList := []int{}
|
||||||
for num := range numSet {
|
for num := range numSet {
|
||||||
numList = append(numList, num)
|
numList = append(numList, num)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ func (t *TorrentManager) Delete(accessKey string, deleteInRD bool) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// t.log.Infof("Removing torrent %s from zurg database (not real-debrid)", accessKey)
|
// t.log.Infof("Removing torrent %s from zurg database (not real-debrid)", accessKey)
|
||||||
t.DirectoryMap.IterCb(func(directory string, torrents cmap.ConcurrentMap[string, *Torrent]) {
|
t.DirectoryMap.IterCb(func(directory string, torrents cmap.ConcurrentMap[string, *Torrent]) {
|
||||||
if directory == config.DOWNLOADS || directory == config.DUMPED_TORRENTS {
|
if directory == config.DOWNLOADS || directory == config.DUMPED_TORRENTS {
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ func (t *TorrentManager) assignDirectory(tor *Torrent, triggerHook bool, outputL
|
|||||||
accessKey := t.GetKey(tor)
|
accessKey := t.GetKey(tor)
|
||||||
|
|
||||||
t.DirectoryMap.IterCb(func(directory string, torrents cmap.ConcurrentMap[string, *Torrent]) {
|
t.DirectoryMap.IterCb(func(directory string, torrents cmap.ConcurrentMap[string, *Torrent]) {
|
||||||
if directory == config.DOWNLOADS || directory == config.DUMPED_TORRENTS {
|
if strings.HasPrefix(directory, "int__") || directory == config.DOWNLOADS || directory == config.DUMPED_TORRENTS {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
torrents.Remove(accessKey)
|
torrents.Remove(accessKey)
|
||||||
@@ -391,8 +391,8 @@ func (t *TorrentManager) assignDirectory(tor *Torrent, triggerHook bool, outputL
|
|||||||
// Map torrents to directories
|
// Map torrents to directories
|
||||||
switch t.Config.GetVersion() {
|
switch t.Config.GetVersion() {
|
||||||
case "v1":
|
case "v1":
|
||||||
updatedPaths := make([]string, 0)
|
updatedPaths := []string{}
|
||||||
dirs := make([]string, 0)
|
dirs := []string{}
|
||||||
configV1 := t.Config.(*config.ZurgConfigV1)
|
configV1 := t.Config.(*config.ZurgConfigV1)
|
||||||
for _, directories := range configV1.GetGroupMap() {
|
for _, directories := range configV1.GetGroupMap() {
|
||||||
for _, directory := range directories {
|
for _, directory := range directories {
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ func (t *TorrentManager) repair(torrent *Torrent, wg *sync.WaitGroup) {
|
|||||||
totalBatches := int(math.Ceil(float64(len(brokenFiles)) / 100))
|
totalBatches := int(math.Ceil(float64(len(brokenFiles)) / 100))
|
||||||
t.repairLog.Infof("Torrent %s will be repaired by downloading %d batches of the %d broken files", t.GetKey(torrent), totalBatches, len(brokenFiles))
|
t.repairLog.Infof("Torrent %s will be repaired by downloading %d batches of the %d broken files", t.GetKey(torrent), totalBatches, len(brokenFiles))
|
||||||
|
|
||||||
newlyDownloadedIds := make([]string, 0)
|
newlyDownloadedIds := []string{}
|
||||||
batchNum := 1
|
batchNum := 1
|
||||||
brokenFileIDs := getFileIDs(brokenFiles)
|
brokenFileIDs := getFileIDs(brokenFiles)
|
||||||
var group []string
|
var group []string
|
||||||
@@ -300,7 +300,7 @@ func (t *TorrentManager) repair(torrent *Torrent, wg *sync.WaitGroup) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
newlyDownloadedIds = append(newlyDownloadedIds, redownloadedInfo.ID)
|
newlyDownloadedIds = append(newlyDownloadedIds, redownloadedInfo.ID)
|
||||||
group = make([]string, 0)
|
group = []string{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user