device

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2019 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kobo

type Kobo struct {
	Device koboDevice

	KuConfig        *KuOptions
	DBRootDir       string
	BKRootDir       string
	ContentIDprefix cidPrefix

	MetadataMap     map[string]KoboMetadata
	UpdatedMetadata []string
	Passwords       *uncagedPassword
	DriveInfo       uc.DeviceInfo

	Wg *sync.WaitGroup
	// contains filtered or unexported fields
}

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

func New

func New(dbRootDir, sdRootDir string, updatingMD bool, opts *KuOptions, 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) GetDeviceOptions

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

GetDeviceOptions gets some device options that UNCaGED requires

func (*Kobo) SaveCoverImage

func (k *Kobo) SaveCoverImage(contentID string, size image.Point, imgB64 string)

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) UpdateIfExists

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

UpdateIfExists updates onboard metadata if it exists in the Nickel database

func (*Kobo) UpdateNickelDB

func (k *Kobo) UpdateNickelDB() error

UpdateNickelDB updates the Nickel database with updated metadata obtained from a previous run

func (*Kobo) WriteMDfile

func (k *Kobo) WriteMDfile() error

WriteMDfile writes metadata to file

func (*Kobo) WriteUpdateMDfile

func (k *Kobo) WriteUpdateMDfile() error

WriteUpdateMDfile writes updated metadata to file

type KoboMetadata

type KoboMetadata struct {
	Authors         []string               `json:"authors" mapstructure:"authors"`
	Languages       []string               `json:"languages" mapstructure:"languages"`
	UserMetadata    map[string]interface{} `json:"user_metadata" mapstructure:"user_metadata"`
	UserCategories  map[string]interface{} `json:"user_categories" mapstructure:"user_categories"`
	Comments        *string                `json:"comments" mapstructure:"comments"`
	Tags            []string               `json:"tags" mapstructure:"tags"`
	Pubdate         *string                `json:"pubdate" mapstructure:"pubdate"`
	SeriesIndex     *float64               `json:"series_index" mapstructure:"series_index"`
	Thumbnail       []interface{}          `json:"thumbnail" mapstructure:"thumbnail"`
	PublicationType *string                `json:"publication_type" mapstructure:"publication_type"`
	Mime            *string                `json:"mime" mapstructure:"mime"`
	AuthorSort      string                 `json:"author_sort" mapstructure:"author_sort"`
	Series          *string                `json:"series" mapstructure:"series"`
	Rights          *string                `json:"rights" mapstructure:"rights"`
	DbID            interface{}            `json:"db_id" mapstructure:"db_id"`
	Cover           *string                `json:"cover" mapstructure:"cover"`
	ApplicationID   interface{}            `json:"application_id" mapstructure:"application_id"`
	BookProducer    *string                `json:"book_producer" mapstructure:"book_producer"`
	Size            int                    `json:"size" mapstructure:"size"`
	AuthorSortMap   map[string]string      `json:"author_sort_map" mapstructure:"author_sort_map"`
	Rating          *float64               `json:"rating" mapstructure:"rating"`
	Lpath           string                 `json:"lpath" mapstructure:"lpath"`
	Publisher       *string                `json:"publisher" mapstructure:"publisher"`
	Timestamp       *string                `json:"timestamp" mapstructure:"timestamp"`
	LastModified    *string                `json:"last_modified" mapstructure:"last_modified"`
	UUID            string                 `json:"uuid" mapstructure:"uuid"`
	TitleSort       string                 `json:"title_sort" mapstructure:"title_sort"`
	AuthorLinkMap   map[string]string      `json:"author_link_map" mapstructure:"author_link_map"`
	Title           string                 `json:"title" mapstructure:"title"`
	Identifiers     map[string]string      `json:"identifiers" mapstructure:"identifiers"`
}

KoboMetadata contains the metadata for ebooks on kobo devices. It replicates the metadata available in the Kobo USBMS driver. Note, pointers are used where necessary to account for null JSON values

func CreateKoboMetadata

func CreateKoboMetadata() KoboMetadata

CreateKoboMetadata creates the required nested maps

type KuOptions

type KuOptions struct {
	PreferSDCard bool
	PreferKepub  bool
	PasswordList []string
	Thumbnail    thumbnailOption
}

KuOptions contains some options that are required

Jump to

Keyboard shortcuts

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