summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-12-21 11:31:36 +0100
committerDaniel Friesel <derf@finalrewind.org>2020-12-21 11:31:36 +0100
commite7f114d3d6244d7248c5bdaaec164c417320cf83 (patch)
tree4c6b1d9abd6483785f6f4d82a5edac3a7c7b8feb
parentf787edbca7638a3a4eacedfe0861a09f0d0b9493 (diff)
add deprecation and source information
-rwxr-xr-xbin/db-zugbildung-to-json10
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/db-zugbildung-to-json b/bin/db-zugbildung-to-json
index 1a9b030..3c52ce9 100755
--- a/bin/db-zugbildung-to-json
+++ b/bin/db-zugbildung-to-json
@@ -8,6 +8,7 @@ use warnings;
use 5.020;
use utf8;
+use Encode qw(decode);
use File::Slurp qw(write_file);
use IPC::Run3;
use JSON;
@@ -167,7 +168,8 @@ if ($?) {
exit 2;
}
-my $wr_pdf = $ARGV[0];
+my $wr_pdf = decode( 'UTF-8', $ARGV[0] );
+my $wr_name = ( split( qr{/}, $wr_pdf ) )[-1];
my $wr_txt;
my $command = [ "pdftotext", "-layout", "-nopgbrk", $wr_pdf, "/dev/stdout" ];
@@ -569,7 +571,9 @@ delete $map{2310}{cycle};
# use canonical output (i.e., sort hash keys) to allow for easy diffing.
say JSON->new->utf8->canonical->encode(
{
- valid => $valid,
- train => {%map}
+ deprecated => \0,
+ source => $wr_name,
+ train => {%map},
+ valid => $valid,
}
);