• Feed RSS
Hi.. It's been a long time since I posted any thing on this blog. There are some things I'm busy doing these days and playing cricinfo fantasy game is certainly one of them :) One of our colleagues set up a fantasy league on cricinfo at the time of WC and asked interested people to join. Since it is the WC, many joined the league and showed great interest in playing the game and getting to the top position. The league was a great success and we all have enjoyed it. And as you know, there is a circus cricket going on in India and we thought there won't be much interest in playing fantasy games. But we were proved wrong as the people have really gotten into the game, atleast till now. As IPL has 74 games, it's easy to forget making changes to the team before a match. So I developed a simple script in python and used a cronjob to change the trump and make replacements at a particular time before the match starts. I thought it would be a good idea to share it here as some people may find it useful

1) Download the script from pastebin, save as 'ci_fantasy' and make it executable
2) Change the variables tid (Team ID), 'login_email' and 'password' inside the script
3) Usage Examples:
       a) For printing the team
           python ci_fantasy
       b) For printing the team along with list of all available players
           python ci_fantasy -p
       c) For replacing a player
           python ci_fantasy -r 'old_player_id1-new_player_id1' -r 'old_player_id2-new_player_id2'
       d) For changing trump
           python ci_fantasy -t 'new_trump_player_id'
       e) Replace a player and make the replacement as trump
           python ci_fantasy -r 'old_player_id-new_player_id' -t new_player_id
   You can combine the 3 options (i.e., "-t","-r" and "-p") as you like
4) Setup a cronjob (crontab -e) on your linux machine. You can use the following tool in case you don't know how to generate cron commands
The below example will replace Raina (9388) with Hodge (9290) and make Hodge as trump at 7:38pm on 18-04 :-
38 19 18 4 * python ci_fantasy -t 9290 -p "9388-9290"
* On Windows machines you can create scheduled jobs in a similar way

Suggestions are welcome