pgaskin / NickelMenu

The easiest way to launch scripts, change settings, and run actions on Kobo e-readers.
https://pgaskin.net/NickelMenu
MIT License
591 stars 32 forks source link

Additional metadata for selection menu arguments #104

Open pgaskin opened 3 years ago

pgaskin commented 3 years ago

As mentioned previously in #93, #94, and on MR.

It will be implemented as an optional feature, only being computed (and potentially returning an error) if used. In addition to making it more future-proof, it means this feature can be included in v0.5.1 rather than v0.6.0.

pgaskin commented 3 years ago

The Volume for the book can be found with ReadingView::getVolume (this is inlined for most callers within ReadingView, but it's used externally by other classes too). Most chapter-related metadata accessed via other getters on ReadingView without needing to deal with Shortcovers directly.

The current ReadingView can be found via MainWindowController::currentView or scanning the widget tree, but I'm going to see if there is a more direct way to do it.

This should avoid the need for parsing the assembly at runtime (or storing it per-version), scanning classes to extract field offsets, or intercepting more functions, which would be significantly less future-proof and/or stable.

shermp commented 3 years ago

Out of curiosity, I was looking at how this could be implemented yesterday, and it seems we came to similar conclusions (getting the Volume from the ReadingView).

pgaskin commented 3 years ago

I just thought of an interesting extension to this: I could add a filter:<arg>:<regexp> option for selection menu items to allow selectively showing them based on the context. This would be especially useful for book-specific wikis or for only showing certain items for sideloaded books (e.g. my progress sync one). This would be for v0.6.0, though.

pgaskin commented 3 years ago

Also, see pgaskin/selection-menu-extra-arguments for my work so far on this. It should be usable in its current state.

NiLuJe commented 3 years ago

(e.g. my progress sync one).

Color me intrigued ;p.

pgaskin commented 3 years ago

Color me intrigued

It really isn't that much. It just mirrors the current position from the DB over SSH to my other Kobos.

taosxx commented 3 years ago
* Book title.

* Chapter title.

* More?

Maybe language code? For language-specific search etc?

pgaskin commented 3 years ago

Maybe language code? For language-specific search etc?

That's a good idea. I'll add that.

pgaskin commented 3 years ago

Also, now that we'll be supporting book-wide metadata in the argument transformation, I think I'm going to add that to the library menu as well.