From 43e7932aef5a3d4b17a00d03032ed1158c5de481 Mon Sep 17 00:00:00 2001 From: Alexandr Kolesov Date: Thu, 24 Oct 2024 19:44:38 +0400 Subject: [PATCH 01/10] Add readme --- README.md | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..9ade40e --- /dev/null +++ b/README.md @@ -0,0 +1,107 @@ +# Image Vault + +Image Vault is a powerful command-line tool specifically designed for managing and organizing photo libraries. It provides photographers and photo enthusiasts with features for initializing photo libraries, adding and organizing image files, verifying library integrity, and displaying detailed photo metadata. + +## Table of Contents + +- [Installation](#installation) +- [Usage](#usage) + - [Initializing a Photo Library](#initializing-a-photo-library) + - [Adding Photos](#adding-photos) + - [Verifying Photo Library Integrity](#verifying-photo-library-integrity) + - [Displaying Photo Metadata](#displaying-photo-metadata) + - [Showing Version Information](#showing-version-information) +- [Configuration](#configuration) +- [Building from Source](#building-from-source) +- [Contributing](#contributing) +- [License](#license) + +## Installation + +To install Image Vault, use the following command: + +``` +go install github.com/askolesov/image-vault/cmd/imv@latest +``` + +Alternatively, you can build from source (see [Building from Source](#building-from-source)). + +## Usage + +Image Vault offers several commands to manage your photo library efficiently. Here are the main commands and their usage: + +### Initializing a Photo Library + +To initialize a new Image Vault photo library in the current directory: + +``` +imv init +``` + +This command creates a configuration file (`image-vault.yaml`) in the current directory, setting up the structure for your photo organization. + +### Adding Photos + +To add photos to your library: + +``` +imv add +``` + +This command processes the photos at the specified path, organizes them according to the configured template (which can include metadata like date taken, camera model, etc.), and adds them to the library. + +### Verifying Photo Library Integrity + +To verify the integrity of your photo library: + +``` +imv verify +``` + +This command checks all photos in the library to ensure they are properly organized and match their expected locations based on their metadata and the configured template. + +### Displaying Photo Metadata + +To show detailed metadata for a specific photo: + +``` +imv info +``` + +This command displays comprehensive metadata information for the specified photo, including camera settings, date taken, and other EXIF data. + +### Showing Version Information + +To display version information about Image Vault: + +``` +imv version +``` + +## Configuration + +Image Vault uses a YAML configuration file (`image-vault.yaml`) to customize its behavior. Here's an example of the default configuration: + +```yaml +template: |- + {{- $make := or .Exif.Make .Exif.DeviceManufacturer "NoMake" -}} + {{- $model := or .Exif.Model .Exif.DeviceModelName "NoModel" -}} + {{- $dateTimeOriginal := and (any .Exif.DateTimeOriginal) (ne .Exif.DateTimeOriginal "0000:00:00 00:00:00") | ternary .Exif.DateTimeOriginal "" -}} + {{- $mediaCreateDate := and (any .Exif.MediaCreateDate) (ne .Exif.MediaCreateDate "0000:00:00 00:00:00") | ternary .Exif.MediaCreateDate "" -}} + {{- $date := or $dateTimeOriginal $mediaCreateDate "1970:01:01 00:00:00" | toDate "2006:01:02 15:04:05" -}} + {{- $mimeType := .Exif.MIMEType | default "unknown/unknown" | splitList "/" | first -}} + {{$make}} {{$model}} ({{$mimeType}})/{{$date | date "2006"}}/{{$date | date "2006-01-02"}}/{{$date | date "2006-01-02_15-04-05"}}_{{.Hash.Md5Short}}{{.Fs.Ext | lower}} + +skipPermissionDenied: true + +ignore: + - image-vault.yaml + - .* + +sidecarExtensions: + - "*.xmp" + - "*.yaml" + - "*.json" +``` + +You can modify this configuration to suit your photo organization needs. The `template` field is particularly important as it determines how your photos will be organized in the library based on their metadata. From 561ce9012a2370e15d93e2441fa43aa0ed9b1a5f Mon Sep 17 00:00:00 2001 From: Alexandr Kolesov Date: Thu, 24 Oct 2024 19:51:52 +0400 Subject: [PATCH 02/10] Revert "test change" This reverts commit 8a39928cc8e10f971696606403a1886f4f01e7b6. --- Makefile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 643b9a8..75ddd42 100644 --- a/Makefile +++ b/Makefile @@ -42,10 +42,4 @@ pre-push: go mod tidy make lint make test - make build - -.PHONY: test-changes -test-changes: - git diff --name-only --cached --diff-filter=ACM | grep -E '\.go$$' | xargs -n 1 gofmt -w - git diff --cached --name-only --diff-filter=ACM | grep -E '\.go$$' | xargs -n 1 go vet - git diff --cached --name-only --diff-filter=ACM | grep -E '\.go$$' | xargs -n 1 go test -v + make build \ No newline at end of file From 2723bc40994997d69e2aed4ad3ba6510405b3d8e Mon Sep 17 00:00:00 2001 From: Alexandr Kolesov Date: Thu, 24 Oct 2024 19:54:49 +0400 Subject: [PATCH 03/10] Add missing readme parts --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/README.md b/README.md index 9ade40e..de744fc 100644 --- a/README.md +++ b/README.md @@ -105,3 +105,51 @@ sidecarExtensions: ``` You can modify this configuration to suit your photo organization needs. The `template` field is particularly important as it determines how your photos will be organized in the library based on their metadata. + +## Building from Source + +To build Image Vault from source: + +1. Clone the repository: + ``` + git clone https://github.com/askolesov/image-vault.git + ``` + +2. Navigate to the project directory: + ``` + cd image-vault + ``` + +3. Build the project: + ``` + make build + ``` + + This will create the `imv` binary in the `build/` directory. + +4. (Optional) Install the binary: + ``` + make install + ``` + +## Contributing + +Contributions to Image Vault are welcome! Please feel free to submit pull requests, create issues, or suggest improvements. + +Before submitting a pull request, please ensure that: + +1. Your code passes all tests: + ``` + make test + ``` + +2. Your code passes the linter: + ``` + make lint + ``` + +3. You've added tests for any new functionality. + +## License + +// TODO: add license From 0ab254d5e9be295dfd3f27d722c038eae8754701 Mon Sep 17 00:00:00 2001 From: Alexandr Kolesov Date: Thu, 24 Oct 2024 20:05:10 +0400 Subject: [PATCH 04/10] Add lint workflow --- .github/workflows/lint.yaml | 23 +++++++++++++++++++++++ .github/workflows/test.yml | 2 +- go.mod | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..01dde70 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,23 @@ +name: Lint + +on: + push: + workflow_call: + +jobs: + lint: + name: Run golanci-lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + + - name: golangci-lint + uses: golangci/golangci-lint-action@v5 + with: + version: v1.61.0 + args: --timeout=5m diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf3194b..3420794 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21' + go-version-file: "go.mod" - name: Build run: go build -v ./... diff --git a/go.mod b/go.mod index 176c08a..c2b750c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/askolesov/image-vault -go 1.21.2 +go 1.23 require ( github.com/Masterminds/sprig/v3 v3.3.0 From 841a9135b609a7a1d1663c36e67d03b80c06016a Mon Sep 17 00:00:00 2001 From: Alexandr Kolesov Date: Thu, 24 Oct 2024 20:09:00 +0400 Subject: [PATCH 05/10] Add exiftool to test pipeline --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3420794..828d7b9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,9 @@ jobs: with: go-version-file: "go.mod" + - name: Install exiftool + run: apt-get update && apt-get install -y exiftool + - name: Build run: go build -v ./... From 383c5ad78d2b17e86918ecf0af1782ea69952c9d Mon Sep 17 00:00:00 2001 From: Alexandr Kolesov Date: Thu, 24 Oct 2024 20:34:46 +0400 Subject: [PATCH 06/10] Add about exiftool to readme --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index de744fc..c150eb0 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,26 @@ go install github.com/askolesov/image-vault/cmd/imv@latest Alternatively, you can build from source (see [Building from Source](#building-from-source)). +### Required Dependency + +Image Vault requires `exiftool` to be installed on your system for handling photo metadata. Below are instructions for installing `exiftool` on different operating systems: + +#### Linux + +To install `exiftool` on Linux, you can use the package manager for your distribution. For example, on Ubuntu, you can use: + +``` +sudo apt install libimage-exiftool-perl +``` + +#### Windows + +To install `exiftool` on Windows using Homebrew, first ensure you have Homebrew installed, then run: + +``` +brew install exiftool +``` + ## Usage Image Vault offers several commands to manage your photo library efficiently. Here are the main commands and their usage: From 3554bd5800f5696d2350693b44f69452a9b60215 Mon Sep 17 00:00:00 2001 From: Alexandr Kolesov Date: Thu, 24 Oct 2024 20:35:55 +0400 Subject: [PATCH 07/10] Fix pipelines --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 828d7b9..e82542f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: go-version-file: "go.mod" - name: Install exiftool - run: apt-get update && apt-get install -y exiftool + run: sudo apt-get update && sudo apt-get install -y exiftool - name: Build run: go build -v ./... From 831d4f7a8229c95c6ea7c25729d8e97b6ec5e0dd Mon Sep 17 00:00:00 2001 From: Alexandr Kolesov Date: Thu, 24 Oct 2024 20:39:18 +0400 Subject: [PATCH 08/10] Consistent workflows naming --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e82542f..6b584a7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,7 @@ on: jobs: build: + name: Build and test runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 5f1a6468315c3813979a85cf14ea92d4b9d3cc35 Mon Sep 17 00:00:00 2001 From: Alexandr Kolesov Date: Thu, 24 Oct 2024 20:41:52 +0400 Subject: [PATCH 09/10] Add badges --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index c150eb0..cf8e932 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Image Vault +[![Lint](https://github.com/askolesov/image-vault/actions/workflows/lint.yaml/badge.svg)](https://github.com/askolesov/image-vault/actions/workflows/lint.yaml) +[![Test](https://github.com/askolesov/image-vault/actions/workflows/test.yaml/badge.svg)](https://github.com/askolesov/image-vault/actions/workflows/test.yaml) + Image Vault is a powerful command-line tool specifically designed for managing and organizing photo libraries. It provides photographers and photo enthusiasts with features for initializing photo libraries, adding and organizing image files, verifying library integrity, and displaying detailed photo metadata. ## Table of Contents From 772d34a115112f47ef8def6ee02785ef4e41187a Mon Sep 17 00:00:00 2001 From: Alexandr Kolesov Date: Thu, 24 Oct 2024 20:42:23 +0400 Subject: [PATCH 10/10] Add badges --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cf8e932..ae4a3a0 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Lint](https://github.com/askolesov/image-vault/actions/workflows/lint.yaml/badge.svg)](https://github.com/askolesov/image-vault/actions/workflows/lint.yaml) [![Test](https://github.com/askolesov/image-vault/actions/workflows/test.yaml/badge.svg)](https://github.com/askolesov/image-vault/actions/workflows/test.yaml) +[![Version](https://img.shields.io/github/v/release/askolesov/image-vault?include_prereleases)](https://github.com/askolesov/image-vault/releases) Image Vault is a powerful command-line tool specifically designed for managing and organizing photo libraries. It provides photographers and photo enthusiasts with features for initializing photo libraries, adding and organizing image files, verifying library integrity, and displaying detailed photo metadata.