FICS Teamleague

Board

Teamleague Forum

Why T49 is coded as T22 in the database?T49Index ->

posted at 2012-01-31 05:34 by ButiOxa

Internal tournament number was always different from the external. For example game 73 from T32 has URL with "tourney=4" in it: http://www.teamleague.org/player.php?tourney=4&pgn=73 (But, to download it, you go to http://www.teamleague.org/games/T32/73.pgn.)

A game from T33: http://www.teamleague.org/player.php?tourney=5&pgn=898
A game from T34: http://www.teamleague.org/player.php?tourney=6&pgn=1117
A game from T35: http://www.teamleague.org/player.php?tourney=7&pgn=2118
A game from T36: http://www.teamleague.org/player.php?tourney=8&pgn=2603
A game from T37: http://www.teamleague.org/player.php?tourney=9&pgn=3681
A game from T38: http://www.teamleague.org/player.php?tourney=10&pgn=4041
A game from T39: http://www.teamleague.org/player.php?tourney=11&pgn=4825
A game from T40: http://www.teamleague.org/player.php?tourney=12&pgn=5666
A game from T41: http://www.teamleague.org/player.php?tourney=13&pgn=6478
A game from T42: http://www.teamleague.org/player.php?tourney=14&pgn=7320
A game from T43: http://www.teamleague.org/player.php?tourney=15&pgn=7867
A game from T44: http://www.teamleague.org/player.php?tourney=16&pgn=9027
A game from T45: http://www.teamleague.org/player.php?tourney=17&pgn=9904
A game from T46: http://www.teamleague.org/player.php?tourney=18&pgn=10298
A game from T47: http://www.teamleague.org/player.php?tourney=19&pgn=11369
A game from T48: http://www.teamleague.org/player.php?tourney=20&pgn=11913
A game from T49: http://www.teamleague.org/player.php?tourney=22&pgn=12410


Why did the number in URL jump in the last line? My script expected 21, not 22 there. Was I wrong to rely on a formula, should I have a table instead? Or was it one time glitch tha should not happen again?

posted at 2012-02-01 08:56 by wmahan

That number is a database ID. Assuming a linear relationship between TL edition and database ID, or that the ID will be otherwise predictable, is certainly fragile and probably not a good idea.

That said, I would like to help make the data you want accessible. It looks possible to remove the requirement for passing in the tourney number at all, but I should talk with fernbap before making any changes. Can you explain what your script does?

posted at 2012-02-02 05:14 by ButiOxa

Please do not change anything for my behalf, as this is only a very small inconvenience for me.

The script http://www.mrfixitonline.com/post_chess_game.php fetches a copy of game PGN from teamleague.org. (We do it when Mekk's watchbot is broken or there are no comments.) The MFO poster usually has a game page (url]http://www.teamleague.org/player.php?tourney=22&pgn=12417[/url]) opened in a browser. Instead of hunting for the game number and tournament number there, poster just copies URL from address bar, and script parses that.

Because we never need to get games from previous tournaments, it's enough to fix the script before each new tournament and only if delta changes. Not a big deal.

Thanks.

posted at 2012-02-08 21:07 by wmahan

I went ahead and removed the requirement to specify the tourney number to the game player. So now you can just link to http://www.teamleague.org/player.php?pgn=12417, for example.

posted at 2012-02-18 05:18 by ButiOxa

Good idea. Unfortunately, you only did half of the work.

Using my first example, now I can get to a game viewer by going either to

http://www.teamleague.org/player.php?tourney=4&pgn=73 or http://www.teamleague.org/player.php?tourney=4&pgn=73, but I can only get to the PGN of the game by using old http://www.teamleague.org/games/T32/73.pgn notation.

I expected that I can use http://www.teamleague.org/games/73.pgn, but it does not work!

The point of the script is getting PGN given the (easily available on the site) viewer URL. Now that the site uses new tourneyless format, where does my script get the tournament number which is still required for fetching PGN?

posted at 2012-02-19 00:06 by wmahan

Well, I don't think changing the organization of the PGN files is a good idea. Instead I made a quick script to download a given PGN file. For example, http://teamleague.org/pgn.php?pgn=12727.

Does that do what you want?

posted at 2012-02-19 07:33 by ButiOxa

Strangely, it does not do what I want, even though it is exactly what I want. I am not sure why it does not work, but this PHP code

$fetched_pgn1 = file_get_contents_curl("http://teamleague.org/pgn.php?pgn=12713");
$fetched_pgn2 = file_get_contents_curl("http://teamleague.org/games/T49/12713.pgn");
$fetched_pgn = "$fetched_pgn1--==========================================--$fetched_pgn2";

should produce (in $fetched_pgn) same PGN string twice, separated by a line of equals, but it does not. First curl apparently fetches empty string! Both URLs work fine in browser. My guess is that the new URL uses some redirection technique CURL cannot handle. Is it so?

posted at 2012-02-19 10:13 by wmahan

Your guess is exactly right. There is apparently a CURLOPT_FOLLOWLOCATION, but I'm not sure if you are able to turn it on, so I changed the script to send the file without a redirect. It should work now.

posted at 2012-02-19 12:05 by ButiOxa

Everything works fine now. Thanks a lot.