Add retain_folder_name_extension option

This commit is contained in:
Ben Sarmiento
2023-11-07 17:20:54 +01:00
parent 3cc5044bc5
commit 0a76fdb14b
10 changed files with 41 additions and 74 deletions

View File

@@ -2,17 +2,16 @@ 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) {
func getFile(torrents []torrent.Torrent, filename 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) {
if filename == fname {
return &torrents[t], &torrents[t].SelectedFiles[f]
}
}