diff --git a/database/database.go b/database/database.go
index ded04b8..8daca90 100644
--- a/database/database.go
+++ b/database/database.go
@@ -79,6 +79,7 @@ type Episode struct {
Slug sql.NullString `sql:"not null;unique_index"`
Name sql.NullString `sql:"not null"`
+ Season sql.NullInt64 `sql:"not null"`
Episode sql.NullInt64 `sql:"not null"`
ThumbS sql.NullString
ThumbB sql.NullString
@@ -90,7 +91,7 @@ type Episode struct {
Duration sql.NullInt64
}
-var Db gorm.DB
+var Db gorm.DB
func InitDb(connection string) (error) {
var err error
@@ -258,6 +259,7 @@ func (e *Episode) BeforeSave() (err error) {
}
e.Votes.Valid = true
e.Episode.Valid = true
+ e.Season.Valid = true
if e.Votes.Int64 == 0 {
e.Rating.Valid = false
} else {
diff --git a/gparser/episodeparser.go b/gparser/episodeparser.go
index c5f4ba1..3920bab 100644
--- a/gparser/episodeparser.go
+++ b/gparser/episodeparser.go
@@ -96,6 +96,7 @@ func ParseEpisode(i int, s *goquery.Selection) {
log.Printf("WAR EP %s: Name does not match RegEx", slug)
EP.Episode.Int64 = 0
}
+ EP.Season.Int64 = 1
doc.Find(".article > p").Each(func(i int, s *goquery.Selection) {
EP.Descr.String += s.Text() + "\n"
})
diff --git a/gparser/feedparser.go b/gparser/feedparser.go
index b3191b3..4160c67 100644
--- a/gparser/feedparser.go
+++ b/gparser/feedparser.go
@@ -106,6 +106,7 @@ func ParseFeedEpisode(u string) {
log.Printf("WAR RSS %s: Name does not match RegEx", slug)
EP.Episode.Int64 = 0
}
+ EP.Season.Int64 = 1
doc.Find(".article > p").Each(func(i int, s *goquery.Selection) {
EP.Descr.String += s.Text() + "\n"
})
diff --git a/gserver/admin.go b/gserver/admin.go
index f56d1ba..4e5e5d6 100644
--- a/gserver/admin.go
+++ b/gserver/admin.go
@@ -200,6 +200,9 @@ func PostAdminEpisode(c *gin.Context) {
}
EP.Slug.String = c.PostForm("slug")
EP.Name.String = c.PostForm("name")
+ if se, err := strconv.ParseInt(c.PostForm("season"), 10, 64); err == nil {
+ EP.Season.Int64 = se
+ }
if ep, err := strconv.ParseInt(c.PostForm("episode"), 10, 64); err == nil {
EP.Episode.Int64 = ep
}
diff --git a/gserver/templates/admin_ep.html b/gserver/templates/admin_ep.html
index e390289..429a49a 100644
--- a/gserver/templates/admin_ep.html
+++ b/gserver/templates/admin_ep.html
@@ -18,6 +18,9 @@
+