bgur

package
v0.0.0-...-80f5753 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const AuthPort = 8099

These are hard coded on the Imgur app auth page

View Source
const AuthUrl = "/oauthcallback"
View Source
const StateAlbumName = "Bgur Sync Data"
View Source
const TimeFormat = time.RFC3339

Variables

This section is empty.

Functions

func DiffImages

func DiffImages(sliceA, sliceB []imgur.Image) ([]imgur.Image, []imgur.Image)

Returns elements in A not in B, and vice versa

func Randomise

func Randomise(images []imgur.Image)

Types

type App

type App struct {
	ConfigDir string
	CacheDir  string
	CacheTime time.Duration
	Sync      bool
	// contains filtered or unexported fields
}

func NewApp

func NewApp(configDir, cacheDir string, cacheTime time.Duration, sync bool) *App

func (*App) AddAlbumToFolder

func (a *App) AddAlbumToFolder(albumId string) (err error)

func (*App) Authorise

func (a *App) Authorise() error

func (*App) AuthorisedUsername

func (a *App) AuthorisedUsername() string

func (*App) CountImages

func (a *App) CountImages() int

func (*App) DownloadImage

func (a *App) DownloadImage(image imgur.Image) (imgPath string, err error)

func (*App) DownloadState

func (a *App) DownloadState() (data []byte, err error)

func (*App) DumpFavourites

func (a *App) DumpFavourites(folderOwner string) (err error)

func (*App) GetStateAlbum

func (a *App) GetStateAlbum() (album imgur.Album, err error)

func (*App) GetStateImage

func (a *App) GetStateImage() (image imgur.Image, err error)

func (*App) LoadAlbums

func (a *App) LoadAlbums() (err error)

func (*App) LoadImages

func (a *App) LoadImages() (err error)

func (*App) LoadState

func (a *App) LoadState() (err error)

func (*App) PickImage

func (a *App) PickImage(expiry time.Duration, minRatio, maxRatio int) (imgur.Image, error)

func (*App) RunServer

func (a *App) RunServer(shutdownChan chan error)

func (*App) SaveImages

func (a *App) SaveImages() error

func (*App) SaveState

func (a *App) SaveState() (err error)

func (*App) SelectFolder

func (a *App) SelectFolder(folderOwner, folderName string) error

func (*App) SetSeed

func (a *App) SetSeed(seed int64)

func (*App) StopServer

func (a *App) StopServer()

func (*App) SyncState

func (a *App) SyncState() (err error)

func (*App) UploadAllImages

func (a *App) UploadAllImages(sourcePath, albumName string) (err error)

func (*App) UploadState

func (a *App) UploadState(state State) (err error)

type State

type State struct {
	CurrentImage int `json:"current_image"`
	// TODO load cacheTimestamp from cache file, remove from state
	CacheTimestamp string `json:"cache_timestamp"`
	DateChanged    string `json:"date_changed"`
	StateTimestamp string `json:"state_timestamp"`
	Seed           int64  `json:"seed"`
}

Jump to

Keyboard shortcuts

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