Skip to content
Snippets Groups Projects
Select Git revision
  • 7b04e7b92fbf280b49a4903cc88f4efa2d8896bc
  • master default protected
  • v2021.2.1
  • v2021.2
  • RC5_v2021.1
  • RC4_v2021.1
  • RC3_v2021.1
  • RC2_v2021.1
  • RC1_v2021.1
  • v2020.1
10 results

slubsipbuilderbagit.pl

Blame
  • slubsipbuilderbagit.pl 39.00 KiB
    #!/usr/bin/env perl
    #===============================================================================
    #         FILE: slubsipbuilderbagit.pl
    #
    #        USAGE: perl -I lib/ bin/slubsipbuilderbagit.pl --save_option=copy
    #               --IE_directory=./export_dir_kitodo/bagit/test2
    #               --SIP_output_path=/tmp --ppn=457035137 --SIP_version=v2020.1
    #               --external_id=10008 --external_workflow=kitodo
    #               --external_ISIL=DE-14 --external_value_descr="Gesetzlicher Auftrag"
    #               --rights_version=1.0
    #               --rights_xml=export_dir_kitodo/bagit/rights/Fallbeispiel-02.xml
    #
    #  DESCRIPTION: A CLI tool to create a valid SIP for SLUBArchiv
    #
    # REQUIREMENTS: perl install version 5.28 or higher, as all necessary modules required
    #               install Archive::BagIt::Base 0.065 or higher
    #               (If fails than you need extra "sudo apt install libperl-dev libperl5.28")
    #               For Windows users: check if UTF-8 flag set at Systemsteuerung/Zeit und Region/Region/Verwaltung/Gebietsschema ändern
    #
    #         BUGS: ---
    #        NOTES: related to official document "SLUBArchiv_Produzenten_SIP_Spezifikation_v2.0.pdf"
    #                --save_option=copy is RECOMMENDED than <replace> or <move>,
    #               because IE can be corrupted if process fails. Manual restoration needed!!!
    #               --add_meta_file="key: values" must be in double quotes to be able to write
    #               whitespaces for values
    #       AUTHOR: Andreas Romeyke (romeyke@slub-dresden.de)
    #               Serhiy Bolkun (Serhiy.Bolkun@slub-dresden.de),
    #
    # ORGANIZATION: SLUB
    #      VERSION: 2.0
    #      CREATED: 2020-04-27
    #===============================================================================
    
    
    use strict;
    use warnings;
    use utf8;
    
    package SLUB::LZA::SIPBuilderBagIt;
        use utf8;
        use feature 'say';
        use Archive::BagIt::Base;
        use Carp;
        use Data::Printer;
        use Encode;
        use File::Copy;
        use File::Copy::Recursive qw(dircopy dirmove);
        use File::Basename;
        use File::Find;
        use LWP::UserAgent;          # to get MARC data
        use MARC::Record;
        use Path::Tiny;
        use Term::ANSIColor;         # colored print
        use Try::Tiny;
        use XML::LibXML;
        use XML::XPath;
        use XML::LibXSLT;
    
        our $VERBOSE = 0;            # print output switch 0 => on, 1 and larger = off
    
        # old SLUB_SIP_Builder functions
        my $marc_mods_url  = 'http://www.loc.gov/standards/mods/v3/MARC21slim2MODS3-6.xsl';
        my $marc_utils_url = 'http://www.loc.gov/standards/marcxml/xslt/MARC21slimUtils.xsl';
        my $swb_url        = 'https://sru.bsz-bw.de/swb';
        my $searchkey_swb  = 'pica.swn';
        my $searchkey_k10p = 'pica.ppn';
        my $recordschema   = 'marcxmlvbos';
        our $with_debug    = 0;
    
        sub prepare_mods_section_with_noppn($){