-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
43 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from django.core.management.base import BaseCommand, CommandError | ||
from readux_ingest_ecds.helpers import get_iiif_models | ||
from readux_ingest_ecds.services.ocr_services import add_ocr_to_canvases | ||
|
||
Manifest = get_iiif_models()["Manifest"] | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "(Re)Build OCR for a volume" | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument( | ||
"volume", type=str, help="PID for volume/manifest to be generated." | ||
) | ||
|
||
def handle(self, *args, **options): | ||
try: | ||
manifest = Manifest.objects.get(pid=options["volume"]) | ||
except Manifest.DoesNotExist: | ||
raise CommandError('Manifest "%s" does not exist' % options["volume"]) | ||
|
||
add_ocr_to_canvases(manifest) | ||
|
||
self.stdout.write( | ||
self.style.SUCCESS('Successfully closed poll "%s"' % manifest.pid) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters