Feature request General forum

9 replies. Last post: 2016-09-29

Reply to this topic Return to forum

Feature request
  • morphles at 2016-09-28

    Url to return number of games where it is users turn to play.

    Users, not self to not require login. Such url could be used in periodically running script to check if it is your turn.  Should be number not just if you have any games where it is your turn as it is not always practical to make moves on certain games immediatly (move requires some deep thinking that is not available at the time). Hate to have browser/tab open all the time, and opening it just to check, possibly multiple times a hour is a waste of everything. Incorporating number of games where it is my turn into “tray area” would be a very nice thing indeed. Worst case of course I could make script to do it from current situation (with login and parsing number out), but I do not see that as best option, as script would be complicated, and most requests would not be interested in most output just single number. So it is better to have url that just outputs that single number.

    If I get fed up with checking for games I might still write more complicated script, would be nice to have simple way to acces information though. Anyone else interested in such thing?

  • mmKALLL ★ at 2016-09-28

    I don't think that the demand for something like this would really be that high… Either way, there is no need to login to parse the data from the website; you can simply work through the profile page without authentication.

    Personally I would feel distracted by a tray area indicator, as I have lots of simultaneous games going on. I understand that such a feature might be useful in your case, though.

  • morphles at 2016-09-28

    You can't profile page does not contain such information, games in progress are not games where it is your turn. I have quite some going on too. But if you get bellow 10 games or so your turn does not come that often in my experience. As I said worst case one can do with login, but all this would be lots of needless work, for server to generate page and for script to parse.

  • z at 2016-09-28

    Isn't login as simple as sending a cookie in your http request? What do you mean by lots of needless work?

  • morphles at 2016-09-29

    Yes, you have to setup and maintain cookie and this is some work. Then get the number from html, not to difficult but needles. And in the end generation of all that html is needless for requests of such kind.

  • z at 2016-09-29

    By my estimation, it takes fewer bytes to maintain the login cookie and extract the number of games from HTML than to write your original feature request ;)

  • morphles at 2016-09-29

    But if I make requests one a minute, just retturning/getting single number from db is less intense :). But whatever I have shell pipeline for this feature, just need to set it up to run only once a min.

  • Mirko Rahn at 2016-09-29

    Do not parse the HTML!  (It is cluttered with visuals that might change and did change in the past.) Use the XML with the list of games that is provided by LG already:

    wget -o /dev/null -O /dev/stdout 'http://www.littlegolem.net/get_xml.jsp?login=$USERNAME&password=$PASSWORD'

    Of course, replace $USERNAME and $PASSWORD. That XML works perfectly for years now and even survived the big layout change!

    Also: I can not see an application where the number of playable games is useful in it's own: If it is not zero, then you probably want to generate links to the games (or even render them directly). The XML that is provided by LG allows for that. If it is zero, the overhead of getting an almost empty XML document is negligible.

  • Mirko Rahn at 2016-09-29

    [This discussion was on before, can't remember the thread.]

    Please: Do not poll on LG!

    Reason 1: Polling might bring LG down. (Suppose 1000 players would poll every minute…)

    Reason 2: There is no reason to do so!! At a certain point in time, if you are willing and able to play, then you hit the Refresh button. If, instead, you are _not_ willing or _not_ able to play, then the information gathered by the script is useless. (In fact, it even puts some stress on you.)

    Remark: Bots are willing and able to play more often then humans. It is good practice to lower the refresh frequency in case the last query found that no games are playable.

Return to forum

Reply to this topic