gui

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeRequest  = "request"
	TypeResponse = "response"
	TypeEvent    = "event"
)

Message types

View Source
const (
	CmdPrepare = "prepare" // GUI → CLI: Here are my files
	CmdUpload  = "upload"  // GUI → CLI: Go with these settings
	CmdCancel  = "cancel"  // GUI → CLI: User hit Escape
)

Commands

View Source
const (
	EventProgress = "progress"
	EventComplete = "complete"
	EventError    = "error"
)

Event types

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelRequest

type CancelRequest struct {
	SessionID string `json:"sessionId"`
}

CancelRequest - Cancel an in-progress upload

type ErrorResponse

type ErrorResponse struct {
	Error   string `json:"error"`
	Code    string `json:"code,omitempty"`    // Error code for GUI handling
	Details string `json:"details,omitempty"` // Technical details
}

ErrorResponse - Error response for any command

type ExtractedMetadata

type ExtractedMetadata struct {
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Tags        []string  `json:"tags"`
	Location    *Location `json:"location,omitempty"`
	Date        string    `json:"date,omitempty"`
	// Add camera info for display?
	Camera string `json:"camera,omitempty"`
	Lens   string `json:"lens,omitempty"`
}

ExtractedMetadata - Pre-filled metadata from EXIF/IPTC

type FileInfo

type FileInfo struct {
	Path     string    `json:"path"`
	Name     string    `json:"name"`
	Size     int64     `json:"size"`
	Modified time.Time `json:"modified"`
}

FileInfo contains basic file information

type Location

type Location struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Altitude  float64 `json:"altitude,omitempty"`
}

Location from GPS EXIF

type Message

type Message struct {
	Type    string      `json:"type"`    // request, response, event
	Command string      `json:"command"` // prepare, upload, cancel
	Data    interface{} `json:"data"`
	ID      string      `json:"id,omitempty"`
}

Message wraps all communication

type Metadata

type Metadata struct {
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Tags        []string `json:"tags"`
	Alt         string   `json:"alt,omitempty"` // For accessibility
}

Metadata - User's edited metadata

type PrepareRequest

type PrepareRequest struct {
	Files []string `json:"files"`
}

PrepareRequest - Initial request from GUI with selected files

type PrepareResponse

type PrepareResponse struct {
	SessionID string            `json:"sessionId"`
	Files     []FileInfo        `json:"files"`
	Metadata  ExtractedMetadata `json:"metadata"`
	Backends  []string          `json:"backends"` // Available backends
}

PrepareResponse - Response with extracted metadata for review

type ProgressEvent

type ProgressEvent struct {
	SessionID string  `json:"sessionId"`
	FileIndex int     `json:"fileIndex"`
	FileName  string  `json:"fileName"`
	Progress  float64 `json:"progress"` // 0-100
	Status    string  `json:"status"`   // "extracting", "uploading", "processing", "complete"
	Message   string  `json:"message,omitempty"`
}

ProgressEvent - Progress updates during upload

type Server

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

Server handles GUI protocol communication

func NewServer

func NewServer(input io.Reader, output io.Writer, cfg *config.Config, uploader *upload.Service) *Server

NewServer creates a new GUI protocol server

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run starts the server loop

type Session

type Session struct {
	ID       string
	Files    []string
	Metadata ExtractedMetadata
	Cancel   context.CancelFunc
}

Session represents an active upload session

type UploadRequest

type UploadRequest struct {
	SessionID    string   `json:"sessionId"`
	Metadata     Metadata `json:"metadata"`
	Backend      string   `json:"backend"`
	PostToSocial []string `json:"postToSocial,omitempty"`
	Format       string   `json:"format"`
}

UploadRequest - Final upload request after user review

type UploadResult

type UploadResult struct {
	SessionID string   `json:"sessionId"`
	Success   bool     `json:"success"`
	Outputs   []string `json:"outputs"` // Formatted per requested format
	Files     []string `json:"files"`   // Original filenames for reference
	Error     string   `json:"error,omitempty"`
}

UploadResult - Final result

Jump to

Keyboard shortcuts

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