363aa5394c5a — russes02 11 years ago
Adds support for UK
1 files changed, 47 insertions(+), 0 deletions(-)

A => uk.go
A => uk.go +47 -0
@@ 0,0 1,47 @@ 
+package autocompare
+
+import (
+	"encoding/csv"
+	"fmt"
+	"io"
+)
+
+type UK struct {
+	BasePage
+}
+
+func (p UK) OriginURL() string {
+	return fmt.Sprintf("http://%s.yellsites.co.uk%s", p.subdomain, p.origPath)
+}
+
+func (p UK) CopyURL() string {
+	//return fmt.Sprintf("http://%s.ybsitecenter.com%s", p.subdomain, p.path)
+	return fmt.Sprintf("http://%s.fwuate2.yb.int%s", p.subdomain, p.path)
+}
+
+type UKSites struct {
+	*csv.Reader
+	*SitesBase
+}
+
+func (s *UKSites) CheckLinks() bool {
+	return true
+}
+
+func (s *UKSites) NextPage() Page {
+	line, err := s.Read()
+	if err == io.EOF {
+		return nil
+	}
+	var state int
+	var message string
+	if line[5] == "1" && line[11] != "" {
+		s.processed++
+		state = NEW
+	} else {
+		s.counts[line[5]]++
+		state = PANIC
+		message = "MIGRATION " + line[5]
+	}
+	return &UK{BasePage{attempts: 0, subdomain: line[3], domain1: line[4], origPath: line[7], path: line[8], adID: line[6], origImg: "", copyImg: "", state: state, message: message, id: line[2]}}
+}