Skip to content

Sync book statistics: add to dispatcher#10285

Merged
Frenzie merged 5 commits into
koreader:masterfrom
ptrm:stats-sync-to-dispatcher
Apr 1, 2023
Merged

Sync book statistics: add to dispatcher#10285
Frenzie merged 5 commits into
koreader:masterfrom
ptrm:stats-sync-to-dispatcher

Conversation

@ptrm

@ptrm ptrm commented Apr 1, 2023

Copy link
Copy Markdown
Contributor

Added the sync book statistics action to dispatcher, along with InfoMessage shown during sync.


This change is Reviewable

@ptrm ptrm force-pushed the stats-sync-to-dispatcher branch from 94cc549 to 0e38a48 Compare April 1, 2023 18:26
Comment thread plugins/statistics.koplugin/main.lua Outdated
Comment on lines +2985 to +2987
text = _("Syncing book statistics, this might take a while…"),
timeout = 1,
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the sync process is blocking, and this stays on until it's done, the timeout is there so it just disappear when the sync process is done?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, the same reason for using nextTick below

Comment thread plugins/statistics.koplugin/main.lua Outdated
end

function ReaderStatistics.onSync(local_path, cached_path, income_path)
function ReaderStatistics:isSyncPossible()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rgrep Possible gives nothing, so we're not used to that. May be ReaderStatistics:canSync() ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

@poire-z

poire-z commented Apr 1, 2023

Copy link
Copy Markdown
Contributor

And congratulation for your first PR !

@Frenzie Frenzie added this to the 2023.04 milestone Apr 1, 2023
Comment thread plugins/statistics.koplugin/main.lua Outdated
timeout = 1,
})

UIManager:nextTick(function ()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no space needed/wanted between function and ()

Comment thread plugins/statistics.koplugin/main.lua Outdated
Comment on lines +2990 to +2994
SyncService.sync(self.settings.sync_server, db_location, self.onSyncServiceSync)
end)
end

function ReaderStatistics.onSyncServiceSync(local_path, cached_path, income_path)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would let this one with its original name ReaderStatistics.onSync(...) just because we don't know if there's not anywhere else something throwing a "Sync" event and expecting handlers to be named onSync (I think we don't, fortunately :)
I see VocabularyBuilder.onSync() has one with the same name.
I don't think we have any such "sync everything" use (and I don't know if we would ever need/want it - one could make a gesture/profile to trigger the ones he needs).
But may be they deserve a more complex name than just "Sync" ? Or just not have a "on" prefix, so we don't risk triggering them with a broadcastEvent(Event:new("Sync")).

Pinging @weijiuqiao who implemented both these onSync for thoughts.

Anyway, keeping the original name would have avoided us to wonder about all that :) It's not too late :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I will revert that :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to maintain distinction between dispatcher ecent and sync method

@Frenzie Frenzie added the Plugin label Apr 1, 2023
Comment thread plugins/statistics.koplugin/main.lua Outdated
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
@Frenzie Frenzie merged commit 2e63028 into koreader:master Apr 1, 2023
@ptrm ptrm deleted the stats-sync-to-dispatcher branch April 1, 2023 23:10
TranHHoang added a commit to TranHHoang/koreader that referenced this pull request May 26, 2023
KOReader 2023.04 "Solar Panel"

![koreader-2023-04-fs8](https://user-images.githubusercontent.com/202757/234975122-d7739c71-74aa-4cb0-a086-72a4bba70f52.png)

It's been another busy month squashing many bugs. Our Mac users will be happy to hear that I told macOS we've supported HiDPI since long before anyone came up with such terminology (koreader#10341), and that the program can now natively build on M1 devices (koreader#10291).

Solar panel credit: <https://openclipart.org/detail/294030/solar-energy> by gnokii

We'd like to thank all contributors for their efforts. Some highlights since the previous release include:

* Readerzooming: fix use of default settings (koreader#10205) @hius07
* ButtonDialog/ButtonDialogTitle: consistent 'width' handling (koreader#10230) @poire-z
* MovableContainer: add support for anchoring initial position (koreader#10230) @poire-z
* Book map, Page browser: add top left menu (koreader#10230) @poire-z
* Book style tweak: add button with CSS suggestions (koreader#10230) @poire-z
* crengine: fix parsing of multibytes encodings (koreader#10230) @poire-z
* readerstyletweak: update profiles on unregistering in dispatcher (koreader#10247) @hius07
* Filesearcher: add search in book metadata (koreader#10198) @hius07
* Fix: Updated legacy directory, which crashed the program (koreader#10260) @Mochitto
* ReaderLink: allow a forward location stack (koreader#10228) @yparitcher
* BookInfo: add page information (koreader#10255) @hius07
* Center pdf manual zoom mode (koreader#10246) @nairyosangha
* File browser: add Folder Menu (koreader#10275) @hius07
* Calendar view: add options to change start time of days (koreader#10254) @weijiuqiao
* filechooser: fix crash on "unreadable content" (koreader#10283) @hius07
* Sync book statistics: add to dispatcher (koreader#10285) @ptrm
* [plugin] Exporter: use util.getSafeFilename() to remove illegal characters from output filename (koreader#10282) @Mochitto
* readerbookmark: fix writing pdf annotation (koreader#10287) @hius07
* Folder Menu: sign for Home folder (koreader#10288) @hius07
* ListMenu: show mark for books with highlights (koreader#10276) @hius07
* Calendar view's day view: thicker separator at 00:00 (koreader#10289) @poire-z
* PageBrowser: tweak scrolling behaviour at book start/end (koreader#10289) @poire-z
* Make `kodev check` feature complete (koreader#8682) @yparitcher
* macOS: support for M1 building (koreader#10291) @ptrm
* Reader: do not apply font size and spacing out of range (koreader#10295, koreader#10307) @hius07
* File browser: show Folder Menu on long-press on Home icon (koreader#10298) @hius07
* SSH.koplugin: fix cant stop SSH server bug when pid file's stale (koreader#10300) @weijiuqiao
* PM: Optimize task queue handling around standby (koreader#10203) @zwim
* statistic.koplugin: fix today's timeline showing next day when within custom offset (koreader#10299) @weijiuqiao
* ReaderThumbnails: update cached page thumbnail on bookmark note change (koreader#10303) @hius07
* SDL: add multitouch support (koreader#10334) @Frenzie
* SDL: add HiDPI support (koreader#10341) @Frenzie
* BookInfo: fix crash on show cover (koreader#10315) @hius07
* Deal with table.pack corner-cases properly (koreader#10350) @NiLuJe
* Android: add Tagus Gea support (<koreader/android-luajit-launcher#412>) @Alfedi

[Full changelog](koreader/koreader@v2023.03...v2023.04) — [closed milestone issues](https://github.com/koreader/koreader/milestone/63?closed=1)

---

Installation instructions: [Android](https://github.com/koreader/koreader/wiki/Installation-on-Android-devices) • [Cervantes](https://github.com/koreader/koreader/wiki/Installation-on-BQ-devices) • [ChromeOS](https://github.com/koreader/koreader/wiki/Installation-on-Chromebook-devices) • [Kindle](https://github.com/koreader/koreader/wiki/Installation-on-Kindle-devices) • [Kobo](https://github.com/koreader/koreader/wiki/Installation-on-Kobo-devices) • [PocketBook](https://github.com/koreader/koreader/wiki/Installation-on-PocketBook-devices) • [ReMarkable](https://github.com/koreader/koreader/wiki/Installation-on-ReMarkable) • [Desktop Linux](https://github.com/koreader/koreader/wiki/Installation-on-desktop-linux) • [MacOS](https://github.com/koreader/koreader/wiki/Installation-on-MacOS)
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants