![]() |
#16 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,336
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Call for comments
I propose that for usb-based devices, calibre creates and maintains a file devinfo.calibre containing the following dict:
Code:
devstatus_calibre = {
'uuid' : None,
'calibre_version' : None,
'date_last_changed' : None,
}
Details: The device driver (usbms) will read the dict from the file when the device connects (in usbms.device.open), initializing the dict if it does not exist. It will update the file at the end of sync_booklists. A new interface function get_devstatus will be provided to fetch the dict. The interface function will not start a job. An API will be added to the device manager to call it. The file will be JSON-encoded. Sample code is under the spoiler: Spoiler:
Design constraints: 1) there can be no data in the dict requiring interaction with the user. 2) the data must be JSON-serializable 3) the dict must be small (less than 512 bytes) and complexity must be low to avoid out-of-space errors or corruption-on-write problems. 4) calibre must be able to survive the file disappearing or being corrupted. |
![]() |
![]() |
![]() |
#17 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,903
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I was just thinking about how to keep the 'snapshot' of the device(s) last list.
Device and CARD ID were the BIG issue. If it is missing the ID, why not ask for user help in (re-)establishing the ID? BTW I uniquely name the 'Volumes' for both my device and SDCARD (removable cards can move around ![]() ![]() 1) calibre ID 2) device ID (eg ser#) 3) volume ID 4) book list match (possible ID) |
![]() |
![]() |
Advert | |
|
![]() |
#18 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,336
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
If we really want to get fancy, the cleanup code can be included in the preferences and run just before the preferences are deleted. |
|
![]() |
![]() |
![]() |
#19 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,336
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
![]() Quote:
What is a volume ID, and where did it come from? What is "book list match" and where did it come from? My guess is that it the information is already in metadata.calibre The device ID will be a UUID assigned by calibre. Many devices don't have a built-in ID, and I have no interest in figuring out how to get the ID for devices that do but that I don't own. If such a thing is necessary, someone else can take on this challenge. There would be such a file on each memory location. |
||
![]() |
![]() |
![]() |
#20 | |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,188
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#21 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,188
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@chaley: I'd suggest just extending the current get_info method to return this info as well and sticking it onto the device object so it only has to be read once.
|
![]() |
![]() |
![]() |
#22 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,336
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
I thought of changing the get_info method, but then I hesitated to change a published API. That is probably silly, though, because there is almost certainly only one user -- gui.devices. ![]() |
|
![]() |
![]() |
![]() |
#23 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,188
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yeah only gui2.device and prs500.cli as per grep
|
![]() |
![]() |
![]() |
#24 | |||
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,903
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
I name all my SD/pen drives/HD partitions. eg. Code:
C:\Documents and Settings\shop1>vol Volume in drive C is C-clamp Volume Serial Number is F857-3467 P:\>vol Volume in drive P is BOOKS1 Volume Serial Number is 8483-EA81 I think all FAT volumes have a serial ID Quote:
I was suggesting one way to ID the (device) storage (with a damaged ID file) was a fast compare with the snapshots in the archived 'on device libraries'. Not perfect. If it reached a threshold of 'hits', the user could be queried: 'Is this Charlies PRS-300?' Quote:
|
|||
![]() |
![]() |
![]() |
#25 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,336
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#26 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,336
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Taking into account theduck's suggestions, I now have device_info containing:
Code:
{'info': [
'Folder Device', '', '', '',
{'main':
{'device_store_uuid': '586a8563-679d-45cf-8c82-fd6100143fd8',
'calibre_version': u'0.7.47',
'prefix': u'C:/Users/charles/Desktop/debug/',
'last_library_uuid': 'THIS IS A UUID',
'date_last_connected': u'2011-02-28 13:13:00.776000+00:00'
}
}
],
'prefixes': (None, None),
'freespace': (321195761664L, 0, 0)}
The first 4 elements of the 'info' list are the device type name, device version, software version on device, and mime type. In most cases the 2nd through 4th are not known and are set to ''. The fifth element in the list is the driveinfo dict containing up to three keys: 'main', 'A', and 'B', providing information about the memory in the device. The key and associated data will be there only if the device has the memory location installed. If the device does not support driveinfo, then the dict will be contain no keys. device_store_uuid will be set the first time that calibre sees a device or a card. last_library_uuid will be UUID of the library open in calibre when the device was last connected (once we have it) The 'prefixes' list contains two elements: the path to memory cards A and B if the memory is installed, otherwise None. The 'drivespace' list contains three elements: the amount of free space on main memory, card A, and card B. The API for fetching the information is device_manager.get_current_device_information(). Last edited by chaley; 02-28-2011 at 08:37 AM. |
![]() |
![]() |
![]() |
#27 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,721
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
At the risk of drifting us even further off ... if a device uuid is now being persisted on the device, does anyone have any interest in enhancing the autodownload news stuff to allow it to be associated with a uuid? So that you could have device specific news lists? Which is what my book sync plugin would need as mentioned by meme above? Or shall I just raise a ticket for it as a potential future addition?
Also, is there going to be any kind of database entry in Calibre for the device where some kind of name could be associated with it as meme raised? Otherwise we will all in our plugins be replicating code requiring the user to "identify" a name for the uuid? Last edited by kiwidude; 02-28-2011 at 06:54 AM. |
![]() |
![]() |
![]() |
#28 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,336
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#29 | |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,721
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#30 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,903
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
What I am calling the 'archived on-device library' is saving the info (listing) you see in one of the device views for the current connected device.
eg. my PEz: Main and Card_A = 2 snapshots into/updating the archive once ID's are established. My idea was to provide a way to 'view' a snapshot (currently disappears, when disconnected) of what was on a device(s). Another goal, would to lay the ground work for a re-occurring, multi-user library permissions management suggestions ![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do you pick names? | AgentBEATS | Writers' Corner | 32 | 02-22-2011 10:03 AM |
Confused about names | shinnosuke | BeBook | 8 | 04-24-2010 11:33 AM |
Publisher's Names | emonti8384 | General Discussions | 10 | 04-05-2010 12:05 AM |
Author names | superplinio | Calibre | 6 | 02-27-2010 04:58 AM |
Help me out with a couple of names | ardeegee | Lounge | 12 | 09-27-2009 03:41 AM |