1
0
forked from HPR/hpr-tools

Updates since 2024-06-15

Database/query2tt2: comment and documentation updates; use of Perl's
    try/catch.

InternetArchive/.make_metadata.cfg: added comments for readability

InternetArchive/make_metadata: bug fix needed now that all shows on the HPR server have
    a directory with assets under it.

InternetArchive/repair_assets: new Bash script in development. Collects
    assets from the IA and uploads them to a new directory on the HPR
    server. Will run 'fix_asset_links' (to repair asset links for their
    new directories) once it is ready.

InternetArchive/repair_item: Bash script which was originally written to
    run on 'borg' and upload files to a new IA item when the uploads
    timed out. Now enhanced to upload missing files recovered from the
    HPR backup disk, such as transcripts.
This commit is contained in:
Dave Morriss
2024-07-16 21:39:28 +01:00
parent 9203dc26e0
commit dc0f29e957
6 changed files with 763 additions and 36 deletions

View File

@@ -26,9 +26,9 @@
# BUGS: ---
# NOTES: Had to revert to MySQL because of a problem with DBD::MariaDB
# AUTHOR: Dave Morriss (djm), Dave.Morriss@gmail.com
# VERSION: 0.0.4
# VERSION: 0.0.5
# CREATED: 2021-06-18 13:24:49
# REVISION: 2024-01-19 17:15:45
# REVISION: 2024-06-29 18:42:49
#
#===============================================================================
@@ -59,7 +59,7 @@ use Data::Dumper;
#
# Version number (manually incremented)
#
our $VERSION = '0.0.4';
our $VERSION = '0.0.5';
#
# Script and directory names
@@ -113,7 +113,7 @@ Options( \%options );
#
# Default help
#
pod2usage( -msg => "Version $VERSION\n", -exitval => 1 )
pod2usage( -msg => "Version $VERSION\n", -exitval => 1, -verbose => 0 )
if ( $options{'help'} );
#
@@ -234,7 +234,7 @@ catch ($e) {
print STDERR "Failed to execute query.\n";
print STDERR "Placeholder/Argument mismatch: $pcount/$acount\n";
exit;
};
}
#
# Grab everything from the query as an arrayref of hashrefs
@@ -325,7 +325,7 @@ sub _dbargs {
#=== FUNCTION ================================================================
# NAME: _define
# PURPOSE: Handles multiple instances of the same option '-define x=42'
# PURPOSE: Handles multiple instances of the option '-define x=42'
# PARAMETERS: $opts hash reference holding the options
# RETURNS: A hash containing all of the named items (e.g. { 'x' => 42 })
# DESCRIPTION: If there are -define options they will be a hashref in the hash
@@ -386,12 +386,13 @@ query2tt2 - A script for formatting a report from database query using a templat
=head1 VERSION
This documentation refers to query2tt2 version 0.0.4
This documentation refers to query2tt2 version 0.0.5
=head1 USAGE
query2tt2 [-help] [-debug=N] [-config=FILE] [-query=FILE]
[-template=FILE] [QUERY]
query2tt2 [-help] [-doc] [-debug=N] [-config=FILE] [-query=FILE]
[-template=FILE] [-dbargs=ARG1 [-dbarg=ARG2] ...]
[define KEY1=VALUE [define key2=VALUE2] ...] [QUERY]
query2tt2 -help
@@ -462,10 +463,10 @@ If neither method is used the script aborts with an error message.
=item B<-dbarg=ARG> [ B<-dbarg=ARG> ... ]
The query can have place holders ('?') in it and the corresponding values can
be passed to the script through the B<-dbarg=ARG> option. The option can be
repeated as many times as required and the order of B<ARG> values is
preserved.
The query can have place holders ('?') in it and the corresponding values for
these placeholders can be passed to the script through the B<-dbarg=ARG>
option. The option can be repeated as many times as required and the order of
B<ARG> values is preserved.
=item B<-template=FILE>
@@ -484,8 +485,10 @@ Output from the template is written to STDOUT.
The Template Toolkit (TT2) template may receive values from the command line
using this option. The argument to the B<-define> option is a B<key=value>
pair. Keys should be unique otherwise they will overwrite one another. The
keys will become TT2 variables and the values will be assigned to them.
pair. Keys should be unique otherwise they will overwrite one another. They
should also not be 'names' or 'result' because these keys are used internally
(for the data from the database). See below for more details. The keys will
become TT2 variables and the values will be assigned to them.
=back
@@ -548,12 +551,7 @@ The nominated template file could not be found.
An error has occurred while performing a database operation.
=item B<Failed to execure query.>
There is a mismatch between the number of placeholders in the query ('?'
characters) and the number of arguments provided through the B<-dbargs=ARG>
option. The script will attempt to analyse whether there are too many or too
few arguments
=item B<Failed to execute query.>
There is a mismatch between the number of placeholders in the query ('?'
characters) and the number of arguments provided through the B<-dbargs=ARG>