Fixed old stuff

This commit is contained in:
Eduard Urbach 2017-07-10 20:39:50 +02:00
parent 1da3e3f2f8
commit b6fb1c1f08
9 changed files with 32 additions and 61 deletions

View File

@ -68,10 +68,6 @@ func sync(data *kitsu.Anime) *arn.Anime {
anime.Mappings = []*arn.Mapping{} anime.Mappings = []*arn.Mapping{}
} }
if anime.Episodes == nil {
anime.Episodes = []*arn.AnimeEpisode{}
}
// Prefer Shoboi Japanese titles over Kitsu JP titles // Prefer Shoboi Japanese titles over Kitsu JP titles
if anime.GetMapping("shoboi/anime") != "" { if anime.GetMapping("shoboi/anime") != "" {
// Only take Kitsu title when our JP title is empty // Only take Kitsu title when our JP title is empty

View File

@ -3,7 +3,6 @@ package main
import ( import (
"fmt" "fmt"
"os" "os"
"sort"
"strings" "strings"
"time" "time"
@ -48,10 +47,10 @@ func main() {
episodes := feed.Episodes episodes := feed.Episodes
// Sort by episode number // // Sort by episode number
sort.Slice(episodes, func(a, b int) bool { // sort.Slice(episodes, func(a, b int) bool {
return episodes[a].Number < episodes[b].Number // return episodes[a].Number < episodes[b].Number
}) // })
for _, episode := range episodes { for _, episode := range episodes {
arnEpisode := anime.EpisodeByNumber(episode.Number) arnEpisode := anime.EpisodeByNumber(episode.Number)

View File

@ -156,8 +156,14 @@ component Anime(anime *arn.Anime, tracks []*arn.SoundTrack, user *arn.User, epis
tbody tbody
each episode in anime.Episodes().Items each episode in anime.Episodes().Items
tr.episode tr.episode
td.episode-number= episode.Number td.episode-number
td.episode-title= episode.Title.Japanese if episode.Number != -1
span= episode.Number
td.episode-title
if episode.Title.Japanese != ""
span= episode.Title.Japanese
else
span -
td.episode-actions td.episode-actions
for name, link := range episode.Links for name, link := range episode.Links
a(href=link, target="_blank", rel="noopener", title="Watch episode " + toString(episode.Number) + " on " + name) a(href=link, target="_blank", rel="noopener", title="Watch episode " + toString(episode.Number) + " on " + name)

View File

@ -0,0 +1,7 @@
package animeepisode
import "github.com/aerogo/aero"
func Get(ctx *aero.Context) string {
return ctx.HTML("")
}

View File

@ -1,5 +1,5 @@
component API(types []string) component API(types []string)
h3 API h1 API
table table
//- thead //- thead

View File

@ -1,4 +1,6 @@
component NewThread(user *arn.User) component NewThread(user *arn.User)
h1 New thread
.widget-form .widget-form
.widget .widget
input#title.widget-element(type="text", placeholder="Title") input#title.widget-element(type="text", placeholder="Title")

View File

@ -1,32 +0,0 @@
package main
import (
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
// Get a stream of all anime
allAnime, err := arn.AllAnime()
if err != nil {
panic(err)
}
// Iterate over the stream
for _, anime := range allAnime {
if anime.Mappings == nil {
anime.Mappings = []*arn.Mapping{}
}
if anime.Episodes == nil {
anime.Episodes = []*arn.AnimeEpisode{}
}
err := anime.Save()
if err != nil {
color.Red("Error saving anime: %v", err)
}
}
}

View File

@ -1,17 +0,0 @@
package main
import (
"github.com/animenotifier/arn"
)
func main() {
for anime := range arn.MustStreamAnime() {
arn.PanicOnError(arn.DB.Set("AnimeEpisodes", anime.ID, &arn.AnimeEpisodes{
AnimeID: anime.ID,
Items: anime.Episodes,
}))
anime.Episodes = anime.Episodes[:0]
anime.MustSave()
}
}

View File

@ -60,6 +60,11 @@ function getRemainingTime(remaining: number): string {
} }
export function displayAiringDate(element: HTMLElement, now: Date) { export function displayAiringDate(element: HTMLElement, now: Date) {
if(element.dataset.startDate === "") {
element.innerText = ""
return
}
let startDate = new Date(element.dataset.startDate) let startDate = new Date(element.dataset.startDate)
let endDate = new Date(element.dataset.endDate) let endDate = new Date(element.dataset.endDate)
@ -91,6 +96,11 @@ export function displayAiringDate(element: HTMLElement, now: Date) {
} }
export function displayDate(element: HTMLElement, now: Date) { export function displayDate(element: HTMLElement, now: Date) {
if(element.dataset.date === "") {
element.innerText = ""
return
}
let startDate = new Date(element.dataset.date) let startDate = new Date(element.dataset.date)
let h = startDate.getHours() let h = startDate.getHours()