aboutsummaryrefslogtreecommitdiff
path: root/mal/seasonals.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2023-08-15 10:57:27 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2023-08-15 10:57:27 +0530
commitfff3dadabc321871e6819392efc605c6dffe2e69 (patch)
tree25aceed23b73b2ad975a06d73fad091d0886a2a6 /mal/seasonals.go
parenta44d6eb2fdddc75983c735e1a0fa744014db9593 (diff)
migrated from MAL2Go to mg package
Diffstat (limited to 'mal/seasonals.go')
-rw-r--r--mal/seasonals.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/mal/seasonals.go b/mal/seasonals.go
index fda130b..29cfea6 100644
--- a/mal/seasonals.go
+++ b/mal/seasonals.go
@@ -19,21 +19,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package mal
import (
+ "vidhukant.com/mg"
"fmt"
"os"
"strconv"
- a "github.com/MikunoNaka/MAL2Go/v4/anime"
)
-func GetSeasonalAnime(season a.Season, sort string) []a.Anime {
- year := strconv.Itoa(season.Year)
- fields := []string{"title", "id"}
+func GetSeasonalAnime(season a.Season, sort string) []mg.Anime {
+ var res []mg.Anime
+ err := MALClient.GetSeasonalAnime(&res, &mg.SeasonalParams{
+ Year: strconv.Itoa(season.Year),
+ Season: season.Name,
+ Sort: sort,
+ Limit: SearchLength,
+ Offset: SearchOffset,
+ NSFW: SearchNSFW,
+ Fields: []string{"title", "id"},
+ })
- res, err := animeClient.GetSeasonalAnime(year, season.Name, sort, SearchLength, SearchOffset, SearchNSFW, fields)
if err != nil {
fmt.Println("MyAnimeList reported error while getting seasonal animes:", err.Error())
os.Exit(1)
}
- return res.Animes
+ return res
}