Dominion Strategy Forum

Please login or register.

Login with username, password and session length
Pages: 1 [2] 3 4 ... 8  All

Author Topic: Goko log parser - now for Chrome!  (Read 65886 times)

0 Members and 1 Guest are viewing this topic.

nutki

  • Scout
  • ****
  • Offline Offline
  • Posts: 40
  • Respect: +195
    • View Profile
Re: Goko log parser - v1.4 DONE
« Reply #25 on: February 06, 2013, 09:24:56 am »
+7

Since the result is an html file, why not javascript?
In short time I come up with this:
http://dom.retrobox.eu/index.html
Just paste the web address of the log in the input box on the top.
I replaced image backgrounds with css gradients so the script uses only one file.
 
Logged
Want a better Goko experience?
Get Firefox, Grease monkey and my script.

theory

  • Administrator
  • *****
  • Offline Offline
  • Posts: 3603
  • Respect: +6125
    • View Profile
    • Dominion Strategy
Re: Goko log parser - v1.4 DONE
« Reply #26 on: February 06, 2013, 09:37:49 am »
+2

omg!  Logs are actually ... pretty!
Logged

philosophyguy

  • Minion
  • *****
  • Offline Offline
  • Posts: 575
  • Respect: +299
    • View Profile
Re: Goko log parser - v1.4 DONE
« Reply #27 on: February 06, 2013, 10:11:37 am »
0

nutki - nothing happens when I change the log file name in the box.
Logged

nutki

  • Scout
  • ****
  • Offline Offline
  • Posts: 40
  • Respect: +195
    • View Profile
Re: Goko log parser - v1.4 DONE
« Reply #28 on: February 06, 2013, 10:19:51 am »
0

nutki - nothing happens when I change the log file name in the box.
Do you see anything aside the input box? If not then either you have JS disabled in your browser or there is a bug in my script that is ignored by my browser. Which browser do you use?

If you see the example log that would mean that the problem is with the onChange method of the text input. Then you can try direct link functionality I just added:
http://dom.retrobox.eu/?/20130204/log.50a0dcd2e4b035929e673232.1360045225424.txt
Logged
Want a better Goko experience?
Get Firefox, Grease monkey and my script.

philosophyguy

  • Minion
  • *****
  • Offline Offline
  • Posts: 575
  • Respect: +299
    • View Profile
Re: Goko log parser - v1.4 DONE
« Reply #29 on: February 06, 2013, 10:41:24 am »
0

I'm using Chrome 21. on a Mac, with Javascript enabled. The example log displays fine. I'm trying to access a demo log that I put together to test some edge cases at https://dl.dropbox.com/u/12565923/logfile.txt, and I can't get that to work in the direct version either.
Logged

nutki

  • Scout
  • ****
  • Offline Offline
  • Posts: 40
  • Respect: +195
    • View Profile
Re: Goko log parser - v1.4 DONE
« Reply #30 on: February 06, 2013, 11:58:20 am »
0

OK, linking to non-goko official site (like dropbox in you case) cannot work as security measure for cross-site scripting. Goko site explicitly allows cross-site access in a reply header: Access-Control-Allow-Origin: *
That could be solved by allowing manual upload.

Edit: I copied your file to my server so you can see the result by putting just 'logfile.txt' into the textbox.

I'm using Chrome 21. on a Mac, with Javascript enabled. The example log displays fine. I'm trying to access a demo log that I put together to test some edge cases at https://dl.dropbox.com/u/12565923/logfile.txt, and I can't get that to work in the direct version either.
« Last Edit: February 06, 2013, 12:06:48 pm by nutki »
Logged
Want a better Goko experience?
Get Firefox, Grease monkey and my script.

shark_bait

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1103
  • Shuffle iT Username: shark_bait
  • Luckyfin and Land of Hinter for iso aliases
  • Respect: +1868
    • View Profile
Re: Goko log parser - v1.4 DONE
« Reply #31 on: February 06, 2013, 12:08:10 pm »
0

does it do multicolor for dual type cards?
Logged
Hello.  Name's Bruce.  It's all right.  I understand.  Why trust a shark, right?

Is quite curious - Who is the mystical "Celestial Chameleon"?

philosophyguy

  • Minion
  • *****
  • Offline Offline
  • Posts: 575
  • Respect: +299
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #32 on: February 06, 2013, 12:21:31 pm »
0

Ok, this will probably be the last version I upload for a while unless there are specific bugs that need to be addressed.

v1.5 fixes a couple of bugs, but most importantly allows you to specify filenames. If you pass one argument, it treats it as the input file and outputs that filename with the extension changed to .html. Two arguments it takes as input and output files, respectively.

The bash script (my version) supports dual-colors through graphics, so there's a clear break between the top and bottom colors. nutki's version uses gradients, so the colors blend together.
Logged

philosophyguy

  • Minion
  • *****
  • Offline Offline
  • Posts: 575
  • Respect: +299
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #33 on: February 06, 2013, 12:26:42 pm »
0

nutki - you'll notice my edge case file creates an error at the bottom of your log. Notice how Occupy Grand Market and Squire Mendel's names are formatted in the placements: the Grand Market and Squire parts are tagged as if they were cards. I added a bit in my script to address that starting in v1.4, but I have no clue how to do that kind of thing in javascript.
Logged

philosophyguy

  • Minion
  • *****
  • Offline Offline
  • Posts: 575
  • Respect: +299
    • View Profile
v1.6 done AND FEEDBACK REQUESTED
« Reply #34 on: February 09, 2013, 03:03:49 pm »
+2

I've just cleaned up a couple of bugs dealing with player names like ^_^_^_^ or multiples of bots (e.g., Serf Bot I and Serf Bot II in the same game). I've also borrowed from nutki's idea of color coding each player's actions and had the script add spans to color each player and the game start/end info.

The new version also uses an external CSS file, which is great for me but not so great for everyone else because there's no permanent link available yet besides my Dropbox account. So: I've attached an HTML file of the new output to this message. I would greatly appreciate any feedback on things that should be changed before I ask to have the new style sheet hosted on councilroom. It's a pain to make modifications to the stylesheet once it's there because I don't have direct upload access, so now is the time to make any modifications.
Logged

theory

  • Administrator
  • *****
  • Offline Offline
  • Posts: 3603
  • Respect: +6125
    • View Profile
    • Dominion Strategy
Re: Goko log parser - v1.5 DONE
« Reply #35 on: February 11, 2013, 11:01:00 am »
0

Suggestions:

I don't think this will get very far unless you make it an online Javascript thing, perhaps hosted on CR.  It's a bit of a hassle, downloading the zip and then running it to prettify the logs.

The online Javascript thing needs to be able to support getting the link easily.  I know you can put it in manually, but you should just either have a "Get Link" box like on CR, or support pasting in a goko link and being redirected to the correct prettified link.
Logged

philosophyguy

  • Minion
  • *****
  • Offline Offline
  • Posts: 575
  • Respect: +299
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #36 on: February 11, 2013, 12:29:15 pm »
+1

I can work on putting the new stuff into Javascript. The problem is my JS is almost non-existent, so it's going to be a while.

Is there any interest in having councilroom run a scraper that grabs the day's Goko logs as well as the Iso ones? If so, the non-JS version could be run as part of the scraper.
Logged

loppo

  • 2014 Austrian Champion
  • *
  • Offline Offline
  • Posts: 176
  • Respect: +194
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #37 on: February 11, 2013, 02:43:05 pm »
0

I can work on putting the new stuff into Javascript. The problem is my JS is almost non-existent, so it's going to be a while.

Is there any interest in having councilroom run a scraper that grabs the day's Goko logs as well as the Iso ones? If so, the non-JS version could be run as part of the scraper.

that would be SOOOOO cool. And if there is a way to filter out the bot games + the Adventures (at least the ones with different starting conditions) it would be even better.
Logged

Beyond Awesome

  • Global Moderator
  • *****
  • Offline Offline
  • Posts: 2941
  • Shuffle iT Username: Beyond Awesome
  • Respect: +2466
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #38 on: February 11, 2013, 02:56:39 pm »
0

Suggestions:

I don't think this will get very far unless you make it an online Javascript thing, perhaps hosted on CR.  It's a bit of a hassle, downloading the zip and then running it to prettify the logs.

The online Javascript thing needs to be able to support getting the link easily.  I know you can put it in manually, but you should just either have a "Get Link" box like on CR, or support pasting in a goko link and being redirected to the correct prettified link.

If this could be hosted on CR, I would be forever grateful.
Logged

jonts26

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2746
  • Shuffle iT Username: jonts
  • Respect: +3671
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #39 on: February 11, 2013, 02:58:39 pm »
0

Would it be possible to move the game summary to the top of the log? Just a convenience issue, but then again, I guess that's what this entire thing is right.
Logged

philosophyguy

  • Minion
  • *****
  • Offline Offline
  • Posts: 575
  • Respect: +299
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #40 on: February 11, 2013, 04:41:42 pm »
0

There are a lot of things that are possible, but they come at the cost of a substantial increase in the time to run the script. That may not matter if you're only running it on a couple of games, but if you have 3500 files to run through (roughly the daily Goko archive at this point) and you add a second to each run, you've added an hour of processing time.

Moving the game summary info is a reasonably resource-intensive process, surprisingly. You need to grab the game summary section and move it to the top. But, since it's multiple lines, you can't just do it with a stream editor unless you use some black magic like removing linebreaks from that section or adding tags to each line in that section. There's probably a couple of writes of temporary files to the disk in order to make that happen. Then you splice the new header into the old file, requiring another write or two. You may then need to undo your black magic edits.

(Also, I've heard mixed opinions on listing the game summary at the top. Some people like the surprise of finding out who won at the end. I'm not in that camp, but since it's an opinion and changing the parser to move the game summary is hard, I'm defaulting to what will let me be lazy.)

The long term solution is for Goko to change the log file. Whether they go all the way to coloring the logs or not, fixing things like listing the opening cards, the trash contents, and the value of alt-VP sources are ridiculously easier if they're done in the original.
« Last Edit: February 11, 2013, 04:47:26 pm by philosophyguy »
Logged

eHalcyon

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 8689
  • Respect: +9187
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #41 on: February 11, 2013, 05:12:14 pm »
0

You're outputting html anyway, right?  Can't you just wrap the game summary info in a div and float it to the top or something?
Logged

^_^_^_^

  • Minion
  • *****
  • Offline Offline
  • Posts: 502
  • Crazy, You Have Been Warned
  • Respect: +111
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #42 on: February 11, 2013, 05:40:15 pm »
+1

I've just cleaned up a couple of bugs dealing with player names like ^_^_^_^
*snip*
That's cause I'm special ^_^_^_^
Logged
"Chicken Chicken Chicken"-Doug Z
"Chicken Chicken Chicken"-Donald X
The cost to buy me is 5Copper. What's Your Cost?

philosophyguy

  • Minion
  • *****
  • Offline Offline
  • Posts: 575
  • Respect: +299
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #43 on: February 11, 2013, 05:43:33 pm »
0

You're right, that would be a more elegant solution. I can play with that; my worry is that because the divs will be multi-lined, it will be easy to screw up the code that wraps the section. (Having to hunt for a single line is obviously easier.) But I can see what I can do.
Logged

eHalcyon

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 8689
  • Respect: +9187
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #44 on: February 11, 2013, 06:08:43 pm »
0

You're right, that would be a more elegant solution. I can play with that; my worry is that because the divs will be multi-lined, it will be easy to screw up the code that wraps the section. (Having to hunt for a single line is obviously easier.) But I can see what I can do.

You can just find the "Game Over" line and put the div from there to the end of the file.  You could probably add a setting on whether to have the box stay at the bottom or moved to the top, so people can choose which way to view it.
« Last Edit: February 11, 2013, 06:09:44 pm by eHalcyon »
Logged

nutki

  • Scout
  • ****
  • Offline Offline
  • Posts: 40
  • Respect: +195
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #45 on: February 16, 2013, 04:14:35 pm »
+17

I converted my script into a Greasemonkey script (attached), showing the live log on the right of the game window. The result looks like this:

To use it you have to install Firefox with the Greasemonkey plugin and open the attached file with 'File'>'Open File...'
Logged
Want a better Goko experience?
Get Firefox, Grease monkey and my script.

rrenaud

  • Administrator
  • *****
  • Offline Offline
  • Posts: 991
  • Uncivilized Barbarian of Statistics
  • Respect: +1197
    • View Profile
    • CouncilRoom
Re: Goko log parser - v1.5 DONE
« Reply #46 on: February 16, 2013, 05:02:43 pm »
+1

Nice, I'd recommend you put your script up on github.
Logged

Beyond Awesome

  • Global Moderator
  • *****
  • Offline Offline
  • Posts: 2941
  • Shuffle iT Username: Beyond Awesome
  • Respect: +2466
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #47 on: February 16, 2013, 05:56:20 pm »
0

I converted my script into a Greasemonkey script (attached), showing the live log on the right of the game window. The result looks like this:

To use it you have to install Firefox with the Greasemonkey plugin and open the attached file with 'File'>'Open File...'

I am impressed. Now, I can play Goko with a log up all the time! Yay!

PS: Can someone help me. I installed Greasmonkey onto Firefox and rebooted it. It says Greasemonkey is enabled, but I am not able to get this to work.
« Last Edit: February 16, 2013, 06:18:06 pm by Beyond Awesome »
Logged

1wheel

  • Chancellor
  • ***
  • Offline Offline
  • Posts: 24
  • Respect: +86
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #48 on: February 16, 2013, 06:20:45 pm »
0

Wow great work nutki!

Would you be willing to put the script up on github? I'm having some layout issues that I can see how to fix.

Kirian

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7096
  • Shuffle iT Username: Kirian
  • An Unbalanced Equation
  • Respect: +9413
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #49 on: February 16, 2013, 06:50:27 pm »
0

I converted my script into a Greasemonkey script (attached), showing the live log on the right of the game window. The result looks like this:

To use it you have to install Firefox with the Greasemonkey plugin and open the attached file with 'File'>'Open File...'

Will it also work on Chrome/Greasemonkey?

Hmm, got it working on FF, but having layout issues like 1wheel.
« Last Edit: February 16, 2013, 07:59:51 pm by Kirian »
Logged
Kirian's Law of f.DS jokes:  Any sufficiently unexplained joke is indistinguishable from serious conversation.
Pages: 1 [2] 3 4 ... 8  All
 

Page created in 0.094 seconds with 21 queries.