Documentation ¶
Overview ¶
Package kobo contains stuff related to Kobo devices, firmware, and nickel.
Index ¶
- Variables
- func ContentIDToImageID(contentID string) string
- func Find() ([]string, error)
- func IsKobo(path string) bool
- func ParseKoboAffiliate(kpath string) (affiliate string, err error)
- func ParseKoboUAString(ua string) (version, id string, err error)
- func ParseKoboVersion(kpath string) (serial, version, id string, err error)
- func PathToContentID(relpath string) string
- func VersionCompare(a, b string) int
- type CodeName
- type CodeNameTriplet
- type CoverType
- type Device
- func (d Device) CodeNames() CodeNameTriplet
- func (d Device) CoverSize(t CoverType) image.Point
- func (d Device) CoverSized(t CoverType, orig image.Point) image.Point
- func (d Device) DisplayPPI() int
- func (d Device) Family() string
- func (d Device) Hardware() Hardware
- func (d Device) ID() int
- func (d Device) IDString() string
- func (d Device) Is(n CodeName) bool
- func (d Device) IsTolino() bool
- func (d Device) Name() string
- func (d Device) StorageGB() int
- func (d Device) String() string
- type Hardware
- type UpgradeCheckResult
- type UpgradeType
Constants ¶
This section is empty.
Variables ¶
var ErrCommandNotFound = errors.New("required command not found")
ErrCommandNotFound is thrown when a required command is not found.
Functions ¶
func ContentIDToImageID ¶
ContentIDToImageID converts the Kobo ContentId to the ImageId.
func ParseKoboAffiliate ¶
ParseKoboAffiliate parses the affiliate from the .kobo/affiliate.conf file.
func ParseKoboUAString ¶
ParseKoboUAString parses a web browser UA string for Kobo ID and version info.
func ParseKoboVersion ¶
ParseKoboVersion gets the info from the .kobo/version file.
func PathToContentID ¶
PathToContentID generates the Kobo ContentId for a path relative to the internal storage root (slashes are converted to forward slashes automatically).
func VersionCompare ¶
VersionCompare compares two firmware versions. a < b = -1 a = b = 0 a > b = 1
Types ¶
type CodeName ¶
type CodeName string
CodeName represents an individual codename. Note that a codename can be used for more than one thing in a triplet.
const ( CodeNameNone CodeName = "" CodeNameDesktop CodeName = "desktop" CodeNameNickel1 CodeName = "nickel1" CodeNameNickel2 CodeName = "nickel2" CodeNameMerch CodeName = "merch" CodeNameVox CodeName = "vox" CodeNameTrilogy CodeName = "trilogy" CodeNamePixie CodeName = "pixie" CodeNamePika CodeName = "pika" CodeNameDragon CodeName = "dragon" CodeNameDahlia CodeName = "dahlia" CodeNameAlyssum CodeName = "alyssum" CodeNameSnow CodeName = "snow" CodeNameNova CodeName = "nova" CodeNameStorm CodeName = "storm" CodeNameDaylight CodeName = "daylight" CodeNameSuperDaylight CodeName = "superDaylight" CodeNameFrost CodeName = "frost" CodeNameFrost32 CodeName = "frost32" CodeNamePhoenix CodeName = "phoenix" CodeNameKraken CodeName = "kraken" CodeNameStar CodeName = "star" CodeNameCadmus CodeName = "cadmus" CodeNameLuna CodeName = "luna" CodeNameGoldfinch CodeName = "goldfinch" CodeNameEuropa CodeName = "europa" CodeNameIo CodeName = "io" CodeNameCondor CodeName = "condor" CodeNameMonza CodeName = "monza" CodeNameMonzaTolino CodeName = "monzaTolino" CodeNameSpaBW CodeName = "spaBW" CodeNameSpaTolinoBW CodeName = "spaTolinoBW" CodeNameSpaColour CodeName = "spaColour" CodeNameSpaTolinoColour CodeName = "spaTolinoColour" CodeNameLoki CodeName = "loki" CodeNameFreya CodeName = "freya" )
Codenames.
type CodeNameTriplet ¶
type CodeNameTriplet [3]CodeName
CodeNameTriplet represents a triplet of class/family/secondary codenames. Note that nothing in nickel says a device can only have 3, but everything so far implies that (and it makes sense).
func (CodeNameTriplet) Class ¶
func (c CodeNameTriplet) Class() CodeName
Class gets the class/category.
func (CodeNameTriplet) Family ¶
func (c CodeNameTriplet) Family() CodeName
Family gets the family/model (i.e. part of a class)
func (CodeNameTriplet) FamilyString ¶
func (c CodeNameTriplet) FamilyString() string
FamilyString gets the human readable family/model.
func (CodeNameTriplet) Secondary ¶
func (c CodeNameTriplet) Secondary() CodeName
Secondary gets the secondary device codename (i.e. refines the family).
func (CodeNameTriplet) SecondaryString ¶
func (c CodeNameTriplet) SecondaryString() string
SecondaryString returns the human readable string to append to FamilyString if applicable (e.g. Limited Edition, 32GB).
func (CodeNameTriplet) String ¶
func (c CodeNameTriplet) String() string
type CoverType ¶
type CoverType string
CoverType is used to identify different cover dimensions used for different purposes by nickel.
const ( CoverTypeFull CoverType = "N3_FULL" CoverTypeLibFull CoverType = "N3_LIBRARY_FULL" CoverTypeLibList CoverType = "N3_LIBRARY_LIST" CoverTypeLibGrid CoverType = "N3_LIBRARY_GRID" )
Cover types.
func CoverTypes ¶
func CoverTypes() []CoverType
CoverTypes returns a slice of all implemented nickel cover types.
func (CoverType) GeneratePath ¶
GeneratePath generates the path for the cover of an ImageID. The path is always separated with forward slashes.
func (CoverType) NickelString ¶
NickelString returns the internal string used in nickel to identify the cover type.
type Device ¶
type Device int
Device is a device model.
const ( DeviceTouchAB Device = 310 DeviceTouchC Device = 320 DeviceGlo Device = 330 DeviceMini Device = 340 DeviceAuraHD Device = 350 DeviceAura Device = 360 DeviceAuraH2O Device = 370 DeviceGloHD Device = 371 DeviceTouch2 Device = 372 DeviceAuraONE Device = 373 DeviceAuraH2OEdition2v1 Device = 374 DeviceAuraEdition2v1 Device = 375 DeviceClaraHD Device = 376 DeviceShine3 Device = 676 DeviceForma Device = 377 DeviceEpos2 Device = 677 DeviceAuraH2OEdition2v2 Device = 378 DeviceAuraEdition2v2 Device = 379 DeviceForma32 Device = 380 DeviceAuraONELimitedEdition Device = 381 DeviceNia Device = 382 DeviceSage Device = 383 DeviceLibraH2O Device = 384 DeviceClara2E Device = 386 DeviceElipsa Device = 387 DeviceLibra2 Device = 388 DeviceElipsa2E Device = 389 DeviceLibraColour Device = 390 DeviceVisionColour Device = 690 DeviceClaraBW Device = 391 DeviceShine Device = 691 DeviceClaraColour Device = 393 DeviceShineColor Device = 693 )
Devices (not including really old ones, like Kobo eReader, Wireless, Literati, and Vox).
func DeviceByID ¶
DeviceByID gets a device by its full ID string.
func (Device) CodeNames ¶
func (d Device) CodeNames() CodeNameTriplet
CodeNames returns the codename triplet for the device (like libnickel). Note: Nickel has a slightly different definition if Class, Family, and Secondary, but these triplets are correct (i.e. Device::is* will match nickel, and the hierachy is correct). These were determined by static analysis of libnickel. See PR#1 for details.
func (Device) CoverSize ¶
CoverSize returns the cover size for a cover type for a Device. Currently, everything except for the Full cover is the same for every device.
func (Device) CoverSized ¶
CoverSized returns a size resized to the correct size using the same logic as nickel.
func (Device) DisplayPPI ¶
DisplayPPI returns the display Pixels Per Inch (PPI) of a Device.
type Hardware ¶
type Hardware int
Hardware is a hardware revision.
const ( HardwareKobo3 Hardware = 3 HardwareKobo4 Hardware = 4 HardwareKobo5 Hardware = 5 HardwareKobo6 Hardware = 6 HardwareKobo7 Hardware = 7 HardwareKobo8 Hardware = 8 HardwareKobo9 Hardware = 9 HardwareKobo10 Hardware = 10 HardwareKobo11 Hardware = 11 HardwareKobo12 Hardware = 12 )
Hardware revisions.
type UpgradeCheckResult ¶
type UpgradeCheckResult struct { Data interface{} ReleaseNoteURL string UpgradeType UpgradeType UpgradeURL string }
UpgradeCheckResult represents an update check result from the Kobo API.
func CheckUpgrade ¶
func CheckUpgrade(device, affiliate, curVersion, serial string) (*UpgradeCheckResult, error)
CheckUpgrade queries the Kobo API for an update.
func (UpgradeCheckResult) ParseVersion ¶
func (u UpgradeCheckResult) ParseVersion() string
ParseVersion tries to extract the version from the UpgradeURL. It returns 0.0.0 if none is present.
type UpgradeType ¶
type UpgradeType int
UpgradeType represents an upgrade type.
const ( UpgradeTypeNone UpgradeType = 0 // No upgrade available. UpgradeTypeAvailable UpgradeType = 1 // Optional update, but never seen this before. UpgradeTypeRequired UpgradeType = 2 // Automatic update. )
Upgrade types.
func (UpgradeType) IsUpdate ¶
func (u UpgradeType) IsUpdate() bool
IsUpdate checks if an UpdateType signifies an available update.
func (UpgradeType) String ¶
func (u UpgradeType) String() string