21 lines
486 B
Go
21 lines
486 B
Go
package universal
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/debridmediamanager.com/zurg/internal/torrent"
|
|
)
|
|
|
|
// getFile finds a link by a fragment, it might be wrong
|
|
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 {
|
|
return &torrents[t], &torrents[t].SelectedFiles[f]
|
|
}
|
|
}
|
|
}
|
|
return nil, nil
|
|
}
|