Documentation
¶
Index ¶
- Constants
- Variables
- func CloseLogFile()
- func LocateConfigFile(configFilename string, portable bool) (string, error)
- func LocateDataFile(configFilename string, portable bool) (string, error)
- func NormaliseText(s string) string
- func OpenConnection(filepath string) error
- func StartLogger(portable bool, level slog.Leveler) (*slog.Logger, error)
- type Backend
- func (b *Backend) DetectKobos() []Kobo
- func (b *Backend) FormatSystemDetails() string
- func (b *Backend) ForwardToReadwise() (int, error)
- func (b *Backend) GetBookmark() *Bookmark
- func (b *Backend) GetContent() *Content
- func (b *Backend) GetPlainSystemDetails() string
- func (b *Backend) GetSelectedKobo() Kobo
- func (b *Backend) GetSettings() *Settings
- func (b *Backend) NavigateExplorerToLogLocation()
- func (b *Backend) PromptForLocalDBPath() error
- func (b *Backend) SelectKobo(devicePath string) error
- type BookListEntry
- type BookListResponse
- type Bookmark
- type Content
- type CoverUpdate
- type Highlight
- type HighlightCounts
- type Kobo
- func (k *Kobo) BuildContentIndex(content []Content, logger *slog.Logger) map[string]Content
- func (k *Kobo) CountDeviceBookmarks(logger *slog.Logger) HighlightCounts
- func (k *Kobo) ListDeviceBookmarks(includeStoreBought bool, logger *slog.Logger) ([]Bookmark, error)
- func (k *Kobo) ListDeviceContent(includeStoreBought bool, logger *slog.Logger) ([]Content, error)
- type Readwise
- func (r *Readwise) CheckTokenValidity(token string) error
- func (r *Readwise) RetrieveUploadedBooks(token string) (BookListResponse, error)
- func (r *Readwise) SendBookmarks(payloads []Response, token string) (int, error)
- func (r *Readwise) UploadCover(encodedCover string, bookId int, token string) error
- type Response
- type Settings
Constants ¶
View Source
const (
HIGHLIGHT_REQUEST_BATCH_MAX = 2000
)
Variables ¶
View Source
var ( AuthEndpoint = "https://readwise.io/api/v2/auth/" BooksEndpoint = "https://readwise.io/api/v2/books?page_size=1000&category=books&source=OctoberForKobo" CoverEndpoint = "https://readwise.io/api/v2/books/%d" HighlightsEndpoint = "https://readwise.io/api/v2/highlights/" MaxHighlightLen = 8096 // It's actually 8191 but we'll go under the limit anyway SourceCategory = "books" SourceType = "OctoberForKobo" UserAgentFmt = "october/%s <https://github.com/marcus-crane/october>" )
View Source
var Conn *gorm.DB
Functions ¶
func CloseLogFile ¶ added in v1.3.0
func CloseLogFile()
func LocateConfigFile ¶ added in v1.6.0
func LocateDataFile ¶ added in v1.6.0
func NormaliseText ¶
func OpenConnection ¶
Types ¶
type Backend ¶
type Backend struct {
SelectedKobo Kobo
ConnectedKobos map[string]Kobo
RuntimeContext *context.Context
Settings *Settings
Readwise *Readwise
Kobo *Kobo
Content *Content
Bookmark *Bookmark
// contains filtered or unexported fields
}
func StartBackend ¶
func (*Backend) DetectKobos ¶
func (*Backend) FormatSystemDetails ¶ added in v1.3.0
func (*Backend) ForwardToReadwise ¶
func (*Backend) GetBookmark ¶
func (*Backend) GetContent ¶
func (*Backend) GetPlainSystemDetails ¶ added in v1.3.0
func (*Backend) GetSelectedKobo ¶
func (*Backend) GetSettings ¶
func (*Backend) NavigateExplorerToLogLocation ¶ added in v1.3.0
func (b *Backend) NavigateExplorerToLogLocation()
func (*Backend) PromptForLocalDBPath ¶
func (*Backend) SelectKobo ¶
type BookListEntry ¶
type BookListResponse ¶
type BookListResponse struct {
Count int `json:"count"`
Results []BookListEntry `json:"results"`
}
type Bookmark ¶
type Bookmark struct {
BookmarkID string `gorm:"BookmarkID" json:"bookmark_id"`
VolumeID string `gorm:"column:VolumeID" json:"volume_id"`
ContentID string `json:"content_id"`
StartContainerPath string
StartContainerChild string
StartContainerChildIndex string
StartOffset string
EndContainerPath string
EndContainerChildIndex string
EndOffset string
Text string `gorm:"Text" json:"text"`
Annotation string `gorm:"Annotation" json:"annotation"`
ExtraAnnotationData string `json:"extra_annotation_data"`
DateCreated string `json:"date_created"`
ChapterProgress float64
Hidden string
Version string
DateModified string
Creator string
UUID string
UserID string
SyncTime string
Published string
ContextString string
Type string
}
type Content ¶
type Content struct {
ContentID string `gorm:"column:ContentID" json:"content_id"`
ContentType string `gorm:"column:ContentType" json:"content_type"`
MimeType string `gorm:"column:MimeType" json:"mime_type"`
BookID string `json:"book_id"`
BookTitle string `gorm:"column:BookTitle" json:"book_title"`
ImageId string `json:"image_id"`
Title string `gorm:"column:Title" json:"title"`
Attribution string `gorm:"column:Attribution" json:"attribution"`
Description string `gorm:"column:Description" json:"description"`
DateCreated string `gorm:"column:DateCreated" json:"date_created"`
ShortCoverKey string
AdobeLocation string `gorm:"column:adobe_location"`
Publisher string
IsEncrypted bool
DateLastRead string `json:"date_last_read"`
FirstTimeReading bool
ChapterIDBookmarked string
ParagraphBookmarked int
BookmarkWordOffset int
NumShortcovers int
VolumeIndex int `gorm:"column:VolumeIndex"`
NumPages int `gorm:"column:___NumPages" json:"num_pages"`
ReadStatus int
SyncTime string `gorm:"column:___SyncTime"`
UserID string `gorm:"column:___UserID"`
PublicationId string
FileOffset int `gorm:"column:___FileOffset"`
FileSize int `gorm:"column:___FileSize"`
PercentRead string `gorm:"column:___PercentRead" json:"percent_read"`
ExpirationStatus int `gorm:"column:___ExpirationStatus"`
FavouritesIndex int
Accessibility int
ContentURL string
Language string
BookshelfTags string
IsDownloaded bool
FeedbackType int
AverageRating float64
Depth int
PageProgressDirection string
InWishlist string
ISBN string
WishlistedDate string
FeedbackTypeSynced bool
IsSocialEnabled bool
EpubType string
Monetization string
ExternalId string
Series string
SeriesNumber string
Subtitle string
WordCount string
Fallback string
RestOfBookEstimate string
CurrentChapterEstimate string
CurrentChapterProgress float32
PocketStatus string
UnsyncedPocketChanges string
ImageUrl string
DateAdded string
WorkId string
Properties string
RenditionSpread string
RatingCount string
ReviewsSyncDate string
MediaOverlay string
RedirectPreviewUrl bool
PreviewFileSize int
EntitlementId string
CrossRevisionId string
DownloadUrl bool
ReadStateSynced bool
TimesStartedReading int
TimeSpentReading int
LastTimeStartedReading string
LastTimeFinishedReading string
ApplicableSubscriptions string
ExternalIds string
PurchaseRevisionId string
SeriesID string
SeriesNumberFloat float64
AdobeLoanExpiration string
HideFromHomePage bool
IsInternetArchive bool
TitleKana string `gorm:"column:titleKana"`
SubtitleKana string `gorm:"column:subtitleKana"`
SeriesKana string `gorm:"column:seriesKana"`
AttributionKana string `gorm:"column:attributionKana"`
PublisherKana string `gorm:"column:publisherKana"`
IsPurchaseable bool
IsSupported bool
AnnotationsSyncToken string
DateModified string
}
type CoverUpdate ¶
type CoverUpdate struct {
Cover string `json:"cover"`
}
type Highlight ¶
type Highlight struct {
Text string `json:"text"`
Title string `json:"title,omitempty"`
Author string `json:"author,omitempty"`
SourceURL string `json:"source_url"`
SourceType string `json:"source_type"`
Category string `json:"category"`
Note string `json:"note,omitempty"`
HighlightedAt string `json:"highlighted_at,omitempty"`
}
type HighlightCounts ¶ added in v1.4.0
type Kobo ¶
type Kobo struct {
Name string `json:"name"`
Storage int `json:"storage"`
DisplayPPI int `json:"display_ppi"`
MntPath string `json:"mnt_path"`
DbPath string `json:"db_path"`
}
func (*Kobo) BuildContentIndex ¶
func (*Kobo) CountDeviceBookmarks ¶
func (k *Kobo) CountDeviceBookmarks(logger *slog.Logger) HighlightCounts
func (*Kobo) ListDeviceBookmarks ¶
type Readwise ¶
type Readwise struct {
UserAgent string
// contains filtered or unexported fields
}
func (*Readwise) CheckTokenValidity ¶
func (*Readwise) RetrieveUploadedBooks ¶
func (r *Readwise) RetrieveUploadedBooks(token string) (BookListResponse, error)
func (*Readwise) SendBookmarks ¶
type Settings ¶
type Settings struct {
ReadwiseToken string `json:"readwise_token"`
UploadCovers bool `json:"upload_covers"`
UploadStoreHighlights bool `json:"upload_store_highlights"`
// contains filtered or unexported fields
}
func (*Settings) SaveCoverUploading ¶
func (*Settings) SaveStoreHighlights ¶ added in v1.4.0
Click to show internal directories.
Click to hide internal directories.