feat: Anilist support

This commit is contained in:
Gabe Farrell 2025-04-04 20:54:47 -04:00
parent ec6c1cc0e0
commit cdd7b67003
8 changed files with 541 additions and 143 deletions

View file

@ -1,12 +1,18 @@
# sonarr-mal-importer
This is basically a wrapper for [Jikan](jikan.moe) that converts a Jikan API call to a list with TVDB IDs that Sonarr can import the results.
# sonarr-anime-importer
Easily create import lists in sonarr with MyAnimeList or Anilist queries!
**This API will spam calls that have pagination so make sure you set a limit in the query parameters so you don't get rate limited or IP banned!!**
This is basically a wrapper for [Jikan](jikan.moe) and the Anilist API that maps IDs to a list with TVDB IDs so that Sonarr can import the results.
Pulls MyAnimeList and TVDB ID associations from https://raw.githubusercontent.com/Kometa-Team/Anime-IDs/master/anime_ids.json.
**Until v1.0.0, breaking changes can happen at any time. Multiple have happened already! Be wary updating.**
**The "limit" parameter is required for all requests!**
Pulls MyAnimeList, Anilist, and TVDB ID associations from https://raw.githubusercontent.com/Kometa-Team/Anime-IDs/master/anime_ids.json.
## Supported Requests
### GET /anime
### GET /v1/mal/anime
Searches anime from MyAnimeList
See https://docs.api.jikan.moe/#tag/anime/operation/getAnimeSearch for parameters.
Additional parameters supported:
@ -15,36 +21,70 @@ Additional parameters supported:
Example request:
```bash
# fetches the top 10 most popular currently airing tv anime
curl "http://localhost:3333/anime?type=tv&status=airing&order_by=popularity&sort=asc&limit=10"
curl "http://localhost:3333/v1/mal/anime?type=tv&status=airing&order_by=popularity&sort=asc&limit=10"
```
### GET /v1/anilist/anime
Searches anime from Anilist
Parameters:
- isAdult: Boolean
- search: String
- format: [[MediaFormat]](https://studio.apollographql.com/sandbox/schema/reference/enums/MediaFormat)
- status: [MediaStatus](https://studio.apollographql.com/sandbox/schema/reference/enums/MediaStatus)
- countryOfOrigin: [CountryCode](https://studio.apollographql.com/sandbox/schema/reference/scalars/CountryCode)
- season: [MediaSeason](https://studio.apollographql.com/sandbox/schema/reference/enums/MediaSeason)
- seasonYear: Int
- year: String
- onList: Boolean
- yearLesser: [FuzzyDateInt](https://studio.apollographql.com/sandbox/schema/reference/scalars/FuzzyDateInt)
- yearGreater: [FuzzyDateInt](https://studio.apollographql.com/sandbox/schema/reference/scalars/FuzzyDateInt)
- averageScoreGreater: Int
- averageScoreLesser: Int
- genres: [String]
- excludedGenres: [String]
- tags: [String]
- excludedTags: [String]
- minimumTagRank: Int
- sort: [[MediaSort]](https://studio.apollographql.com/sandbox/schema/reference/enums/MediaSort)
- limit: Int
- allowDuplicates: Boolean
Example request:
```bash
# fetch the top 20, non-adult trending anime that are either TV or ONA and are made in Japan after 2020
curl "http://localhost:3333/v1/anilist/anime?format=TV,ONA&sort=TRENDING_DESC&isAdult=false&countryOfOrigin=JP&yearGreater=20200000&limit=20"
```
## Environment
One configuration environment variable is supported:
- `ALWAYS_SKIP_MAL_IDS`: Comma-separated list of MyAnimeList IDs to always skip. These do not count towards the return limit.
- `ALWAYS_SKIP_ANILIST_IDS`: Comma-separated list of Anilist IDs to always skip. These do not count towards the return limit.
## Docker Compose
```yaml
services:
sonarr-mal-importer:
image: gabehf/sonarr-mal-importer:latest
container_name: sonarr-mal-importer
sonarr-anime-importer:
image: gabehf/sonarr-anime-importer:latest
container_name: sonarr-anime-importer
ports:
- 3333:3333
environment:
- ALWAYS_SKIP_MAL_IDS=12345,67890 # Comma-separated
- ALWAYS_SKIP_ANILIST_IDS=01234,56789 # Comma-separated
restart: unless-stopped
```
# TODO
- [x] Add de-duplication and a query param to disable it
- [x] Add perma-skip by MALId option in environment variable
- [ ] Only do "a.k.a." when logging if the anime has different romanized and english titles
- [x] Only do "a.k.a." when logging if the anime has different romanized and english titles
- [ ] Prevent spamming calls when few/no IDs are mapped to TVDB
# Albums that fueled development
| Album | Artist |
|-------------------------|------------------------------|
| ZOO!! | Necry Talkie (ネクライトーキー) |
| FREAK | Necry Talkie (ネクライトーキー) |
| Expert In A Dying Field | The Beths |
| Vivid | ADOY |
| Album | Artist |
|-------------------------|---------------------------------|
| ZOO!! | Necry Talkie (ネクライトーキー) |
| FREAK | Necry Talkie (ネクライトーキー) |
| Expert In A Dying Field | The Beths |
| Vivid | ADOY |
| CHUU | Strawberry Rush |
| MIMI | Hug (feat. HATSUNE MIKU & KAFU) |