uploads

package
v2.5.4+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package uploads is for the one-off validation / queue processing which only applies to issues which aren't yet in the workflow. e.g., verifying that scanned issues have PDFs and TIFFs for each page, reporting pre-process-specific errors when trying to bring an issue into NCA's workflow, etc.

The package is meant to be usable from the web as well as command-line tasks as a way to ensure consistency when processing uploaded issues.

Index

Constants

View Source
const DaysIssueConsideredDangerous = 2

DaysIssueConsideredDangerous is how long we require an issue to be untouched prior to anybody queueing it

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	*schema.File
}

File wraps a schema file to add upload-specific validations

func (*File) ValidateDPI

func (f *File) ValidateDPI(expected int)

ValidateDPI adds errors to the file if its embedded images' DPIs are not within 15% of the expected value. This does nothing if the file isn't a pdf.

type Issue

type Issue struct {
	*schema.Issue

	Files []*File
	// contains filtered or unexported fields
}

Issue wraps a schema.Issue to add upload- and queue-specific validations and behavior

func New

New returns an Issue ready for validation checks and queueing. It requires a Scanner for checking dupes as well as global configuration in order to know scanned-issue DPI and born-digital MARC organization code.

func (*Issue) Queue

func (i *Issue) Queue() apperr.Error

Queue attempts to send the issue to the workflow by queueing up a move job

func (*Issue) ValidateAll

func (i *Issue) ValidateAll()

ValidateAll runs through all upload-queue-specific validations and adds errors which are only relevant to these issues. This validator runs the DPI check and is therefore fairly slow for scanned uploads. It shouldn't be run in bulk across a large number of issues.

func (*Issue) ValidateFast

func (i *Issue) ValidateFast()

ValidateFast runs all the upload-queue-specific validations except those which are slow (namely the DPI check). This should be run against every issue being considered for queue.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL