Compare commits
10 commits
101baf1938
...
99f2fda7be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99f2fda7be | ||
|
|
0c53f82635 | ||
|
|
9940de3bde | ||
|
|
0e3f0fe882 | ||
|
|
279ce453ba | ||
|
|
0237e90fd6 | ||
|
|
ec22febde3 | ||
|
|
aafd95a24b | ||
|
|
c523eb5d3b | ||
|
|
872e29b9bc |
9 changed files with 199 additions and 81 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
*~
|
||||
date-range-1.pl
|
||||
__pycache__
|
||||
|
|
|
|||
|
|
@ -49,6 +49,10 @@ set -e
|
|||
/usr/bin/git status > /dev/null
|
||||
|
||||
# Make sure machine is up. set -e will ensure that.
|
||||
if [ -f $HOME/.shoddy-network ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
/bin/ping -q -w 20 -c 5 $HOME_MACHINE > /dev/null 2>&1
|
||||
|
||||
cd ~/calendars/personal/private/bkuhn
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ use feature 'unicode_strings';
|
|||
use Encode qw(encode decode);
|
||||
use Text::Autoformat qw(autoformat);
|
||||
use File::Temp ();
|
||||
use Getopt::Long;
|
||||
|
||||
######################################################################
|
||||
sub ReadRecentWeatherAlerts ($) {
|
||||
|
|
|
|||
|
|
@ -26,13 +26,23 @@ while ($curTix < $tixCount) {
|
|||
my $rr;
|
||||
while (read($randomFH, $rr, 4) != 4) { }
|
||||
$rr = unpack("I", $rr) % scalar(@choices);
|
||||
$rr = $choices[$rr];
|
||||
if (scalar(keys(%done)) < @choices) {
|
||||
next if defined $done{$rr};
|
||||
$done{$rr} = 1;
|
||||
} else {
|
||||
next if $rr < 31;
|
||||
my %inThisTicket = map { $_, 1 } @{$tix[$curTix]}; next if $inThisTicket{$rr};
|
||||
my $min = min(grep { $_ > 31} values %done); next if $done{$rr} > $min;
|
||||
|
||||
my $hundred;
|
||||
while (read($randomFH, $hundred, 4) != 4) { }
|
||||
$hundred = unpack("I", $hundred) % 100;
|
||||
|
||||
next if ($rr <= 31) and ($hundred > 40);
|
||||
next if ($rr == 7) and ($hundred > 5);
|
||||
|
||||
my $min = min(@done{grep { $_ > 31} keys %done});
|
||||
next if $done{$rr} > $min;
|
||||
$done{$rr}++;
|
||||
}
|
||||
push(@{$tix[$curTix]}, $rr);
|
||||
}
|
||||
|
|
@ -40,5 +50,11 @@ while ($curTix < $tixCount) {
|
|||
}
|
||||
my $count = 1;
|
||||
foreach my $ticket (@tix) {
|
||||
print "Ticket $count: ", join(" ", sort { $a <=> $b } @$ticket), "\n";
|
||||
print sprintf("Ticket %2d: ", $count), map { sprintf("%2d ", $_) } sort { $a <=> $b } @$ticket;
|
||||
print "\n";
|
||||
$count++;
|
||||
}
|
||||
#print "\n\nStats\n";
|
||||
#foreach my $choice (sort { $a <=> $b } keys %done) {
|
||||
# print sprintf("%2d used: %2d\n", $choice, $done{$choice});
|
||||
# }
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ if (@ARGV < 2) {
|
|||
|
||||
my($TYPE, $MAILDIR_FOLDER) = ($ARGV[0], $ARGV[1]);
|
||||
|
||||
die "Bad type, $TYPE" unless $TYPE =~ /^(unlink|svn|print)$/;
|
||||
my (@dupFolders) = @ARGV[2..$#ARGV];
|
||||
|
||||
my %msgs; # indexed by Message-Id
|
||||
|
|
@ -48,6 +49,8 @@ foreach my $folder (@dupFolders) {
|
|||
warn "$dir/$file has no message ID";
|
||||
next;
|
||||
}
|
||||
$id =~ s/^[\<\s]+//; $id =~ s/[\>\s]$//;
|
||||
|
||||
|
||||
# die "Duplicate message ID's $id\n" if defined $msgs{$id};
|
||||
|
||||
|
|
@ -86,6 +89,8 @@ foreach my $dir (@msgDirs) {
|
|||
next;
|
||||
}
|
||||
}
|
||||
$id =~ s/^[\<\s]+//; $id =~ s/[\>\s]$//;
|
||||
|
||||
if (not defined $id or $id =~ /^\s*$/) {
|
||||
warn "$dir/$file has no message ID";
|
||||
next;
|
||||
|
|
@ -101,10 +106,12 @@ foreach my $dir (@msgDirs) {
|
|||
system("svn rm \"$existing_file\"");
|
||||
die "Unable to unlink file $existing_file: $!"
|
||||
unless $? == 0;
|
||||
} else {
|
||||
} elsif ($TYPE eq 'unlink') {
|
||||
print STDERR "Removing $existing_file\n";
|
||||
die "Unable to unlink $existing_file: $!"
|
||||
unless unlink($existing_file) == 1;
|
||||
} else {
|
||||
die "doing nothing here, type operation not known: $TYPE";
|
||||
}
|
||||
} else {
|
||||
$msgs{$id} = $fields;
|
||||
|
|
|
|||
|
|
@ -19,15 +19,28 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Encode;
|
||||
use Email::MIME::RFC2047::Encoder;
|
||||
use utf8;
|
||||
|
||||
if (@ARGV != 3) {
|
||||
print "usage: $0 <LIST_OF_ADDRESSES_FILE> <MESSAGE_FILE> <FRM_ADDR>\n";
|
||||
my $encoder = Email::MIME::RFC2047::Encoder->new();
|
||||
use utf8;
|
||||
|
||||
if (@ARGV != 3 and @ARGV != 4) {
|
||||
print "usage: $0 <LIST_OF_ADDRESSES_FILE> <MESSAGE_FILE> <FRM_ADDR> [<SKIP_LIST_FILE>]\n";
|
||||
exit 1;
|
||||
}
|
||||
my($LIST_FILE, $MESSAGE_FILE, $FROM_ADDRESS) = @ARGV;
|
||||
my($LIST_FILE, $MESSAGE_FILE, $FROM_ADDRESS, $SKIP_LIST_FILE) = @ARGV;
|
||||
|
||||
my %skip;
|
||||
|
||||
if (defined $SKIP_LIST_FILE) {
|
||||
die "$SKIP_LIST_FILE does not exist or is not readable: $!" unless -r $SKIP_LIST_FILE;
|
||||
open(SKIP_LIST, "<", $SKIP_LIST_FILE);
|
||||
while (my $line = <SKIP_LIST>) {
|
||||
chomp $line;
|
||||
$skip{$line} = $SKIP_LIST_FILE;
|
||||
}
|
||||
}
|
||||
open(LIST, "<$LIST_FILE") or die "unable to open $LIST_FILE: $!";
|
||||
|
||||
my @sendTo;
|
||||
|
|
@ -49,19 +62,33 @@ my @message;
|
|||
close MESSAGE;
|
||||
|
||||
foreach my $fullEmailLine (@sendTo) {
|
||||
$fullEmailLine =~ s/\s*#.*$//; $fullEmailLine =~ s/\s*$//; $fullEmailLine =~ s/^\s*//;
|
||||
$fullEmailLine = Encode::encode("MIME-Header", $fullEmailLine);
|
||||
#
|
||||
my $emailTo = $fullEmailLine;
|
||||
$emailTo =~ s/^[^<]+\<\s*([^\>]+)\s*\>\s*$/$1/;
|
||||
my $doSkip = 0;
|
||||
foreach my $skip (keys %skip) {
|
||||
if ($fullEmailLine =~ /$skip/) {
|
||||
print STDERR "Skipping $fullEmailLine\n";
|
||||
$doSkip = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
next if $doSkip;
|
||||
|
||||
open(SENDMAIL, "|/usr/lib/sendmail -f \"$FROM_ADDRESS\" -oi -oem -- $emailTo $FROM_ADDRESS") or
|
||||
$fullEmailLine =~ s/\s*#.*$//; $fullEmailLine =~ s/\s*$//; $fullEmailLine =~ s/^\s*//;
|
||||
|
||||
my $emailTo;
|
||||
die unless $fullEmailLine =~ /^"?([^\<]+)\s*"?\<\s*([^\>]+)\s*\>\s*$/;
|
||||
($fullEmailLine, $emailTo) = ($1, $2);
|
||||
$fullEmailLine =~ s/\s*\"?\s*$//; $fullEmailLine =~ s/^\s*"?\s*//;
|
||||
$fullEmailLine = $encoder->encode_phrase($fullEmailLine) . " <" . $emailTo .">";
|
||||
#
|
||||
|
||||
open(SENDMAIL, "|/usr/lib/sendmail -f \"$FROM_ADDRESS\" -oi -oem -- \"$emailTo\" \"$FROM_ADDRESS\"") or
|
||||
die "unable to run sendmail: $!";
|
||||
|
||||
print SENDMAIL "To: $fullEmailLine\n"; # X-Precedence: bulk\n";
|
||||
print SENDMAIL @message;
|
||||
|
||||
close SENDMAIL;
|
||||
print STDERR "Sentto \"$fullEmailLine\" at $emailTo\n";
|
||||
sleep 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
28
time-span-in-hours.plx
Executable file
28
time-span-in-hours.plx
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
sub TimeCalc($$) {
|
||||
my($date, $start) = @_;
|
||||
my $finish = $start;
|
||||
use Date::Manip;
|
||||
$start =~ s/^\s*([^\-]+)\-.*$/$1/;
|
||||
$finish =~ s/^.*\-([^\-]+)\s*$/$1/;
|
||||
$start = ParseDate("$date $start");
|
||||
$finish = ParseDate("$date $finish");
|
||||
return Delta_Format(DateCalc($start, $finish), 5, '%ht');
|
||||
}
|
||||
my $input;
|
||||
if (@ARGV == 0) {
|
||||
$input = <STDIN>;
|
||||
chomp $input;
|
||||
} elsif (@ARGV == 1) {
|
||||
$input = $ARGV[0];
|
||||
} else {
|
||||
die "oneargor noarg";
|
||||
}
|
||||
|
||||
print TimeCalc('today', $input), "\n";
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/perl
|
||||
# urgent-mail-check.plx
|
||||
#
|
||||
# Copyright (C) 2013, Bradley M. Kuhn
|
||||
# Copyright (C) 2013, 2015, 2016, Bradley M. Kuhn
|
||||
#
|
||||
# This program gives you software freedom; you can copy, modify, convey,
|
||||
# and/or redistribute it under the terms of the GNU General Public License
|
||||
|
|
@ -26,57 +26,61 @@ use Date::Manip;
|
|||
use Net::IMAP::Client;
|
||||
use File::Spec;
|
||||
use File::Temp;
|
||||
use Encode qw(encode decode);
|
||||
|
||||
if (@ARGV != 2) {
|
||||
print STDERR "usage: <username> <password_file>\n";
|
||||
my $VERBOSE = 0;
|
||||
if (@ARGV != 3) {
|
||||
print STDERR "usage: <server> <username> <password_file>\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my($SERVER, $USERNAME, $PASSWORD_FILE) = @ARGV;
|
||||
|
||||
my $DIR = File::Spec->catdir("$ENV{HOME}", 'tmp', '.urgent-email-displayed');
|
||||
|
||||
chdir($DIR) or die "unable to go to $DIR";
|
||||
|
||||
######################################################################
|
||||
sub ReadRecentUrgentEmailAnnouncements ($) {
|
||||
my($dir) = @_;
|
||||
sub ReadRecentUrgentEmailAnnouncements ($$) {
|
||||
my($dir, $server) = @_;
|
||||
|
||||
my %info;
|
||||
my $file = File::Spec->catfile($dir, 'urgent-email-announce-recent');
|
||||
open(RECENT_ALERTS, "<", $file) or die "unable to open $file for reading: $!";
|
||||
my $file = File::Spec->catfile($dir, $server . '.urgent-email-announce-recent');
|
||||
open(RECENT_ALERTS, '<:encoding(UTF-8)', $file) or die "unable to open $file for reading: $!";
|
||||
my $key;
|
||||
my $data = "";
|
||||
foreach my $line (<RECENT_ALERTS>) {
|
||||
chomp $line;
|
||||
next if $line =~ /^\s*$/;
|
||||
if ($line =~ /^\s*([\d\:\-]+)\s*$/) {
|
||||
my $newKey = $1;
|
||||
$info{$key} = $data if defined $key;
|
||||
$key = $newKey;
|
||||
$data = "";
|
||||
} else {
|
||||
$data .= $line;
|
||||
if ($line =~ /^\s*\"(.*)\"\s*:\s*([\d\:\-]+)\s*$/) {
|
||||
my($key, $date) = ($1, $2);
|
||||
$info{$key} = $date if defined $key;
|
||||
}
|
||||
}
|
||||
close RECENT_ALERTS; die "error($?) reading $file: $!" unless $? == 0;
|
||||
|
||||
$info{$key} = $data if (defined $key); # Grab last one.
|
||||
|
||||
return \%info;
|
||||
}
|
||||
######################################################################
|
||||
sub WriteRecentUrgentEmailAnnouncements ($$) {
|
||||
my($dir, $info) = @_;
|
||||
sub WriteRecentUrgentEmailAnnouncements ($$$) {
|
||||
my($dir, $server, $info) = @_;
|
||||
|
||||
my $file = File::Spec->catfile($dir, 'urgent-email-announce-recent');
|
||||
open(RECENT_ALERTS, ">", $file) or die "unable to open $file for reading: $!";
|
||||
my $file = File::Spec->catfile($dir, $server . '.urgent-email-announce-recent');
|
||||
print STDERR "writing to $file\n" if $VERBOSE;
|
||||
open(RECENT_ALERTS, '>:encoding(UTF-8)', $file) or die "unable to open $file for reading: $!";
|
||||
|
||||
foreach my $key (sort keys %$info) {
|
||||
print RECENT_ALERTS "$key\n$info->{$key}\n";
|
||||
print STDERR "\"$key\": $info->{$key}\n" if $VERBOSE;
|
||||
print RECENT_ALERTS "\"$key\": $info->{$key}\n";
|
||||
}
|
||||
close RECENT_ALERTS; die "error($?) writing $file: $!" unless $? == 0;
|
||||
print STDERR "Closed $file\n" if $VERBOSE;
|
||||
}
|
||||
######################################################################
|
||||
# Test if network is up
|
||||
if (-f "$ENV{HOME}/.shoddy-network") {
|
||||
print "\${color5}Shoddy Network, no urgent email check!\n";
|
||||
exit 0;
|
||||
}
|
||||
system('/bin/ping -q -w 20 -c 5 pine.sfconservancy.org > /dev/null 2>&1');
|
||||
|
||||
if ($? != 0) {
|
||||
|
|
@ -84,31 +88,30 @@ if ($? != 0) {
|
|||
exit 0;
|
||||
}
|
||||
|
||||
if (not -f $ARGV[1]) {
|
||||
print "\${color5}File $ARGV[1] not readable!\n";
|
||||
if (not -f $PASSWORD_FILE) {
|
||||
print "\${color5}File $PASSWORD_FILE not readable!\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $output = "";
|
||||
my $record = "";
|
||||
my $info = ReadRecentUrgentEmailAnnouncements($DIR);
|
||||
my $info = ReadRecentUrgentEmailAnnouncements($DIR, $SERVER);
|
||||
|
||||
# open a connection to the IMAP server
|
||||
use Net::IMAP::Client;
|
||||
open(PW, "<", $ARGV[1]) or die "unable to open $ARGV[0] to find password!";
|
||||
open(PW, "<", $PASSWORD_FILE) or die "unable to open $PASSWORD_FILE to find password!";
|
||||
|
||||
my %passwords;
|
||||
while (my $line = <PW>) {
|
||||
die "invalid line in password file: $ARGV[1]"
|
||||
die "invalid line in password file: $PASSWORD_FILE"
|
||||
unless $line =~ /^\s*(\S+)\s+(\S+)\s*$/;
|
||||
$passwords{$1} = $2;
|
||||
}
|
||||
close PW;
|
||||
|
||||
my $imap = Net::IMAP::Client->new(
|
||||
server => 'pine.sfconservancy.org',
|
||||
user => $ARGV[0],
|
||||
pass => $passwords{$ARGV[0]},
|
||||
server => $SERVER,
|
||||
user => $USERNAME,
|
||||
pass => $passwords{$USERNAME},
|
||||
ssl => 1, # (use SSL? default no)
|
||||
ssl_verify_peer => 1, # (use ca to verify server, default yes)
|
||||
# ssl_ca_file => '/etc/ssl/certs/certa.pm', # (CA file used for verify server) or
|
||||
|
|
@ -126,51 +129,80 @@ my $summaries = $imap->get_summaries($messages);
|
|||
|
||||
use Data::Dumper;
|
||||
|
||||
my(%noticeOutput);
|
||||
my $now = ParseDate("now");
|
||||
foreach my $summary (@{$summaries}) {
|
||||
my $now = ParseDate("now");
|
||||
my($who, $subject) = ($summary->{from}->[0]->name, $summary->subject);
|
||||
my $datetime = ParseDate($summary->date);
|
||||
my $ago = Delta_Format(DateCalc($datetime, $now), 0, "%dt days");
|
||||
$ago = Delta_Format(DateCalc($datetime, $now), 0, "%ht hours")
|
||||
if (defined $ago and $ago =~ /0 days/);
|
||||
$ago = Delta_Format(DateCalc($datetime, $now), 0, "%mt minutes")
|
||||
if (defined $ago and $ago =~ /0 hours/);
|
||||
$ago = Delta_Format(DateCalc($datetime, $now), 0, "%st seconds")
|
||||
if (defined $ago and $ago =~ /0 minutes/);
|
||||
my $output = "";
|
||||
my $ago = Delta_Format(DateCalc($datetime, $now), "approx", 0, "%dt days");
|
||||
$ago = Delta_Format(DateCalc($datetime, $now), "approx", 0, "%ht hours")
|
||||
if (defined $ago and $ago =~ /(^|\s+)0\s+day/);
|
||||
$ago = Delta_Format(DateCalc($datetime, $now), "approx", 0, "%mt minutes")
|
||||
if (defined $ago and $ago =~ /(^|\s+)0\s+hour/);
|
||||
$ago = Delta_Format(DateCalc($datetime, $now), "approx", 0, "%st seconds")
|
||||
if (defined $ago and $ago =~ /(^|\s+)0\s+minute/);
|
||||
$ago = "" if not defined $ago;
|
||||
$subject = "" unless defined $subject;
|
||||
|
||||
$subject = (split('\n', $subject))[0];
|
||||
$subject =~ s/^\s*Re\s*:\s*//i;
|
||||
my $record = "$who about $subject";
|
||||
$output .= "\${font Inconsolata:size=13}$ago ago from $record\n";
|
||||
|
||||
my $alreadyDone = 0;
|
||||
foreach my $key (keys %$info) {
|
||||
$alreadyDone = (($info->{$key} eq $record) and
|
||||
(Delta_Format(DateCalc($key, $now), 0, "%mt") < 14400));
|
||||
last if $alreadyDone;
|
||||
}
|
||||
unless ($alreadyDone) {
|
||||
$info->{$now} = $record;
|
||||
my $fh = File::Temp->new();
|
||||
$fh->unlink_on_destroy( 1 );
|
||||
my $fname = $fh->filename;
|
||||
print $fh "Urgent email: ";
|
||||
print $fh $record;
|
||||
$fh->close();
|
||||
system("$ENV{HOME}/bin/myosd", $fname);
|
||||
system('/usr/bin/notify-send', '-u', 'critical', '-t', '300000',
|
||||
'Urgent Email', $record);
|
||||
system("$ENV{HOME}/bin/myspeakbyfile", $fname)
|
||||
unless -f "$ENV{HOME}/.silent-running";
|
||||
}
|
||||
next if not defined $subject or $subject =~ /^\s*$/;
|
||||
$who = "unknown" unless defined $who;
|
||||
my $record = encode('UTF-8', "$who about $subject");
|
||||
|
||||
$noticeOutput{$record}{output} = $output;
|
||||
$noticeOutput{$record}{datetime} = $datetime;
|
||||
$noticeOutput{$record}{who} = $who;
|
||||
$noticeOutput{$record}{subject} = $subject;
|
||||
}
|
||||
WriteRecentUrgentEmailAnnouncements($DIR, $info);
|
||||
my $olderCount = 0;
|
||||
my $oldestNow = $now;
|
||||
my $SEVEN_DAYS_AGO = DateCalc($now, "-7 days");
|
||||
my $allOutput = "";
|
||||
foreach my $record (sort {$noticeOutput{$a}{datetime} cmp $noticeOutput{$b}{datetime} } keys %noticeOutput ) {
|
||||
my $alreadyDone = (defined $info->{$record} ) ? $info->{$record} : undef;
|
||||
#and (Delta_Format(DateCalc($info->{$record}, $now), "approx", 0, "%ht") < 96));
|
||||
# uncomment above and put into expression if you want reminders on older emails you're ignoring in urgent.
|
||||
$info->{$record} = $now;
|
||||
if ($noticeOutput{$record}{datetime} lt $SEVEN_DAYS_AGO) {
|
||||
$olderCount++;
|
||||
$oldestNow = $alreadyDone if defined $alreadyDone and $alreadyDone lt $oldestNow;
|
||||
next;
|
||||
} else {
|
||||
$allOutput .= $noticeOutput{$record}{output};
|
||||
}
|
||||
next if defined $alreadyDone;
|
||||
|
||||
print "\$hr\n\${font :size=17}Urgent Emails:\n$output\$hr" if ($output ne "");
|
||||
$info->{$record} = $now;
|
||||
my $fh = File::Temp->new();
|
||||
$fh->unlink_on_destroy( 1 );
|
||||
my $fname = $fh->filename;
|
||||
print $fh "Urgent email: ";
|
||||
print $fh $record;
|
||||
$fh->close();
|
||||
# system("$ENV{HOME}/bin/myosd", $fname);
|
||||
system('/usr/bin/notify-send', '-u', 'critical', '-t', '300000',
|
||||
'Urgent Email', $record);
|
||||
system("$ENV{HOME}/bin/myspeakbyfile", $fname)
|
||||
unless -f "$ENV{HOME}/.silent-running";
|
||||
}
|
||||
WriteRecentUrgentEmailAnnouncements($DIR, $SERVER, $info);
|
||||
|
||||
if ($allOutput ne "") {
|
||||
print "\$hr\n\${font :size=17}Urgent Emails:\n$allOutput";
|
||||
print "\${font Inconsolata:size=13}... and $olderCount emails older than 7 days\n" if $olderCount > 0;
|
||||
print "\$hr";
|
||||
}
|
||||
my $hoursSinceNotify = Delta_Format(DateCalc($oldestNow, $now), "approx", 0, "%ht");
|
||||
if ($olderCount > 0 and $hoursSinceNotify > 1) {
|
||||
system('/usr/bin/notify-send', '-u', 'critical', '-t', '300000',
|
||||
'LONG PENDING URGENT EMAIL',
|
||||
"$olderCount urgent emails in folder older than 7 days (last remind: $hoursSinceNotify)");
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Local variables:
|
||||
# compile-command: "perl -c urgent-mail-check.plx"
|
||||
# End:
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,13 @@ for (text, link) in find_md_links(body_markdown):
|
|||
errMsg = None
|
||||
if not re.match(r'^(mailto|http|ftp|#)', link, re.IGNORECASE):
|
||||
path = Path(link)
|
||||
if not path.is_file():
|
||||
if not path.is_file() and not path.is_dir():
|
||||
errMsg = "local file by that name does not exist for relative file link"
|
||||
else:
|
||||
print(path)
|
||||
# FIXME: test other types of links
|
||||
if errMsg:
|
||||
print("Bad link of \"%s\" (labeled as \"%s\") has error: %s" % (link, text, errMsg))
|
||||
print("# Bad link of \"%s\" (labeled as \"%s\") has error: %s" % (link, text, errMsg))
|
||||
|
||||
exit(0)
|
||||
# Below doesn't work, didn't have time to find out why
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue