Пример #1
0
// See ingestion.Processor interface.
func (p *pdfProcessor) Process(resultsFile ingestion.ResultFileLocation) error {
	r, err := resultsFile.Open()
	if err != nil {
		return err
	}

	dmResults, err := goldingestion.ParseDMResultsFromReader(r)
	if err != nil {
		return err
	}

	// Get the results in this file that have produced a PDF.
	pdfResults := getPDFResults(dmResults)

	// If there are no PDF results we are done here.
	if len(pdfResults) == 0 {
		return nil
	}

	// Get the output name.
	outFile := resultsFile.Name()

	// check if they have been generated already (the JSON file exists)
	if p.resultExists(p.outJsonBucket, p.outJsonDir, outFile) {
		return nil
	}

	return p.rasterizeAndUpload(outFile, dmResults, pdfResults)
}