yourealwaysbe / forkyz

Forkyz Crosswords
GNU General Public License v3.0
38 stars 5 forks source link

Circles in boxes #29

Closed rodan123 closed 3 years ago

rodan123 commented 3 years ago

I do the LA times crosswords that frequently feature circled letters in the puzzle. Shortyz would display the circles, Forkyz doesn't. Any chance of implementing this feature?

yourealwaysbe commented 3 years ago

Ah, dang, then i broke it somewhere along the line. Do you have an example LA Times puzzle i can use to test?

yourealwaysbe commented 3 years ago

Ok, found one -- Aug 4th, confirmed the circles aren't showing.

rodan123 commented 3 years ago

Great. You're much faster than me. Thanks for looking at this and for keeping the program up to date.

yourealwaysbe commented 3 years ago

This looks like it's because i switched the data source from Arkadium Hosted back to Uclick. If I try the supposed Arkadium Hosted URL for 4 Aug 2021 it returns data for the 4 Aug 2019 crossword. Uclick uses a different data format, but returns the right puzzle. However, the Uclick data format seems to contain no trace of the circles.

The LA Times website gets the data from a different URL from Amuse Labs. However, naive use of this URL gets a blank response outside of a browser, and a fully formed HTML page inside.

So it looks like fixing this bug means figuring out if Uclick hides the circles somewhere in its XML, or if there's a way of getting the Amuse Labs data in a useful format.

rodan123 commented 3 years ago

Ah, the Uclick XML is pretty straightforward, nothing looks cryptic. Scraping the Amuse Labs page appears like it might be possible, https://github.com/thisisparker/xword-dl But haven't tried the program and it would probably be too much trouble to integrate.

Thanks for the quick response.

yourealwaysbe commented 3 years ago

Thanks -- looks like the puzzle JSON is base64 encoded in the window.rawc property. This decodes to a JSON format i don't recognise, but it's not a lot of xword-dl code to get the required info out. It could be done something like GuardianDailyCrypticDownloader.java which has a similar HTML scraping / JSON handling thing to do. The new class would then need an entry in Downloaders.java and preferences_daily.xml.

It's a bit of work, so i'm not sure if/when i'll do it. I'm happy to accept pull requests though ;)

In the meantime, as a workaround, you can try using xword-dl to get the crosswords as .puz files, then use the (+) button in Forkyz to import them.

(To be honest, there should really be a GuardianIO.java in the puzlib/.../io directory that parses the JSON stream instead of doing it directly in GuardianDailyCrypticDownloader.java, but that's a to do for another day.)

yourealwaysbe commented 3 years ago

An Amuse Labs downloader is now implemented on the version10 branch. I think this might be useful for several other puzzle sources that i had retired. I will release version10 in a week or so.