device

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GenerateAll     string = "all"
	GeneratePartial string = "partial"
	GenerateNone    string = "none"
)

What thumbnails, if any, to save

View Source
const IgnoreProgress int = -127

IgnoreProgress tells HandleMessage not to send progress value to web UI

Variables

This section is empty.

Functions

This section is empty.

Types

type BookMeta added in v0.5.4

type BookMeta struct {
	UpdatedBook bool
	NewBook     bool
	Meta        *uc.CalibreBookMeta
}

BookMeta stores information about metadata for each book

type Kobo

type Kobo struct {
	KuVers string
	Device kobo.Device

	KuConfig        *KuOptions
	DBRootDir       string
	BKRootDir       string
	ContentIDprefix cidPrefix
	UseSDCard       bool
	MetadataMap     map[string]BookMeta
	SeriesIDMap     map[string]string
	LibInfo         uc.CalibreLibraryInfo
	PassCache       calPassCache
	DriveInfo       uc.DeviceInfo

	FinishedMsg string
	BrowserOpen bool

	MsgChan  chan WebMsg
	AuthChan chan *calPassword

	UCExitChan chan<- bool
	// contains filtered or unexported fields
}

Kobo contains the variables and methods required to use the UNCaGED library

func New

func New(dbRootDir, sdRootDir string, bindAddress string, disableNDB bool, vers string) (*Kobo, error)

New creates a Kobo object, ready for use

func (*Kobo) Close

func (k *Kobo) Close()

Close the kobo object when we're finished with it

func (*Kobo) DebugLogPrintf added in v0.5.4

func (k *Kobo) DebugLogPrintf(format string, args ...interface{})

DebugLogPrintf prints logs when debugging enabled

func (*Kobo) GetCalibreInstance added in v0.5.0

func (k *Kobo) GetCalibreInstance(calInstances []uc.CalInstance) uc.CalInstance

GetCalibreInstance instructs the user to select from a list of available Calibre instances on their network

func (*Kobo) GetDeviceOptions

func (k *Kobo) GetDeviceOptions() (ext []string, model string, thumbSz image.Point)

GetDeviceOptions gets some device options that UNCaGED requires

func (*Kobo) GetDirectConnection added in v0.5.0

func (k *Kobo) GetDirectConnection() *uc.CalInstance

GetDirectConnection gets a direct connection if set

func (*Kobo) GetPassword added in v0.5.0

func (k *Kobo) GetPassword(calUUID, calLibName string) string

GetPassword provides a method of either using a cached password, or prompting the user for a new password

func (*Kobo) HandleCalAuth added in v0.5.0

func (k *Kobo) HandleCalAuth(w http.ResponseWriter, r *http.Request)

HandleCalAuth gets user supplied password

func (*Kobo) HandleCalInstances added in v0.5.0

func (k *Kobo) HandleCalInstances(w http.ResponseWriter, r *http.Request)

HandleCalInstances gets the user selected calibre instance to connect to

func (*Kobo) HandleConfig added in v0.5.0

func (k *Kobo) HandleConfig(w http.ResponseWriter, r *http.Request)

HandleConfig sends and gets config from user

func (*Kobo) HandleExit added in v0.5.0

func (k *Kobo) HandleExit(w http.ResponseWriter, r *http.Request)

HandleExit allows the client to exit at the config page. Witout this, the only way to exit on the config page was to kill the process(es)

func (*Kobo) HandleIndex added in v0.5.0

func (k *Kobo) HandleIndex(w http.ResponseWriter, r *http.Request)

HandleIndex displays a form allowing the user to customize KU. It uses the existing ku.toml file as a seed

func (*Kobo) HandleLibraryInfo added in v0.5.0

func (k *Kobo) HandleLibraryInfo(w http.ResponseWriter, r *http.Request)

HandleLibraryInfo gets and sets library specific config/info

func (*Kobo) HandleMessages added in v0.5.0

func (k *Kobo) HandleMessages(w http.ResponseWriter, r *http.Request)

HandleMessages sends messages to the client using server sent events.

func (*Kobo) HandleUCExit added in v0.5.0

func (k *Kobo) HandleUCExit(w http.ResponseWriter, r *http.Request)

HandleUCExit lets the user stop UNCaGED client side, without having to disconnect via Calibre

func (*Kobo) SaveCoverImage

func (k *Kobo) SaveCoverImage(contentID string, size image.Point, imgB64 string, done chan<- struct{})

SaveCoverImage generates cover image and thumbnails, and save to appropriate locations

func (*Kobo) SaveDeviceInfo

func (k *Kobo) SaveDeviceInfo() error

SaveDeviceInfo save device info to file

func (*Kobo) SaveUserOptions added in v0.5.0

func (k *Kobo) SaveUserOptions() error

func (*Kobo) UpdateIfExists

func (k *Kobo) UpdateIfExists(cID string, len int) error

UpdateIfExists updates onboard metadata if it exists in the Nickel database

func (*Kobo) WebSend added in v0.5.0

func (k *Kobo) WebSend(msg WebMsg)

WebSend is a small function to print a message to webclient, and wait for to be sent before returning

func (*Kobo) WriteMDfile

func (k *Kobo) WriteMDfile() error

WriteMDfile writes metadata to file

func (*Kobo) WritePassCache added in v0.5.0

func (k *Kobo) WritePassCache() error

WritePassCache writes the password cache to a file

func (*Kobo) WriteUpdatedMetadataSQL added in v0.5.0

func (k *Kobo) WriteUpdatedMetadataSQL() (bool, error)

WriteUpdatedMetadataSQL writes SQL to write updated metadata to the Kobo database. The SQLite CLI client will be used to perform the import.

type KuLibOptions added in v0.5.0

type KuLibOptions struct {
	SubtitleColumn string `json:"subtitleColumn"`
}

KuLibOptions contains per-library options

type KuOptions

type KuOptions struct {
	PreferSDCard    bool                    `json:"preferSDCard"`
	PreferKepub     bool                    `json:"preferKepub"`
	EnableDebug     bool                    `json:"enableDebug"`
	Thumbnail       thumbnailOption         `json:"thumbnail"`
	LibOptions      map[string]KuLibOptions `json:"libOptions"`
	DirectConnIndex int                     `json:"directConnIndex"`
	DirectConn      []uc.CalInstance        `json:"directConn"`
	ExcludeFormats  []string                `json:"excludeFormats"`
}

KuOptions contains some options that are required

type MetaIterator added in v0.4.0

type MetaIterator struct {
	// contains filtered or unexported fields
}

MetaIterator Kobo UNCaGED to lazy load book metadata

func NewMetaIter added in v0.4.0

func NewMetaIter(k *Kobo) *MetaIterator

NewMetaIter creates a new MetaIterator for use

func (*MetaIterator) Add added in v0.4.0

func (m *MetaIterator) Add(cid string)

Add a client ID to the iterator

func (*MetaIterator) Count added in v0.4.0

func (m *MetaIterator) Count() int

Count gets the number items in the iterator

func (*MetaIterator) Get added in v0.4.0

func (m *MetaIterator) Get() (uc.CalibreBookMeta, error)

Get the metadata of the current iteration

func (*MetaIterator) Next added in v0.4.0

func (m *MetaIterator) Next() bool

Next advances the iterator

type WebMsg added in v0.5.0

type WebMsg struct {
	ShowMessage    string
	Progress       int
	GetPassword    bool
	GetCalInstance bool
	GetLibInfo     bool
	Finished       string
}

WebMsg is used to send messages to the web client

Jump to

Keyboard shortcuts

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