|
2010-05-22
, 19:39
|
Posts: 527 |
Thanked: 121 times |
Joined on Feb 2010
|
#152
|
While proper backup/restore developments are in the brewery you can have a look HERE
|
2010-05-22
, 19:51
|
|
Posts: 700 |
Thanked: 846 times |
Joined on Nov 2009
|
#153
|
So MLBeeCon is truly wonderful; thanks, No!No!No!Yes!
But I follow more than one team. And of course some people care about seeing certain teams lose, e.g. during a pennant race. So here's a somewhat fancier script. Drop it someplace convenient (I put it in /home/user/bin) and make it executable (chmod +x script-name). Then invoke it as:
/home/user/bin/mlbeecon CWS CWC -STL
which says you want to cheer for the White Sox, the Cubs, and whoever is playing Saint Louis.
The icon smiles if more of your teams win than lose, frowns if losers outnumber winners, and is smug if everything is balanced.
Code:#!/bin/bash # # Fetch MLB scores and colorize them for use with Queen BeeCon. # USAGE='Usage: mlbeecon [team] [team] [-team] ...' # # Each team is an abbreviation used on the m.mlb.com site. A team preceded # by a minus sign is a "team you love to hate;" the icon becomes happy if # that team loses. The icon is happy if more teams win than lose, angry # if losing dominates, and smug if the losers equal the winners. (Ties # aren't considered in thois calculation.) echo "<span foreground=\"green\"><big><i>[`date '+%m/%d/%Y %H:%M'`]</i></big></span>" wget -t 1 -T 10 -q -O - http://m.mlb.com/scores/`date +%Y%m%d`/ \ | awk 'BEGIN \ { ntm = split("'"$*"'", tm) w = 0 l = 0 t = 0 } /<td>.+<\/td>/ \ { s = gensub(/<[^>]*>/, "", "g") s = gensub(/[\t ]+/, " ", "g", s) split(s, a) ist = 0 for (i = 1; i <= ntm; i++) { ct = tm[i] bad = 0 if (ct ~ /^-/) { bad = 1 ct = substr(ct, 2) } if (a[1] == ct || a[3] == ct || a[4] == ct) { ist = 1 break } } if (!ist) { print s next } print "<span foreground=\"cyan\"><b><big>" s "</big></b></span>" if (a[2] == "vs." || a[5] == a[2]) t++ else if ((a[4] == tm[i] && a[5] > a[2]) \ || (a[1] == tm[i] && a[2] > a[5])) { w += !bad l += bad } else { w += bad l += !bad } } END \ { if (w + l + t == 0) { print "No\nMatch!\n" exit 1 } else if (w > l) exit 0 else if (w < l) exit 2 else exit 1 }'
|
2010-05-22
, 19:54
|
|
Posts: 700 |
Thanked: 846 times |
Joined on Nov 2009
|
#154
|
My widgets aren't auto-updating. I removed .queen_beecon, restarted the desktop, and recreated the MLB example (see following post for some improvements). It works fine when I click it, but doesn't update every 5 minutes. I did double-check the settings, and it's set correctly. Grepping .queen_beecon shows delayIndex=3.
Any thoughts as to why the timers aren't firing? If it's relevant, it was working earlier and then stopped; the clean restart was an attempt to get it to work properly.
|
2010-05-22
, 20:12
|
Posts: 67 |
Thanked: 36 times |
Joined on May 2010
@ Claremont (LA), California
|
#155
|
|
2010-05-22
, 21:13
|
|
Posts: 700 |
Thanked: 846 times |
Joined on Nov 2009
|
#156
|
Hi - please is it possible to alter the script to point the snippet to here:
http://m.flickr.com/#/explore/interesting/
Think the other page is static - my fault, sorry!
|
2010-05-22
, 21:15
|
|
Posts: 700 |
Thanked: 846 times |
Joined on Nov 2009
|
#157
|
First, thanks for posting my script. I forgot to mention that I'd appreciate you doing that.
Based on timestamps in /var/lib/dpkg/info, it looks like I did an update about two days ago, at 08:55 Zulu on 2010-May-20. But the md5sums are from Mar 16, which I find odd. Surely you've done a release since then? How do I find out the version I'm running?
|
2010-05-22
, 21:45
|
Posts: 76 |
Thanked: 4 times |
Joined on Apr 2010
|
#158
|
There you go ...
|
2010-05-22
, 21:50
|
|
Posts: 700 |
Thanked: 846 times |
Joined on Nov 2009
|
#159
|
|
2010-05-22
, 22:16
|
|
Posts: 700 |
Thanked: 846 times |
Joined on Nov 2009
|
#160
|
I seem to be having a bit of a problem getting the Ebay Snippet to work correctly. I followed your instructions (very clear - many thanks) but I cannot seem to get a correct output, i.e. I edit the ebay item number and click "Save and Run" and I get the item title and picture, but no timer.
Having read your recent message about the Flickr snippet I installed "Wget" application but this doesn;t appear to have done the trick.
What might be useful is a suggested 'default' for layout, font etc to optimise the appearance of the widget maybe?
But I follow more than one team. And of course some people care about seeing certain teams lose, e.g. during a pennant race. So here's a somewhat fancier script. Drop it someplace convenient (I put it in /home/user/bin) and make it executable (chmod +x script-name). Then invoke it as:
/home/user/bin/mlbeecon CWS CWC -STL
which says you want to cheer for the White Sox, the Cubs, and whoever is playing Saint Louis.
The icon smiles if more of your teams win than lose, frowns if losers outnumber winners, and is smug if everything is balanced.
Last edited by gkuenning; 2010-08-19 at 05:04. Reason: Fix bug in counting hostile teams