Skip to content

Database

RobbWatershed edited this page Jul 11, 2020 · 11 revisions

Database model (v1.12.0+)

NB : Database is implemented with ObjectBox entities.

Attribute table

This table is the master data table containing all attributes of the collection. If many books have the same attribute, it only appears once in that table; the N-N links between Attribute and Content are managed by ObjectBox.

When two sources have the same attribute, there's still one line in Attribute and two lines in AttributeLocation each of them containing the source code and its URL.

Field Description Example
id Primary key / unique identifier (auto-increment) 198120505
name Attribute name "sole male"
type Attribute type - See AttributeType class : ARTIST(0), PUBLISHER(1), LANGUAGE(2), TAG(3), TRANSLATOR(4), SERIE(5), UPLOADER(6), CIRCLE(7), CHARACTER(8), CATEGORY(9) 3 for Tag

AttributeLocation table

Lists all locations of a given attribute, according to the source.

Field Description Example
id Primary key / unique identifier (auto-increment) 198120505
site Code of the site where the attribute is located - see Site class 3 for Nhentai

Content table

Describes the book in the collection

Field Description Example
id Primary key / unique identifier. Value is the hashCode of the url field -922656221
unique_site_id Unique identifier of the book in its original site 36257
category If any related attribute is of type "Category", it is displayed here doujinshi
url Relative url of the book in its origin site "/229071/"
title Title of the book "Fate/Luck GEAR material"
qty_pages Number of declared pages of the book (may be higher than the actual number of found / downloaded pages) 30
upload_date unused 0
download_date Timestamp of the moment when the book was downloaded in the library 1520406092301
status Download status of the book - See StatusContent class : SAVED(0), DOWNLOADED(1), DOWNLOADING(2), PAUSED(3), ERROR(4), MIGRATED(5), IGNORED(6), UNHANDLED_ERROR(7), CANCELED(8) 1 for Downloaded
cover_image_url Absolute URL of the cover picture of the book in its origin site http://a.com/5/cover.jpg
site Code of the origin site - See Site class : FAKKU(0), PURURIN(1), HITOMI(2), NHENTAI(3), TSUMINO(4), HENTAICAFE(5), ASMHENTAI(6), ASMHENTAI_COMICS(7) ... 1 for Pururin
author If any related attribute is of type "Artist" or "Circle", it is displayed here "kakao"
storage_folder Relative folder (to the Hentoid root folder) where the images of the book are stored "/Pururin/[35925]"
storageUri Content Uri of the folder where the images of the book are stored "content:/storage/emulated/0/.Hentoid/Pururin/[35925]"
favourite Indicates whether the book is a favourite book or not true
reads Number of times the book has been read 56
last_read_date Timestamp of the moment when the book was last opened (default = download date) 1520406092301
lastReadPageIndex Index of the last page that has been read (useful for the "restart at last read page" option; default = -1) 12
downloadParams Extra parameters to use by the download engine when downloading the book; empty when the download is complete (status=DOWNLOADED) any value useful in the context of the corresponding source
isBeingDeleted True if the book is being deleted by the user (useful to display the "being deleted" state when delete operations are long) false
jsonUri Content URI of the JSON file describing the book (useful to speed up I/O operations e.g. when favouriting a page) content URI
bookPreferences JSON-formatted key and values used to store preferences local to the book

Image file table

Used to keep track of download progression of a given book by tracking the download status of each of its pages

Field Description Example
id Primary key / unique identifier (auto-increment) -2077566210
order order of the page in the corresponding book 5
url url of the image in the origin site "http://a.com/5/05.jpg"
name Name of the image file to be created on the phone "005"
status Download status of the image - See StatusContent class : SAVED(0), DOWNLOADED(1), DOWNLOADING(2), PAUSED(3), ERROR(4), MIGRATED(5), IGNORED(6), UNHANDLED_ERROR(7), CANCELED(8), ONLINE(9) 1 for Downloaded
downloadParams Extra parameters to use by the download engine when downloading the page; empty when the download is complete (status=DOWNLOADED) any value useful in the context of the corresponding source
favourite Indicates whether the page is a favourite page or not true
isCover Indicates whether the page is the cover picture of the book or not true
mimeType MIME-type of the image file image/jpeg
size Size of the image file, in bytes 8865465

QueueRecord table

Describes the contents of the current download queue

Field Description Example
id Primary key / unique identifier (auto-increment) 2077566200
rank order of the book in the download queue 1

NB : There is no guarantee that the ranks will start from 1 and increment by 1; the idea is to have an order regardless of the actual values


ErrorRecord table

Describes the errors that happened when processing the corresponding book

Field Description Example
id Primary key / unique identifier (auto-increment) 2077566200
type Type of the error, as documented in the ErrorType class 1
url URL of the resource that caused the error http://site.com/080897/pi_0786.jpg
contentPart Description of the resource affected by the error Picture
description Description of the error Timeout when downloading
timestamp Timestamp of the moment when the error occured, in POSIX time 1594483537

SiteHistory table

Stores the last viewed url for each site

Field Description Example
id Primary key / unique identifier (auto-increment) 2077566200
site Code of the site, as defined in the Site class 1 for Pururin
url URL of the last viewed page of the site http://site.com/080897/