Add caching
This commit is contained in:
@@ -20,14 +20,12 @@ func convertRFC3339toRFC1123(input string) string {
|
||||
|
||||
// findAllTorrentsWithName finds all torrents in a given directory with a given name
|
||||
func findAllTorrentsWithName(t *torrent.TorrentManager, directory, torrentName string) []torrent.Torrent {
|
||||
var matchingTorrents []torrent.Torrent
|
||||
|
||||
matchingTorrents := make([]torrent.Torrent, 0, 10)
|
||||
torrents := t.GetByDirectory(directory)
|
||||
for i := range torrents {
|
||||
if torrents[i].Name == torrentName || strings.HasPrefix(torrents[i].Name, torrentName) {
|
||||
matchingTorrents = append(matchingTorrents, torrents[i])
|
||||
}
|
||||
}
|
||||
|
||||
return matchingTorrents
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user