Commit Diff
Diff:
f0fb0f0898465906e605ce59cd2b31d1730d6d8c
8a090a172e23e4181d9fe7b99f357449d1786050
Commit:
8a090a172e23e4181d9fe7b99f357449d1786050
Tree:
3c62493ded9afc9c6c262e5dfb3b8c8753a5414f
Author:
Omar Polo <op@omarpolo.com>
Date:
Tue Aug 30 13:28:10 2022 UTC
Message:
use (part) of the original file name instead of the message-id
commit - f0fb0f0898465906e605ce59cd2b31d1730d6d8c
commit + 8a090a172e23e4181d9fe7b99f357449d1786050
blob - 533da445bdd961874847d9785f922a37c475c766
blob + a1c53732ad9b93159612c229b7eda9d445762de2
--- GotMArc.pm
+++ GotMArc.pm
@@ -7,6 +7,7 @@ use Exporter;
use warnings;
use v5.32;
use Exporter;
+use File::Basename;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(san urlencode parse initpage endpage index_header thread_header);
@@ -36,18 +37,10 @@ sub mid2path {
return san($str);
}
-sub mid2path {
- my $mid = shift;
- $mid =~ s,_,__,g;
- $mid =~ s,/,_,g;
- return $mid;
-}
-
sub parse {
- my ($indent, $fname, $mid, $date, $from, $subj) = m{
+ my ($indent, $fname, $date, $from, $subj) = m{
^([^-]*)- # the indent level
([^ ]+)\s # filename
- <([^>]+)> # message id
(\d{4}-\d\d-\d\d[ ]\d\d:\d\d) # date
<([^>]+)> # from
(.*) # subject
@@ -56,10 +49,12 @@ sub parse {
my $level = length($indent);
$level = 10 if $indent =~ m/\.\.\d+\.\./;
- $mid = mid2path($mid);
$from = ssan($from);
$subj = ssan($subj);
+ my ($time, $id) = split /\./, basename($fname);
+ my $mid = "$time.$id";
+
return ($level, $fname, $mid, $date, $from, $subj);
}
blob - 7f12b242345ac2f79761c623f68e0678b800c617
blob + 2d71787d92cced740dd2d576f6827838c7594e18
--- gotmarc
+++ gotmarc
@@ -8,5 +8,5 @@ fmt='%i-%R %I%16D<%64f>%128S'
: ${MDIR:?not defined}
-fmt='%i-%R %I%16D<%64f>%128S'
+fmt='%i-%R %16D<%64f>%128S'
mlist "${MDIR}" | mthread -r | mscan -f "$fmt" | ./pe | ./mkindex
Omar Polo