Documentation ¶
Index ¶
- func CopyFile(src, dst string) (err error)
- func StartDispatcher(nworkers int, CacheInvalidation bool, WorkQueue chan File, log *log.Logger)
- func StartWorker(CacheInvalidation bool, WorkQueue chan File, log *log.Logger)
- type ByDateTime
- type Context
- type File
- func (f *File) ClearTemp() error
- func (f *File) DateTimeString() string
- func (f *File) DetectMIME() error
- func (f *File) EnsureTagDirectoryExists() error
- func (f *File) Exists() bool
- func (f *File) GenerateImage(width int, height int, crop bool) error
- func (f *File) GenerateLinks(baseurl string)
- func (f *File) GetLink(s string) string
- func (f *File) ImageExists(width int, height int) bool
- func (f *File) ImagePath(width int, height int) string
- func (f *File) MediaType() string
- func (f *File) ParseExif() error
- func (f *File) Publish() error
- func (f *File) Purge() error
- func (f *File) Remove() error
- func (f *File) SetFilename(s string) error
- func (f *File) SetTag(s string) error
- func (f *File) SetTagDir(filedir string) error
- func (f *File) StatInfo() error
- func (f *File) VerifySHA256(s string) error
- func (f *File) WriteTempfile(d io.Reader, tempdir string) error
- type Link
- type Tag
- func (t *Tag) CalculateExpiration(expiration int64) error
- func (t *Tag) IsExpired(expiration int64) (bool, error)
- func (t *Tag) List(baseurl string) error
- func (t *Tag) Remove() error
- func (t *Tag) SetTag(s string) error
- func (t *Tag) SetTagDir(filedir string)
- func (t *Tag) StatInfo() error
- func (t *Tag) TagDirExists() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFile ¶
http://stackoverflow.com/a/21067803 CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.
func StartDispatcher ¶
Dispatcher function to spawn a number of workers
Types ¶
type ByDateTime ¶
type ByDateTime []File
Sort files by DateTime
func (ByDateTime) Len ¶
func (a ByDateTime) Len() int
func (ByDateTime) Less ¶
func (a ByDateTime) Less(i, j int) bool
func (ByDateTime) Swap ¶
func (a ByDateTime) Swap(i, j int)
type File ¶
type File struct { Filename string `json:"filename"` Tag string `json:"tag"` TagDir string `json:"-"` Bytes int64 `json:"bytes"` BytesReadable string `json:"-"` MIME string `json:"mime"` CreatedReadable string `json:"-"` CreatedAt time.Time `json:"created"` Links []Link `json:"links"` Checksum string `json:"checksum,omitempty"` Algorithm string `json:"algorithm,omitempty"` Verified bool `json:"verified"` RemoteAddr string `json:"-"` UserAgent string `json:"-"` Tempfile string `json:"-"` // Image specific attributes DateTime time.Time `json:"datetime,omitempty"` DateTimeReadable string `json:"-"` Longitude float64 `json:"longitude,omitempty"` Latitude float64 `json:"latitude,omitempty"` Altitude string `json:"altitude,omitempty"` Exif *exif.Exif `json:"-"` }
func (*File) DateTimeString ¶
Return DateTime as a string. Useful in templates.
func (*File) DetectMIME ¶
func (*File) EnsureTagDirectoryExists ¶
func (*File) GenerateLinks ¶
func (*File) SetFilename ¶
func (*File) VerifySHA256 ¶
type Tag ¶
type Tag struct { Tag string `json:"tag"` TagDir string `json:"-"` ExpirationAt time.Time `json:"-"` ExpirationReadable string `json:"expiration"` Expired bool `json:"-"` LastUpdateAt time.Time `json:"-"` LastUpdateReadable string `json:"lastupdate"` Files []File `json:"files"` Album bool `json:"-"` }
func (*Tag) CalculateExpiration ¶
func (*Tag) TagDirExists ¶
Click to show internal directories.
Click to hide internal directories.