Removing DeleteLP and adjusting Sitemap generator for it

This commit is contained in:
Andreas Mieke 2016-02-28 14:50:20 +01:00
parent 25cdb9e9d9
commit 9935f6df3a
4 changed files with 1 additions and 16 deletions

View file

@ -105,7 +105,6 @@ func ParseEpisode(i int, s *goquery.Selection) {
EP.Episode.Int64 = 0
EP.Name.String = removeRegex.ReplaceAllString(EP.Name.String, "")
}
EP.Season.Int64 = 1
doc.Find(".article > p").Each(func(i int, s *goquery.Selection) {
EP.Descr.String += s.Text() + "\n"
})

View file

@ -120,15 +120,3 @@ func UpdateLP(LP database.LetsPlay) {
}
}
}
func DeleteEmptyLPs() {
var LPs []database.LetsPlay
database.Db.Find(&LPs)
for _, LP := range LPs {
var count int
database.Db.Model(database.Episode{}).Where("lets_play_id = ?", LP.ID).Count(&count)
if count == 0 {
database.Db.Delete(&LP)
}
}
}

View file

@ -63,7 +63,7 @@ func GenerateSitemap() {
func genLPs(uset *urlset) {
var LPs []database.LetsPlay
database.Db.Find(&LPs)
database.Db.Where("aired IS NOT NULL").Find(&LPs)
for _, LP := range LPs {
var temp URL
temp.Location = config.C.SiteUrl + "/lets-play/" + LP.Slug.String

View file

@ -17,7 +17,6 @@ func UpdateAll() {
log.Printf("*** FINISHED UPDATING LETSPLAYS ***")
UpdateEpisodes()
log.Printf("*** FINISHED UPDATING EPISODES ***")
DeleteEmptyLPs()
GenerateSitemap()
}
@ -30,7 +29,6 @@ func ParseAll() {
log.Printf("*** FINISHED PARSING LETSPLAYS ***")
ParseEpisodes()
log.Printf("*** FINISHED PARSING EPISODES ***")
DeleteEmptyLPs()
GenerateSitemap()
}