cc.db

The file at /var/local/cc.db is used by com.lab126.ccat and stores information regarding the indexed books and collections.

It contains the following tables:

  • BACKFILLING
  • Collation
  • Collections
  • CollectionsJournal
  • DBOK
  • Entries
  • Locale
  • Series
  • SharedStates
  • Versions

BACKFILLING

Unknown.

ColumnTypeDescription
x_versionBLOB (int)

Collation

Described as “current collation locale (string)”. Otherwise unknown.

ColumnTypeDescription
collationBLOB

Collections

Table where the collections (user-created “series” grouping). This is a N-to-N mapping between a collection UUID and a collection member UUID.

The same data can potentially be found from the Entries table, it is unsure which one is the source of truth.

ColumnTypeDescription
i_collection_uuidBLOB (UUID)Collection side
i_member_uuidBLOB (UUID)Member side
i_orderBLOB (int)Order of member within collection
i_member_cde_typeBLOBcdeType of the member
i_member_cde_keyBLOBcdeKey of the member
i_member_is_presentBLOBmember is present on device
i_is_sideloadedBLOBItem sideloaded/downloaded value

There is a UNIQUE (i_collection_uuid, i_member_uuid) constraint on this table.

CollectionsJournal

Unknown.

ColumnTypeDescription
i_event_timeBLOB (datetime)Event time
j_eventBLOB (json)Contains the collections event

DBOK

Unknown.

ColumnTypeDescription
x_okBLOB

The x_ok column is defined as:
PRIMARY KEY
NOT NULL
UNIQUE
CHECK (x_ok = 1)
CHECK (typeof(x_ok) = "integer")

Entries

Main table containing the whole catalog. Everything is here, including books, collections, series containers, dictionaries, and system entries.

The p_titles_0_collation and p_credits_0_name_collation columns use COLLATE icu, which requires the ICU extension. The Kindle’s com.lab126.ccat service has ICU built in, but the standalone sqlite3 CLI on the device does not. This means INSERT operations on this table will fail when using the sqlite3 CLI with Error: no such collation sequence: icu. Workarounds include registering a stub collation in Python (conn.create_collation("icu", ...)), or temporarily stripping COLLATE icu from the schema via PRAGMA writable_schema=ON.

ColumnTypeDescription
p_uuidBLOB PRIMARY KEY NOT NULL (UUID)ID of entry
p_typeBLOB (string)App-defined type. Known values: Entry:Item (books), Entry:Item:Series (series container), Entry:Item:Dictionary, Entry:Item:Audible, Entry:Item:Feedback, Entry:Item:ADC, Entry:Item:HDC, Entry:Item:Images, Entry:Item:AKUGC, Entry:Item:HKUGC, Collection
p_locationBLOB (string)Location (URI to content)
p_lastAccessBLOB (datetime)Last access
p_modificationTimeBLOB (datetime)File modification
p_isArchivedBLOB (bool)Is archived item?
p_titles_0_nominalBLOB (string)Pieces of first title (LString)
p_titles_0_collationBLOB COLLATE icu (string)Used only for filtering and sorting
p_titles_0_pronunciationBLOB (string)Return value is always j_titles
j_titlesBLOB (array of hashmap)All titles (array of LString)
p_titleCountBLOB (int)How many titles (unsigned)
p_credits_0_name_collationBLOB COLLATE icu (string)Collation string for first credit
j_creditsBLOB (array of hashmap)All credits
j_creditCountBLOB (int)How many credits (unsigned)
j_collectionsBLOB (array of UUID)This entry is a member of these collections
p_collectionCountBLOB (int)How many collections (used for filtering)
j_membersBLOB (array of UUID)This collection has these members
p_memberCountBLOB (int)How many members (used for filtering)
p_lastAccessedPositionBLOBFor books: LPR; MP3/Audio: last timestamp played
p_publicationDateBLOB (UTC datetime)Publication date (Whether this should be interpreted as a floating date or a timepoint depends on the content, and we have no reliable way of knowing which is which—currently, use type (EBook, Blog, Magazine, etc.) to decide
p_expirationDateBLOB (UTC datetime)Expiration date. (Time when this item should be purged. Typically used for periodicals and blogs. Will be null for books, etc. which should not be purged)
p_publisherBLOB (string)Publisher
p_isDRMProtectedBLOB (bool)Has DRM?
p_isVisibleHomeBLOB (bool)Should appear in Home?
p_isLatestItemBLOB (bool)Is this the latest item in a group such as a periodical?
p_isDownloadingBLOB (bool)Is currently downloading?
p_isUpdateAvailableBLOB (bool)Is an update available, say to a KDK app?
p_virtualCollectionCountBLOB (int)Number of items in a virtual collection, such as Periodical Back Issues or Archived Items
p_languages_0BLOB (string)Primary content language
j_languagesBLOB (array of IETF BCP 47)All content languages
p_languageCountBLOB (int)How many languages (unsigned)
p_mimeTypeBLOB (string)Mime type
p_coverBLOB (string)Cover location (URI)
p_thumbnailBLOB (string)Thumbnail location (URI)
p_diskUsageBLOB (int)Bytes on disk
p_cdeGroupBLOB (string)CDE Grouping ID (to group periodicals, Retail ASIN)
p_cdeKeyBLOB (string)CDE Key/ASIN
p_cdeTypeBLOB (string)CDE Type. Known values: EBOK (Amazon ebook or sideloaded book), PDOC (personal document), AUDI (Audible audiobook), series (series container entry)
p_versionBLOB (string)Content version
p_guidBLOB (string)Content GUID
j_displayObjectsBLOB (array of hashmap)What to display
j_displayTagsBLOB (array of string)Tags to display (array of enum (string) values)
j_excludedTransportsBLOB (array of string)Disallowed networks for download
p_isMultimediaEnabledBLOB (bool)For Luna books
p_watermarkBLOB (string)Watermark
p_contentSizeBLOB (int)Human-perceived length
p_percentFinishedBLOB (float)What percentage of the total content length the lastAccessedPosition represents
p_isTestDataBLOB (bool)Is this test data?
p_contentIndexedStateBLOB (int)The state of indexing the content of this entry
p_metadataIndexedStateBLOB (int)The state of indexing the metadata of this entry
p_noteIndexedStateBLOB (int)The state of indexing the notes/annotations of this entry
p_credits_0_name_pronunciationBLOB (string)Authors pronunciation
p_metadataStemWordsBLOBMetadata stem words (not used currently. Introduced in J3)
p_metadataStemLanguageBLOBLanguage of the metadata (not used currently. Introduced in J3)
p_ownershipTypeBLOB (int)Ownership type
p_shareTypeBLOBSupport share feature in Discovery App
p_contentStateBLOB (int)Downloaded / sideloaded value
p_metadataUnicodeWordsBLOB (string)Searchable metadata for contents. Terms are separated by U+FFFC (OBJECT REPLACEMENT CHARACTER). Typically contains the title and author name repeated: title\ufffctitle\ufffcauthor\ufffcauthor
p_homeMemberCountBLOB (int)Number of downloaded/sideloaded books inside a collection
j_collectionsSyncAttributesBLOBCollection sync attributes
p_collectionSyncCounterBLOB (int)Max whispersync counter for a collection
p_collectionDataSetNameBLOB (string)Whispersync dataset name for collection
p_originTypeBLOB (int)Content Origin Type
p_pvcIdBLOBPVC identifier
p_companionCdeKeyBLOB (string)Companion CDE ASIN. For an audio book, we may have a companion ebook and vice-versa
p_seriesStateBLOB (int)Series membership state. 0 = this entry is a member of a series (the firmware hides it from the main library and shows it inside the series container). 1 = default value for all other entries (books not in a series, dictionaries, collections, system items, and Entry:Item:Series container rows themselves)
p_totalContentSizeREAL (long)Total size (including sidecars) occupied by the content on the device
p_visibilityStateBLOB (int)Used to determine whether an entry should be visible or not
p_isProcessedBLOB (int)Flag to specify whether the entry should be processed or has already been processed
p_readStateBLOB (int)Indicates the read state of an entry
p_subTypeBLOB (int)Integer to specify the sub type of the entry

Locale

Unknown.

ColumnTypeDescription
localeBLOB (string)

Series

Maps books to series for the “Group Series in Library” feature (firmware 5.13.4+). For Amazon-purchased books, this table is populated by Amazon’s servers during metadata sync. It can also be populated manually for sideloaded books to achieve the same visual grouping.

Each row links a single book to a series. A series with 9 books has 9 rows, all sharing the same d_seriesId.

ColumnTypeDescription
d_seriesIdBLOB (string)Series identifier. Format: urn:collection:1:asin-{ASIN} where {ASIN} is the Amazon series ASIN (e.g. B08BX5D4LC)
d_itemCdeKeyBLOB (string)p_cdeKey of the member book from the Entries table
d_itemPositionBLOB (double)0-indexed position in the series (Book 1 = 0, Book 2 = 1, etc.)
d_itemPositionLabelBLOB (string)1-indexed display label shown in the UI (e.g. "1", "2")
d_itemTypeBLOB (string)Type of the member. Always Entry:Item for books
d_seriesOrderTypeBLOB (string)Sort behavior. Observed values: ordered, unordered

There is a UNIQUE (d_seriesId, d_itemCdeKey) constraint on this table.

Series grouping requirements

For a series to appear in the Kindle library, three things must exist in the database:

  1. Rows in the Series table linking each book to the series (this table)
  2. An Entry:Item:Series row in the Entries table acting as the series container (see below)
  3. p_seriesState = 0 on each member book’s Entries row, which tells the firmware to hide the individual book and show it inside the series instead

Entry:Item:Series rows

Each series has a corresponding row in the Entries table with p_type = 'Entry:Item:Series'. This is the series container that appears in the library. Key fields:

FieldValue / Description
p_typeEntry:Item:Series
p_cdeKeyThe series ASIN (matches the {ASIN} portion of d_seriesId)
p_cdeTypeseries
p_cdeGroupSame as d_seriesId: urn:collection:1:asin-{ASIN}
p_mimeTypeapplication/x-kindle-series
j_titlesJSON: [{"display":"Series Name","collation":"Series Name","language":"en","pronunciation":"Series Name"}]
j_creditsCopied from the first book’s author credits
p_thumbnailPath to the first book’s cover (e.g. /mnt/us/system/thumbnails/thumbnail_{cdeKey}_EBOK_portrait.jpg)
j_members[] (empty — membership is tracked via the Series table, not this field)
p_memberCountTotal number of books in the series
p_homeMemberCountNumber of downloaded/sideloaded books in the series on the device
j_displayObjects[{"ref":"titles"},{"ref":"credits"}]
p_isArchived1
p_isVisibleInHome1
p_seriesState1 (the container itself uses 1; member books use 0)
p_visibilityState1
p_originType-1
p_contentIndexedState2147483647 (INT_MAX — not applicable for series containers)
p_virtualCollectionCountp_memberCount + 1

Versions

Unknown.

ColumnTypeDescription
x_tableBLOB (string) PRIMARY KEY NOT NULL UNIQUE
x_versionBLOB (int)