fixed simkl and anilist syncing bugs
This commit is contained in:
parent
4d9012b43c
commit
e3ed5bb2b9
@ -138,7 +138,7 @@ func (a *App) GetAniListItem(aniId int, login bool) AniListGetSingleAnime {
|
|||||||
Variables: neededVariables,
|
Variables: neededVariables,
|
||||||
}
|
}
|
||||||
|
|
||||||
returnedBody, _ := AniListQuery(body, false)
|
returnedBody, _ := AniListQuery(body, login)
|
||||||
|
|
||||||
var post AniListGetSingleAnime
|
var post AniListGetSingleAnime
|
||||||
err := json.Unmarshal(returnedBody, &post)
|
err := json.Unmarshal(returnedBody, &post)
|
||||||
|
@ -83,7 +83,7 @@ func (a *App) SimklGetUserWatchlist() SimklWatchList {
|
|||||||
return watchlist
|
return watchlist
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) SimklSyncEpisodes(anime SimklAnime, progress int) interface{} {
|
func (a *App) SimklSyncEpisodes(anime SimklAnime, progress int) SimklAnime {
|
||||||
|
|
||||||
var episodes []Episode
|
var episodes []Episode
|
||||||
var url string
|
var url string
|
||||||
@ -124,10 +124,18 @@ func (a *App) SimklSyncEpisodes(anime SimklAnime, progress int) interface{} {
|
|||||||
log.Printf("Failed at unmarshal, %s\n", err)
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return success
|
for i, simklAnime := range WatchList.Anime {
|
||||||
|
if anime.Show.Ids.Simkl == simklAnime.Show.Ids.Simkl {
|
||||||
|
WatchList.Anime[i].WatchedEpisodesCount = progress
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.WatchedEpisodesCount = progress
|
||||||
|
|
||||||
|
return anime
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) SimklSyncRating(anime SimklAnime, rating int) interface{} {
|
func (a *App) SimklSyncRating(anime SimklAnime, rating int) SimklAnime {
|
||||||
var url string
|
var url string
|
||||||
var showWithRating = ShowWithRating{
|
var showWithRating = ShowWithRating{
|
||||||
Title: anime.Show.Title,
|
Title: anime.Show.Title,
|
||||||
@ -171,10 +179,18 @@ func (a *App) SimklSyncRating(anime SimklAnime, rating int) interface{} {
|
|||||||
log.Printf("Failed at unmarshal, %s\n", err)
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return success
|
for i, simklAnime := range WatchList.Anime {
|
||||||
|
if anime.Show.Ids.Simkl == simklAnime.Show.Ids.Simkl {
|
||||||
|
WatchList.Anime[i].UserRating = rating
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.UserRating = rating
|
||||||
|
|
||||||
|
return anime
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) SimklSyncStatus(anime SimklAnime, status string) interface{} {
|
func (a *App) SimklSyncStatus(anime SimklAnime, status string) SimklAnime {
|
||||||
url := "https://api.simkl.com/sync/add-to-list"
|
url := "https://api.simkl.com/sync/add-to-list"
|
||||||
var show = SimklShowStatus{
|
var show = SimklShowStatus{
|
||||||
Title: anime.Show.Title,
|
Title: anime.Show.Title,
|
||||||
@ -203,11 +219,18 @@ func (a *App) SimklSyncStatus(anime SimklAnime, status string) interface{} {
|
|||||||
log.Printf("Failed at unmarshal, %s\n", err)
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return success
|
for i, simklAnime := range WatchList.Anime {
|
||||||
|
if anime.Show.Ids.Simkl == simklAnime.Show.Ids.Simkl {
|
||||||
|
WatchList.Anime[i].Status = status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.Status = status
|
||||||
|
|
||||||
|
return anime
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) SimklSearch(aniId int) SimklAnime {
|
func (a *App) SimklSearch(aniId int) SimklAnime {
|
||||||
fmt.Println(aniId)
|
|
||||||
var result SimklAnime
|
var result SimklAnime
|
||||||
|
|
||||||
if reflect.DeepEqual(WatchList, SimklWatchList{}) {
|
if reflect.DeepEqual(WatchList, SimklWatchList{}) {
|
||||||
|
@ -31,14 +31,14 @@ type SimklWatchList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SimklAnime struct {
|
type SimklAnime struct {
|
||||||
LastWatchedAt string `json:"last_watched_at" ts_type:"last_watched_at"`
|
LastWatchedAt string `json:"last_watched_at" ts_type:"last_watched_at"`
|
||||||
Status string `json:"status" ts_type:"status"`
|
Status string `json:"status" ts_type:"status"`
|
||||||
UserRating float64 `json:"user_rating" ts_type:"user_rating"`
|
UserRating int `json:"user_rating" ts_type:"user_rating"`
|
||||||
LastWatched string `json:"last_watched" ts_type:"last_watched"`
|
LastWatched string `json:"last_watched" ts_type:"last_watched"`
|
||||||
NextToWatch string `json:"next_to_watch" ts_type:"next_to_watch"`
|
NextToWatch string `json:"next_to_watch" ts_type:"next_to_watch"`
|
||||||
WatchedEpisodesCount int `json:"watched_episodes_count" ts_type:"watched_episodes_count"`
|
WatchedEpisodesCount int `json:"watched_episodes_count" ts_type:"watched_episodes_count"`
|
||||||
TotalEpisodesCount int `json:"total_episodes_count" ts_type:"total_episodes_count"`
|
TotalEpisodesCount int `json:"total_episodes_count" ts_type:"total_episodes_count"`
|
||||||
NotAiredEpisodesCount int `json:"not_aired_episodes_count" ts_type:"not_aired_episodes_count"`
|
NotAiredEpisodesCount int `json:"not_aired_episodes_count" ts_type:"not_aired_episodes_count"`
|
||||||
Show struct {
|
Show struct {
|
||||||
Title string `json:"title" ts_type:"title"`
|
Title string `json:"title" ts_type:"title"`
|
||||||
Poster string `json:"poster" ts_type:"poster"`
|
Poster string `json:"poster" ts_type:"poster"`
|
||||||
|
@ -13,6 +13,7 @@ post {
|
|||||||
headers {
|
headers {
|
||||||
Content-Type: "application/json"
|
Content-Type: "application/json"
|
||||||
Accept: "application/json"
|
Accept: "application/json"
|
||||||
|
Authorization: Bearer {{ANILIST_ACCESS_TOKEN}}
|
||||||
}
|
}
|
||||||
|
|
||||||
body:graphql {
|
body:graphql {
|
||||||
@ -92,7 +93,7 @@ body:graphql {
|
|||||||
body:graphql:vars {
|
body:graphql:vars {
|
||||||
{
|
{
|
||||||
"userId": 413504,
|
"userId": 413504,
|
||||||
"mediaId": 157371,
|
"mediaId": 110,
|
||||||
"listType": "ANIME"
|
"listType": "ANIME"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {
|
import {
|
||||||
anilistModal,
|
anilistModal,
|
||||||
simklWatchList,
|
|
||||||
aniListLoggedIn,
|
aniListLoggedIn,
|
||||||
simklLoggedIn,
|
simklLoggedIn,
|
||||||
malLoggedIn,
|
malLoggedIn,
|
||||||
malAnime,
|
malAnime,
|
||||||
simklAnime,
|
simklAnime,
|
||||||
|
aniListAnime,
|
||||||
} from "./GlobalVariablesAndHelperFunctions.svelte";
|
} from "./GlobalVariablesAndHelperFunctions.svelte";
|
||||||
import {aniListAnime} from "./GlobalVariablesAndHelperFunctions.svelte";
|
|
||||||
import {Button} from "flowbite-svelte";
|
import {Button} from "flowbite-svelte";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import StarRatting from "@ernane/svelte-star-rating"
|
import StarRatting from "@ernane/svelte-star-rating"
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import { Table, TableBody, TableBodyCell, TableBodyRow, TableHead, TableHeadCell } from 'flowbite-svelte';
|
import { Table, TableBody, TableBodyCell, TableBodyRow, TableHead, TableHeadCell } from 'flowbite-svelte';
|
||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import type {SimklAnime, SimklWatchList} from "./simkl/types/simklTypes";
|
import type {SimklAnime} from "./simkl/types/simklTypes";
|
||||||
import {
|
import {
|
||||||
AniListUpdateEntry, MyAnimeListUpdate,
|
AniListUpdateEntry, MyAnimeListUpdate,
|
||||||
SimklSyncEpisodes,
|
SimklSyncEpisodes,
|
||||||
@ -24,8 +23,8 @@
|
|||||||
} from "../wailsjs/go/main/App";
|
} from "../wailsjs/go/main/App";
|
||||||
import type {MALAnime, MALUploadStatus, MyListStatus} from "./mal/types/MALTypes";
|
import type {MALAnime, MALUploadStatus, MyListStatus} from "./mal/types/MALTypes";
|
||||||
import type {AniListUpdateVariables} from "./anilist/types/AniListTypes";
|
import type {AniListUpdateVariables} from "./anilist/types/AniListTypes";
|
||||||
|
import type {AniListGetSingleAnime} from "./anilist/types/AniListCurrentUserWatchListType";
|
||||||
|
|
||||||
let simklWatch: SimklWatchList
|
|
||||||
let isAniListLoggedIn: boolean
|
let isAniListLoggedIn: boolean
|
||||||
let isMalLoggedIn: boolean
|
let isMalLoggedIn: boolean
|
||||||
let isSimklLoggedIn: boolean
|
let isSimklLoggedIn: boolean
|
||||||
@ -33,14 +32,15 @@
|
|||||||
let currentSimklAnime: SimklAnime
|
let currentSimklAnime: SimklAnime
|
||||||
let submitting = writable(false)
|
let submitting = writable(false)
|
||||||
let isSubmitting: boolean
|
let isSubmitting: boolean
|
||||||
|
let currentAniListAnime: AniListGetSingleAnime
|
||||||
|
|
||||||
aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value)
|
aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value)
|
||||||
malLoggedIn.subscribe((value) => isMalLoggedIn = value)
|
malLoggedIn.subscribe((value) => isMalLoggedIn = value)
|
||||||
simklLoggedIn.subscribe((value) => isSimklLoggedIn = value)
|
simklLoggedIn.subscribe((value) => isSimklLoggedIn = value)
|
||||||
malAnime.subscribe((value) => currentMalAnime = value)
|
malAnime.subscribe((value) => currentMalAnime = value)
|
||||||
submitting.subscribe((value) => isSubmitting = value)
|
submitting.subscribe((value) => isSubmitting = value)
|
||||||
simklWatchList.subscribe((value) => simklWatch = value)
|
|
||||||
simklAnime.subscribe((value) => currentSimklAnime = value)
|
simklAnime.subscribe((value) => currentSimklAnime = value)
|
||||||
|
aniListAnime.subscribe((value) => currentAniListAnime = value)
|
||||||
|
|
||||||
type statusOption = {
|
type statusOption = {
|
||||||
id: number,
|
id: number,
|
||||||
@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
let startingAnilistStatusOption: statusOption
|
let startingAnilistStatusOption: statusOption
|
||||||
|
|
||||||
startingAnilistStatusOption = statusOptions.filter(option => aniListAnime.data.MediaList.status === option.aniList)[0]
|
startingAnilistStatusOption = statusOptions.filter(option => currentAniListAnime.data.MediaList.status === option.aniList)[0]
|
||||||
|
|
||||||
let items = [] as {
|
let items = [] as {
|
||||||
id: number
|
id: number
|
||||||
@ -76,15 +76,15 @@
|
|||||||
|
|
||||||
if(isAniListLoggedIn) {
|
if(isAniListLoggedIn) {
|
||||||
items.push({
|
items.push({
|
||||||
id: aniListAnime.data.MediaList.id,
|
id: currentAniListAnime.data.MediaList.id,
|
||||||
service: "AniList",
|
service: "AniList",
|
||||||
progress: aniListAnime.data.MediaList.progress,
|
progress: currentAniListAnime.data.MediaList.progress,
|
||||||
status: aniListAnime.data.MediaList.status,
|
status: currentAniListAnime.data.MediaList.status,
|
||||||
startedAt: `${aniListAnime.data.MediaList.startedAt.month}-${aniListAnime.data.MediaList.startedAt.day}-${aniListAnime.data.MediaList.startedAt.year}`,
|
startedAt: `${currentAniListAnime.data.MediaList.startedAt.month}-${currentAniListAnime.data.MediaList.startedAt.day}-${currentAniListAnime.data.MediaList.startedAt.year}`,
|
||||||
completedAt: `${aniListAnime.data.MediaList.completedAt.month}-${aniListAnime.data.MediaList.completedAt.day}-${aniListAnime.data.MediaList.completedAt.year}`,
|
completedAt: `${currentAniListAnime.data.MediaList.completedAt.month}-${currentAniListAnime.data.MediaList.completedAt.day}-${currentAniListAnime.data.MediaList.completedAt.year}`,
|
||||||
score: aniListAnime.data.MediaList.score,
|
score: currentAniListAnime.data.MediaList.score,
|
||||||
repeat: aniListAnime.data.MediaList.repeat,
|
repeat: currentAniListAnime.data.MediaList.repeat,
|
||||||
notes: aniListAnime.data.MediaList.notes
|
notes: currentAniListAnime.data.MediaList.notes
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,9 +166,9 @@
|
|||||||
anilistModal.set(false)
|
anilistModal.set(false)
|
||||||
};
|
};
|
||||||
|
|
||||||
const title = aniListAnime.data.MediaList.media.title.english !== "" ?
|
const title = currentAniListAnime.data.MediaList.media.title.english !== "" ?
|
||||||
aniListAnime.data.MediaList.media.title.english :
|
currentAniListAnime.data.MediaList.media.title.english :
|
||||||
aniListAnime.data.MediaList.media.title.romaji
|
currentAniListAnime.data.MediaList.media.title.romaji
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
@ -178,7 +178,7 @@
|
|||||||
max: 5,
|
max: 5,
|
||||||
step: 0.5
|
step: 0.5
|
||||||
},
|
},
|
||||||
score: aniListAnime.data.MediaList.score / 2,
|
score: currentAniListAnime.data.MediaList.score / 2,
|
||||||
showScore: false,
|
showScore: false,
|
||||||
scoreFormat: function () {
|
scoreFormat: function () {
|
||||||
return `(${this.score.toFixed(1)}/${this.countStars})`
|
return `(${this.score.toFixed(1)}/${this.countStars})`
|
||||||
@ -194,21 +194,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let values = {
|
let values = {
|
||||||
progress: aniListAnime.data.MediaList.progress,
|
progress: currentAniListAnime.data.MediaList.progress,
|
||||||
status: startingAnilistStatusOption,
|
status: startingAnilistStatusOption,
|
||||||
startedAt: {
|
startedAt: {
|
||||||
year: aniListAnime.data.MediaList.startedAt.year,
|
year: currentAniListAnime.data.MediaList.startedAt.year,
|
||||||
month: aniListAnime.data.MediaList.startedAt.month,
|
month: currentAniListAnime.data.MediaList.startedAt.month,
|
||||||
day: aniListAnime.data.MediaList.startedAt.day
|
day: currentAniListAnime.data.MediaList.startedAt.day
|
||||||
},
|
},
|
||||||
completedAt: {
|
completedAt: {
|
||||||
year: aniListAnime.data.MediaList.completedAt.year,
|
year: currentAniListAnime.data.MediaList.completedAt.year,
|
||||||
month: aniListAnime.data.MediaList.completedAt.month,
|
month: currentAniListAnime.data.MediaList.completedAt.month,
|
||||||
day: aniListAnime.data.MediaList.completedAt.day
|
day: currentAniListAnime.data.MediaList.completedAt.day
|
||||||
},
|
},
|
||||||
repeat: aniListAnime.data.MediaList.repeat,
|
repeat: currentAniListAnime.data.MediaList.repeat,
|
||||||
score: aniListAnime.data.MediaList.score,
|
score: currentAniListAnime.data.MediaList.score,
|
||||||
notes: aniListAnime.data.MediaList.notes
|
notes: currentAniListAnime.data.MediaList.notes
|
||||||
}
|
}
|
||||||
let startedAtDate: string
|
let startedAtDate: string
|
||||||
let completedAtDate: string
|
let completedAtDate: string
|
||||||
@ -250,7 +250,7 @@
|
|||||||
const submitData = async () => {
|
const submitData = async () => {
|
||||||
submitting.set(true)
|
submitting.set(true)
|
||||||
let body: AniListUpdateVariables = {
|
let body: AniListUpdateVariables = {
|
||||||
mediaId: aniListAnime.data.MediaList.mediaId,
|
mediaId: currentAniListAnime.data.MediaList.mediaId,
|
||||||
progress: values.progress,
|
progress: values.progress,
|
||||||
status: values.status.aniList,
|
status: values.status.aniList,
|
||||||
score: values.score,
|
score: values.score,
|
||||||
@ -268,7 +268,49 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await AniListUpdateEntry(body).then((value) => {
|
await AniListUpdateEntry(body).then((value) => {
|
||||||
console.log(value)
|
aniListAnime.update(anime => {
|
||||||
|
anime.data.MediaList.status = value.data.SaveMediaListEntry.status
|
||||||
|
anime.data.MediaList.progress = value.data.SaveMediaListEntry.progress
|
||||||
|
anime.data.MediaList.repeat = value.data.SaveMediaListEntry.repeat
|
||||||
|
anime.data.MediaList.score = value.data.SaveMediaListEntry.score
|
||||||
|
anime.data.MediaList.startedAt.day = value.data.SaveMediaListEntry.startedAt.day
|
||||||
|
anime.data.MediaList.startedAt.month = value.data.SaveMediaListEntry.startedAt.month
|
||||||
|
anime.data.MediaList.startedAt.year = value.data.SaveMediaListEntry.startedAt.year
|
||||||
|
if (value.data.SaveMediaListEntry.notes === null) {
|
||||||
|
anime.data.MediaList.notes = ""
|
||||||
|
} else {
|
||||||
|
anime.data.MediaList.notes = value.data.SaveMediaListEntry.notes
|
||||||
|
}
|
||||||
|
if (value.data.SaveMediaListEntry.completedAt.year === null) {
|
||||||
|
anime.data.MediaList.completedAt.year = 0
|
||||||
|
} else {
|
||||||
|
anime.data.MediaList.completedAt.year = value.data.SaveMediaListEntry.completedAt.year
|
||||||
|
}
|
||||||
|
if (value.data.SaveMediaListEntry.completedAt.month === null) {
|
||||||
|
anime.data.MediaList.completedAt.month = 0
|
||||||
|
} else {
|
||||||
|
anime.data.MediaList.completedAt.month = value.data.SaveMediaListEntry.completedAt.month
|
||||||
|
}
|
||||||
|
if (value.data.SaveMediaListEntry.completedAt.day === null) {
|
||||||
|
anime.data.MediaList.completedAt.day = 0
|
||||||
|
} else {
|
||||||
|
anime.data.MediaList.completedAt.day = value.data.SaveMediaListEntry.completedAt.day
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let item of items) {
|
||||||
|
if (item.service === "AniList") {
|
||||||
|
item.id = anime.data.MediaList.id
|
||||||
|
item.progress = anime.data.MediaList.progress
|
||||||
|
item.status = anime.data.MediaList.status
|
||||||
|
item.startedAt = `${anime.data.MediaList.startedAt.month}-${anime.data.MediaList.startedAt.day}-${anime.data.MediaList.startedAt.year}`
|
||||||
|
item.completedAt = `${anime.data.MediaList.completedAt.month}-${anime.data.MediaList.completedAt.day}-${anime.data.MediaList.completedAt.year}`
|
||||||
|
item.score = anime.data.MediaList.score
|
||||||
|
item.repeat = anime.data.MediaList.repeat
|
||||||
|
item.notes = anime.data.MediaList.notes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return anime
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
if(malLoggedIn) {
|
if(malLoggedIn) {
|
||||||
@ -294,23 +336,20 @@
|
|||||||
|
|
||||||
if (simklLoggedIn) {
|
if (simklLoggedIn) {
|
||||||
if (currentSimklAnime.watched_episodes_count !== values.progress) {
|
if (currentSimklAnime.watched_episodes_count !== values.progress) {
|
||||||
await SimklSyncEpisodes(currentSimklAnime, values.progress).then(() => {
|
await SimklSyncEpisodes(currentSimklAnime, values.progress).then((value) => {
|
||||||
currentSimklAnime.watched_episodes_count = values.progress
|
simklAnime.set(value)
|
||||||
simklWatch.anime[simklWatch.currentIndex].watched_episodes_count = values.progress
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentSimklAnime.user_rating !== values.score) {
|
if (currentSimklAnime.user_rating !== values.score) {
|
||||||
await SimklSyncRating(currentSimklAnime, values.score).then(() => {
|
await SimklSyncRating(currentSimklAnime, values.score).then((value) => {
|
||||||
currentSimklAnime.user_rating = values.score
|
simklAnime.set(value)
|
||||||
simklWatch.anime[simklWatch.currentIndex].user_rating = values.score
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentSimklAnime.status !== values.status.simkl) {
|
if (currentSimklAnime.status !== values.status.simkl) {
|
||||||
await SimklSyncStatus(currentSimklAnime, values.status.simkl).then(() => {
|
await SimklSyncStatus(currentSimklAnime, values.status.simkl).then((value) => {
|
||||||
currentSimklAnime.status = values.status.simkl
|
simklAnime.set(value)
|
||||||
simklWatch.anime[simklWatch.currentIndex].status = values.status.simkl
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,7 +360,7 @@
|
|||||||
<div id="inapp-data">
|
<div id="inapp-data">
|
||||||
<div class="grid grid-cols-1 md:grid-cols-10 grid-flow-col gap-4">
|
<div class="grid grid-cols-1 md:grid-cols-10 grid-flow-col gap-4">
|
||||||
<div class="md:col-span-2 space-y-3">
|
<div class="md:col-span-2 space-y-3">
|
||||||
<img class="rounded-lg" src={aniListAnime.data.MediaList.media.coverImage.large} alt="{title} Cover Image">
|
<img class="rounded-lg" src={currentAniListAnime.data.MediaList.media.coverImage.large} alt="{title} Cover Image">
|
||||||
<StarRatting bind:config on:change={changeRating}/>
|
<StarRatting bind:config on:change={changeRating}/>
|
||||||
<p>Rating: {config.score * 2}</p>
|
<p>Rating: {config.score * 2}</p>
|
||||||
<p>{ratingInWords[config.score * 2]}</p>
|
<p>{ratingInWords[config.score * 2]}</p>
|
||||||
@ -460,7 +499,7 @@
|
|||||||
<TableBodyRow>
|
<TableBodyRow>
|
||||||
<TableBodyCell class="overflow-x-auto">{item.id}</TableBodyCell>
|
<TableBodyCell class="overflow-x-auto">{item.id}</TableBodyCell>
|
||||||
<TableBodyCell class="overflow-x-auto">{item.service}</TableBodyCell>
|
<TableBodyCell class="overflow-x-auto">{item.service}</TableBodyCell>
|
||||||
<TableBodyCell class="overflow-x-auto">{item.progress}</TableBodyCell>
|
<TableBodyCell class="overflow-x-auto" bind:value={item.progress}>{item.progress}</TableBodyCell>
|
||||||
<TableBodyCell class="overflow-x-auto">{item.status}</TableBodyCell>
|
<TableBodyCell class="overflow-x-auto">{item.status}</TableBodyCell>
|
||||||
<TableBodyCell class="overflow-x-auto">{item.startedAt}</TableBodyCell>
|
<TableBodyCell class="overflow-x-auto">{item.startedAt}</TableBodyCell>
|
||||||
<TableBodyCell class="overflow-x-auto">{item.completedAt}</TableBodyCell>
|
<TableBodyCell class="overflow-x-auto">{item.completedAt}</TableBodyCell>
|
||||||
@ -523,6 +562,6 @@
|
|||||||
<h3 class="text-2xl">
|
<h3 class="text-2xl">
|
||||||
Summary
|
Summary
|
||||||
</h3>
|
</h3>
|
||||||
<p>{@html aniListAnime.data.MediaList.media.description}</p>
|
<p>{@html currentAniListAnime.data.MediaList.media.description}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -21,7 +21,7 @@
|
|||||||
import {type AniListUser, MediaListSort} from "./anilist/types/AniListTypes";
|
import {type AniListUser, MediaListSort} from "./anilist/types/AniListTypes";
|
||||||
import type {MALAnime, MALWatchlist, MyAnimeListUser} from "./mal/types/MALTypes";
|
import type {MALAnime, MALWatchlist, MyAnimeListUser} from "./mal/types/MALTypes";
|
||||||
|
|
||||||
export let aniListAnime: AniListGetSingleAnime
|
export let aniListAnime = writable({} as AniListGetSingleAnime)
|
||||||
export let title = writable("")
|
export let title = writable("")
|
||||||
export let anilistModal = writable(false);
|
export let anilistModal = writable(false);
|
||||||
export let aniListLoggedIn = writable(false)
|
export let aniListLoggedIn = writable(false)
|
||||||
@ -46,8 +46,7 @@
|
|||||||
let page: number
|
let page: number
|
||||||
let perPage: number
|
let perPage: number
|
||||||
let aniWatchlist: AniListCurrentUserWatchList
|
let aniWatchlist: AniListCurrentUserWatchList
|
||||||
let simklWatch: SimklWatchList
|
let currentAniListAnime: AniListGetSingleAnime
|
||||||
let currentSimklAnime: SimklAnime
|
|
||||||
|
|
||||||
let isMalLoggedIn: boolean
|
let isMalLoggedIn: boolean
|
||||||
let isSimklLoggedIn: boolean
|
let isSimklLoggedIn: boolean
|
||||||
@ -58,24 +57,38 @@
|
|||||||
aniListWatchlist.subscribe(value => aniWatchlist = value)
|
aniListWatchlist.subscribe(value => aniWatchlist = value)
|
||||||
malLoggedIn.subscribe(value => isMalLoggedIn = value)
|
malLoggedIn.subscribe(value => isMalLoggedIn = value)
|
||||||
simklLoggedIn.subscribe(value => isSimklLoggedIn = value)
|
simklLoggedIn.subscribe(value => isSimklLoggedIn = value)
|
||||||
simklWatchList.subscribe(value => simklWatch = value)
|
aniListAnime.subscribe(value => currentAniListAnime = value)
|
||||||
simklAnime.subscribe(value => currentSimklAnime = value)
|
|
||||||
|
|
||||||
|
|
||||||
export async function GetAniListSingleItemAndOpenModal(aniId: number, login: boolean): Promise<""> {
|
export async function GetAniListSingleItemAndOpenModal(aniId: number, login: boolean): Promise<""> {
|
||||||
await GetAniListItem(aniId, login).then(aniListResult => {
|
await GetAniListItem(aniId, login).then(aniListResult => {
|
||||||
aniListAnime = aniListResult
|
let finalResult: AniListGetSingleAnime
|
||||||
title.set(aniListAnime.data.MediaList.media.title.english === "" ?
|
finalResult = aniListResult
|
||||||
aniListAnime.data.MediaList.media.title.romaji :
|
if (login === false) {
|
||||||
aniListAnime.data.MediaList.media.title.english)
|
finalResult.data.MediaList.status = ""
|
||||||
|
finalResult.data.MediaList.score = 0
|
||||||
|
finalResult.data.MediaList.progress = 0
|
||||||
|
finalResult.data.MediaList.notes = ""
|
||||||
|
finalResult.data.MediaList.repeat = 0
|
||||||
|
finalResult.data.MediaList.startedAt.day = 0
|
||||||
|
finalResult.data.MediaList.startedAt.month = 0
|
||||||
|
finalResult.data.MediaList.startedAt.year = 0
|
||||||
|
finalResult.data.MediaList.completedAt.day = 0
|
||||||
|
finalResult.data.MediaList.completedAt.month = 0
|
||||||
|
finalResult.data.MediaList.completedAt.year = 0
|
||||||
|
}
|
||||||
|
aniListAnime.set(finalResult)
|
||||||
|
title.set(currentAniListAnime.data.MediaList.media.title.english === "" ?
|
||||||
|
currentAniListAnime.data.MediaList.media.title.romaji :
|
||||||
|
currentAniListAnime.data.MediaList.media.title.english)
|
||||||
})
|
})
|
||||||
if (isMalLoggedIn) {
|
if (isMalLoggedIn) {
|
||||||
await GetMyAnimeListAnime(aniListAnime.data.MediaList.media.idMal).then(malResult => {
|
await GetMyAnimeListAnime(currentAniListAnime.data.MediaList.media.idMal).then(malResult => {
|
||||||
malAnime.set(malResult)
|
malAnime.set(malResult)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (isSimklLoggedIn) {
|
if (isSimklLoggedIn) {
|
||||||
await SimklSearch(aniListAnime.data.MediaList.media.id).then((value: SimklAnime) => {
|
await SimklSearch(currentAniListAnime.data.MediaList.media.id).then((value: SimklAnime) => {
|
||||||
simklAnime.set(value)
|
simklAnime.set(value)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
6
frontend/wailsjs/go/main/App.d.ts
vendored
6
frontend/wailsjs/go/main/App.d.ts
vendored
@ -44,8 +44,8 @@ export function SimklLogin():Promise<void>;
|
|||||||
|
|
||||||
export function SimklSearch(arg1:number):Promise<main.SimklAnime>;
|
export function SimklSearch(arg1:number):Promise<main.SimklAnime>;
|
||||||
|
|
||||||
export function SimklSyncEpisodes(arg1:main.SimklAnime,arg2:number):Promise<any>;
|
export function SimklSyncEpisodes(arg1:main.SimklAnime,arg2:number):Promise<main.SimklAnime>;
|
||||||
|
|
||||||
export function SimklSyncRating(arg1:main.SimklAnime,arg2:number):Promise<any>;
|
export function SimklSyncRating(arg1:main.SimklAnime,arg2:number):Promise<main.SimklAnime>;
|
||||||
|
|
||||||
export function SimklSyncStatus(arg1:main.SimklAnime,arg2:string):Promise<any>;
|
export function SimklSyncStatus(arg1:main.SimklAnime,arg2:string):Promise<main.SimklAnime>;
|
||||||
|
Loading…
Reference in New Issue
Block a user