mfGalleryMetaCreatorGo

package module
v0.0.0-...-2b4f3f0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: MIT Imports: 13 Imported by: 0

README

mfGalleryMetaCreatorGo

Replacement for https://github.com/ktt-ol/mfGalleryMetaCreator

Build

  • dep ensure install
  • go build cli/makeMeta.go or use ./buildStatic.sh

Or use the docker image to build for linux amd64. See [docker-img/README.md] for details.

Usage

Run the makeMeta binary with proper options.

$ ./makeMeta
Usage of ./makeMeta:
  -cc-size int
    	creates a jsonp file for the Chromecast for this thumbnail size. (default -1)
  -debug
    	activates debug logging.
  -force-update
    	ignores the existing meta.json files.
  -max-threads int
    	The maximum amount of threads to use. Default is the number of cpu. (default -1)
  -order string
    	exifTimeAsc,exifTimeDesc,filenameAsc,filenameDesc (default "exifTimeAsc")
  -path string
    	the path to the images (required)
  -size value
    	the bounding box of the thumbnails (required). You can use this parameter more than once.
Folder name

You can easily add the date of an album by encoding the date into the folder name. This script can parse the following date schemes:

  • 2015-08-27_Title_boing
  • 2015-08_Title_boing
  • 2015_Title_boing

You can also skip the date, of course. Every underline will be converted into space.

Folder config

Create a content.ini file to change some attributes for the containing folder. The format is like this:

title=Other name
description=Some description, \
even with line break
cover=someImage.jpg

Important: Don't add any spaces between the equal (=) sign.

Possible settings:

  • title sets the title of the album. The default is the folder name.
  • description of the folder. The default is none.
  • cover sets the cover image for the album. The default is the first image in the album.

Documentation

Index

Constants

View Source
const (
	FILE_REGEXP          = `(?i)\.jpe?g$`
	THUMB_DIR            = ".thumbs"
	CONTENT_INI          = "content.ini"
	META_NAME            = "meta.json"
	META_NAME_CHROMECAST = "meta_cc.jsonp.js"
	META_NAME_LAST_X     = "meta-last.json"
	META_NAME_FIRST_X    = "meta-first.json"
	CC_PREFIX            = "ifsImagesDataCallback("
	CC_SUFFIX            = ");"
)
View Source
const (
	NO_ROTATION = iota
	ROTATE_90
	ROTATE_180
	ROTATE_270
)

Variables

View Source
var IMAGE_ORDER_FUNCTIONS = [...]string{"exifTimeAsc", "exifTimeDesc", "filenameAsc", "filenameDesc"}

available image order functions

Functions

func CheckError

func CheckError(err error, messages ...string)

func SortImages

func SortImages(orderFunctionName string, images JsonImages)

func UpdateThumbnails

func UpdateThumbnails(folder *FolderContent, sizeList IntList, maxThreads int)

Creates thumbnails recursively for the given folder using a thread pool with NumCPU of threads. folder - works on this folder sizeList - creates thumbnails for this sizes. The size represents the maximum bounding box.

Types

type ByTimeDesc

type ByTimeDesc struct{ JsonDirs }

func (ByTimeDesc) Less

func (s ByTimeDesc) Less(i, j int) bool

type ChromecastImage

type ChromecastImage struct {
	Filename string `json:"filename"`
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	Time     *int64 `json:"time"`
}

type FolderConfig

type FolderConfig struct {
	// sets the title of the album. The default is the folder name.
	Title string
	// description of the folder. The default is none.
	Description string
	// sets the cover image for the album. The default is the first image in the album.
	Cover string
}

type FolderContent

type FolderContent struct {
	FullPath      string
	Name          string
	Time          *int64
	Title         string
	Config        FolderConfig
	Files         []string
	ImageMetadata map[string]MetaJsonImage
	Folder        []FolderContent
}

func (*FolderContent) GetFolderTitle

func (fc *FolderContent) GetFolderTitle() string

func (*FolderContent) GetFullPathFile

func (fc *FolderContent) GetFullPathFile(file string) string

func (*FolderContent) String

func (fc *FolderContent) String() string

func (*FolderContent) StringWithIntent

func (fc *FolderContent) StringWithIntent(intention int) string

type IntList

type IntList []int

func (*IntList) Set

func (i *IntList) Set(value string) error

func (*IntList) String

func (i *IntList) String() string

type JsonDirs

type JsonDirs []MetaJsonSubDir

func (JsonDirs) Len

func (s JsonDirs) Len() int

func (JsonDirs) Swap

func (s JsonDirs) Swap(i, j int)

type JsonImages

type JsonImages []MetaJsonImage

func (JsonImages) Len

func (s JsonImages) Len() int

func (JsonImages) Swap

func (s JsonImages) Swap(i, j int)

type MetaJson

type MetaJson struct {
	Meta    MetaJsonMeta     `json:"meta"`
	Images  []MetaJsonImage  `json:"images"`
	SubDirs []MetaJsonSubDir `json:"subDirs"`
}

type MetaJsonImage

type MetaJsonImage struct {
	Filename string         `json:"filename"`
	Width    int            `json:"width"`
	Height   int            `json:"height"`
	Exif     metaJsonExif   `json:"exif"`
	Rotate   RotationAction `json:"-"`
}

type MetaJsonMeta

type MetaJsonMeta struct {
	Title       string `json:"title"`
	Time        *int64 `json:"time"`
	Description string `json:"description"`
}

type MetaJsonSubDir

type MetaJsonSubDir struct {
	FolderName string  `json:"foldername"`
	Title      string  `json:"title"`
	Time       *int64  `json:"time"`
	Cover      *string `json:"cover"`
	ImageCount int     `json:"imageCount"`
}

type RotationAction

type RotationAction int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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