I'm having weird amount of fun while tinkering with this script, thanks again to Gede (and sorry windows folks, I'm not going to learn how to do all that in python - perl, bash and bunch of linux commandline utilities is what you get).
First, you have to log TNP output. -u is needed otherwise output will be buffered and you only get notification after 4096 bytes of output accumulate, which is far too late:
while true; do python3 -u ./the_napping_gamer.py 2>&1 | tee -a the_napping_gamer.log; if ! sleep 10; then break; fi; done
If you want to know what games are part of insomnia, or what exactly to put into your wishlist.txt (should you include ":" or not etc.):
cat the_napping_gamer.log | perl -n -e'if (m/NEW! "(.*)"/) { print "$1\n"; }' | sort | uniq
You can also redirect output of above commands to a file, say "list_snapshot", let it run for a while and then see what new games GOG added to the insomnia since then:
cat the_napping_gamer.log | perl -n -e'if (m/NEW! "(.*)"/) { print "$1\n"; }' | sort | uniq | cat - list_snapshot | sort | uniq -u
And finally, if you want to know how much money GOG got from insomnia (only estimate - because regional prices, nobody probably has the complete log, and the log will contain duplicates around restarts/crashes):
#!/usr/bin/env perl
my $totalPrice = 0;
my $totalItems = 0;
my $lastGame = '';
while ($_ = <STDIN>) {
if (m#\d{2,2}:\d{2,2}:\d{2,2}\s*"([^"]*)"\s*[A-Z]{3,3}\s*([0-9.]*)\s*\d+/(\d+)#) {
if ($1 ne $lastGame) {
$lastGame = $1;
$totalItems += $3;
$totalPrice += ($3 * $2);
}
}
}
printf "total sales: $totalItems for $totalPrice \$, average %.2f\n", ($totalPrice / $totalItems);
Also, a small bug:
16:51:51 NEW! "reus" at USD 1.99 (-80%) 16/25 copies ('
https://www.gog.com//game/reus',)
15:51:51 "reus" USD 1.99 16/25
You may nap for 0.8 more minutes (15:52:39). I'll stand guard! Next peek in 30 seconds.
The first timestamp respects my UTC offset, second does not.
EDIT: bug in sale summary script