Skip to content

Commit

Permalink
Added death dates to ICS file - #96
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Oct 18, 2019
1 parent 28ea891 commit abae030
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ BEGIN {
if($@) {
system('cpan -i Gedcom Genealogy::Gedcom::Date Date::Parse Geo::Coder::List Geo::Coder::Free IPC::System::Simple Geo::Coder::Ovi CHI String::Compare');
system('cpan -i Geo::Coder::RandMcnally Geo::Coder::US::Census Geo::Coder::OSM Geo::Coder::XYZ Geo::Coder::CA Geo::Coder::Postcodes Geo::Coder::OpenCage');
system('cpan -i Net::OAuth Geo::Coder::GooglePlaces Geo::Coder::Bing Geo::GeoNames F/FR/FRIFFIN/Geo-Coder-PlaceFinder-0.1.tar.gz');
system('cpan -i Lingua::EN::NameCase Lingua::EN::Numbers::Ordinate Lingua::EN::ABC Lingua::EN::Inflect DateTime::Format::Natural');
system('cpan -i DateTime::Format::Genealogy URI::Find::Schemeless Sort::Key::DateTime Text::Names::GB HTTP::Cache::Transparent Geo::Coder::DataScienceToolkit');
system('cpan -i LWP::UserAgent::Cached Class::Simple::Cached Class::Simple::Readonly::Cached Data::ICal Data::ICal::Entry::Event Date::ICal Data::ICal::TimeZone Data::ICal::TimeZone');

This comment has been minimized.

Copy link
@tukusejssirs

tukusejssirs Oct 18, 2019

L. 35: You still mention the package twice: Data::ICal::TimeZone Data::ICal::TimeZone.

system('cpan -i Net::OAuth Geo::Coder::GooglePlaces Geo::Coder::Bing Geo::GeoNames F/FR/FRIFFIN/Geo-Coder-PlaceFinder-0.1.tar.gz');
}

# FIXME
Expand Down Expand Up @@ -1034,9 +1034,8 @@ sub generate {

print "$firstname, $surname\n";

my $birth = $person->get_record('birth');
my $dateofbirth = get_value({ person => $person, value => 'birth date' });
if((!$dateofbirth) && $birth) {
if((!defined($dateofbirth)) && (my $birth = $person->get_record('birth'))) {
$dateofbirth = $birth->date();
}
if($dateofbirth) {
Expand All @@ -1045,9 +1044,8 @@ sub generate {
$dateofbirth = 'NULL';
}

my $death = $person->get_record('death');
my $dateofdeath = get_value({ person => $person, value => 'death date' });
if((!$dateofdeath) && $death) {
if((!defined($dateofdeath)) && (my $death = $person->get_record('death'))) {
$dateofdeath = $death->date();
}
if($dateofdeath) {
Expand Down Expand Up @@ -1151,18 +1149,28 @@ sub generate {

next;
} elsif($ical) {
my $birth = $person->get_record('birth');
my $dateofbirth = get_value({ person => $person, value => 'birth date' });
if((!$dateofbirth) && $birth) {
if((!defined($dateofbirth)) && (my $birth = $person->get_record('birth'))) {
$dateofbirth = $birth->date();
}
next unless($dateofbirth);
next unless($dateofbirth =~ /^\d+\s\w{3}\s\d{3,4}$/);
add_to_ical(
ical => $ical,
datetime => date_to_datetime(date => $dateofbirth),
summary => 'birth of ' . $person->as_string()
);
if($dateofbirth && ($dateofbirth =~ /^\d+\s\w{3}\s\d{3,4}$/)) {
add_to_ical(
ical => $ical,
datetime => date_to_datetime(date => $dateofbirth),
summary => 'birth of ' . $person->as_string()
);
}
my $dateofdeath = get_value({ person => $person, value => 'death date' });
if((!defined($dateofdeath)) && (my $death = $person->get_record('death'))) {
$dateofdeath = $death->date();
}
if($dateofdeath && ($dateofdeath =~ /^\d+\s\w{3}\s\d{3,4}$/)) {
add_to_ical(
ical => $ical,
datetime => date_to_datetime(date => $dateofdeath),
summary => 'death of ' . $person->as_string()
);
}
next;
}

Expand Down

0 comments on commit abae030

Please sign in to comment.