Compare commits
5 Commits
2292ae32c2
...
0.1.3
Author | SHA1 | Date | |
---|---|---|---|
1fd453f399 | |||
3ab77ea8d3 | |||
3edfed6272 | |||
aa81102194 | |||
0c90c3e29d |
@ -360,27 +360,47 @@ func (a *App) GetAniListUserWatchingList(page int, perPage int, sort string) Ani
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
returnedBody, _ := AniListQuery(body, true)
|
returnedBody, status := AniListQuery(body, true)
|
||||||
|
|
||||||
|
var badPost struct {
|
||||||
|
Errors []struct {
|
||||||
|
Message string `json:"message"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
Locations []struct {
|
||||||
|
Line int `json:"line"`
|
||||||
|
Column int `json:"column"`
|
||||||
|
} `json:"locations"`
|
||||||
|
} `json:"errors"`
|
||||||
|
Data any `json:"data"`
|
||||||
|
}
|
||||||
var post AniListCurrentUserWatchList
|
var post AniListCurrentUserWatchList
|
||||||
err := json.Unmarshal(returnedBody, &post)
|
if status == "200 OK" {
|
||||||
if err != nil {
|
err := json.Unmarshal(returnedBody, &post)
|
||||||
log.Printf("Failed at unmarshal, %s\n", err)
|
if err != nil {
|
||||||
}
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
|
||||||
// Getting the real total, finding the real last page and storing that in the Page info
|
|
||||||
statuses := post.Data.Page.MediaList[0].User.Statistics.Anime.Statuses
|
|
||||||
var total int
|
|
||||||
for _, status := range statuses {
|
|
||||||
if status.Status == "CURRENT" {
|
|
||||||
total = status.Count
|
|
||||||
}
|
}
|
||||||
|
// Getting the real total, finding the real last page and storing that in the Page info
|
||||||
|
statuses := post.Data.Page.MediaList[0].User.Statistics.Anime.Statuses
|
||||||
|
var total int
|
||||||
|
for _, status := range statuses {
|
||||||
|
if status.Status == "CURRENT" {
|
||||||
|
total = status.Count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lastPage := total / perPage
|
||||||
|
|
||||||
|
post.Data.Page.PageInfo.Total = total
|
||||||
|
post.Data.Page.PageInfo.LastPage = lastPage
|
||||||
}
|
}
|
||||||
|
|
||||||
lastPage := total / perPage
|
if status == "403 Forbidden" {
|
||||||
|
err := json.Unmarshal(returnedBody, &badPost)
|
||||||
post.Data.Page.PageInfo.Total = total
|
if err != nil {
|
||||||
post.Data.Page.PageInfo.LastPage = lastPage
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
log.Fatal(badPost.Errors[0].Message)
|
||||||
|
}
|
||||||
|
|
||||||
return post
|
return post
|
||||||
}
|
}
|
||||||
|
@ -193,9 +193,9 @@
|
|||||||
};
|
};
|
||||||
await AniListUpdateEntry(body).then(
|
await AniListUpdateEntry(body).then(
|
||||||
(value: AniListGetSingleAnime) => {
|
(value: AniListGetSingleAnime) => {
|
||||||
// in future when you inevitably add tags to typescript, until Anilist fixes the api bug
|
/* TODO in future when you inevitably add tags to typescript, until Anilist fixes the api bug
|
||||||
// where tags break the SaveMediaListEntry return, you'll want to use this delete line
|
where tags break the SaveMediaListEntry return, you'll want to use this delete line
|
||||||
// delete value.data.MediaList.media.tags
|
delete value.data.MediaList.media.tags */
|
||||||
aniListAnime.update((newValue) => {
|
aniListAnime.update((newValue) => {
|
||||||
newValue = value;
|
newValue = value;
|
||||||
return newValue;
|
return newValue;
|
||||||
@ -397,6 +397,16 @@
|
|||||||
submitSuccess.set(true);
|
submitSuccess.set(true);
|
||||||
setTimeout(() => submitSuccess.set(false), 2000);
|
setTimeout(() => submitSuccess.set(false), 2000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let max = 999
|
||||||
|
|
||||||
|
if (currentAniListAnime.data.MediaList.media.episodes !== 0) {
|
||||||
|
max = currentAniListAnime.data.MediaList.media.episodes
|
||||||
|
}
|
||||||
|
if (currentAniListAnime.data.MediaList.media.episodes === 0 &&
|
||||||
|
currentAniListAnime.data.MediaList.media.nextAiringEpisode.episode !== 0) {
|
||||||
|
max = currentAniListAnime.data.MediaList.media.nextAiringEpisode.episode - 1
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form on:submit|preventDefault={handleSubmit} class="container pt-3 pb-10">
|
<form on:submit|preventDefault={handleSubmit} class="container pt-3 pb-10">
|
||||||
@ -427,7 +437,7 @@
|
|||||||
type="number"
|
type="number"
|
||||||
name="episodes"
|
name="episodes"
|
||||||
min="0"
|
min="0"
|
||||||
max={currentAniListAnime.data.MediaList.media.episodes}
|
max={max}
|
||||||
id="episodes"
|
id="episodes"
|
||||||
class="border {currentAniListAnime.data.MediaList
|
class="border {currentAniListAnime.data.MediaList
|
||||||
.progress < 0 ||
|
.progress < 0 ||
|
||||||
@ -441,9 +451,18 @@
|
|||||||
bind:value={currentAniListAnime.data.MediaList.progress}
|
bind:value={currentAniListAnime.data.MediaList.progress}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
<div>
|
||||||
|
/ {currentAniListAnime.data.MediaList.media
|
||||||
|
.nextAiringEpisode.episode !== 0
|
||||||
|
? currentAniListAnime.data.MediaList.media
|
||||||
|
.nextAiringEpisode.episode - 1
|
||||||
|
: currentAniListAnime.data.MediaList.media.episodes}
|
||||||
|
</div>
|
||||||
|
{#if currentAniListAnime.data.MediaList.media.nextAiringEpisode.episode !== 0}
|
||||||
<div>
|
<div>
|
||||||
of {currentAniListAnime.data.MediaList.media.episodes}
|
of {currentAniListAnime.data.MediaList.media.episodes}
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@ -12,6 +12,6 @@
|
|||||||
},
|
},
|
||||||
"info": {
|
"info": {
|
||||||
"productName": "AniTrack",
|
"productName": "AniTrack",
|
||||||
"productVersion": "0.1.1"
|
"productVersion": "0.1.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user