diff --git a/index.html b/index.html index cf09b171..c7846880 100644 --- a/index.html +++ b/index.html @@ -60,6 +60,12 @@ Live Action - Idol/Promotional Video Live Action - Raw + + Search all + Remakes + Trusted + A+ + No Items per Page diff --git a/main.go b/main.go index 0fbca27a..ed0706ae 100644 --- a/main.go +++ b/main.go @@ -96,6 +96,7 @@ func searchHandler(w http.ResponseWriter, r *http.Request) { pagenum, _ := strconv.Atoi(html.EscapeString(page)) searchQuery := r.URL.Query().Get("q") cat := r.URL.Query().Get("c") + stat := r.URL.Query().Get("s") catsSplit := strings.Split(cat, "_") // need this to prevent out of index panics var searchCatId, searchSubCatId string @@ -109,7 +110,8 @@ func searchHandler(w http.ResponseWriter, r *http.Request) { b := []TorrentsJson{} - torrents := getTorrents(createWhereParams("torrent_name LIKE ? AND category_id LIKE ? AND sub_category_id LIKE ?", "%"+searchQuery+"%", searchCatId+"%", searchSubCatId+"%"), maxPerPage, maxPerPage*(pagenum-1)) + torrents := getTorrents(createWhereParams("torrent_name LIKE ? AND status_id LIKE ? AND category_id LIKE ? AND sub_category_id LIKE ?", + "%"+searchQuery+"%", stat+"%", searchCatId+"%", searchSubCatId+"%"), maxPerPage, maxPerPage*(pagenum-1)) for i, _ := range torrents { nbTorrents++ @@ -119,7 +121,7 @@ func searchHandler(w http.ResponseWriter, r *http.Request) { } - htv := HomeTemplateVariables{b, getAllCategories(false), searchQuery, cat, maxPerPage, nbTorrents} + htv := HomeTemplateVariables{b, getAllCategories(false), searchQuery, stat, cat, maxPerPage, nbTorrents} err := templates.ExecuteTemplate(w, "index.html", htv) if err != nil { diff --git a/models.go b/models.go index 5da49ac6..b366f21d 100644 --- a/models.go +++ b/models.go @@ -25,10 +25,10 @@ type Sub_Categories struct { type Torrents struct { gorm.Model - Id int `gorm:"column:torrent_id"` - Name string `gorm:"column:torrent_name"` - Category_id int `gorm:"column:category_id"` - Sub_category_id int + Id int `gorm:"column:torrent_id"` + Name string `gorm:"column:torrent_name"` + Category_id int `gorm:"column:category_id"` + Sub_category_id int `gorm:"column:sub_category_id"` Status int `gorm:"column:status_id"` Hash string `gorm:"column:torrent_hash"` Categories Categories `gorm:"ForeignKey:category_id;AssociationForeignKey:category_id"` @@ -67,6 +67,7 @@ type HomeTemplateVariables struct { ListTorrents []TorrentsJson ListCategories []Categories Query string + Status string Category string QueryRecordCount int TotalRecordCount int