Mercurial > minori
comparison src/services/anilist.cc @ 184:09492158bcc5
anime: etc. comments and changes
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Mon, 04 Dec 2023 13:44:42 -0500 |
| parents | 01d259b9c89f |
| children | 62e336597bb7 |
comparison
equal
deleted
inserted
replaced
| 183:01d259b9c89f | 184:09492158bcc5 |
|---|---|
| 251 * int mediaId, | 251 * int mediaId, |
| 252 * MediaListStatus status, | 252 * MediaListStatus status, |
| 253 * float score, | 253 * float score, |
| 254 * int scoreRaw, | 254 * int scoreRaw, |
| 255 * int progress, | 255 * int progress, |
| 256 * int progressVolumes, | 256 * int progressVolumes, // manga-specific. |
| 257 * int repeat, | 257 * int repeat, // rewatch |
| 258 * int priority, | 258 * int priority, |
| 259 * bool private, | 259 * bool private, |
| 260 * string notes, | 260 * string notes, |
| 261 * bool hiddenFromStatusLists, | 261 * bool hiddenFromStatusLists, |
| 262 * string[] customLists, | 262 * string[] customLists, |
| 263 * float[] advancedScores, | 263 * float[] advancedScores, |
| 264 * Date startedAt, | 264 * Date startedAt, |
| 265 * Date completedAt | 265 * Date completedAt |
| 266 **/ | 266 **/ |
| 267 Anime::Anime& anime = Anime::db.items[id]; | 267 Anime::Anime& anime = Anime::db.items[id]; |
| 268 if (!anime.IsInUserList()) | |
| 269 return 0; | |
| 270 | |
| 268 constexpr std::string_view query = "mutation ($media_id: Int, $progress: Int, $status: MediaListStatus, $score: Int, " | 271 constexpr std::string_view query = "mutation ($media_id: Int, $progress: Int, $status: MediaListStatus, $score: Int, " |
| 269 "$notes: String, $start: FuzzyDateInput, $comp: FuzzyDateInput) {\n" | 272 "$notes: String, $start: FuzzyDateInput, $comp: FuzzyDateInput, $repeat: Int) {\n" |
| 270 " SaveMediaListEntry (mediaId: $media_id, progress: $progress, status: $status, " | 273 " SaveMediaListEntry (mediaId: $media_id, progress: $progress, status: $status, " |
| 271 "scoreRaw: $score, notes: $notes, startedAt: $start, completedAt: $comp) {\n" | 274 "scoreRaw: $score, notes: $notes, startedAt: $start, completedAt: $comp, repeat: $repeat) {\n" |
| 272 " id\n" | 275 " id\n" |
| 273 " }\n" | 276 " }\n" |
| 274 "}\n"; | 277 "}\n"; |
| 275 // clang-format off | 278 // clang-format off |
| 276 nlohmann::json json = { | 279 nlohmann::json json = { |
| 280 {"progress", anime.GetUserProgress()}, | 283 {"progress", anime.GetUserProgress()}, |
| 281 {"status", ListStatusToString(anime)}, | 284 {"status", ListStatusToString(anime)}, |
| 282 {"score", anime.GetUserScore()}, | 285 {"score", anime.GetUserScore()}, |
| 283 {"notes", anime.GetUserNotes()}, | 286 {"notes", anime.GetUserNotes()}, |
| 284 {"start", anime.GetUserDateStarted().GetAsAniListJson()}, | 287 {"start", anime.GetUserDateStarted().GetAsAniListJson()}, |
| 285 {"comp", anime.GetUserDateCompleted().GetAsAniListJson()} | 288 {"comp", anime.GetUserDateCompleted().GetAsAniListJson()}, |
| 289 {"repeat", anime.GetUserRewatchedTimes()} | |
| 286 }} | 290 }} |
| 287 }; | 291 }; |
| 288 // clang-format on | 292 // clang-format on |
| 289 | 293 |
| 290 auto ret = SendJSONRequest(json); | 294 auto ret = SendJSONRequest(json); |
