mirror of
https://github.com/ultrasn0w/huso.git
synced 2025-12-13 13:59:53 +01:00
Fix bugs with own struct
This commit is contained in:
14
schaffer.go
14
schaffer.go
@@ -46,26 +46,26 @@ func JikanConvert(jik *SeasonAnimeJikan) AnimeDetail {
|
||||
return res
|
||||
}
|
||||
|
||||
func GetSeasonCache() (*SeasonJikan, error) {
|
||||
func GetSeasonCache() ([]Anime, error) {
|
||||
data, err := cache.Get(seasonApiJikan)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var seasonData SeasonJikan
|
||||
var seasonData []Anime
|
||||
err = json.Unmarshal(data, &seasonData)
|
||||
return &seasonData, err
|
||||
return seasonData, err
|
||||
}
|
||||
|
||||
func SearchSeason(animeId int64) (*SeasonAnimeJikan, error) {
|
||||
func SearchSeason(animeId int64) (*Anime, error) {
|
||||
season, err := GetSeasonCache()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if season.Pagination.Items.Count == 0 {
|
||||
if len(season) == 0 {
|
||||
return nil, errors.New("no seasonal anime")
|
||||
}
|
||||
for _, a := range season.Data {
|
||||
if a.MalID == animeId {
|
||||
for _, a := range season {
|
||||
if a.Anime == animeId {
|
||||
return &a, err
|
||||
}
|
||||
}
|
||||
|
||||
12
season.qtpl
12
season.qtpl
@@ -1,5 +1,5 @@
|
||||
{% package main %}
|
||||
{% func Index(season *SeasonJikan) %}
|
||||
{% func Index(animes []Anime) %}
|
||||
{% collapsespace %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -23,16 +23,16 @@ body { background-color: #1a1a1a; color: #fff; }
|
||||
<table>
|
||||
<tr>
|
||||
<td><strong>Airing 📺</strong></td>
|
||||
<td>{%d season.Pagination.Items.Total %}</td>
|
||||
<td>{%d len(animes) %}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</br>
|
||||
<table>
|
||||
{% for _, anime := range season.Data %}
|
||||
{% for _, anime := range animes %}
|
||||
<tr>
|
||||
<td><strong>{%s anime.Title %}</strong></td>
|
||||
<td>{%dl anime.MalID %}</td>
|
||||
<td>{%s anime.Aired.String %}</td>
|
||||
<td><strong>{%s anime.Data.Title %}</strong></td>
|
||||
<td>{%dl anime.Anime %}</td>
|
||||
<td>{%d anime.Data.Episodes %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
@@ -18,30 +18,30 @@ var (
|
||||
)
|
||||
|
||||
//line season.qtpl:2
|
||||
func StreamIndex(qw422016 *qt422016.Writer, season *SeasonJikan) {
|
||||
func StreamIndex(qw422016 *qt422016.Writer, animes []Anime) {
|
||||
//line season.qtpl:2
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line season.qtpl:3
|
||||
qw422016.N().S(` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> * { font-family: sans-serif; } table { border-spacing: 0; } td, th { text-align: left; padding: 0 0.5em; } td:first-child, th:first-child { padding-left: 0; } td:last-child, th:first-child { padding-right: 0; } body { background-color: #1a1a1a; color: #fff; } </style> <title>HUSO - Hanami universeller Serien Organizer</title> </head> <body> <h1>HUSO - Hanami universeller Serien Organizer</h1> <h2>Anime</h2> <table> <tr> <td><strong>Airing 📺</strong></td> <td>`)
|
||||
//line season.qtpl:26
|
||||
qw422016.N().D(season.Pagination.Items.Total)
|
||||
qw422016.N().D(len(animes))
|
||||
//line season.qtpl:26
|
||||
qw422016.N().S(`</td> </tr> </table> </br> <table> `)
|
||||
//line season.qtpl:31
|
||||
for _, anime := range season.Data {
|
||||
for _, anime := range animes {
|
||||
//line season.qtpl:31
|
||||
qw422016.N().S(` <tr> <td><strong>`)
|
||||
//line season.qtpl:33
|
||||
qw422016.E().S(anime.Title)
|
||||
qw422016.E().S(anime.Data.Title)
|
||||
//line season.qtpl:33
|
||||
qw422016.N().S(`</strong></td> <td>`)
|
||||
//line season.qtpl:34
|
||||
qw422016.N().DL(anime.MalID)
|
||||
qw422016.N().DL(anime.Anime)
|
||||
//line season.qtpl:34
|
||||
qw422016.N().S(`</td> <td>`)
|
||||
//line season.qtpl:35
|
||||
qw422016.E().S(anime.Aired.String)
|
||||
qw422016.N().D(anime.Data.Episodes)
|
||||
//line season.qtpl:35
|
||||
qw422016.N().S(`</td> </tr> `)
|
||||
//line season.qtpl:37
|
||||
@@ -55,22 +55,22 @@ func StreamIndex(qw422016 *qt422016.Writer, season *SeasonJikan) {
|
||||
}
|
||||
|
||||
//line season.qtpl:42
|
||||
func WriteIndex(qq422016 qtio422016.Writer, season *SeasonJikan) {
|
||||
func WriteIndex(qq422016 qtio422016.Writer, animes []Anime) {
|
||||
//line season.qtpl:42
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line season.qtpl:42
|
||||
StreamIndex(qw422016, season)
|
||||
StreamIndex(qw422016, animes)
|
||||
//line season.qtpl:42
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line season.qtpl:42
|
||||
}
|
||||
|
||||
//line season.qtpl:42
|
||||
func Index(season *SeasonJikan) string {
|
||||
func Index(animes []Anime) string {
|
||||
//line season.qtpl:42
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line season.qtpl:42
|
||||
WriteIndex(qb422016, season)
|
||||
WriteIndex(qb422016, animes)
|
||||
//line season.qtpl:42
|
||||
qs422016 := string(qb422016.B)
|
||||
//line season.qtpl:42
|
||||
|
||||
Reference in New Issue
Block a user