mirror of
https://github.com/ultrasn0w/huso.git
synced 2025-12-13 17:29:54 +01:00
Delete user from anime on finish
This commit is contained in:
53
ober.go
53
ober.go
@@ -91,21 +91,16 @@ func AnimeGet(ctx *fasthttp.RequestCtx) {
|
||||
ctx.SetStatusCode(fasthttp.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
// search season first
|
||||
anime, err := SearchSeason(malId)
|
||||
var bytes []byte
|
||||
// search anime
|
||||
anime, err := SearchAnime(malId)
|
||||
if err != nil {
|
||||
_, bytes, err = GetAnimeDetailData(malId)
|
||||
if err != nil {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
bytes, err = json.Marshal(&anime)
|
||||
if err != nil {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
bytes, err := json.Marshal(&anime)
|
||||
if err != nil {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
_, err = ctx.Write(bytes)
|
||||
if err != nil {
|
||||
@@ -123,8 +118,8 @@ func AnimeSearchGet(ctx *fasthttp.RequestCtx) {
|
||||
return
|
||||
}
|
||||
query := string(ctx.QueryArgs().Peek("q"))
|
||||
// Search with query
|
||||
_, bytes, err := SearchAnime(query)
|
||||
// search with query
|
||||
_, bytes, err := SearchAnimeData(query)
|
||||
if err != nil {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
@@ -271,15 +266,11 @@ func WatchExtendedGet(ctx *fasthttp.RequestCtx) {
|
||||
animeUsersExtended := make([]AnimeUserExtended, 0)
|
||||
// make list advanced
|
||||
for _, a := range animeUsers {
|
||||
// Search season first
|
||||
var data *Anime
|
||||
data, err := SearchSeason(a.Anime)
|
||||
// search anime
|
||||
data, err := SearchAnime(a.Anime)
|
||||
if err != nil {
|
||||
data, _, err = GetAnimeDetailData(a.Anime)
|
||||
if err != nil {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
animeUsersExtended = append(animeUsersExtended, AnimeUserExtended{
|
||||
Anime: a.Anime,
|
||||
@@ -545,16 +536,12 @@ func processUpdateReq(ctx *fasthttp.RequestCtx, update bool) {
|
||||
|
||||
// iterate sent animes
|
||||
for i, anime := range animes {
|
||||
// check if anime is in season
|
||||
_, err = SearchSeason(anime.Anime)
|
||||
// anime holen sie diese
|
||||
_, err = SearchAnime(anime.Anime)
|
||||
if err != nil {
|
||||
// anime not in season => holen sie diese
|
||||
_, _, err := GetAnimeDetailData(anime.Anime)
|
||||
if err != nil {
|
||||
ctx.WriteString(err.Error())
|
||||
ctx.SetStatusCode(fasthttp.StatusNotFound)
|
||||
return
|
||||
}
|
||||
ctx.WriteString(err.Error())
|
||||
ctx.SetStatusCode(fasthttp.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
var animeData *AnimeUser
|
||||
|
||||
Reference in New Issue
Block a user