lib

package
v0.0.0-...-669539d Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GRHost       = "http://192.168.0.1/"
	PhotoListURI = "v1/photos"
	PropsURI     = "v1/props"
)

Variables

This section is empty.

Functions

func ApplyOrientation

func ApplyOrientation(img image.Image, orientation int) image.Image

func CopyFile

func CopyFile(srcPath, dstPath string) error

func EnsureDownloadDir

func EnsureDownloadDir(dir string) error

func ExtractExifInfo

func ExtractExifInfo(name string, cfg Config) interface{}

func GRPhotoListURL

func GRPhotoListURL() string

func GetFileInfo

func GetFileInfo(name string, cfg Config, existingFiles map[string]bool) (size int64, modTime time.Time, exists bool)

func ScanCameraUsb

func ScanCameraUsb(out *[]string, cfg Config)

func ScanCameraWiFi

func ScanCameraWiFi(out *[]string, mock bool)

func ScanDownloadDir

func ScanDownloadDir(existingFiles map[string]bool, cfg Config)

func SetLogText

func SetLogText(logBox *tview.TextView)

func SetupControls

func SetupControls(
	app *tview.Application,
	photoListBox *tview.List,
	currentItem *int,
	photos []string,
	pages *tview.Pages,
	logBox *tview.TextView,
	setAppFocus func(t *tview.TextView, l *tview.List),
	itemIsSelected func(int) bool,
	toggleSelection func(int),
	downloadSelected func(),
	selectAll func(),
	deselectAll func(),
	renderPreviewModal func(string) tview.Primitive,
)

SetupControls sets up the global keybindings for the app.

func WaitForConnection

func WaitForConnection(cfg Config)

func WriteLog

func WriteLog(message string, logBox *tview.TextView)

Types

type Config

type Config struct {
	Mock             bool             `json:"-"` // for testing purposes, not actually in the config file
	ConnectionMethod ConnectionMethod `json:"connection_method"`
	DownloadDir      string           `json:"download_dir"`
	UsbSettings      UsbSettings      `json:"usb"`
}

func LoadConfig

func LoadConfig() (Config, error)

type ConnectionMethod

type ConnectionMethod string
const (
	ConnectionMethodUSB  ConnectionMethod = "usb"
	ConnectionMethodWiFi ConnectionMethod = "wifi"
)

type Direction

type Direction int
const (
	Up   Direction = -1
	Down Direction = 1
)

type GRPhotoList

type GRPhotoList struct {
	ErrCode int    `json:"errCode"`
	ErrMsg  string `json:"errMsg"`
	Dirs    []struct {
		Name  string   `json:"name"`
		Files []string `json:"files"`
	} `json:"dirs"`
}

type PhotoInfo

type PhotoInfo struct {
	ErrCode     int    `json:"errCode"`
	ErrMsg      string `json:"errMsg"`
	CameraModel string `json:"cameraModel"`
	Dir         string `json:"dir"`
	File        string `json:"file"`
	Size        int64  `json:"size"`
	Datetime    string `json:"datetime"`
	Orientation int    `json:"orientation"`
	AspectRatio string `json:"aspectRatio"`
	Av          string `json:"av"`
	Tv          string `json:"tv"`
	Sv          string `json:"sv"`
	Xv          string `json:"xv"`
	GpsInfo     string `json:"gpsInfo"`
}

type UsbSettings

type UsbSettings struct {
	CameraDir string `json:"camera_dir"`
}

Jump to

Keyboard shortcuts

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