kobo

package
v2.0.0-...-a315511 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountBookmarks

func CountBookmarks(kobo *Kobo) (int, error)

func CountContent

func CountContent(kobo *Kobo) (count int, err error)

func FindMountedDevices

func FindMountedDevices() ([]string, error)

FindMountDevices runs a variety of detection methods for different operating systems (Linux, macOS, Windows) returning any results it can find. Those results are then checked for the existence of a .kobo folder which is used to determine whether a device is valid or not.

func QueryDistinctVolumes

func QueryDistinctVolumes(kobo *Kobo) ([]string, error)

QueryDistinctVolumes retrieves all books that contains highlights and reside (or did at one point) on the device itself. We exclude Kobo store books for simplicity where the path is a GUID which is not useful in the context of retrieving the underlying epub for scanning.

Types

type Bookmark

type Bookmark struct {
	BookmarkID               string  `db:"BookmarkID"`
	VolumeID                 string  `db:"VolumeID"`
	ContentID                string  `db:"ContentID"`
	StartContainerPath       string  `db:"StartContainerPath"`
	StartContainerChild      string  `db:"StartContainerChild"`
	StartContainerChildIndex int     `db:"StartContainerChildIndex"`
	StartOffset              int     `db:"StartOffset"`
	EndContainerPath         string  `db:"EndContainerPath"`
	EndContainerChildIndex   int     `db:"EndContainerChildIndex"`
	EndOffset                int     `db:"EndOffset"`
	Text                     string  `db:"Text"`
	Annotation               string  `db:"Annotation"`
	ExtraAnnotationData      string  `db:"ExtraAnnotationData"`
	DateCreated              string  `db:"DateCreated"`
	ChapterProgress          float64 `db:"ChapterProgress"`
	Hidden                   bool    `db:"Hidden"`
	Version                  string  `db:"Version"`
	DateModified             string  `db:"DateModified"`
	Creator                  string  `db:"Creator"`
	UUID                     string  `db:"UUID"`
	UserID                   string  `db:"UserID"`
	SyncTime                 string  `db:"SyncTime"`
	Published                bool    `db:"Published"`
	ContextString            string  `db:"ContextString"`
	Type                     string  `db:"Type"`
}

type Content

type Content struct {
	ContentID                    string  `db:"ContentID"`
	ContentType                  string  `db:"ContentType"`
	MimeType                     string  `db:"MimeType"`
	BookID                       string  `db:"BookID"`
	BookTitle                    string  `db:"BookTitle"`
	ImageId                      string  `db:"ImageId"`
	Title                        string  `db:"Title"`
	Attribution                  string  `db:"Attribution"`
	Description                  string  `db:"Description"`
	DateCreated                  string  `db:"DateCreated"`
	ShortCoverKey                string  `db:"ShortCoverKey"`
	AdobeLocation                string  `db:"adobe_location"`
	Publisher                    string  `db:"Publisher"`
	IsEncrypted                  bool    `db:"IsEncrypted"`
	DateLastRead                 string  `db:"DateLastRead"`
	FirstTimeReading             bool    `db:"FirstTimeReading"`
	ChapterIDBookmarked          string  `db:"ChapterIDBookmarked"`
	ParagraphBookmarked          int     `db:"ParagraphBookmarked"`
	BookmarkWordOffset           int     `db:"BookmarkWordOffset"`
	NumShortcovers               int     `db:"NumShortcovers"`
	VolumeIndex                  int     `db:"VolumeIndex"`
	NumPages                     int     `db:"___NumPages"`
	ReadStatus                   int     `db:"ReadStatus"`
	SyncTime                     string  `db:"___SyncTime"`
	UserID                       string  `db:"___UserID"`
	PublicationId                string  `db:"PublicationId"`
	FileOffset                   int     `db:"___FileOffset"`
	FileSize                     int     `db:"___FileSize"`
	PercentRead                  int     `db:"___PercentRead"`
	ExpirationStatus             int     `db:"___ExpirationStatus"`
	FavouritesIndex              int     `db:"FavouritesIndex"`
	Accessibility                int     `db:"Accessibility"`
	ContentURL                   string  `db:"ContentURL"`
	Language                     string  `db:"Language"`
	BookshelfTags                string  `db:"BookshelfTags"`
	IsDownloaded                 bool    `db:"IsDownloaded"`
	FeedbackType                 int     `db:"FeedbackType"`
	AverageRating                int     `db:"AverageRating"`
	Depth                        int     `db:"Depth"`
	PageProgressDirection        string  `db:"PageProgressDirection"`
	InWishlist                   bool    `db:"InWishlist"`
	ISBN                         string  `db:"ISBN"`
	WishlistedDate               string  `db:"WishlistedDate"`
	FeedbackTypeSynced           int     `db:"FeedbackTypeSynced"`
	IsSocialEnabled              bool    `db:"IsSocialEnabled"`
	EpubType                     int     `db:"EpubType"`
	Monetization                 int     `db:"Monetization"`
	ExternalId                   string  `db:"ExternalId"`
	Series                       string  `db:"Series"`
	SeriesNumber                 string  `db:"SeriesNumber"`
	Subtitle                     string  `db:"Subtitle"`
	WordCount                    int     `db:"WordCount"`
	Fallback                     string  `db:"Fallback"`
	RestOfBookEstimate           int     `db:"RestOfBookEstimate"`
	CurrentChapterEstimate       int     `db:"CurrentChapterEstimate"`
	CurrentChapterProgress       float32 `db:"CurrentChapterProgress"`
	PocketStatus                 int     `db:"PocketStatus"`
	UnsyncedPocketChanges        string  `db:"UnsyncedPocketChanges"`
	ImageUrl                     string  `db:"ImageUrl"`
	DateAdded                    string  `db:"DateAdded"`
	WorkId                       string  `db:"WorkId"`
	Properties                   string  `db:"Properties"`
	RenditionSpread              string  `db:"RenditionSpread"`
	RatingCount                  int     `db:"RatingCount"`
	ReviewsSyncDate              string  `db:"ReviewsSyncDate"`
	MediaOverlay                 string  `db:"MediaOverlay"`
	MediaOverlayType             string  `db:"MediaOverlayType"`
	RedirectPreviewUrl           bool    `db:"RedirectPreviewUrl"`
	PreviewFileSize              int     `db:"PreviewFileSize"`
	EntitlementId                string  `db:"EntitlementId"`
	CrossRevisionId              string  `db:"CrossRevisionId"`
	DownloadUrl                  string  `db:"DownloadUrl"`
	ReadStateSynced              bool    `db:"ReadStateSynced"`
	TimesStartedReading          int     `db:"TimesStartedReading"`
	TimeSpentReading             int     `db:"TimeSpentReading"`
	LastTimeStartedReading       string  `db:"LastTimeStartedReading"`
	LastTimeFinishedReading      string  `db:"LastTimeFinishedReading"`
	ApplicableSubscriptions      string  `db:"ApplicableSubscriptions"`
	ExternalIds                  string  `db:"ExternalIds"`
	PurchaseRevisionId           string  `db:"PurchaseRevisionId"`
	SeriesID                     string  `db:"SeriesID"`
	SeriesNumberFloat            float64 `db:"SeriesNumberFloat"`
	AdobeLoanExpiration          string  `db:"AdobeLoanExpiration"`
	HideFromHomePage             bool    `db:"HideFromHomePage"`
	IsInternetArchive            bool    `db:"IsInternetArchive"`
	TitleKana                    string  `db:"titleKana"`
	SubtitleKana                 string  `db:"subtitleKana"`
	SeriesKana                   string  `db:"seriesKana"`
	AttributionKana              string  `db:"attributionKana"`
	PublisherKana                string  `db:"publisherKana"`
	IsPurchaseable               bool    `db:"IsPurchaseable"`
	IsSupported                  bool    `db:"IsSupported"`
	AnnotationsSyncToken         string  `db:"AnnotationsSyncToken"`
	DateModified                 string  `db:"DateModified"`
	StorePages                   int     `db:"StorePages"`
	StoreWordCount               int     `db:"StoreWordCount"`
	StoreTimeToReadLowerEstimate int     `db:"StoreTimeToReadLowerEstimate"`
	StoreTimeToReadUpperEstimate int     `db:"StoreTimeToReadUpperEstimate"`
	Duration                     int     `db:"Duration"`
	IsAbridged                   bool    `db:"IsAbridged"`
}

type Kobo

type Kobo struct {
	Name       string `json:"device_name"`
	Storage    int    `json:"device_storage"`
	DisplayPPI int    `json:"display_ppi"`
	MountPath  string `json:"mount_path"`
	DbPath     string `json:"db_path"`
	Serial     string `json:"serial"`
	Version    string `json:"version"`
	DeviceId   string `json:"deviceId"`
	// contains filtered or unexported fields
}

Kobo represents a device, either physically connected or it may be operating on a backup locally stored on disc. It doesn't make much difference operationally.

func GetDeviceMetadata

func GetDeviceMetadata(path string) (Kobo, error)

GetDeviceMetadata looks up the connected Kobo by checking the version string located at <kobo>/.kobo/version An uninitialised KoboConnection will be returned populated with identifiers like device name, storage etc If a device is unknown (ie; released before we support it), a minimally populated KoboConnection will be returned which should still contain enough information for October to still connect regardless.

func NewKobo

func NewKobo(mountPath string, dbPath string) Kobo

NewKobo can be used to emulate a connection to a device on disc with some reasonable defaults. Rather than using default Kobo layout, it is possible to store your Kobo device layout in one folder and your DB in another but the underlying assumption is that it will try to operate upon a folder as if it has epubs and what not in addition to being able to query a database

func (*Kobo) Connect

func (k *Kobo) Connect() error

Connect will do some sanity checking around the configured database path and upon passing, will instantiate the connection to the underlying Kobo sqlite database

func (*Kobo) Disconnect

func (k *Kobo) Disconnect() error

Disconnect can be called to shut down the underlying database connection. This is generally done when switching from one database to another.

func (*Kobo) Ping

func (k *Kobo) Ping() error

Ping can be used to check if the connection to the database is still alive

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL