![]() |
#1 |
cosiñeiro
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,406
Karma: 2451781
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Smart Device App questions
Hi. I'm playing a bit with the API of "smart device app" to improve KOReader wirelessly connection with calibre. So far so good but I have a couple of questions related to free space on disk:
1. It seems that the smart device app ignores reported free space. It does not raise FreeSpaceError as indicated in https://github.com/kovidgoyal/calibr...erface.py#L389 2. I can live with (1) because calibre reports the length in bytes of each file, so I can compare it with device free space. I don't know if there's a way to tell calibre that one or more specific files were not received by the client. In the best case scenario I would want the server to report issues like "connect to folder" device is doing (in attachment) but I'm fine if the server doesn't report any error as long as it could report the files already on-device. This is my first attempt to look at calibre/python code. Please forgive me if I mis something obvious. Also please forgive my english. I hope my question can be understood. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,408
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
It is true that the smart device driver does not raise that exception. It is possible that it could, but I need to look at what the implications are.
I am not sure what question you are asking. It is up to the device to report what files are on the device. |
![]() |
![]() |
![]() |
#3 |
cosiñeiro
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,406
Karma: 2451781
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Hi chaley, thanks for your help.
When calibre sends the opcode "SEND_BOOK" I check if the book fits in the device. If it fits then I store it on disk and update my local database accordly. calibre expects a client response per book. I send an opcode "OK" and no data if the book was stored fine. I would like to know how to notify calibre that a specific book in a batch was not received by the client. I tried to send "NOOP" but calibre thinks the book is on device until I disconnect the client and connect it again. |
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,408
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
I have to be very careful about what I change in order to avoid breaking other clients. That said, I can do two things, tested using CC:
|
|
![]() |
![]() |
![]() |
#5 | |
cosiñeiro
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,406
Karma: 2451781
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Quote:
With the sanity check in place everything seems to work just fine. In order to test the user feedback I modified the reported free disk space in response to FREE_SPACE opcode. It works too (attachment #1) ![]() For legacy calibre versions I didn't found a better way to handle no disk space than send all binary data to the void and report a message asking the user for disconnect and connect again (attachment #2). Obviously it would be better if I could manage to send the book count again without reconnecting, but I'm fine with the solution. Again, thanks for your work! |
|
![]() |
![]() |
![]() |
#6 |
cosiñeiro
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,406
Karma: 2451781
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Another thing I noticed: the wireless server doesn't notify clients when its "ejecting" the drive. It just closes the socket.
It would be amazing to send a new opcode to figure out that the user intention is to disconnect the "disk" and it isn't just a temporarily failure on talking with the server. |
![]() |
![]() |
![]() |
#7 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,408
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
What I can do: when calibre tells the device to eject, send a NOOP with an argument {'ejecting': True} just before I close the socket. Existing clients shouldn't break (CC won't). This won't prevent calibre from simply closing the socket sometimes because there are ways for the driver to be shutdown without being told why. Is this OK? If so I will submit changes. |
|
![]() |
![]() |
![]() |
#8 | |
cosiñeiro
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,406
Karma: 2451781
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Quote:
Thank you!!! |
|
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,408
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question: Smart Audiobook Player app for Android | haertig | Audiobook Hardware & Software | 18 | 10-24-2018 02:23 PM |
found more than one calibre: smart device / wireless device? | nikoski | Calibre Companion | 3 | 08-04-2016 05:23 AM |
Smart Punctuation v7.38, quick questions | jackie_w | Calibre | 6 | 01-08-2011 04:25 PM |
Seriously thoughtful Who is YOUR Smart Mobile Device Pundit? | Nate the great | Lounge | 7 | 02-11-2010 11:05 AM |
How would you rate the Smart Q7 as a E-Book Reading Device ONLY (and which OS) | rana | Alternative Devices | 0 | 09-21-2009 02:33 AM |