mirror of
https://github.com/Apologieze/Benri.git
synced 2026-01-18 17:17:21 +01:00
client token and adding begin
This commit is contained in:
@@ -48,10 +48,10 @@ var categoriesToInt = make(map[string]int)
|
||||
"Planning": 3,
|
||||
}*/
|
||||
|
||||
func GetData(radio *widget.RadioGroup, username string, delete func()) {
|
||||
v := verniy.New()
|
||||
var Client *verniy.Client = verniy.New()
|
||||
|
||||
typeAnime, err := v.GetUserAnimeList(username, fields...)
|
||||
func GetData(radio *widget.RadioGroup, username string, delete func()) {
|
||||
typeAnime, err := Client.GetUserAnimeList(username, fields...)
|
||||
if err != nil {
|
||||
typeAnime = make([]verniy.MediaListGroup, 4)
|
||||
log.Error("Invalid token")
|
||||
@@ -128,3 +128,13 @@ func IdToUrl(id int) *url.URL {
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func SearchFromQuery(strQuery string) *[]verniy.Media {
|
||||
query := verniy.PageParamMedia{Search: strQuery}
|
||||
result, err := Client.SearchAnime(query, 1, 10)
|
||||
if err != nil {
|
||||
log.Error("Error searching anime:", err)
|
||||
return nil
|
||||
}
|
||||
return &result.Media
|
||||
}
|
||||
|
||||
9
main.go
9
main.go
@@ -153,6 +153,7 @@ func changeEpisodeInApp(variation int) {
|
||||
|
||||
func initMainApp() {
|
||||
secondCurdInit()
|
||||
anilist.Client.AccessToken = user.Token
|
||||
window.SetTitle("AnimeGUI")
|
||||
fmt.Println(localAnime)
|
||||
|
||||
@@ -190,7 +191,13 @@ func initMainApp() {
|
||||
radiobox.Horizontal = true
|
||||
|
||||
toolbar := widget.NewToolbar(
|
||||
widget.NewToolbarAction(theme.ContentAddIcon(), func() {}),
|
||||
widget.NewToolbarAction(theme.ContentAddIcon(), func() {
|
||||
result := anilist.SearchFromQuery(input.Text)
|
||||
if result == nil {
|
||||
return
|
||||
}
|
||||
fmt.Printf("Result: %+v\n", *result)
|
||||
}),
|
||||
widget.NewToolbarSeparator(),
|
||||
widget.NewToolbarAction(theme.ViewRefreshIcon(), func() {}),
|
||||
widget.NewToolbarSeparator(),
|
||||
|
||||
Reference in New Issue
Block a user