User:AnomieBOT/source/tasks/OnThisDayTagger.pm: Difference between revisions

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: AnomieBOT::API: * Add configuration variable (and accessor function) for the bot operator's username * Better logging when testing uploads All tasks: * Remove useless metadata field
AnomieBOT (talk | contribs)
Updating published sources: AnomieBOT::Task: * Allow for easy exporting of POSIX::strftime, Time::Local::timegm, and Time::Local::timelocal. * Remove unneeded "use" directives. All tasks, where applicable: * Use the new exports instead of directly us
Line 25:
use strict;
 
use AnomieBOT::Task qw/:time/;
use Data::Dumper;
use POSIX;
Line 93:
for(my $d=1; $d<=31; $d++){
my $md=sprintf("%02d-%02d",$m,$d);
next unless POSIX::strftime("%m-%d",0,0,0,$d,$m-1,100) eq $md;
my $res=$api->query([],
titles => POSIX::strftime("Wikipedia:Selected anniversaries/%B %-d",0,0,0,$d,$m-1,100),
prop => 'revisions',
rvprop => 'ids|timestamp',
Line 417:
 
# The anniversary pages were created 2004-02-26 through 2004-02-28; We count
# 2004-02-26 as day 0. This function does POSIX::strftime on the day number.
# Thankfully, it correctly converts
sub day {
my $fmt=shift;
my $day=shift;
return POSIX::strftime($fmt,0,0,0,$day+26,1,104);
}
 
Line 428:
my $ts=shift;
my ($min,$max)=(0,5000);
my $target=POSIX::strftime("%F", gmtime $ts);
while(1){
my $day=day("%F",$max);