Go to Post Here we go again with all kinds of speculation. We can never out guess FIRST. - BobC [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications > Website Design/Showcase
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-03-2010, 19:42
LukeS LukeS is offline
4272 mentor, 1024 alumnus
AKA: Luke Shumaker
FRC #4272
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Indianapolis, IN
Posts: 60
LukeS is an unknown quantity at this point
API for FMS twitter feed

I wrote this last night, and after seeing that it works today, figured I might share it.

This is a PHP API to grab the #FRCFMS Twitter feed, and parse it's data in an easy-to-access way.

The file is http://servb.ath.cx:3445/~luke/1024/frcfms/frcfms.php, get the source at http://servb.ath.cx:3445/~luke/1024/...ile=frcfms.php

Another file of interest is index.php, a sample use of this. adding ?team=XXXX will filter to only show a certain team. So, for example, I can see all of our team's matches with http://servb.ath.cx:3445/~luke/1024/....php?team=1024

load_frcfms() returns an array of objects that have the
  • $date, $event, $type, $match, $red, $blue
  • $r1, $r2, $r3, $rBonus, $rPenalties, $rGoals, $rGoalPen
  • $b1, $b2, $b3, $bBonus, $bPenalties, $bGoals, $bGoalPen
sub-variables for you to access. r/b1-3 are the teams involved, red/blue are the final scores.

I'll probably write up some real documentation eventually, but hopefully some of you find this useful.
  #2   Spotlight this post!  
Unread 04-03-2010, 19:51
efoote868 efoote868 is offline
foote stepped in
AKA: E. Foote
FRC #0868
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2005
Location: Noblesville, IN
Posts: 1,416
efoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond repute
Re: API for FMS twitter feed

Doesn't twitter have it's own API?

The only reason I say that is because I've done a lot of xlet programming (java applet for tru2way cable boxes), and one of the things I wrote was a twitter client.
I haven't messed with it since... last summer... and I don't intend to anymore.


Actually, come to think of it, I might tweak my program to do just that, so I have something to distract me at work these next few weeks
__________________
Be Healthy. Never Stop Learning. Say It Like It Is. Own It.

Like our values? Flexware Innovation is looking for Automation Engineers. Check us out!
  #3   Spotlight this post!  
Unread 04-03-2010, 20:09
kavisiegel kavisiegel is offline
Registered User
FRC #0061 (The Shifters)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Milford MA
Posts: 37
kavisiegel is an unknown quantity at this point
Re: API for FMS twitter feed

I didn't even think about using the Twitter feed like that, pretty sweet.. thanks for the idea!

by the way, your frcfms_event() function would probably be better off as an associative array slightly more efficient, slightly neater.
__________________
www.team61.com
  #4   Spotlight this post!  
Unread 04-03-2010, 22:41
Fletch1373's Avatar
Fletch1373 Fletch1373 is offline
Registered User
AKA: Fletch
FRC #3181 (Panthers)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2004
Location: Rochester, NY
Posts: 251
Fletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud of
Re: API for FMS twitter feed

I have also attempted this... mine isn't currently set up as a distributable API, but more for personal/team use... however I do have it live on the web for all to use

the URL is http://fletch809.mine.nu/FRCFMS

I'm wide open to suggestions for it, and already have a list of features to add

I would also like to add that mine is stored in a mySQL database for future use as twitter's API only allows you to read so many tweets at a time
__________________
Student:
<04: FRC0213> <05-08: FRC1373>
Mentor:
<09-10: FRC0809> <11-12: FRC3555> <12-14: FRC0073> <15-??: FRC3181>
Volunteer:
<FTAA> <CSA> <Defense Coordinator> <Scorekeeper> <Robot Inspector> <Official Scorer>
2016 Tour:
CTWAT [DefCoord] > Pittsburgh[Mentor/DefCoord] > TVR[FTAA] > FLR[CSA] > NE DCMP[CSA] > CMP[CSA]

Last edited by Fletch1373 : 04-03-2010 at 22:44.
  #5   Spotlight this post!  
Unread 04-03-2010, 23:38
LukeS LukeS is offline
4272 mentor, 1024 alumnus
AKA: Luke Shumaker
FRC #4272
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Indianapolis, IN
Posts: 60
LukeS is an unknown quantity at this point
Re: API for FMS twitter feed

Quote:
Originally Posted by efoote868 View Post
Doesn't twitter have it's own API?
I think so, but it was trivial to parse the RSS, the real benefit of my API is parsing of the special format of their posts into usable data.

Quote:
Originally Posted by Fletch1373 View Post
I would also like to add that mine is stored in a mySQL database for future use as twitter's API only allows you to read so many tweets at a time
That's nifty, although, if I were to do something like that, I would take advantage of Google Reader's cache to take a load off of our 300Mhz, 3.4GB server

I also think that anyone using mine should set up a cron task to download/cache a copy of the RSS feed every minute or something, as sometimes it is unresponsive, which will throw a PHP error if it can't open.
  #6   Spotlight this post!  
Unread 05-03-2010, 00:11
Fletch1373's Avatar
Fletch1373 Fletch1373 is offline
Registered User
AKA: Fletch
FRC #3181 (Panthers)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2004
Location: Rochester, NY
Posts: 251
Fletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud of
Re: API for FMS twitter feed

mine uses a cron task to run a python script every 30 minutes to parse the recent tweets(since the last recorded one), and is reading the XML version of the twitter API
__________________
Student:
<04: FRC0213> <05-08: FRC1373>
Mentor:
<09-10: FRC0809> <11-12: FRC3555> <12-14: FRC0073> <15-??: FRC3181>
Volunteer:
<FTAA> <CSA> <Defense Coordinator> <Scorekeeper> <Robot Inspector> <Official Scorer>
2016 Tour:
CTWAT [DefCoord] > Pittsburgh[Mentor/DefCoord] > TVR[FTAA] > FLR[CSA] > NE DCMP[CSA] > CMP[CSA]
  #7   Spotlight this post!  
Unread 06-03-2010, 06:16
LukeS LukeS is offline
4272 mentor, 1024 alumnus
AKA: Luke Shumaker
FRC #4272
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Indianapolis, IN
Posts: 60
LukeS is an unknown quantity at this point
Re: API for FMS twitter feed

I've updated mine to use a cache.
Check out `table.php' in http://servb.ath.cx:3445/~luke/1024/frcfms/cached/
The cache is out of-date/missing entries, because I was testing it on my computer, which didn't have constant internet, and now shell_exec is disabled on the server for security purposes, and it is needed to update the cache. Anyway, if it were enabled, it would update every minute on the minute.
  #8   Spotlight this post!  
Unread 06-03-2010, 23:36
Fletch1373's Avatar
Fletch1373 Fletch1373 is offline
Registered User
AKA: Fletch
FRC #3181 (Panthers)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2004
Location: Rochester, NY
Posts: 251
Fletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud of
Re: API for FMS twitter feed

Quote:
Originally Posted by LukeS View Post
I've updated mine to use a cache.
Check out `table.php' in http://servb.ath.cx:3445/~luke/1024/frcfms/cached/
The cache is out of-date/missing entries, because I was testing it on my computer, which didn't have constant internet, and now shell_exec is disabled on the server for security purposes, and it is needed to update the cache. Anyway, if it were enabled, it would update every minute on the minute.
Luke, Looks like you're at the spot I was a week or so ago... I chose to switch my txt "cache" file to a mysql database for efficiency reasons

also, just out of curiosity, what do you need shell_exec for?
__________________
Student:
<04: FRC0213> <05-08: FRC1373>
Mentor:
<09-10: FRC0809> <11-12: FRC3555> <12-14: FRC0073> <15-??: FRC3181>
Volunteer:
<FTAA> <CSA> <Defense Coordinator> <Scorekeeper> <Robot Inspector> <Official Scorer>
2016 Tour:
CTWAT [DefCoord] > Pittsburgh[Mentor/DefCoord] > TVR[FTAA] > FLR[CSA] > NE DCMP[CSA] > CMP[CSA]
  #9   Spotlight this post!  
Unread 07-03-2010, 19:30
michandrz michandrz is offline
Registered User
AKA: Michael
FRC #1024 (Kil-a-bytes)
Team Role: Webmaster
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Indiana
Posts: 5
michandrz is an unknown quantity at this point
Re: API for FMS twitter feed

Quote:
Originally Posted by LukeS View Post
I think so, but it was trivial to parse the RSS, the real benefit of my API is parsing of the special format of their posts into usable data.

That's nifty, although, if I were to do something like that, I would take advantage of Google Reader's cache to take a load off of our 300Mhz, 3.4GB server

I also think that anyone using mine should set up a cron task to download/cache a copy of the RSS feed every minute or something, as sometimes it is unresponsive, which will throw a PHP error if it can't open.
Luke, you finally stated to use mysql, I am shocked. oh and just to let you know it wouldn't take any of the stress off of the servers because the SQL database is on serva as well, all servb is running is NFS so serva can get to it
  #10   Spotlight this post!  
Unread 11-03-2010, 16:15
LukeS LukeS is offline
4272 mentor, 1024 alumnus
AKA: Luke Shumaker
FRC #4272
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Indianapolis, IN
Posts: 60
LukeS is an unknown quantity at this point
Re: API for FMS twitter feed

Quote:
Originally Posted by Fletch1373 View Post
Luke, Looks like you're at the spot I was a week or so ago... I chose to switch my txt "cache" file to a mysql database for efficiency reasons

also, just out of curiosity, what do you need shell_exec for?
I basically dump semi-parsed data to stdout so I can use simple UNIX utils to add it to the existing cache, via:
PHP Code:
shell_exec("echo '".$data."' | cat - cache_file.txt | sort | uniq > cache_file.txt"); 
Quote:
Originally Posted by michandrz View Post
Luke, you finally stated to use mysql, I am shocked. oh and just to let you know it wouldn't take any of the stress off of the servers because the SQL database is on serva as well, all servb is running is NFS so serva can get to it
1) no, I didn't start useing MySQL. What gave you that impression?
2) it would take less HDD space, and not have to check for updates every minute, because it is using HTTP to get google's cache. Though, I didn't do this, I did write my own cache.
  #11   Spotlight this post!  
Unread 11-03-2010, 21:49
Fletch1373's Avatar
Fletch1373 Fletch1373 is offline
Registered User
AKA: Fletch
FRC #3181 (Panthers)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2004
Location: Rochester, NY
Posts: 251
Fletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud of
Re: API for FMS twitter feed

Quote:
Originally Posted by LukeS View Post
I basically dump semi-parsed data to stdout so I can use simple UNIX utils to add it to the existing cache, via:
PHP Code:
shell_exec("echo '".$data."' | cat - cache_file.txt | sort | uniq > cache_file.txt"); 
interesting... you didn't feel like using PHP's built-in file system functions?
__________________
Student:
<04: FRC0213> <05-08: FRC1373>
Mentor:
<09-10: FRC0809> <11-12: FRC3555> <12-14: FRC0073> <15-??: FRC3181>
Volunteer:
<FTAA> <CSA> <Defense Coordinator> <Scorekeeper> <Robot Inspector> <Official Scorer>
2016 Tour:
CTWAT [DefCoord] > Pittsburgh[Mentor/DefCoord] > TVR[FTAA] > FLR[CSA] > NE DCMP[CSA] > CMP[CSA]
  #12   Spotlight this post!  
Unread 21-03-2010, 00:35
Hagar Topeka 1's Avatar
Hagar Topeka 1 Hagar Topeka 1 is offline
Blitz Team 2470
FRC #2470 (Blitz Team)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bloomington, Minnesota
Posts: 5
Hagar Topeka 1 is an unknown quantity at this point
Question Re: API for FMS twitter feed

*Bump*

I'm from a fairly inept team, and personally I have little idea what this is about (I had to Google API). I'm trying to use this code to turn the Twitter feeds into a graphic output which we can have on a computer monitor in our pit.

Again, I have absolutely no idea what I'm doing. How does one implement these programs?
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Twitter Hash Tags for the Regionals Justin Regional Competitions 13 05-03-2011 16:28
Twitter for FRC dk5sm5luigi General Forum 0 09-01-2010 08:02
HOT ITEM: Qualifications Ranking program needed for FMS Lite Andy Baker General Forum 2 17-10-2009 12:54
Strange data in FMS Twitter feed rsisk Technical Discussion 1 15-05-2009 09:53
New Vex API for MCC18: LibVexBot outpaddling Programming 2 22-12-2008 09:32


All times are GMT -5. The time now is 00:58.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi