mirror of
https://github.com/ultrasn0w/huso.git
synced 2025-12-14 06:29:53 +01:00
Add appointment to watchext
This commit is contained in:
20
schaffer.go
20
schaffer.go
@@ -6,6 +6,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/xujiajun/nutsdb"
|
||||
)
|
||||
|
||||
func JikanConvert(jik *SeasonAnimeJikan) Anime {
|
||||
@@ -160,6 +162,24 @@ func SearchAnime(animeId int64) (*Anime, error) {
|
||||
return anime, err
|
||||
}
|
||||
|
||||
func SearchAppointments(animeId int64) ([]Appointment, error) {
|
||||
appointments, err := ReadAppointments()
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "not found") || err == nutsdb.ErrBucketEmpty {
|
||||
return make([]Appointment, 0), nil
|
||||
} else {
|
||||
return appointments, err
|
||||
}
|
||||
}
|
||||
result := make([]Appointment, 0)
|
||||
for _, a := range appointments {
|
||||
if animeId == a.Anime {
|
||||
result = append(result, a)
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func FetchProgress(animeId, userId int64, username string, progress int) (int, time.Time, string, error) {
|
||||
// check watching first
|
||||
newProgress, updated, err := fetchProgressOnState(animeId, userId, progress, username, malApiStatusW)
|
||||
|
||||
Reference in New Issue
Block a user