2
0
mirror of https://github.com/thumbsup/thumbsup synced 2024-11-05 12:01:04 +00:00
Go to file
Romain 24b2f9bd7c Major optimisations: SQLite index + faster disk glob + new exiftool streaming
1. Move from a JSON index to a SQLite database.
  - This allows the indexing to be interrupted & resumed
  - Updating the index consumes less RAM than loading / saving an entire JSON object
  - Loading the index consumes less RAM since it can be streamed, only exacting the properties we need every time (instead of loading all EXIF data in memory, only to discard most of it later)
  - These make a big difference when processing 10,000+ photos

2. Switch from <glob> to a manual <readdir>
  - Glob would take several hundred or GB of RAM when asked to find several thousand files
  - Manual approach with <micromatch> library does the same thing in a fraction of the time / memory usage

3. Exiftool optimisations
  - Run 1 exiftool process per CPU, still in batch mode (divide all files to be read into 1 bucket per CPU)
  - Stream the exiftool output instead of buffering it in memory
2017-11-24 22:08:59 +11:00
.github Github contribution templates 2017-05-29 17:34:19 +10:00
bin Fix #61: new options to avoid copying original photos to the output folder 2017-06-03 21:25:41 +10:00
docs Move screenshots and banners to subfolder 2017-11-24 21:52:10 +11:00
fixtures Major optimisations: SQLite index + faster disk glob + new exiftool streaming 2017-11-24 22:08:59 +11:00
public Upgrade VideoJS to 5.17 2017-03-11 10:05:27 +11:00
scripts Add full integration test: compare galleries to previously generated snapshot 2017-06-14 17:44:28 +10:00
src Major optimisations: SQLite index + faster disk glob + new exiftool streaming 2017-11-24 22:08:59 +11:00
templates Create a Metadata model attached to input files 2017-08-07 22:52:26 +10:00
test Major optimisations: SQLite index + faster disk glob + new exiftool streaming 2017-11-24 22:08:59 +11:00
test-integration Smarter fuzzy comparison for the “snapshot” integration test 2017-11-24 21:56:45 +11:00
.dockerignore Basic production Dockerfile (doesn’t run the tests yet) 2017-11-24 21:55:26 +11:00
.editorconfig Render progress using Listr + split the main process into "steps" which are easier to test 2017-11-06 00:02:42 +11:00
.gitignore Major optimisations: SQLite index + faster disk glob + new exiftool streaming 2017-11-24 22:08:59 +11:00
.npmignore Ignore files from the final npm package 2017-07-23 21:40:14 +10:00
.travis.yml Stop supporting Node v4 to enable newer ES6 syntax 2017-10-12 20:13:27 +11:00
Dockerfile Basic production Dockerfile (doesn’t run the tests yet) 2017-11-24 21:55:26 +11:00
LICENSE.md Prepare for npm publish (ignore tests, cleanup license...) 2016-11-13 13:35:52 +11:00
package.json Major optimisations: SQLite index + faster disk glob + new exiftool streaming 2017-11-24 22:08:59 +11:00
README.md Move screenshots and banners to subfolder 2017-11-24 21:52:10 +11:00

thumbsup

NPM License Travis CI Dependencies Dev dependencies Standard - JavaScript Style Guide

banner

Turn any folder with photos & videos into a web gallery.

  • thumbnails & multiple resolutions for fast previews
  • mobile friendly website with customisable themes
  • only rebuilds changed files: it's fast!
  • uses relative paths so you can deploy the pages anywhere
  • works great with Amazon S3 for static hosting

Quick start

Simply point thumbsup to a folder with photos & videos. All nested folders become separate albums.

npm install -g thumbsup
thumbsup --input ./media --output ./website

Screen recording

There are many more command line arguments to customise the output. See the website for the full documentation: https://thumbsup.github.io.

Requirements

Thumbsup requires the following dependencies:

You can also run thumbsup as a Docker container (thumbsupgallery/thumbsup) which pre-packages all the dependencies above.

See a sample gallery online at https://thumbsup.github.io/demos/themes/mosaic/

sample gallery

Command line arguments

This reflects the CLI for the latest code on master. For the latest published version please refer to the docs on the website.


Usages:
  thumbsup [required] [options]
  thumbsup --config config.json

Required:
  --input   Path to the folder with all photos/videos  [string] [required]
  --output  Output path for the static website  [string] [required]

Output options:
  --thumb-size            Pixel size of the square thumbnails  [number] [default: 120]
  --large-size            Pixel height of the fullscreen photos  [number] [default: 1000]
  --download-photos       Target of the photo download links  [choices: "large", "copy", "symlink", "link"] [default: "large"]
  --download-videos       Target of the video download links  [choices: "large", "copy", "symlink", "link"] [default: "large"]
  --download-link-prefix  Path or URL prefix for linked downloads  [string]
  --cleanup               Remove any output file that's no longer needed  [boolean] [default: false]

Album options:
  --albums-from            How to group media into albums  [choices: "folders", "date"] [default: "folders"]
  --albums-date-format     How albums are named in <date> mode [moment.js pattern]  [default: "YYYY-MM"]
  --sort-albums-by         How to sort albums  [choices: "title", "start-date", "end-date"] [default: "start-date"]
  --sort-albums-direction  Album sorting direction  [choices: "asc", "desc"] [default: "asc"]
  --sort-media-by          How to sort photos and videos  [choices: "filename", "date"] [default: "date"]
  --sort-media-direction   Media sorting direction  [choices: "asc", "desc"] [default: "asc"]

Website options:
  --index                 Filename of the home page  [default: "index.html"]
  --albums-output-folder  Output subfolder for HTML albums (default: website root)  [default: "."]
  --theme                 Name of the gallery theme to apply  [choices: "classic", "cards", "mosaic"] [default: "classic"]
  --title                 Website title  [default: "Photo album"]
  --footer                Text or HTML footer  [default: null]
  --css                   Path to a custom provided CSS/LESS file for styling  [string]
  --google-analytics      Code for Google Analytics tracking  [string]

Deprecated:
  --original-photos  Copy and allow download of full-size photos  [boolean] [default: false]
  --original-videos  Copy and allow download of full-size videos  [boolean] [default: false]

Options:
  --version  Show version number  [boolean]
  --help     Show help  [boolean]
  --config   Path to JSON config file  [string]

The optional JSON config should contain a single object with one key per argument, not including the leading "--". For example:

{ "sort-albums-by": "start-date" }

Contributing

We welcome all issues and pull requests!

If you are facing any issues or getting crashes, please try the following options to help troubleshoot:

thumbsup [options] | tee
# [16:04:56] media/thumbs/photo-1446822622709-e1c7ad6e82d52.jpg [started]
# [16:04:57] media/thumbs/photo-1446822622709-e1c7ad6e82d52.jpg [completed]

DEBUG="*" thumbsup [options] | tee
# [16:04:56] media/thumbs/photo-1446822622709-e1c7ad6e82d52.jpg [started]
# gm "identify" "-ping" "-format" "%[EXIF:Orientation]" [...]
# gm "convert" "-quality" "90" "-resize" "x400>" "+profile" [...]
# [16:04:57] media/thumbs/photo-1446822622709-e1c7ad6e82d52.jpg [completed]

Please make sure the tests are passing when submitting a code change:

./scripts/cibuild