git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
keyboard/altgr: label keys in each row with big class
[sheet.git]
/
tools
/
mkusage-wikimedia
diff --git
a/tools/mkusage-wikimedia
b/tools/mkusage-wikimedia
index 7a59ba54bc0e8af83469b53ae37e996a112d7b2b..71d6e5fa077000cf2fb40541d3ab8ab4fb6cf0e8 100755
(executable)
--- a/
tools/mkusage-wikimedia
+++ b/
tools/mkusage-wikimedia
@@
-4,13
+4,13
@@
use warnings;
use Data::Dump 'pp';
use Data::Dump 'pp';
-our $VERSION = '1.0
1
';
+our $VERSION = '1.0
3
';
my %BROWSERID = qw(
my %BROWSERID = qw(
- IE
i
e
+ IE
edg
e
IE-Mobile ie_mob
IE-Mobile ie_mob
- Edge
i
e
- Edge-Mobile
i
e
+ Edge
edg
e
+ Edge-Mobile
edg
e
Firefox firefox
Firefox-Mobile and_ff
Safari safari
Firefox firefox
Firefox-Mobile and_ff
Safari safari
@@
-18,14
+18,15
@@
my %BROWSERID = qw(
Mobile-Safari-UIWebView ios_saf
Chrome chrome
Chromium chrome
Mobile-Safari-UIWebView ios_saf
Chrome chrome
Chromium chrome
- Chrome-Mobile and
roid
- Chrome-Mobile-iOS and
roid
- Android and
roid
+ Chrome-Mobile and
_chr
+ Chrome-Mobile-iOS and
_chr
+ Android and
_chr
Opera opera
Opera-Mini op_mini
BlackBerry-WebKit bb
UC-Browser and_uc
Samsung-Internet samsung
Opera opera
Opera-Mini op_mini
BlackBerry-WebKit bb
UC-Browser and_uc
Samsung-Internet samsung
+ Google 0
Other 0
);
Other 0
);
@@
-34,14
+35,21
@@
my %count = (
-site => 'https://analytics.wikimedia.org/',
);
-site => 'https://analytics.wikimedia.org/',
);
-my $recent = qr/^2019-/;
-
(readline =~ y/\t//) == 3 or die "unexpected amount of columns in header\n";
(readline =~ y/\t//) == 3 or die "unexpected amount of columns in header\n";
+my @lines = readline;
+
+my $recent; # minimum date to include
+for (reverse @lines) {
+ my ($date) = /(\S+)/;
+ $recent ne $date or next if $recent; # same day
+ $recent = $date; # override older date
+ last if state $i++ >= 2; # repeat twice
+}
-
while (my $row = readline
) {
+
for my $row (@lines
) {
$row =~ s/\r?\n\z//;
my ($date, $name, $version, $pct) = split /\t/, $row;
$row =~ s/\r?\n\z//;
my ($date, $name, $version, $pct) = split /\t/, $row;
- $date
=~
$recent or next;
+ $date
ge
$recent or next;
$name =~ y/ /-/;
my $browser = $BROWSERID{$name};
if (not $browser) {
$name =~ y/ /-/;
my $browser = $BROWSERID{$name};
if (not $browser) {