mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Basic fixes to calibre-sync (#3558)
* Properly create intermediate directories when receiving books from Calibre. This fixes an issue where you can't receive books except into directories that already exist on the Kobo, which, in particular, causes problems when your configuration in Calibre is something like "put books in $Author/$Title.epub" and you haven't previously synced any books by that author. * Wake up periodically to process ZMQs if any are registered. This fixes an issue where if there are any timed events (such as the suspend timer) in the queue, ZMQ events may not get processed until the timed event fires, which is a problem when (for example) the suspend timer goes off in an hour and you have something trying to send a book to the kobo over wifi *right now*. With this change, the event loop will wake up every 50ms to check for ZMQ events and process them if necessary. If there are no ZMQs registered (which is typical), it uses the original behaviour -- so this won't affect battery life under normal usage.
This commit is contained in:
committed by
Frans de Jonge
parent
79517eb166
commit
f9ac8b138b
@@ -5,6 +5,7 @@ local JSON = require("json")
|
||||
local DEBUG = require("dbg")
|
||||
local _ = require("gettext")
|
||||
local NetworkMgr = require("ui/network/manager")
|
||||
local util = require("frontend/util")
|
||||
|
||||
require("ffi/zeromq_h")
|
||||
|
||||
@@ -320,6 +321,7 @@ function CalibreCompanion:sendBook(arg)
|
||||
local inbox_dir = G_reader_settings:readSetting("inbox_dir")
|
||||
local filename = inbox_dir .. "/" .. arg.lpath
|
||||
DEBUG("write to file", filename)
|
||||
util.makePath((util.splitFilePathName(filename)))
|
||||
local outfile = io.open(filename, "wb")
|
||||
local to_write_bytes = arg.length
|
||||
local calibre_device = self
|
||||
|
||||
Reference in New Issue
Block a user