Ignore:
Timestamp:
2020-10-13T17:24:34+13:00 (4 years ago)
Author:
davidb
Message:

ex.Title now set based on escaped URL filename

Location:
main/trunk/model-sites-dev/atea/collect/digital-nz
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-sites-dev/atea/collect/digital-nz/perllib/plugins/DNZJSONPlugin.pm

    r33166 r34453  
    122122}
    123123
     124sub dnz_add_utf8_metadata_title
     125{
     126    my $self = shift (@_);
     127    my ($doc_obj,$section,$md_val) = @_;
     128
     129    $md_val =~ s/~COLON~/\:/g;
     130    $md_val =~ s/~SLASH~/\//g;
     131    $md_val =~ s/~DOT~/\./g;
     132
     133    $md_val =~ s/\.json$//;
     134   
     135    $doc_obj->add_utf8_metadata($section, "Title", $md_val);
     136   
     137}
     138
    124139sub process
    125140{
     
    142157        if (defined $md_val && ($md_val ne "")) {
    143158            $doc_obj->add_utf8_metadata($section, "dnz.$k", $md_val);
     159            # $self->dnz_add_utf8_metadata($doc_obj,$section, $k, $md_val);
    144160        }
    145161        }
     
    149165        if (defined $md_val && ($md_val ne "")) {
    150166            $doc_obj->add_utf8_metadata($section, "dnz.$k", $md_val);
     167            # $self->dnz_add_utf8_metadata($doc_obj,$section, $k, $md_val);
    151168        }
    152169    }
     
    154171    }
    155172
    156 
     173    my $source = $doc_obj->get_metadata_element($section,"Source");
     174    $self->dnz_add_utf8_metadata_title($doc_obj,$section, $source);
     175   
    157176    # Record was processed successfully
    158177    return 1;
  • main/trunk/model-sites-dev/atea/collect/digital-nz/prepare/dnz-search-language-mi--python3.py

    r34447 r34453  
    1515# DNZ key
    1616DNZ = dnz.api.Dnz('<CHANGEME>')
    17 
    1817
    1918#result = dnz.search('kiwi tui')
     
    4140        #json_landing_filename = re.sub('[:/.]', '-', landing_url) + ".json"
    4241
    43         json_landing_filename1 = re.sub('[:]', '-', landing_url)
    44         json_landing_filename2 = re.sub('[/]', '|', json_landing_filename1)
    45         json_landing_filename  = re.sub('[.]', '_', json_landing_filename2) + ".json"
     42        json_landing_filename1 = re.sub('[:]', '~COLON~', landing_url)
     43        json_landing_filename2 = re.sub('[/]', '~SLASH~', json_landing_filename1)
     44        json_landing_filename  = re.sub('[.]', '~DOT~', json_landing_filename2) + ".json"
    4645               
    4746        full_json_landing_filename = "import/" + json_landing_filename
Note: See TracChangeset for help on using the changeset viewer.