#!/usr/bin/perl -w use 5.010; use strict; use warnings; use autodie; # ABSTRACT: Send reminders of what you were doing a while ago. our $VERSION = '0.06'; # VERSION: Generated by DZP::OurPkg::Version # PODNAME: idonethis-memories use WebService::Idonethis; use Config::Tiny; use POSIX qw(tzset strftime); use constant ONE_WEEK => 7 * 86400; use constant ONE_MONTH => 30 * 86400; # It's about a month... use constant SIX_MONTHS => 365 * 86400 / 2; # About six months... use constant ONE_YEAR => 365 * 86400; # TODO: Leapyears $ENV{TZ} = "Australia/Melbourne"; # I'm usually here. tzset(); my $config = Config::Tiny->read( "$ENV{HOME}/.idonethisrc" ); unless ($config->{auth}{user}) { die "Cannot find credentials in $ENV{HOME}/.idonethisrc"; } my $idt = WebService::Idonethis->new( user => $config->{auth}{user}, pass => $config->{auth}{pass}, ); send_memories($idt); sub send_memories { my ($idt) = @_; my $now = time; foreach my $timeframe (ONE_YEAR, SIX_MONTHS, ONE_MONTH, ONE_WEEK) { my $then = $now - $timeframe; my $date = strftime("%Y-%m-%d", localtime($then)); my $dones = $idt->get_day($date); if ($dones->[0]) { say "Here's what you were doing on $date:\n"; foreach my $item (@$dones) { say "* $item->{text}"; } return; } } say "I have no idea what you were doing. (Probably a bug.)"; } __END__ =pod =head1 NAME idonethis-memories - Send reminders of what you were doing a while ago. =head1 VERSION version 0.06 =head1 SYNOPSIS # On the cmdline, or via cron $ idonethis-memories # In ~/.idonethisrc [auth] user=someuser pass=somepass =head1 DESCRIPTION This is a simple proof-of-concept for iDoneThis's excellent (but now defunct) memory service, which would send reminders as to what one was doing a year ago by email. Patches are extremely welcome. L =head1 AUTHOR Paul Fenwick =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Paul Fenwick. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut