Finalize repair

This commit is contained in:
Ben Sarmiento
2023-10-26 03:29:13 +02:00
parent cc9616894a
commit 54ab801796
13 changed files with 500 additions and 517 deletions

View File

@@ -0,0 +1,21 @@
package universal
import (
"path/filepath"
"strings"
"github.com/debridmediamanager.com/zurg/internal/torrent"
)
// getFile finds a link by a fragment, it might be wrong
func getFile(torrents []torrent.Torrent, filename, fragment string) (*torrent.Torrent, *torrent.File) {
for t := range torrents {
for f, file := range torrents[t].SelectedFiles {
fname := filepath.Base(file.Path)
if filename == fname && strings.Contains(file.Link, fragment) {
return &torrents[t], &torrents[t].SelectedFiles[f]
}
}
}
return nil, nil
}