Changeset 37060


Ignore:
Timestamp:
2022-12-25T18:07:37+13:00 (16 months ago)
Author:
davidb
Message:

Removed the 'allinone' version of functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/structured-image/trunk/perllib/plugins/GoogleVisionAPIConverter.pm

    r37059 r37060  
    341341    $self->{'openannotation-list'} = $openannotation_list;
    342342}
    343 
    344 
    345 
    346 sub start_openannotation_list_ALLINONE
    347 {
    348     my $self = shift (@_);
    349     my ($doc_obj) = @_;
    350 
    351     my $OID = $doc_obj->get_OID();
    352 
    353     my $openannotation_list = {
    354         "\@context" => "http://www.shared-canvas.org/ns/context.json",
    355     # "\@id"      => "https://iiif.harvardartmuseums.org/manifests/object/299843/list/47174896",
    356     "\@id"      => "${OID}/openannotation-list.json",  # #### **** make full URL to be unique? or greenstone3:site:collect:OID ??
    357     "\@type"    => "sc:AnnotationList",
    358     "resources" => []
    359     };
    360 
    361     $self->{'openannotation-list'} = $openannotation_list;
    362 }
    363 
    364343
    365344   
     
    592571
    593572
    594 
    595 sub openannotation_list_associate_json_ALLINONE
    596 {
    597     my $self = shift (@_);
    598     my ($doc_obj, $gv_dococr_json_filename_recs) = @_;
    599 
    600     my $outhandle = $self->{'outhandle'};
    601    
    602     # Guaranteed to have at least one value in gv_dococr_json_filename_recs
    603     #
    604     # Legacy code used to have a '\d+' just before the '.json' reflecting page/section number
    605     # Keep this in the regular expression, just in case,
    606     #
    607     my ($gv_dococr_filename_root) = ($gv_dococr_json_filename_recs->[0]->{'filename'} =~ m/^(.+)(?:\d+)?\.json$/);
    608 
    609     # slight of hand so new directory spot in cache_dir picked out is where we want it!
    610     $gv_dococr_filename_root .= "/";
    611    
    612     my $collect_dir = $ENV{'GSDLCOLLECTDIR'};
    613     my $toplevel_cached_dir = &FileUtils::filenameConcatenate($collect_dir,"cached");
    614    
    615     $self->init_cache_for_file($gv_dococr_filename_root);
    616     my $cached_dir = $self->{'cached_dir'};
    617 
    618     my $assoc_openannotation_json_ofile = "openannotation-list.json";
    619     my $cached_openannotation_json_ofilename = &FileUtils::filenameConcatenate($cached_dir,$assoc_openannotation_json_ofile);   
    620 
    621     my $needs_json_regen = 0;
    622 
    623     if (!-f $cached_openannotation_json_ofilename) {
    624     $needs_json_regen = 1;
    625     }
    626     else {
    627     for my $gv_json_filename_rec (@$gv_dococr_json_filename_recs) {
    628         my $gv_json_filename = $gv_json_filename_rec->{'filename'};
    629         if (-M $gv_json_filename > -M $cached_openannotation_json_ofilename) {
    630         $needs_json_regen = 1;
    631         last;
    632         }
    633     }
    634     }
    635 
    636     my $saved_ok = 1;
    637    
    638     if ($needs_json_regen) {
    639 
    640     print $outhandle "  OpenAnnotation-List: Generating $cached_openannotation_json_ofilename\n";
    641    
    642     $self->start_openannotation_list($doc_obj);
    643 
    644     for my $gv_json_filename_rec (@$gv_dococr_json_filename_recs) {
    645         my $gv_json_filename = $gv_json_filename_rec->{'filename'};
    646         my $section = $gv_json_filename_rec->{'section'};
    647         $self->convert_and_append_openannotation_resources($gv_json_filename, $doc_obj,$section);
    648     }
    649    
    650     $saved_ok = $self->end_openannotation_list($doc_obj,$cached_openannotation_json_ofilename);
    651     }
    652    
    653     if ($saved_ok) {
    654     print $outhandle "  OpenAnnotation-List: Cached file $cached_openannotation_json_ofilename already exists\n";
    655    
    656     my $top_section = $doc_obj->get_top_section();
    657     $doc_obj->associate_file($cached_openannotation_json_ofilename,$assoc_openannotation_json_ofile,"application/json",$top_section);
    658     }
    659 
    660     return $saved_ok;
    661 }
    662 
    663 
    664573sub opt_run_gen_openannotation
    665574{   
Note: See TracChangeset for help on using the changeset viewer.