roygbyte / crossword.koplugin

Crosswords on your KOReader device
GNU Affero General Public License v3.0
12 stars 2 forks source link

Add support for ipuz files #6

Closed aero31aero closed 5 months ago

aero31aero commented 6 months ago

The currently linked repo is awfully close to the ipuz format for puzzles, which are relatively much simpler to obtain (look at how Forkyz allows you to download new puzzles daily from various sources).

I've attached a sample file below (had to rename it from sample.ipuz to sample.json to make Github play along well.

sample.json

Please consider either changing the plugin to just support ipuz files, or to support both of them? Thanks for the awesome plugin! <3


Please check out this page for the official spec: https://web.archive.org/web/20230530005239/http://www.ipuz.org/

Its a shame the original website isn't functional anymore but this archived version is good enough. You'd have to scroll down to the section labelled: Crossword Puzzles - http://ipuz.org/crossword.

aero31aero commented 6 months ago

Re this comment, I'll hold back on attempting this on my own, because its a foreign codebase to me and I have a feeling you, as the original author, could kick up a solution pretty fast.

roygbyte commented 6 months ago

Cool idea! I'll take a look at the format and the code and see if there's a way to marry the two together.

Glad you are enjoying the plugin.

roygbyte commented 6 months ago

I have ipuz support working. I need to integrate this new format into the unit tests, test it on device, and then I'll push the changes to main. Once this is done, I'd appreciate if you could try it out and let me know whether you experience any crashes.

aero31aero commented 6 months ago

Happy to test. Is there a PR/branch I can deploy?

roygbyte commented 6 months ago

Here t'is: https://github.com/roygbyte/crossword.koplugin/tree/add_ipuz_support

aero31aero commented 6 months ago

Going to Puzzle Library doesn't show any items.

$ pwd && ls
/mnt/us/stuff/crosswords
sample.ipuz
$ cat /mnt/us/koreader/settings/crossword_settings.lua 
-- ./settings/crossword_settings.lua
return {
    ["puzzle_library_dir"] = "/mnt/us/stuff/crosswords/",
}
aero31aero commented 6 months ago

Hmm, okay, so that was weird. After copying over /spec and /nyt_crosswords, I see ".. and ." and using that, I navigated to my puzzle directory, but it looks like the starting directory was the plugin's spec directory and because I didn't bother creating that when copying to the Kindle, I just saw an empty screen?

Anyway, the puzzles load perfectly (tested some other puzzles too).

Thanks for the quick implementation. The IPUZ part feels smooth as can be! <3 Not sure if I should file separate issues for these bugs. Lemme know if you can't reproduce them.

roygbyte commented 5 months ago

Hmm, okay, so that was weird. After copying over /spec and /nyt_crosswords, I see ".. and ." and using that, I navigated to my puzzle directory, but it looks like the starting directory was the plugin's spec directory and because I didn't bother creating that when copying to the Kindle, I just saw an empty screen?

I'm not too sure I understand. But it sounds like there's an edge case I didn't account for. When I've installed the plugin, it's by copying the full directory.

There's a slight bug that I've noticed on tapping on the top-left square. When I'm solving a horizontal clue, that takes me to the last horizontal clue in the puzzle, and same for the vertical clue.

Yeah, I've known about this bug. I have no idea what's going on, despite some effort with debugging.

The screen doesn't redraw on pressing exit. When I swipe down again, the puzzle browser goes back up one directory and then redraws the screen (this is on Kindle).

Also aware of this, and unsure why it's happening. I'm not too sure about how screen refreshing works with KOReader.

Pressing the "close" icon on the puzzle browser doesn't actually close it, but goes back to the previously browsed directory, so exiting the puzzle extension took me like 7-8 taps of the close button.

Known, and not sure how to fix.

Not sure if I should file separate issues for these bugs. Lemme know if you can't reproduce them.

Feel free to submit issues if you'd like. I'm not sure when I'll get back to refining this plugin. I'm too happy to simply solve the crosswords, and the puzzle of building the app is just not on my plate at the moment. But feel free to take a crack at fixing these bugs, if you'd like! I'm going to close this issue since the original problem/feature is solved.