Refactor with ordered maps
This commit is contained in:
@@ -1,20 +1 @@
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user