Removing DeleteLP and adjusting Sitemap generator for it
This commit is contained in:
parent
25cdb9e9d9
commit
9935f6df3a
|
@ -105,7 +105,6 @@ func ParseEpisode(i int, s *goquery.Selection) {
|
||||||
EP.Episode.Int64 = 0
|
EP.Episode.Int64 = 0
|
||||||
EP.Name.String = removeRegex.ReplaceAllString(EP.Name.String, "")
|
EP.Name.String = removeRegex.ReplaceAllString(EP.Name.String, "")
|
||||||
}
|
}
|
||||||
EP.Season.Int64 = 1
|
|
||||||
doc.Find(".article > p").Each(func(i int, s *goquery.Selection) {
|
doc.Find(".article > p").Each(func(i int, s *goquery.Selection) {
|
||||||
EP.Descr.String += s.Text() + "\n"
|
EP.Descr.String += s.Text() + "\n"
|
||||||
})
|
})
|
||||||
|
|
|
@ -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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -63,7 +63,7 @@ func GenerateSitemap() {
|
||||||
|
|
||||||
func genLPs(uset *urlset) {
|
func genLPs(uset *urlset) {
|
||||||
var LPs []database.LetsPlay
|
var LPs []database.LetsPlay
|
||||||
database.Db.Find(&LPs)
|
database.Db.Where("aired IS NOT NULL").Find(&LPs)
|
||||||
for _, LP := range LPs {
|
for _, LP := range LPs {
|
||||||
var temp URL
|
var temp URL
|
||||||
temp.Location = config.C.SiteUrl + "/lets-play/" + LP.Slug.String
|
temp.Location = config.C.SiteUrl + "/lets-play/" + LP.Slug.String
|
||||||
|
|
|
@ -17,7 +17,6 @@ func UpdateAll() {
|
||||||
log.Printf("*** FINISHED UPDATING LETSPLAYS ***")
|
log.Printf("*** FINISHED UPDATING LETSPLAYS ***")
|
||||||
UpdateEpisodes()
|
UpdateEpisodes()
|
||||||
log.Printf("*** FINISHED UPDATING EPISODES ***")
|
log.Printf("*** FINISHED UPDATING EPISODES ***")
|
||||||
DeleteEmptyLPs()
|
|
||||||
GenerateSitemap()
|
GenerateSitemap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +29,6 @@ func ParseAll() {
|
||||||
log.Printf("*** FINISHED PARSING LETSPLAYS ***")
|
log.Printf("*** FINISHED PARSING LETSPLAYS ***")
|
||||||
ParseEpisodes()
|
ParseEpisodes()
|
||||||
log.Printf("*** FINISHED PARSING EPISODES ***")
|
log.Printf("*** FINISHED PARSING EPISODES ***")
|
||||||
DeleteEmptyLPs()
|
|
||||||
GenerateSitemap()
|
GenerateSitemap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue