02fee7ace414632306cce20330396e6165ed1109 — Matthew Johnston 4 months ago 639b744
Adds jpegoptim to the organize step
2 files changed, 53 insertions(+), 1 deletions(-)

M gopro
M README.md => README.md +31 -0
@@ 18,6 18,37 @@ Or simply execute it with `python path/to/gopro`.

## Commands

### `organize`

Takes the crazy format that GoPro stores the files as and moves them into their
respective directories.

The directory structure is as follows:

* timelapse
    * chapter
* videos
    * thumbnails
    * low-res
    * hi-res

Timelapse files will be optimized with `jpegoptim` which is a lossless
optimization. There is roughly a 6% reduction in each file size.

Timelapse files will also be archived using `tar`. This is so that after
converting the timelapse to an `mp4` the directory of all the images can be
deleted and the archive can be moved to a NAS or backed up elsewhere.
Transferring thousands of small 2MB files over a network has a lot of overhead
that a single tar file will suffice.

#### Options

* `--archive` - Set to `--archive no` to disable archiving the timelapse files.
  Default is enabled.
* `--optimize` - Set to `--optimize no` to disable jpegoptim. Default is

### `timelapse`

Converts the timelapse images into a single `mp4` file.

M gopro => gopro +22 -1
@@ 126,6 126,22 @@ def organize(args):
            print(f"DELETE {directory}")

    # Run jpegoptim on all of the gopro timelapse jpegs. I usually see a 6%
    # optimization in size reduction. In my eyes it is worth the extra
    # processing.
    if args.optimize:
        for path in list(timelapse_dir.glob("*")):
            if path.is_dir():

    # Archive all of the timelapse images into a single tar file. Makes moving
    # an entire set of files easier.
    if args.archive:
        for path in list(timelapse_dir.glob("*")):
            if path.is_dir():

@@ 146,7 162,6 @@ def organize(args):

def timelapse(args):
    working_dir = Path(args.dir).resolve()
    file_glob = Path(working_dir, "*.JPG")

@@ 240,6 255,12 @@ organize_parser.add_argument(
    help="Enable or disable archiving the timelapse files",
    help="Enable or disable jpeg optimization",

timelapse_parser = subparsers.add_parser(