#jsmess 2017-03-04,Sat

↑back Search

Time Nickname Message
00:11 🔗 bai oh yeah...so what you want to do is get a reference to the canvas, which we may already have somewhere, then call canvas.toDataURI('image/png')
00:11 🔗 bai I'm just heading out on vacation but if you send me a link to the current script I can tweak it
00:15 🔗 SketchCow Would I do this with firefox?
00:16 🔗 SketchCow I'm on a headless firefox remember.
00:16 🔗 SketchCow This can certainly wait to after your vacation
00:16 🔗 SketchCow I've got plenty of things to amuse me before then
00:16 🔗 SketchCow Before you get back
00:19 🔗 SketchCow I mean, sounds like I should just use phantomjs
00:49 🔗 bai it should work headless too yeah
01:09 🔗 godane has left
01:10 🔗 SketchCow Any experience with phantom?
01:11 🔗 SketchCow I have a script now, cobbled from elsewhere, that takes 50 shots of the page.
01:11 🔗 Vito` I tested with it before the latest 2.x series releases, it was missing some thing we needed
01:11 🔗 Vito` in theory the current series should work, assuming WebGL isn't needed
01:11 🔗 SketchCow http://teamarchive1.fnf.archive.org/PHANTOM/
01:11 🔗 SketchCow frames/ is the directory with shots
01:12 🔗 SketchCow Obviously, it's not doing much
01:12 🔗 SketchCow But I do have a pile of frames!
01:12 🔗 SketchCow Vito` with the save
01:12 🔗 SketchCow I want to click the element. I see all sorts of tricks for this
01:13 🔗 SketchCow http://stackoverflow.com/questions/15739263/phantomjs-click-an-element
01:14 🔗 Vito` the answers further down are the ones you want
01:14 🔗 godane has joined #jsmess
01:15 🔗 SketchCow 2
01:15 🔗 SketchCow down vote
01:15 🔗 SketchCow Document.querySelector(element).click()?
01:16 🔗 Vito` page.evaluate(function() {
01:16 🔗 Vito` document.getElementById('yourId').click();
01:16 🔗 Vito` });
01:16 🔗 Vito` says in the 2.x series that should work
01:16 🔗 SketchCow Can you tell me where in archive.js I shove that?
01:17 🔗 Vito` when are you trying to click on something
01:17 🔗 Vito` oh I see
01:18 🔗 SketchCow yeah
01:18 🔗 SketchCow I'm going through the HTML to see what it calls the element.
01:19 🔗 Vito` do that at the top of the first SetTimeout, before // Initial Frame
01:20 🔗 Vito` document.getElementById("jsmessSS").click()
01:20 🔗 Vito` that's what you want
01:20 🔗 SketchCow Trying it
01:22 🔗 SketchCow Good news is it worked. Bad news is something fails.
01:22 🔗 SketchCow This is a step forward, tough - no mo guesstimating the location of the button.
01:22 🔗 SketchCow And we can pump something into a funnel
01:23 🔗 Vito` there's a way to get it to dump the browser console to your terminal
01:24 🔗 Vito` http://phantomjs.org/api/webpage/handler/on-console-message.html
01:24 🔗 Vito` stick that before your page.open
01:25 🔗 Vito` if this isn't an entire remote instance, or if you can open a port, you might also be able to just use Chrome: http://phantomjs.org/release-1.5.html
01:25 🔗 Vito` "Improved debugging" gives a couple other options
01:26 🔗 Vito` adding that page.onError bit would probably also help
01:28 🔗 SketchCow http://teamarchive1.fnf.archive.org/PHANTOM/archive.js
01:28 🔗 SketchCow Yeah, that's not outputting anything
01:30 🔗 SketchCow (added some comments to keep track of things.)
01:31 🔗 SketchCow Let's focus on something else for a second... JUST grabbing the canvas element for the screengrab.
01:31 🔗 SketchCow page.render('frames/screenshot'+(frame++)+'.png', { format: "png" });
01:33 🔗 SketchCow I see our canvas is named canvas
01:36 🔗 SketchCow <div id="canvasholder">
01:36 🔗 SketchCow <canvas id="canvas" style="width:560px;height:384px"></canvas>
01:36 🔗 SketchCow Actually
01:36 🔗 SketchCow <div id="emulate">
01:36 🔗 SketchCow <center class="posrel">
01:36 🔗 SketchCow <a id="jsmessSS" href="#loading" onclick="return AJS.emulate()"><div id="screenshot"><img src="/serve/msdos_shareware_fb_CLPMT208/CLPMT208_screenshot.gif" alt="[screenshot]"/></div><img class="ghost" src="/images/start.png" title="Click to Begin" data-placement="bottom" data-toggle="tooltip"></a>
01:36 🔗 SketchCow <div id="canvasholder">
01:36 🔗 SketchCow <canvas id="canvas" style="width:560px;height:384px"></canvas>
01:36 🔗 SketchCow <div id="gamepadtext"></div>
01:36 🔗 SketchCow </div>
01:36 🔗 SketchCow </center>
01:37 🔗 SketchCow </div><!--/#emulate-->
01:37 🔗 SketchCow So in theory one could have just that I guess
01:38 🔗 SketchCow (I'm playing inside the command line stuff.
01:38 🔗 SketchCow I'm sure browserfs is asking for storage and it's telling it rightly to fuck off
01:39 🔗 Vito` are you not seeing any errors?
01:39 🔗 SketchCow I am not
01:39 🔗 Vito` page.onError = function (msg, trace) {
01:39 🔗 Vito` console.log(msg);
01:39 🔗 Vito` trace.forEach(function(item) {
01:39 🔗 Vito` console.log(' ', item.file, ':', item.line);
01:39 🔗 Vito` })
01:39 🔗 Vito` }
01:39 🔗 Vito` add that before your page.open block
01:43 🔗 SketchCow root@teamarchive1:/0/PHANTOM# phantomjs --local-storage-path=./.localstorage archive.js
01:43 🔗 SketchCow root@teamarchive1:/0/PHANTOM#
01:44 🔗 SketchCow ls
01:44 🔗 SketchCow ls -l
01:44 🔗 SketchCow root@teamarchive1:/0/PHANTOM# du -sh .localstorage/
01:44 🔗 SketchCow 8.0K .localstorage/
01:44 🔗 SketchCow Definitely saw it, used it
01:45 🔗 SketchCow I'm trying lots of command-line options.
01:46 🔗 SketchCow http://phantomjs.org/api/command-line.html is where I'm getting them
01:46 🔗 SketchCow My theory is our item downloads are stopped. I realize you'e going in from the other end, to print all errors.
01:46 🔗 Vito` I mean, you should be seeing what the errors are at this point
01:49 🔗 SketchCow Is the top of it wrong or something?
01:49 🔗 Vito` http://stackoverflow.com/a/31338510 might be what you want for extracting just the canvas
01:49 🔗 Vito` replace #hplogo with #canvas
01:49 🔗 Vito` I thought the placeholder canvas got replaced with something else after it loaded, though
01:50 🔗 Vito` no your JS looks right
01:54 🔗 SketchCow http://teamarchive1.fnf.archive.org/PHANTOM/frames/screenshot44.png
01:54 🔗 SketchCow THAT is good news
01:54 🔗 SketchCow (Yes, I realize the crapola on the right
01:54 🔗 Vito` probably only need to do that once
01:54 🔗 Vito` move the two blocks under // Do just the canvas of the emulator
01:55 🔗 Vito` to above the // Clicks on the big happy button block
01:56 🔗 SketchCow Done
01:56 🔗 SketchCow Now I'm going to switch URLs
01:56 🔗 SketchCow (Just to see)
01:57 🔗 SketchCow (Still fails)
01:59 🔗 SketchCow Screengrabs temporarily off because I wanted to see what "emulate" had in it.
01:59 🔗 SketchCow Fixed
02:01 🔗 SketchCow Continuing my attack on command line options
02:07 🔗 SketchCow I'm sure it's failing to save something locally
02:08 🔗 SketchCow Just got to figure out what in the settings isn't granting it.
02:09 🔗 SketchCow Problems falling like rain
02:11 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] WebPage - setupFrame ""
02:11 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] WebPage - updateLoadingProgress: 10
02:11 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] WebPage - setupFrame ""
02:11 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] WebPage - updateLoadingProgress: 100
02:11 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] WebPage - setupFrame ""
02:11 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] FileSystem - _open: ":/modules/fs.js" QMap(("mode", QVariant(QString, "r")))
02:11 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] FileSystem - _open: ":/modules/system.js" QMap(("mode", QVariant(QString, "r")))
02:11 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] FileSystem - _open: ":/modules/webpage.js" QMap(("mode", QVariant(QString, "r")))
02:11 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] WebPage - updateLoadingProgress: 10
02:11 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] WebPage - setupFrame ""
02:12 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] FileSystem - _open: ":/modules/fs.js" QMap(("mode", QVariant(QString, "r")))
02:12 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] FileSystem - _open: ":/modules/system.js" QMap(("mode", QVariant(QString, "r")))
02:12 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] FileSystem - _open: ":/modules/webpage.js" QMap(("mode", QVariant(QString, "r")))
02:12 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] WebPage - updateLoadingProgress: 100
02:12 🔗 SketchCow 2017-03-04T02:09:51 [DEBUG] CookieJar - Purged (session) "PHPSESSID=0k21i93cseu81p0qqaap2k1a26; domain=.archive.org; path=/"
02:12 🔗 SketchCow --
02:12 🔗 SketchCow Not a lot of anything helpful, although it's "working" even if it fails
02:18 🔗 SketchCow pinged db48x
02:18 🔗 Vito` SyntaxError: Expected token '}' ia802608.us.archive.org/8/items/jsmess_keyboard_v2/arcade-williams.js:11
02:18 🔗 Vito` got the remote debugger working
02:19 🔗 Vito` sometimes these things can be flaky about the JS they'll accept, was just using one that crapped out on heavily minified JS
02:19 🔗 Vito` was fine on the unminified stuff
02:21 🔗 SketchCow https://github.com/ariya/phantomjs/issues/12867 was an example of that
02:22 🔗 SketchCow I'm switching to an Apple II program
02:23 🔗 SketchCow I'm using timestamps against the thing to know we're not doing poorly here.
02:23 🔗 SketchCow I'm this close to adding a command line call for it and cleaning up frames after each hit.
02:24 🔗 Vito` if it's barfing on our JS though it's never gonna run the apps
02:24 🔗 Vito` that said, isn't this on a machine with xvfb already?
02:25 🔗 SketchCow Agreed which is why I swapped away rom using jsmesskeyboard_v2
02:25 🔗 SketchCow The others don't.
02:25 🔗 SketchCow So if you run it now, it won't hit the minified
02:29 🔗 Vito` huhn
02:29 🔗 Vito` still failed on that URL
02:30 🔗 Vito` but no errors that would suggest why
02:30 🔗 * Vito` shrugs
02:30 🔗 Vito` phantomjs is not super reliable
02:31 🔗 Vito` if you have xvfb already, you might instead consider
02:31 🔗 Vito` http://www.nightmarejs.org
02:32 🔗 Vito` or https://slimerjs.org which is Gecko-based
02:33 🔗 Vito` in my experience trying to use Phantom for other things, if you can't get it working pretty quick, you probably won't, it's pretty flaky and unreliable
02:50 🔗 SketchCow My response would be along the lines of how much you're up for helping.
02:50 🔗 SketchCow I'm out of my depth, although as we can see the actual task is pretty simple
02:53 🔗 Vito` sorry, I'm not prepared to work on this at all
02:53 🔗 Vito` I'm just saying since it's not working out of the box, all effort may be wasted, because phantomjs is not super reliable
02:54 🔗 SketchCow Well, in this case, it's consistently unreliable. :)
02:55 🔗 SketchCow I pinged db to see if he has insight
02:56 🔗 SketchCow slimer's not going to be better than HEADSHOT (my bash script)
03:01 🔗 SketchCow Installing Node
03:03 🔗 SketchCow "npm install nightmare" says it all
03:13 🔗 SketchCow Installed. Invoking it.... issues
03:18 🔗 SketchCow If when bai becomes available he might have ideas where the loader's breaking down.
03:18 🔗 SketchCow This feels a LOT like it's the.... hey hmmm
03:25 🔗 SketchCow Yeah, will need help
03:25 🔗 SketchCow Slime's a mess though.
03:28 🔗 SketchCow Thanks again, Vito`
03:35 🔗 Ravenloft has quit IRC (Read error: Connection reset by peer)
04:01 🔗 db48x has joined #jsmess
05:27 🔗 db48x` has joined #jsmess
05:29 🔗 db48x has quit IRC (Read error: Operation timed out)
05:31 🔗 SketchCow db48x`: Hi
06:12 🔗 X-Scale has quit IRC (Quit: Try HydraIRC -> http://www.hydrairc.com <-)
09:53 🔗 db48x` SketchCow: howdy
09:53 🔗 db48x` is now known as db48x
10:25 🔗 wdna has joined #jsmess
11:02 🔗 SketchCow We had an adventure today!
11:02 🔗 SketchCow Vito` helped with making screenshots work after a fashion
11:02 🔗 SketchCow Like, I can run phantomjs and it snaps stuff.
11:03 🔗 SketchCow http://teamarchive1.fnf.archive.org/PHANTOM/
11:03 🔗 SketchCow As you can see in the frames/ directory, we actually screenshot!
11:04 🔗 SketchCow But the loading fails.
11:04 🔗 SketchCow I suspect it's something stupid.
11:08 🔗 SketchCow http://teamarchive1.fnf.archive.org/PHANTOM/archive.js is the phantomjs script
11:08 🔗 SketchCow Culled from the corpses of a thousand bastard scripts and Vito`'s skills
11:15 🔗 SketchCow Gotta take a quick exercise walk - let me knowif you have ideas/questions
12:46 🔗 wdna has quit IRC (Quit: WeeChat 1.7)
12:48 🔗 wdna has joined #jsmess
15:47 🔗 wdna has quit IRC (Quit: WeeChat 1.7)
15:53 🔗 db48x :)
15:54 🔗 db48x any output in the console?
16:00 🔗 db48x your script looks workable
19:20 🔗 SketchCow No output on the script. I think I can port it to a port though
19:29 🔗 SketchCow pacman.js was me using tilde.club/~pacman to just force stuff without all that k-razy IA stuff
19:29 🔗 SketchCow To see if it's a CORS thing
19:30 🔗 SketchCow Let me try metacade
19:30 🔗 Vito` db48x: I wasn't getting any errors, which makes me think it's a weird phantomjs compatibility problem
19:32 🔗 SketchCow http://teamarchive1.fnf.archive.org/PHANTOM/frames/screenshot1.png
19:32 🔗 SketchCow So that's with zero IA schmutz
19:35 🔗 SketchCow That's using http://assets.metacade.com/emulators/pacman.html
20:06 🔗 db48x a lot of different exceptions could cause that
20:07 🔗 db48x you're catching exceptions and printing them with console.log
20:07 🔗 db48x what's in that console output?
20:07 🔗 Vito` nothing
20:08 🔗 Vito` I ran it locally and got nothing in the console
20:08 🔗 Vito` or in the remote debugger
20:08 🔗 db48x print something unconditionally and make sure that much is working?
20:08 🔗 Vito` it prints other stuff, and I see like CSS errors and stuff in the remote debugger console
20:09 🔗 Vito` but no JS errors or failures
20:09 🔗 db48x hmm
20:09 🔗 db48x ok, in the remote debugger, make sure you're debugging the webpage and tell it to stop on all exceptions, even ones that are caught
20:10 🔗 Vito` I can upload the script I was using if you want to try that
20:11 🔗 db48x I saw it, but I don't have phantomjs all set up
20:11 🔗 db48x if that fails, you could just single-step through the loader.js code
20:11 🔗 db48x starting around line 955
20:12 🔗 db48x time for me to sleep though
21:23 🔗 X-Scale has joined #jsmess
23:07 🔗 SketchCow Yeah, sorry my time is so shifted here

irclogger-viewer