# HG changeset patch # User russes02 # Date 1343838746 14400 # Wed Aug 01 12:32:26 2012 -0400 # Node ID 363aa5394c5ad10850193fe58bb8ab033a3ea1fb # Parent 1fec06951a2a2b46c7e7366cd27a236afdb4dc1c Adds support for UK diff --git a/uk.go b/uk.go new file mode 100644 --- /dev/null +++ b/uk.go @@ -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]}} +}