Removing SUC messages and chainging WAR to ERR if operation is aborted
This commit is contained in:
parent
8faf206b11
commit
180d966486
|
@ -80,8 +80,6 @@ func ParseAuthor(i int, s *goquery.Selection) {
|
|||
}
|
||||
if err := database.Db.Create(&AT).Error; err != nil {
|
||||
log.Printf("ERR AT %s: Could not be added to databse (%+v)", slug, err)
|
||||
} else {
|
||||
log.Printf("SUC AT %s: Added to database", slug)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +112,5 @@ func UpdateAuthor(AT database.Author) {
|
|||
}
|
||||
if err := database.Db.Save(&AT).Error; err != nil {
|
||||
log.Printf("ERR AT %s: Could not be updated in database (%+v)", AT.Slug.String, err)
|
||||
} else {
|
||||
log.Printf("SUC AT %s: Updated in database", AT.Slug.String)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,12 +88,12 @@ func ParseEpisode(i int, s *goquery.Selection) {
|
|||
if match := episodeRegex.FindStringSubmatch(EP.Name.String); len(match) > 0 {
|
||||
num, err := strconv.Atoi(match[1])
|
||||
if err != nil {
|
||||
log.Printf("SUC EP %s: Integer conversion not possible", slug)
|
||||
log.Printf("WAR EP %s: Integer conversion not possible", slug)
|
||||
EP.Episode.Int64 = 0
|
||||
}
|
||||
EP.Episode.Int64 = int64(num)
|
||||
} else {
|
||||
log.Printf("SUC EP %s: Name does not match RegEx", slug)
|
||||
log.Printf("WAR EP %s: Name does not match RegEx", slug)
|
||||
EP.Episode.Int64 = 0
|
||||
}
|
||||
doc.Find(".article > p").Each(func(i int, s *goquery.Selection) {
|
||||
|
@ -112,7 +112,7 @@ func ParseEpisode(i int, s *goquery.Selection) {
|
|||
}
|
||||
ytres, err := youtube.GetVideos([]string {"snippet", "statistics", "status", "contentDetails"}, []string {EP.Youtube.String}, config.C.YoutubeKey)
|
||||
if err != nil || len(ytres.Items) == 0 || ytres.Items[0].Status.UploadStatus != "processed" {
|
||||
log.Printf("WAR EP %s: Video %s is private (%+v)", slug, EP.Youtube.String, err)
|
||||
log.Printf("ERR EP %s: Video %s is private (%+v)", slug, EP.Youtube.String, err)
|
||||
return
|
||||
}
|
||||
if EP.Descr.String == "" {
|
||||
|
@ -135,7 +135,7 @@ func ParseEpisode(i int, s *goquery.Selection) {
|
|||
if err == nil {
|
||||
EP.Duration.Int64 = int64(dur.ToDuration().Seconds())
|
||||
} else {
|
||||
log.Printf("SUC EP %s: Could not parse duration", slug)
|
||||
log.Printf("WAR EP %s: Could not parse duration", slug)
|
||||
EP.Duration.Int64 = 0
|
||||
}
|
||||
EP.Rating.Float64, EP.Votes.Int64 = youtube.GetRatingAndVotesWithRes(ytres)
|
||||
|
@ -146,8 +146,6 @@ func ParseEpisode(i int, s *goquery.Selection) {
|
|||
|
||||
if err := database.Db.Create(&EP).Error; err != nil {
|
||||
log.Printf("ERR EP %s: Could not be added to databse (%+v)", slug, err)
|
||||
} else {
|
||||
log.Printf("SUC EP %s: Added to database", slug)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +181,5 @@ func UpdateEpisode(EP database.Episode) {
|
|||
|
||||
if err := database.Db.Save(&EP).Error; err != nil {
|
||||
log.Printf("ERR EP %s: Could not be updated in databse (%+v)", EP.Slug.String, err)
|
||||
} else {
|
||||
log.Printf("SUC EP %s: Updated in database", EP.Slug.String)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ func ParseFeedEpisode(u string) {
|
|||
num, _ := strconv.Atoi(match[1])
|
||||
EP.Episode.Int64 = int64(num)
|
||||
} else {
|
||||
log.Printf("SUC RSS %s: Name does not match RegEx", slug)
|
||||
log.Printf("WAR RSS %s: Name does not match RegEx", slug)
|
||||
EP.Episode.Int64 = 0
|
||||
}
|
||||
doc.Find(".article > p").Each(func(i int, s *goquery.Selection) {
|
||||
|
@ -122,7 +122,7 @@ func ParseFeedEpisode(u string) {
|
|||
}
|
||||
ytres, err := youtube.GetVideos([]string {"snippet", "statistics", "status", "contentDetails"}, []string {EP.Youtube.String}, config.C.YoutubeKey)
|
||||
if err != nil || len(ytres.Items) == 0 || ytres.Items[0].Status.UploadStatus != "processed" {
|
||||
log.Printf("WAR RS %s: Video %s is private (%s)", slug, EP.Youtube.String, err)
|
||||
log.Printf("ERR RS %s: Video %s is private (%s)", slug, EP.Youtube.String, err)
|
||||
return
|
||||
}
|
||||
if EP.Descr.String == "" {
|
||||
|
@ -145,14 +145,12 @@ func ParseFeedEpisode(u string) {
|
|||
if err == nil {
|
||||
EP.Duration.Int64 = int64(dur.ToDuration().Seconds())
|
||||
} else {
|
||||
log.Printf("SUC RSS %s: Could not parse duration", slug)
|
||||
log.Printf("WAR RSS %s: Could not parse duration", slug)
|
||||
EP.Duration.Int64 = 0
|
||||
}
|
||||
EP.Rating.Float64, EP.Votes.Int64 = youtube.GetRatingAndVotesWithRes(ytres)
|
||||
|
||||
if err := database.Db.Create(&EP).Error; err != nil {
|
||||
log.Printf("ERR RS %s: Could not be added to databse (%+v)", slug, err)
|
||||
} else {
|
||||
log.Printf("SUC RSS %s: Added to database", slug)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,8 +79,6 @@ func ParseLPPage(gslug string, LP *database.LetsPlay) {
|
|||
if err := database.Db.Create(&LP).Error; err != nil {
|
||||
log.Printf("ERR LP %s: Could not be added to database (%+v)", gslug, err)
|
||||
return
|
||||
} else {
|
||||
log.Printf("SUC LP %s: Added to database", gslug)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,8 +117,6 @@ func UpdateLP(LP database.LetsPlay) {
|
|||
if err := database.Db.Save(&LP).Error; err != nil {
|
||||
log.Printf("ERR LP %s: Could not be updated in database (%+v)", LP.Slug.String, err)
|
||||
return
|
||||
} else {
|
||||
log.Printf("SUC LP %s: Updated in database", LP.Slug.String)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ func ParseLT(i int, s *goquery.Selection) {
|
|||
}
|
||||
ytres, err := youtube.GetVideos([]string {"snippet", "statistics", "status", "contentDetails"}, []string {LT.Youtube.String}, config.C.YoutubeKey)
|
||||
if err != nil || len(ytres.Items) == 0 || ytres.Items[0].Status.UploadStatus != "processed" {
|
||||
log.Printf("WAR LT %s: Video %s is private (%+v)", slug, LT.Youtube.String, err)
|
||||
log.Printf("ERR LT %s: Video %s is private (%+v)", slug, LT.Youtube.String, err)
|
||||
return
|
||||
}
|
||||
if LT.Descr.String == "" {
|
||||
|
@ -106,8 +106,6 @@ func ParseLT(i int, s *goquery.Selection) {
|
|||
LT.Rating.Float64, LT.Votes.Int64 = youtube.GetRatingAndVotesWithRes(ytres)
|
||||
if err := database.Db.Create(<).Error; err != nil {
|
||||
log.Printf("ERR LT %s: Could not be added to databse (%+v)", slug, err)
|
||||
} else {
|
||||
log.Printf("SUC LT %s: Added to database", slug)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,7 +172,5 @@ func UpdateLT(LT database.LetsTest) {
|
|||
}
|
||||
if err := database.Db.Save(<).Error; err != nil {
|
||||
log.Printf("ERR LT %s: Could not be updated in databse (%+v)", LT.Slug.String, err)
|
||||
} else {
|
||||
log.Printf("SUC LT %s: Updated in database", LT.Slug.String)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue