Updated to latest ARN API
This commit is contained in:
parent
93e7ad01d5
commit
04373033cc
@ -14,7 +14,7 @@ const maxPopularAnime = 10
|
||||
func main() {
|
||||
color.Yellow("Caching popular anime")
|
||||
|
||||
animeChan, err := arn.AllAnime()
|
||||
animeList, err := arn.AllAnime()
|
||||
|
||||
if err != nil {
|
||||
color.Red("Failed fetching anime channel")
|
||||
@ -22,12 +22,6 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
var animeList []*arn.Anime
|
||||
|
||||
for anime := range animeChan {
|
||||
animeList = append(animeList, anime)
|
||||
}
|
||||
|
||||
sort.Slice(animeList, func(i, j int) bool {
|
||||
return animeList[i].Rating.Overall > animeList[j].Rating.Overall
|
||||
})
|
||||
|
@ -21,7 +21,7 @@ func updateAnimeIndex() {
|
||||
animeSearchIndex := arn.NewSearchIndex()
|
||||
|
||||
// Anime
|
||||
animeStream, err := arn.AllAnime()
|
||||
animeStream, err := arn.StreamAnime()
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -15,7 +15,7 @@ func main() {
|
||||
color.Yellow("Syncing Anime")
|
||||
|
||||
// Get a stream of all anime
|
||||
allAnime := kitsu.AllAnime()
|
||||
allAnime := kitsu.StreamAnime()
|
||||
|
||||
// Iterate over the stream
|
||||
for anime := range allAnime {
|
||||
|
3
main.go
3
main.go
@ -18,6 +18,7 @@ import (
|
||||
"github.com/animenotifier/notify.moe/pages/forum"
|
||||
"github.com/animenotifier/notify.moe/pages/forums"
|
||||
"github.com/animenotifier/notify.moe/pages/login"
|
||||
"github.com/animenotifier/notify.moe/pages/music"
|
||||
"github.com/animenotifier/notify.moe/pages/newthread"
|
||||
"github.com/animenotifier/notify.moe/pages/popularanime"
|
||||
"github.com/animenotifier/notify.moe/pages/posts"
|
||||
@ -67,7 +68,9 @@ func configure(app *aero.Application) *aero.Application {
|
||||
app.Ajax("/user/:nick/animelist/:id", animelistitem.Get)
|
||||
app.Ajax("/new/thread", newthread.Get)
|
||||
app.Ajax("/settings", settings.Get)
|
||||
app.Ajax("/music", music.Get)
|
||||
app.Ajax("/admin", admin.Get)
|
||||
app.Ajax("/search", search.Get)
|
||||
app.Ajax("/search/:term", search.Get)
|
||||
app.Ajax("/users", users.Get)
|
||||
app.Ajax("/login", login.Get)
|
||||
|
@ -26,7 +26,7 @@ component LoggedInMenu(user *arn.User)
|
||||
NavigationButton("Dash", "/", "dashboard")
|
||||
NavigationButton("Profile", "/+", "user")
|
||||
NavigationButton("Forum", "/forum", "comment")
|
||||
NavigationButton("Anime", "/anime", "television")
|
||||
NavigationButton("Music", "/music", "music")
|
||||
|
||||
FuzzySearch
|
||||
|
||||
|
@ -33,9 +33,13 @@ func dashboard(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
flow.Parallel(func() {
|
||||
posts, err = arn.AllPostsSlice()
|
||||
posts, err = arn.AllPosts()
|
||||
arn.SortPostsLatestFirst(posts)
|
||||
posts = arn.FilterPostsWithUniqueThreads(posts, maxPosts)
|
||||
}, func() {
|
||||
// threads, err = arn.AllThreadsSlice()
|
||||
// arn.SortPostsLatestFirst(posts)
|
||||
// posts = arn.FilterPostsWithUniqueThreads(posts, maxPosts)
|
||||
}, func() {
|
||||
userList, err = arn.DB.GetMany("User", user.Following)
|
||||
followingList = userList.([]*arn.User)
|
||||
|
@ -15,7 +15,7 @@ component Dashboard(posts []*arn.Post, following []*arn.User)
|
||||
h3.widget-title Forums
|
||||
|
||||
each post in posts
|
||||
a.widget-element.ajax(href=post.Thread().Link() + "#" + post.ID)
|
||||
a.widget-element.ajax(href=post.Thread().Link())
|
||||
.widget-element-text
|
||||
Icon(arn.GetForumIcon(post.Thread().Tags[0]))
|
||||
span= post.Thread().Title
|
||||
|
8
pages/music/music.go
Normal file
8
pages/music/music.go
Normal file
@ -0,0 +1,8 @@
|
||||
package music
|
||||
|
||||
import "github.com/aerogo/aero"
|
||||
|
||||
// Get renders the music page.
|
||||
func Get(ctx *aero.Context) string {
|
||||
return ctx.HTML("Coming soon.")
|
||||
}
|
@ -7,7 +7,7 @@ import (
|
||||
|
||||
func main() {
|
||||
// Get a stream of all posts
|
||||
allPosts, err := arn.AllPosts()
|
||||
allPosts, err := arn.StreamPosts()
|
||||
arn.PanicOnError(err)
|
||||
|
||||
// Iterate over the stream
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
func main() {
|
||||
// Get a stream of all posts
|
||||
allPosts, err := arn.AllPosts()
|
||||
allPosts, err := arn.StreamPosts()
|
||||
arn.PanicOnError(err)
|
||||
|
||||
threadToPosts := make(map[string][]string)
|
||||
|
Loading…
Reference in New Issue
Block a user