aboutsummaryrefslogtreecommitdiff
path: root/mal/search.go
diff options
context:
space:
mode:
Diffstat (limited to 'mal/search.go')
-rw-r--r--mal/search.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/mal/search.go b/mal/search.go
index 1bad114..e6e416a 100644
--- a/mal/search.go
+++ b/mal/search.go
@@ -28,7 +28,13 @@ import (
func SearchAnime(searchString string, fields []string) []a.Anime {
fields = append([]string{"title", "id"}, fields...)
- res, err := animeClient.SearchAnime(searchString, SearchLength, SearchOffset, SearchNSFW, fields)
+ searchLength, searchOffset := SearchLength, SearchOffset
+ if AutoSel > 0 {
+ searchLength = 1
+ searchOffset = AutoSel - 1
+ }
+
+ res, err := animeClient.SearchAnime(searchString, searchLength, searchOffset, SearchNSFW, fields)
if err != nil {
fmt.Println("MyAnimeList reported error while searching:", err.Error())
os.Exit(1)
@@ -40,7 +46,13 @@ func SearchAnime(searchString string, fields []string) []a.Anime {
func SearchManga(searchString string, fields []string) []m.Manga {
fields = append([]string{"title", "id"}, fields...)
- res, err := mangaClient.SearchManga(searchString, SearchLength, SearchOffset, SearchNSFW, fields)
+ searchLength, searchOffset := SearchLength, SearchOffset
+ if AutoSel > 0 {
+ searchLength = 1
+ searchOffset = AutoSel - 1
+ }
+
+ res, err := mangaClient.SearchManga(searchString, searchLength, searchOffset, SearchNSFW, fields)
if err != nil {
fmt.Println("MyAnimeList reported error while searching:", err.Error())
os.Exit(1)