Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0cca48adb1 | ||
|
|
d2f2f8a618 | ||
|
|
fcbcda7eac | ||
|
|
0a89ec3652 | ||
|
|
5a14863a8f |
+133
-20
@@ -7,26 +7,42 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func AniListQuery(body interface{}, login bool) (json.RawMessage, string) {
|
func AniListQuery(body interface{}, login bool) (json.RawMessage, string) {
|
||||||
reader, _ := json.Marshal(body)
|
reader, err := json.Marshal(body)
|
||||||
response, err := http.NewRequest("POST", "https://graphql.anilist.co", bytes.NewBuffer(reader))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed at response, %s\n", err)
|
log.Printf("AniList request failed: could not encode request body\n")
|
||||||
|
return nil, "Could not prepare the AniList request."
|
||||||
|
}
|
||||||
|
request, err := http.NewRequest("POST", "https://graphql.anilist.co", bytes.NewBuffer(reader))
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("AniList request failed: could not create request\n")
|
||||||
|
return nil, "Could not reach AniList. Please check your connection and try again."
|
||||||
}
|
}
|
||||||
if login && (AniListJWT{}) != aniListJwt {
|
if login && (AniListJWT{}) != aniListJwt {
|
||||||
response.Header.Add("Authorization", "Bearer "+aniListJwt.AccessToken)
|
request.Header.Add("Authorization", "Bearer "+aniListJwt.AccessToken)
|
||||||
} else if login {
|
} else if login {
|
||||||
return nil, "Please login to AniList to make this request"
|
return nil, "Please login to AniList to make this request"
|
||||||
}
|
}
|
||||||
response.Header.Add("Content-Type", "application/json")
|
request.Header.Add("Content-Type", "application/json")
|
||||||
response.Header.Add("Accept", "application/json")
|
request.Header.Add("Accept", "application/json")
|
||||||
|
|
||||||
client := &http.Client{}
|
client := &http.Client{Timeout: 20 * time.Second}
|
||||||
res, resErr := client.Do(response)
|
res, resErr := client.Do(request)
|
||||||
if resErr != nil {
|
if resErr != nil {
|
||||||
log.Printf("Failed at res, %s\n", err)
|
log.Printf("AniList request failed: network error\n")
|
||||||
|
return nil, "Could not reach AniList. Please check your connection and try again."
|
||||||
|
}
|
||||||
|
if res == nil {
|
||||||
|
log.Printf("AniList request failed: empty response\n")
|
||||||
|
return nil, "Could not reach AniList. Please check your connection and try again."
|
||||||
|
}
|
||||||
|
if res.Body == nil {
|
||||||
|
log.Printf("AniList request failed: empty response body\n")
|
||||||
|
return nil, "Could not reach AniList. Please check your connection and try again."
|
||||||
}
|
}
|
||||||
|
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
@@ -39,6 +55,37 @@ func AniListQuery(body interface{}, login bool) (json.RawMessage, string) {
|
|||||||
return returnedBody, res.Status
|
return returnedBody, res.Status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func aniListGraphQLErrorMessage(returnedBody json.RawMessage) string {
|
||||||
|
var gqlErr struct {
|
||||||
|
Errors []struct {
|
||||||
|
Message string `json:"message"`
|
||||||
|
} `json:"errors"`
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(returnedBody, &gqlErr); err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if len(gqlErr.Errors) > 0 && strings.TrimSpace(gqlErr.Errors[0].Message) != "" {
|
||||||
|
return strings.TrimSpace(gqlErr.Errors[0].Message)
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func aniListSearchStatusError(status string, returnedBody json.RawMessage) error {
|
||||||
|
if msg := aniListGraphQLErrorMessage(returnedBody); msg != "" {
|
||||||
|
return fmt.Errorf("AniList search failed: %s", msg)
|
||||||
|
}
|
||||||
|
if strings.Contains(status, "429") {
|
||||||
|
return fmt.Errorf("AniList is rate-limiting search right now. Please wait a moment and try again.")
|
||||||
|
}
|
||||||
|
if strings.Contains(status, "500") || strings.Contains(status, "502") || strings.Contains(status, "503") || strings.Contains(status, "504") {
|
||||||
|
return fmt.Errorf("AniList is temporarily unavailable (%s). Please try again shortly.", status)
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(status, "Could not") || strings.HasPrefix(status, "Please login") {
|
||||||
|
return fmt.Errorf("%s", status)
|
||||||
|
}
|
||||||
|
return fmt.Errorf("AniList search failed (%s). Please try again.", status)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *App) GetAniListItem(aniId int, login bool) AniListGetSingleAnime {
|
func (a *App) GetAniListItem(aniId int, login bool) AniListGetSingleAnime {
|
||||||
user := a.GetAniListLoggedInUser()
|
user := a.GetAniListLoggedInUser()
|
||||||
|
|
||||||
@@ -338,12 +385,18 @@ func (a *App) AniListSearch(query string) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
returnedBody, status := AniListQuery(body, false)
|
returnedBody, status := AniListQuery(body, false)
|
||||||
if status != "200 OK" {
|
if status != "200 OK" {
|
||||||
return nil, fmt.Errorf("API search failed with status: %s", status)
|
return nil, aniListSearchStatusError(status, returnedBody)
|
||||||
|
}
|
||||||
|
if len(returnedBody) == 0 {
|
||||||
|
return nil, fmt.Errorf("AniList returned an empty response. Please try again.")
|
||||||
|
}
|
||||||
|
if msg := aniListGraphQLErrorMessage(returnedBody); msg != "" {
|
||||||
|
return nil, fmt.Errorf("AniList search failed: %s", msg)
|
||||||
}
|
}
|
||||||
var post interface{}
|
var post interface{}
|
||||||
err := json.Unmarshal(returnedBody, &post)
|
err := json.Unmarshal(returnedBody, &post)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed at unmarshal, %s\n", err)
|
log.Printf("Failed at unmarshal search results\n")
|
||||||
return nil, fmt.Errorf("Failed to parse search results")
|
return nil, fmt.Errorf("Failed to parse search results")
|
||||||
}
|
}
|
||||||
return post, nil
|
return post, nil
|
||||||
@@ -558,7 +611,7 @@ func (a *App) GetAniListUserWatchingList(page int, perPage int, sort string) (An
|
|||||||
return post, nil
|
return post, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) AniListUpdateEntry(updateBody AniListUpdateVariables) AniListGetSingleAnime {
|
func (a *App) AniListUpdateEntry(updateBody AniListUpdateVariables) (AniListGetSingleAnime, error) {
|
||||||
body := struct {
|
body := struct {
|
||||||
Query string `json:"query"`
|
Query string `json:"query"`
|
||||||
Variables AniListUpdateVariables `json:"variables"`
|
Variables AniListUpdateVariables `json:"variables"`
|
||||||
@@ -584,6 +637,10 @@ func (a *App) AniListUpdateEntry(updateBody AniListUpdateVariables) AniListGetSi
|
|||||||
startedAt: $startedAt
|
startedAt: $startedAt
|
||||||
completedAt: $completedAt
|
completedAt: $completedAt
|
||||||
) {
|
) {
|
||||||
|
id
|
||||||
|
mediaId
|
||||||
|
userId
|
||||||
|
media {
|
||||||
id
|
id
|
||||||
idMal
|
idMal
|
||||||
title {
|
title {
|
||||||
@@ -660,8 +717,7 @@ func (a *App) AniListUpdateEntry(updateBody AniListUpdateVariables) AniListGetSi
|
|||||||
isAdult
|
isAdult
|
||||||
}
|
}
|
||||||
isAdult
|
isAdult
|
||||||
}
|
}
|
||||||
|
|
||||||
status
|
status
|
||||||
startedAt {
|
startedAt {
|
||||||
year
|
year
|
||||||
@@ -700,22 +756,53 @@ func (a *App) AniListUpdateEntry(updateBody AniListUpdateVariables) AniListGetSi
|
|||||||
Variables: updateBody,
|
Variables: updateBody,
|
||||||
}
|
}
|
||||||
|
|
||||||
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"`
|
||||||
|
}
|
||||||
|
|
||||||
|
if status == "403 Forbidden" {
|
||||||
|
err := json.Unmarshal(returnedBody, &badPost)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
return AniListGetSingleAnime{}, fmt.Errorf("API authentication error")
|
||||||
|
}
|
||||||
|
return AniListGetSingleAnime{}, fmt.Errorf("AniList API error: %s", badPost.Errors[0].Message)
|
||||||
|
}
|
||||||
|
if status != "200 OK" {
|
||||||
|
log.Printf("AniListUpdateEntry failed with status: %s, body: %s\n", status, string(returnedBody))
|
||||||
|
return AniListGetSingleAnime{}, fmt.Errorf("API request failed with status: %s", status)
|
||||||
|
}
|
||||||
|
|
||||||
var returnedJson AniListUpdateReturn
|
var returnedJson AniListUpdateReturn
|
||||||
err := json.Unmarshal(returnedBody, &returnedJson)
|
err := json.Unmarshal(returnedBody, &returnedJson)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed at unmarshal, %s\n", err)
|
log.Printf("AniListUpdateEntry failed to unmarshal response: %s, body: %s\n", err, string(returnedBody))
|
||||||
|
return AniListGetSingleAnime{}, fmt.Errorf("failed to parse AniList update response")
|
||||||
|
}
|
||||||
|
|
||||||
|
if returnedJson.Data.SaveMediaListEntry.MediaID == 0 {
|
||||||
|
log.Printf("AniListUpdateEntry returned no saved entry, body: %s\n", string(returnedBody))
|
||||||
|
return AniListGetSingleAnime{}, fmt.Errorf("AniList returned no saved entry")
|
||||||
}
|
}
|
||||||
|
|
||||||
var post AniListGetSingleAnime
|
var post AniListGetSingleAnime
|
||||||
|
|
||||||
post.Data.MediaList = returnedJson.Data.SaveMediaListEntry
|
post.Data.MediaList = returnedJson.Data.SaveMediaListEntry
|
||||||
|
|
||||||
return post
|
return post, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) AniListDeleteEntry(mediaListId int) DeleteAniListReturn {
|
func (a *App) AniListDeleteEntry(mediaListId int) (DeleteAniListReturn, error) {
|
||||||
type Variables = struct {
|
type Variables = struct {
|
||||||
Id int `json:"id"`
|
Id int `json:"id"`
|
||||||
}
|
}
|
||||||
@@ -740,15 +827,41 @@ func (a *App) AniListDeleteEntry(mediaListId int) DeleteAniListReturn {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
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"`
|
||||||
|
}
|
||||||
|
|
||||||
|
if status == "403 Forbidden" {
|
||||||
|
err := json.Unmarshal(returnedBody, &badPost)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
return DeleteAniListReturn{}, fmt.Errorf("API authentication error")
|
||||||
|
}
|
||||||
|
return DeleteAniListReturn{}, fmt.Errorf("AniList API error: %s", badPost.Errors[0].Message)
|
||||||
|
}
|
||||||
|
if status != "200 OK" {
|
||||||
|
log.Printf("AniListDeleteEntry failed with status: %s, body: %s\n", status, string(returnedBody))
|
||||||
|
return DeleteAniListReturn{}, fmt.Errorf("API request failed with status: %s", status)
|
||||||
|
}
|
||||||
|
|
||||||
var post DeleteAniListReturn
|
var post DeleteAniListReturn
|
||||||
err := json.Unmarshal(returnedBody, &post)
|
err := json.Unmarshal(returnedBody, &post)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed at unmarshal, %s\n", err)
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
return DeleteAniListReturn{}, fmt.Errorf("failed to parse AniList delete response")
|
||||||
}
|
}
|
||||||
|
|
||||||
return post
|
return post, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) AniListBrowse(
|
func (a *App) AniListBrowse(
|
||||||
|
|||||||
+39
-36
@@ -66,12 +66,7 @@ type AniListUpdateReturn struct {
|
|||||||
type Media struct {
|
type Media struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
IDMal int `json:"idMal"`
|
IDMal int `json:"idMal"`
|
||||||
Title struct {
|
Title MediaTitle `json:"title"`
|
||||||
UserPreferred string `json:"userPreferred"`
|
|
||||||
Romaji string `json:"romaji"`
|
|
||||||
English string `json:"english"`
|
|
||||||
Native string `json:"native"`
|
|
||||||
} `json:"title"`
|
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
CoverImage struct {
|
CoverImage struct {
|
||||||
ExtraLarge string
|
ExtraLarge string
|
||||||
@@ -95,41 +90,15 @@ type Media struct {
|
|||||||
Trending int
|
Trending int
|
||||||
Favourites int
|
Favourites int
|
||||||
isFavourite bool
|
isFavourite bool
|
||||||
Relations struct {
|
Relations MediaRelations `json:"relations"`
|
||||||
nodes struct {
|
StartDate MediaFuzzyDate `json:"startDate"`
|
||||||
id int
|
EndDate MediaFuzzyDate `json:"endDate"`
|
||||||
Title struct {
|
|
||||||
UserPreferred string `json:"userPreferred"`
|
|
||||||
Romaji string `json:"romaji"`
|
|
||||||
English string `json:"english"`
|
|
||||||
Native string `json:"native"`
|
|
||||||
} `json:"title"`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StartDate struct {
|
|
||||||
Year int
|
|
||||||
Month int
|
|
||||||
Day int
|
|
||||||
}
|
|
||||||
EndDate struct {
|
|
||||||
Year int
|
|
||||||
Month int
|
|
||||||
Day int
|
|
||||||
}
|
|
||||||
NextAiringEpisode struct {
|
NextAiringEpisode struct {
|
||||||
AiringAt int `json:"airingAt"`
|
AiringAt int `json:"airingAt"`
|
||||||
TimeUntilAiring int `json:"timeUntilAiring"`
|
TimeUntilAiring int `json:"timeUntilAiring"`
|
||||||
Episode int `json:"episode"`
|
Episode int `json:"episode"`
|
||||||
} `json:"nextAiringEpisode"`
|
} `json:"nextAiringEpisode"`
|
||||||
AiringSchedule struct {
|
AiringSchedule MediaAiringSchedule `json:"airingSchedule"`
|
||||||
Nodes struct {
|
|
||||||
Id int
|
|
||||||
AiringAt int
|
|
||||||
TimeUntilAiring int
|
|
||||||
Episode int
|
|
||||||
MediaId int
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Genres []string `json:"genres"`
|
Genres []string `json:"genres"`
|
||||||
Tags []struct {
|
Tags []struct {
|
||||||
Id int `json:"id"`
|
Id int `json:"id"`
|
||||||
@@ -142,6 +111,40 @@ type Media struct {
|
|||||||
IsAdult bool `json:"isAdult"`
|
IsAdult bool `json:"isAdult"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MediaTitle struct {
|
||||||
|
UserPreferred string `json:"userPreferred"`
|
||||||
|
Romaji string `json:"romaji"`
|
||||||
|
English string `json:"english"`
|
||||||
|
Native string `json:"native"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MediaRelations struct {
|
||||||
|
Nodes []MediaRelation `json:"nodes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MediaRelation struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Title MediaTitle `json:"title"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MediaFuzzyDate struct {
|
||||||
|
Year int `json:"year"`
|
||||||
|
Month int `json:"month"`
|
||||||
|
Day int `json:"day"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MediaAiringSchedule struct {
|
||||||
|
Nodes []AiringScheduleNode `json:"nodes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AiringScheduleNode struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
AiringAt int `json:"airingAt"`
|
||||||
|
TimeUntilAiring int `json:"timeUntilAiring"`
|
||||||
|
Episode int `json:"episode"`
|
||||||
|
MediaId int `json:"mediaId"`
|
||||||
|
}
|
||||||
|
|
||||||
type MediaList struct {
|
type MediaList struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
MediaID int `json:"mediaId"`
|
MediaID int `json:"mediaId"`
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
aniListLoggedIn,
|
aniListLoggedIn,
|
||||||
malAnime,
|
malAnime,
|
||||||
malLoggedIn,
|
malLoggedIn,
|
||||||
|
setApiError,
|
||||||
simklAnime,
|
simklAnime,
|
||||||
simklLoggedIn,
|
simklLoggedIn,
|
||||||
watchlistNeedsRefresh,
|
watchlistNeedsRefresh,
|
||||||
@@ -207,10 +208,15 @@
|
|||||||
completedAt: convertDateToAniList(completedAtDate),
|
completedAt: convertDateToAniList(completedAtDate),
|
||||||
};
|
};
|
||||||
await AniListUpdateEntry(body).then((value: AniListGetSingleAnime) => {
|
await AniListUpdateEntry(body).then((value: AniListGetSingleAnime) => {
|
||||||
value.data.MediaList.media.tags =
|
if (!value.data?.MediaList || value.data.MediaList.mediaId === 0) {
|
||||||
currentAniListAnime.data.MediaList.media.tags;
|
setApiError(
|
||||||
value.data.MediaList.media.genres =
|
"anilist",
|
||||||
currentAniListAnime.data.MediaList.media.genres;
|
"AniList update failed: no saved entry was returned",
|
||||||
|
undefined,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
aniListAnime.update((newValue) => {
|
aniListAnime.update((newValue) => {
|
||||||
newValue = value;
|
newValue = value;
|
||||||
return newValue;
|
return newValue;
|
||||||
@@ -233,7 +239,18 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
||||||
|
console.error("Error submitting AniList changes:", error);
|
||||||
|
setApiError(
|
||||||
|
"anilist",
|
||||||
|
`Failed to sync AniList: ${errorMsg}`,
|
||||||
|
undefined,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (malLoggedIn && currentMalAnime.id !== 0) {
|
if (malLoggedIn && currentMalAnime.id !== 0) {
|
||||||
let body: MALUploadStatus = {
|
let body: MALUploadStatus = {
|
||||||
status: submitData.status.mal,
|
status: submitData.status.mal,
|
||||||
@@ -286,7 +303,18 @@
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
||||||
|
console.error("Error submitting MyAnimeList changes:", error);
|
||||||
|
setApiError(
|
||||||
|
"mal",
|
||||||
|
`Failed to sync MyAnimeList: ${errorMsg}`,
|
||||||
|
undefined,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (simklLoggedIn && currentSimklAnime.show.ids.simkl !== 0) {
|
if (simklLoggedIn && currentSimklAnime.show.ids.simkl !== 0) {
|
||||||
if (currentSimklAnime.watched_episodes_count !== submitData.episodes) {
|
if (currentSimklAnime.watched_episodes_count !== submitData.episodes) {
|
||||||
await SimklSyncEpisodes(currentSimklAnime, submitData.episodes).then(
|
await SimklSyncEpisodes(currentSimklAnime, submitData.episodes).then(
|
||||||
@@ -359,13 +387,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error submitting changes:", error);
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
||||||
} finally {
|
console.error("Error submitting Simkl changes:", error);
|
||||||
|
setApiError(
|
||||||
|
"simkl",
|
||||||
|
`Failed to sync Simkl: ${errorMsg}`,
|
||||||
|
undefined,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
}
|
||||||
submitting.set(false);
|
submitting.set(false);
|
||||||
submitSuccess.set(true);
|
submitSuccess.set(true);
|
||||||
watchlistNeedsRefresh.set(true);
|
watchlistNeedsRefresh.set(true);
|
||||||
setTimeout(() => submitSuccess.set(false), 2000);
|
setTimeout(() => submitSuccess.set(false), 2000);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteEntries = async () => {
|
const deleteEntries = async () => {
|
||||||
@@ -389,6 +423,18 @@
|
|||||||
notes: "",
|
notes: "",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
||||||
|
console.error("Error deleting AniList entry:", error);
|
||||||
|
setApiError(
|
||||||
|
"anilist",
|
||||||
|
`Failed to delete AniList entry: ${errorMsg}`,
|
||||||
|
undefined,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (malLoggedIn && currentMalAnime.id !== 0) {
|
if (malLoggedIn && currentMalAnime.id !== 0) {
|
||||||
await DeleteMyAnimeListEntry(currentMalAnime.id);
|
await DeleteMyAnimeListEntry(currentMalAnime.id);
|
||||||
AddAnimeServiceToTable({
|
AddAnimeServiceToTable({
|
||||||
@@ -404,6 +450,18 @@
|
|||||||
notes: "",
|
notes: "",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
||||||
|
console.error("Error deleting MyAnimeList entry:", error);
|
||||||
|
setApiError(
|
||||||
|
"mal",
|
||||||
|
`Failed to delete MyAnimeList entry: ${errorMsg}`,
|
||||||
|
undefined,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (simklLoggedIn && currentSimklAnime.show.ids.simkl !== 0) {
|
if (simklLoggedIn && currentSimklAnime.show.ids.simkl !== 0) {
|
||||||
await SimklSyncRemove(currentSimklAnime);
|
await SimklSyncRemove(currentSimklAnime);
|
||||||
AddAnimeServiceToTable({
|
AddAnimeServiceToTable({
|
||||||
@@ -420,13 +478,19 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error deleting entries:", error);
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
||||||
} finally {
|
console.error("Error deleting Simkl entry:", error);
|
||||||
|
setApiError(
|
||||||
|
"simkl",
|
||||||
|
`Failed to delete Simkl entry: ${errorMsg}`,
|
||||||
|
undefined,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
}
|
||||||
submitting.set(false);
|
submitting.set(false);
|
||||||
submitSuccess.set(true);
|
submitSuccess.set(true);
|
||||||
watchlistNeedsRefresh.set(true);
|
watchlistNeedsRefresh.set(true);
|
||||||
setTimeout(() => submitSuccess.set(false), 2000);
|
setTimeout(() => submitSuccess.set(false), 2000);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let max = 999;
|
let max = 999;
|
||||||
|
|||||||
@@ -5,23 +5,128 @@
|
|||||||
import {push} from "svelte-spa-router";
|
import {push} from "svelte-spa-router";
|
||||||
|
|
||||||
let aniSearch = ""
|
let aniSearch = ""
|
||||||
let aniListSearch: AniSearchList
|
let aniListSearch: AniSearchList | null = null
|
||||||
let aniListSearchActive = false
|
let dropdownOpen = false
|
||||||
|
let isSearching = false
|
||||||
|
let showSlowNotice = false
|
||||||
|
let searchError: string | null = null
|
||||||
|
let hasSearched = false
|
||||||
|
let searchRequestId = 0
|
||||||
|
|
||||||
function runAniListSearch(): void {
|
const SLOW_NOTICE_MS = 8000
|
||||||
AniListSearch(aniSearch).then(result => {
|
const SEARCH_TIMEOUT_MS = 30000
|
||||||
aniListSearch = result
|
|
||||||
aniListSearchActive = true
|
function openDropdown(): void {
|
||||||
})
|
dropdownOpen = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchDropdown(): void {
|
function closeDropdown(): void {
|
||||||
let dropdown = document.querySelector("#aniListSearchDropdown")
|
dropdownOpen = false
|
||||||
dropdown.classList.toggle("hidden")
|
}
|
||||||
|
|
||||||
|
function displayTitle(media: { title?: { english?: string | null; romaji?: string | null; native?: string | null } }): string {
|
||||||
|
const english = media?.title?.english
|
||||||
|
if (english !== undefined && english !== null && english !== "") {
|
||||||
|
return english
|
||||||
|
}
|
||||||
|
const romaji = media?.title?.romaji
|
||||||
|
if (romaji !== undefined && romaji !== null && romaji !== "") {
|
||||||
|
return romaji
|
||||||
|
}
|
||||||
|
return media?.title?.native ?? "Unknown title"
|
||||||
|
}
|
||||||
|
|
||||||
|
function resultCount(): number {
|
||||||
|
const media = aniListSearch?.data?.Page?.media
|
||||||
|
return Array.isArray(media) ? media.length : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
async function runAniListSearch(): Promise<void> {
|
||||||
|
const term = aniSearch.trim()
|
||||||
|
openDropdown()
|
||||||
|
if (term.length === 0) {
|
||||||
|
searchRequestId += 1
|
||||||
|
aniListSearch = null
|
||||||
|
searchError = null
|
||||||
|
hasSearched = false
|
||||||
|
isSearching = false
|
||||||
|
showSlowNotice = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (isSearching) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (typeof navigator !== "undefined" && !navigator.onLine) {
|
||||||
|
aniListSearch = null
|
||||||
|
hasSearched = true
|
||||||
|
searchError = "You appear to be offline. Check your connection and try again."
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isSearching = true
|
||||||
|
showSlowNotice = false
|
||||||
|
searchError = null
|
||||||
|
hasSearched = true
|
||||||
|
const myRequest = searchRequestId + 1
|
||||||
|
searchRequestId = myRequest
|
||||||
|
let slowTimer: ReturnType<typeof setTimeout> | null = null
|
||||||
|
let timeoutTimer: ReturnType<typeof setTimeout> | null = null
|
||||||
|
try {
|
||||||
|
slowTimer = setTimeout(() => {
|
||||||
|
if (searchRequestId === myRequest && isSearching) {
|
||||||
|
showSlowNotice = true
|
||||||
|
}
|
||||||
|
}, SLOW_NOTICE_MS)
|
||||||
|
const timeout = new Promise<never>((_, reject) => {
|
||||||
|
timeoutTimer = setTimeout(() => {
|
||||||
|
reject(new Error("AniList is taking too long to respond. Please try again."))
|
||||||
|
}, SEARCH_TIMEOUT_MS)
|
||||||
|
})
|
||||||
|
const result = await Promise.race([AniListSearch(term), timeout])
|
||||||
|
if (searchRequestId !== myRequest) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
aniListSearch = result as AniSearchList
|
||||||
|
if (!Array.isArray(aniListSearch?.data?.Page?.media)) {
|
||||||
|
aniListSearch = null
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (searchRequestId !== myRequest) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
aniListSearch = null
|
||||||
|
searchError = e instanceof Error ? e.message : String(e)
|
||||||
|
} finally {
|
||||||
|
if (slowTimer !== null) {
|
||||||
|
clearTimeout(slowTimer)
|
||||||
|
}
|
||||||
|
if (timeoutTimer !== null) {
|
||||||
|
clearTimeout(timeoutTimer)
|
||||||
|
}
|
||||||
|
if (searchRequestId === myRequest) {
|
||||||
|
isSearching = false
|
||||||
|
showSlowNotice = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function goToAnime(id: number): void {
|
||||||
|
closeDropdown()
|
||||||
|
push(`#/anime/${id}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleWindowClick(e: MouseEvent): void {
|
||||||
|
if (!dropdownOpen) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const container = document.querySelector("#searchDropdown")
|
||||||
|
if (container && e.target instanceof Node && !container.contains(e.target)) {
|
||||||
|
closeDropdown()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:window on:click={handleWindowClick} />
|
||||||
|
|
||||||
<div id="searchDropdown" class="relative w-64 md:w-48">
|
<div id="searchDropdown" class="relative w-64 md:w-48">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
@@ -33,16 +138,20 @@
|
|||||||
placeholder="Search for Anime"
|
placeholder="Search for Anime"
|
||||||
on:keypress={(e) => {
|
on:keypress={(e) => {
|
||||||
if (e.key === "Enter") {
|
if (e.key === "Enter") {
|
||||||
searchDropdown()
|
runAniListSearch()
|
||||||
if(aniSearch.length > 0) runAniListSearch()
|
}
|
||||||
|
}}
|
||||||
|
on:keydown={(e) => {
|
||||||
|
if (e.key === "Escape") {
|
||||||
|
closeDropdown()
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
required/>
|
required/>
|
||||||
<button id="aniListSearchButton"
|
<button id="aniListSearchButton"
|
||||||
class="absolute top-0 end-0 h-full p-2.5 text-sm font-medium rounded-e-lg border focus:ring-4 focus:outline-none bg-blue-600 hover:bg-blue-700 focus:ring-blue-800"
|
class="absolute top-0 end-0 h-full p-2.5 text-sm font-medium rounded-e-lg border focus:ring-4 focus:outline-none bg-blue-600 hover:bg-blue-700 focus:ring-blue-800 disabled:opacity-50"
|
||||||
|
disabled={isSearching}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
searchDropdown()
|
runAniListSearch()
|
||||||
if(aniSearch.length > 0) runAniListSearch()
|
|
||||||
}}>
|
}}>
|
||||||
<svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none"
|
<svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none"
|
||||||
viewBox="0 0 20 20">
|
viewBox="0 0 20 20">
|
||||||
@@ -54,31 +163,38 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="aniListSearchDropdown" class="z-10 absolute left-0 hidden bg-white rounded-lg shadow w-60 2xl:w-80 dark:bg-gray-700">
|
<div id="aniListSearchDropdown" class:hidden={!dropdownOpen} class="z-10 absolute left-0 bg-white rounded-lg shadow w-60 2xl:w-80 dark:bg-gray-700">
|
||||||
{#if aniListSearchActive}
|
{#if isSearching}
|
||||||
|
<div class="m-4 text-gray-700 dark:text-gray-200">{showSlowNotice ? "AniList is slow today, still trying..." : "Searching AniList..."}</div>
|
||||||
|
{:else if searchError}
|
||||||
|
<div class="m-4">
|
||||||
|
<p class="text-red-600 dark:text-red-400 font-medium">Search failed</p>
|
||||||
|
<p class="mt-1 text-sm text-gray-700 dark:text-gray-200">{searchError}</p>
|
||||||
|
<button class="mt-3 text-sm font-medium text-blue-600 hover:underline dark:text-blue-400"
|
||||||
|
on:click={() => runAniListSearch()}>
|
||||||
|
Retry search
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{:else if !hasSearched && aniSearch.trim().length === 0}
|
||||||
|
<div class="m-4 text-gray-700 dark:text-gray-200">Please enter a search term...</div>
|
||||||
|
{:else if resultCount() > 0 && aniListSearch}
|
||||||
<ul class="h-56 w-full py-2 overflow-y-auto text-gray-700 dark:text-gray-200"
|
<ul class="h-56 w-full py-2 overflow-y-auto text-gray-700 dark:text-gray-200"
|
||||||
aria-labelledby="aniListSearchButton">
|
aria-labelledby="aniListSearchButton">
|
||||||
{#each aniListSearch.data.Page.media as media}
|
{#each aniListSearch.data.Page.media as media (media.id)}
|
||||||
<li class="w-full">
|
<li class="w-full">
|
||||||
<div class="flex w-full items-start p-1 hover:bg-gray-600 hover:text-white rounded-lg">
|
<div class="flex w-full items-start p-1 hover:bg-gray-600 hover:text-white rounded-lg">
|
||||||
<button on:click={() => {
|
<button on:click={() => goToAnime(media.id)}
|
||||||
searchDropdown()
|
|
||||||
push(`#/anime/${media.id}`)
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<img class="rounded-bl-lg rounded-tl-lg max-w-24 max-h-24" src={media.coverImage.large}
|
<img class="rounded-bl-lg rounded-tl-lg max-w-24 max-h-24" src={media?.coverImage?.large}
|
||||||
alt="{media.title.english === '' || media.title.english === null ? media.title.romaji : media.title.english} Cover">
|
alt="{displayTitle(media)} Cover">
|
||||||
</button>
|
</button>
|
||||||
<button class="rounded-bl-lg rounded-tl-lg w-full h-24" on:click={() => {
|
<button class="rounded-bl-lg rounded-tl-lg w-full h-24" on:click={() => goToAnime(media.id)} >{displayTitle(media)}</button>
|
||||||
searchDropdown()
|
|
||||||
push(`#/anime/${media.id}`)
|
|
||||||
}} >{media.title.english === '' || media.title.english === null ? media.title.romaji : media.title.english }</button>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
{:else if aniSearch.length === 0}
|
{:else if hasSearched}
|
||||||
<div class="m-4">Please enter a search term...</div>
|
<div class="m-4 text-gray-700 dark:text-gray-200">No results found for "{aniSearch.trim()}". Try a different title.</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
+161
-15
@@ -1,5 +1,25 @@
|
|||||||
export namespace main {
|
export namespace main {
|
||||||
|
|
||||||
|
export class AiringScheduleNode {
|
||||||
|
id: number;
|
||||||
|
airingAt: number;
|
||||||
|
timeUntilAiring: number;
|
||||||
|
episode: number;
|
||||||
|
mediaId: number;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new AiringScheduleNode(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.id = source["id"];
|
||||||
|
this.airingAt = source["airingAt"];
|
||||||
|
this.timeUntilAiring = source["timeUntilAiring"];
|
||||||
|
this.episode = source["episode"];
|
||||||
|
this.mediaId = source["mediaId"];
|
||||||
|
}
|
||||||
|
}
|
||||||
export class AniListCurrentUserWatchList {
|
export class AniListCurrentUserWatchList {
|
||||||
data: struct { Page struct { PageInfo struct { Total int "json:\"total\""; PerPage int "json:\"perPage\""; CurrentPage int "json:\"currentPage\""; LastPage int "json:\"lastPage\""; HasNextPage bool "json:\"hasNextPage\"" } "json:\"pageInfo\""; MediaList []main.;
|
data: struct { Page struct { PageInfo struct { Total int "json:\"total\""; PerPage int "json:\"perPage\""; CurrentPage int "json:\"currentPage\""; LastPage int "json:\"lastPage\""; HasNextPage bool "json:\"hasNextPage\"" } "json:\"pageInfo\""; MediaList []main.;
|
||||||
|
|
||||||
@@ -381,11 +401,136 @@ export namespace main {
|
|||||||
this.isAdult = source["isAdult"];
|
this.isAdult = source["isAdult"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export class MediaAiringSchedule {
|
||||||
|
nodes: AiringScheduleNode[];
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new MediaAiringSchedule(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.nodes = this.convertValues(source["nodes"], AiringScheduleNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
if (!a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (a.slice && a.map) {
|
||||||
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||||
|
} else if ("object" === typeof a) {
|
||||||
|
if (asMap) {
|
||||||
|
for (const key of Object.keys(a)) {
|
||||||
|
a[key] = new classs(a[key]);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return new classs(a);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class MediaFuzzyDate {
|
||||||
|
year: number;
|
||||||
|
month: number;
|
||||||
|
day: number;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new MediaFuzzyDate(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.year = source["year"];
|
||||||
|
this.month = source["month"];
|
||||||
|
this.day = source["day"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class MediaRelation {
|
||||||
|
id: number;
|
||||||
|
title: MediaTitle;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new MediaRelation(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.id = source["id"];
|
||||||
|
this.title = this.convertValues(source["title"], MediaTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
if (!a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (a.slice && a.map) {
|
||||||
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||||
|
} else if ("object" === typeof a) {
|
||||||
|
if (asMap) {
|
||||||
|
for (const key of Object.keys(a)) {
|
||||||
|
a[key] = new classs(a[key]);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return new classs(a);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class MediaRelations {
|
||||||
|
nodes: MediaRelation[];
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new MediaRelations(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.nodes = this.convertValues(source["nodes"], MediaRelation);
|
||||||
|
}
|
||||||
|
|
||||||
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
if (!a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (a.slice && a.map) {
|
||||||
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||||
|
} else if ("object" === typeof a) {
|
||||||
|
if (asMap) {
|
||||||
|
for (const key of Object.keys(a)) {
|
||||||
|
a[key] = new classs(a[key]);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return new classs(a);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class MediaTitle {
|
||||||
|
userPreferred: string;
|
||||||
|
romaji: string;
|
||||||
|
english: string;
|
||||||
|
native: string;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new MediaTitle(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.userPreferred = source["userPreferred"];
|
||||||
|
this.romaji = source["romaji"];
|
||||||
|
this.english = source["english"];
|
||||||
|
this.native = source["native"];
|
||||||
|
}
|
||||||
|
}
|
||||||
export class Media {
|
export class Media {
|
||||||
id: number;
|
id: number;
|
||||||
idMal: number;
|
idMal: number;
|
||||||
// Go type: struct { UserPreferred string "json:\"userPreferred\""; Romaji string "json:\"romaji\""; English string "json:\"english\""; Native string "json:\"native\"" }
|
title: MediaTitle;
|
||||||
title: any;
|
|
||||||
description: string;
|
description: string;
|
||||||
// Go type: struct { ExtraLarge string; Large string "json:\"large\""; Medium string; Color string }
|
// Go type: struct { ExtraLarge string; Large string "json:\"large\""; Medium string; Color string }
|
||||||
coverImage: any;
|
coverImage: any;
|
||||||
@@ -404,16 +549,12 @@ export namespace main {
|
|||||||
Popularity: number;
|
Popularity: number;
|
||||||
Trending: number;
|
Trending: number;
|
||||||
Favourites: number;
|
Favourites: number;
|
||||||
// Go type: struct { nodes struct { id int; Title struct { UserPreferred string "json:\"userPreferred\""; Romaji string "json:\"romaji\""; English string "json:\"english\""; Native string "json:\"native\"" } "json:\"title\"" } }
|
relations: MediaRelations;
|
||||||
Relations: any;
|
startDate: MediaFuzzyDate;
|
||||||
// Go type: struct { Year int; Month int; Day int }
|
endDate: MediaFuzzyDate;
|
||||||
StartDate: any;
|
|
||||||
// Go type: struct { Year int; Month int; Day int }
|
|
||||||
EndDate: any;
|
|
||||||
// Go type: struct { AiringAt int "json:\"airingAt\""; TimeUntilAiring int "json:\"timeUntilAiring\""; Episode int "json:\"episode\"" }
|
// Go type: struct { AiringAt int "json:\"airingAt\""; TimeUntilAiring int "json:\"timeUntilAiring\""; Episode int "json:\"episode\"" }
|
||||||
nextAiringEpisode: any;
|
nextAiringEpisode: any;
|
||||||
// Go type: struct { Nodes struct { Id int; AiringAt int; TimeUntilAiring int; Episode int; MediaId int } }
|
airingSchedule: MediaAiringSchedule;
|
||||||
AiringSchedule: any;
|
|
||||||
genres: string[];
|
genres: string[];
|
||||||
tags: [];
|
tags: [];
|
||||||
isAdult: boolean;
|
isAdult: boolean;
|
||||||
@@ -426,7 +567,7 @@ export namespace main {
|
|||||||
if ('string' === typeof source) source = JSON.parse(source);
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
this.id = source["id"];
|
this.id = source["id"];
|
||||||
this.idMal = source["idMal"];
|
this.idMal = source["idMal"];
|
||||||
this.title = this.convertValues(source["title"], Object);
|
this.title = this.convertValues(source["title"], MediaTitle);
|
||||||
this.description = source["description"];
|
this.description = source["description"];
|
||||||
this.coverImage = this.convertValues(source["coverImage"], Object);
|
this.coverImage = this.convertValues(source["coverImage"], Object);
|
||||||
this.BannerImage = source["BannerImage"];
|
this.BannerImage = source["BannerImage"];
|
||||||
@@ -444,11 +585,11 @@ export namespace main {
|
|||||||
this.Popularity = source["Popularity"];
|
this.Popularity = source["Popularity"];
|
||||||
this.Trending = source["Trending"];
|
this.Trending = source["Trending"];
|
||||||
this.Favourites = source["Favourites"];
|
this.Favourites = source["Favourites"];
|
||||||
this.Relations = this.convertValues(source["Relations"], Object);
|
this.relations = this.convertValues(source["relations"], MediaRelations);
|
||||||
this.StartDate = this.convertValues(source["StartDate"], Object);
|
this.startDate = this.convertValues(source["startDate"], MediaFuzzyDate);
|
||||||
this.EndDate = this.convertValues(source["EndDate"], Object);
|
this.endDate = this.convertValues(source["endDate"], MediaFuzzyDate);
|
||||||
this.nextAiringEpisode = this.convertValues(source["nextAiringEpisode"], Object);
|
this.nextAiringEpisode = this.convertValues(source["nextAiringEpisode"], Object);
|
||||||
this.AiringSchedule = this.convertValues(source["AiringSchedule"], Object);
|
this.airingSchedule = this.convertValues(source["airingSchedule"], MediaAiringSchedule);
|
||||||
this.genres = source["genres"];
|
this.genres = source["genres"];
|
||||||
this.tags = this.convertValues(source["tags"], );
|
this.tags = this.convertValues(source["tags"], );
|
||||||
this.isAdult = source["isAdult"];
|
this.isAdult = source["isAdult"];
|
||||||
@@ -472,6 +613,8 @@ export namespace main {
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class MediaList {
|
export class MediaList {
|
||||||
id: number;
|
id: number;
|
||||||
mediaId: number;
|
mediaId: number;
|
||||||
@@ -527,6 +670,9 @@ export namespace main {
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export class MyAnimeListUser {
|
export class MyAnimeListUser {
|
||||||
id: id;
|
id: id;
|
||||||
name: name;
|
name: name;
|
||||||
|
|||||||
+1
-1
@@ -12,6 +12,6 @@
|
|||||||
},
|
},
|
||||||
"info": {
|
"info": {
|
||||||
"productName": "AniTrack",
|
"productName": "AniTrack",
|
||||||
"productVersion": "1.5.5"
|
"productVersion": "1.6.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user