Erg Tweet -- post to C2 via Twitter

Please add feature and function requests for PM3 firmware, DLL/API's, and documentation here.
Post Reply
ergscores
Paddler
Posts: 2
Joined: December 9th, 2006, 1:30 am
Location: San Diego
Contact:

Erg Tweet -- post to C2 via Twitter

Post by ergscores » June 24th, 2009, 11:07 am

Not sure where this goes, so I'll put here under software.

I wrote a little app (ErgFeed) that will allow you to "erg tweet" your erg scores. Just send a tweet to @ergscores with DISTANCE TIME DATE(optional) comments(optional). (see http://twitter.com/ergscores)

TIME can be split or total time.

If you log into http://ergfeed.appspot.com (uses Google account) you can setup your C2 logbook profile and tweets will get posted to your logbook.

Just a small app that maybe some finds useful.

User avatar
Citroen
SpamTeam
Posts: 8054
Joined: March 16th, 2006, 3:28 pm
Location: A small cave in deepest darkest Basingstoke, UK

Post by Citroen » June 24th, 2009, 11:20 am

I've edited your post to fix the URLs (sorry about the restriction on new users not being able to post URLs - it's to stop spammers).

Rather than using ERGfeed to update your C2 logbook (I'm using the C2 Utility for that), how about using the C2 logbook to update ERGfeed and tweet the results?

I'd use http://concept2.com/sranking03/small_co ... ser=142454 as the data source (you'd have to store the data in a database so you can calculate the delta) and go round and poll all the registered users on a timer. That doesn't need the userid/password for the C2 logbook, it's a public URL used for the iGoogle widget (only needs a ranking ID).

Of course, what we really need from the nice folks in Vermont is a RESTful API for the C2 Logbook. That would let us play in Web 2.0 with all of the logbook stuff.
Dougie Lawson
61yrs, 172cm, Almost LWt (in my dreams).
Twitter: @DougieLawson

ToddMR
Paddler
Posts: 38
Joined: August 28th, 2008, 7:12 pm

Post by ToddMR » July 14th, 2009, 2:42 pm

Is there a way to add the information in the iGoogle C2 counter to my WordPress blog?

User avatar
Citroen
SpamTeam
Posts: 8054
Joined: March 16th, 2006, 3:28 pm
Location: A small cave in deepest darkest Basingstoke, UK

Post by Citroen » July 14th, 2009, 4:40 pm

ToddMR wrote:Is there a way to add the information in the iGoogle C2 counter to my WordPress blog?
You can use:
http://concept2.com/sranking03/small_co ... ser=142454<<< use your ranking ID here
as a raw datasource. It's not difficult to parse the HTML that's returned using something like HTML::TokeParser in Perl.

Use that as the source for any gadget or widget, if you're prepared to write some code round it. It'll work in a simple IFRAME.

Code: Select all

<iframe src ="http://concept2.com/sranking03/small_counter.asp?user=142454" width="100%" height="600px">
<p>Your browser does not support iframes.</p>
</iframe>
What we really need is a Web 2.0 RESTful API for the C2 Logbook. Perhaps if I say that often enough C2 will do it for me.
Dougie Lawson
61yrs, 172cm, Almost LWt (in my dreams).
Twitter: @DougieLawson

ToddMR
Paddler
Posts: 38
Joined: August 28th, 2008, 7:12 pm

Post by ToddMR » August 9th, 2009, 1:29 pm

Is there a way to get just the text data from the
http://concept2.com/sranking03/small_co ... ser=142454<<< use your ranking ID here without the image?

I'd like to put the counter data into a sidebar text widget, but they're limited to 160px in width.

User avatar
Citroen
SpamTeam
Posts: 8054
Joined: March 16th, 2006, 3:28 pm
Location: A small cave in deepest darkest Basingstoke, UK

Post by Citroen » August 9th, 2009, 3:28 pm

ToddMR wrote:I'd like to put the counter data into a sidebar text widget, but they're limited to 160px in width.
Here's a bit of scruffy Perl code that will strip out the <TABLE></TABLE> with the main detail.

Code: Select all

#! /usr/bin/perl

  use strict;
  use LWP::Simple;
  use HTML::TokeParser;
  use Switch;
 
  my $url= 'http://concept2.com/sranking03/small_counter.asp?user=142454';
  my $content = get $url;
  die "Couldn't get $url" unless defined $content;

  my $parse = HTML::TokeParser->new(\$content);
  my $output = 0;
  my ($tag, $attr, $attrseq, $rawtxt);

  while (my $token = $parse->get_token)
  {  my $ttype = shift @{$token};
     my ($tag1, $tag2, $tag3, $tag4) = @{$token};
     if ($ttype eq "S") {if ($tag1 eq "table") {$output = 1;}} 
     if ($ttype eq "E") {if ($tag1 eq "table") {print $tag2; $output = 0;}}
     if ($output eq 1) { switch ($ttype) {
        case "S" { print  $tag4 }
        case "T" { print  $tag1 }
        case "E" { print  $tag2 }
        else { print "\n" } } }
  }
Dougie Lawson
61yrs, 172cm, Almost LWt (in my dreams).
Twitter: @DougieLawson

Post Reply