Fix for file namings
This commit is contained in:
@@ -2,6 +2,7 @@ package repair
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/sirrobot01/debrid-blackhole/pkg/arr"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
@@ -129,3 +130,20 @@ func checkFileStart(filePath string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func collectFiles(media arr.Content) map[string][]arr.ContentFile {
|
||||
uniqueParents := make(map[string][]arr.ContentFile)
|
||||
files := media.Files
|
||||
for _, file := range files {
|
||||
target := getSymlinkTarget(file.Path)
|
||||
if target != "" {
|
||||
file.IsSymlink = true
|
||||
dir, f := filepath.Split(target)
|
||||
torrentNamePath := filepath.Clean(dir)
|
||||
// Set target path folder/file.mkv
|
||||
file.TargetPath = f
|
||||
uniqueParents[torrentNamePath] = append(uniqueParents[torrentNamePath], file)
|
||||
}
|
||||
}
|
||||
return uniqueParents
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user