[CLI]: Provide the option to skip unchanged files #154

Closed
opened 2026-02-19 23:03:03 -05:00 by deekerman · 7 comments
Owner

Originally created by @linosgian on GitHub (Jan 11, 2020).

Originally assigned to: @linosgian on GitHub.

As shown below in the API's StartIndex route, an option can be passed to skip indexing photos that haven't changed and thus reduce indexing time.
github.com/photoprism/photoprism@ba9b3cad72/internal/api/index.go (L89-L93)

In the CLI's index command there seems to be no such option:
github.com/photoprism/photoprism@ba9b3cad72/internal/commands/index.go (L48-L49)

I am syncing photos from multiple devices to a single directory, so I'd like to be able to create a cronjob to periodically index photos, but currently it takes too many resources to do it hourly. If I was able to skip unchanged files, it should be feasible.

Originally created by @linosgian on GitHub (Jan 11, 2020). Originally assigned to: @linosgian on GitHub. As shown below in the API's `StartIndex` route, an option can be passed to skip indexing photos that haven't changed and thus reduce indexing time. https://github.com/photoprism/photoprism/blob/ba9b3cad72e402f51ee88e77b3c8a5705e117b75/internal/api/index.go#L89-L93 In the CLI's `index` command there seems to be no such option: https://github.com/photoprism/photoprism/blob/ba9b3cad72e402f51ee88e77b3c8a5705e117b75/internal/commands/index.go#L48-L49 I am syncing photos from multiple devices to a single directory, so I'd like to be able to create a cronjob to periodically index photos, but currently it takes too many resources to do it hourly. If I was able to skip unchanged files, it should be feasible.
deekerman 2026-02-19 23:03:03 -05:00
Author
Owner

@lastzero commented on GitHub (Jan 11, 2020):

You are absolutely right... should be done.

@lastzero commented on GitHub (Jan 11, 2020): You are absolutely right... should be done.
Author
Owner

@marcoamorales commented on GitHub (Jan 17, 2020):

I'd like to help with this.. fairly new to the project though @lastzero if you could provide any pointers to find which files have been indexed already, I would really appreciate that :)

@marcoamorales commented on GitHub (Jan 17, 2020): I'd like to help with this.. fairly new to the project though @lastzero if you could provide any pointers to find which files have been indexed already, I would really appreciate that :)
Author
Owner

@lastzero commented on GitHub (Jan 20, 2020):

@marcoamorales You have to add command flags to https://github.com/photoprism/photoprism/blob/develop/internal/commands/index.go

See https://github.com/photoprism/photoprism/blob/develop/internal/commands/thumbnails.go for how to do that ("force" flag).

Main task is to think about what flags to add and how to name them. Probably "all" (short "a") makes sense. Code would look like:

	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "all, a",
			Usage: "Re-index existing files",
		},
	},
@lastzero commented on GitHub (Jan 20, 2020): @marcoamorales You have to add command flags to https://github.com/photoprism/photoprism/blob/develop/internal/commands/index.go See https://github.com/photoprism/photoprism/blob/develop/internal/commands/thumbnails.go for how to do that ("force" flag). Main task is to think about what flags to add and how to name them. Probably "all" (short "a") makes sense. Code would look like: ``` Flags: []cli.Flag{ cli.BoolFlag{ Name: "all, a", Usage: "Re-index existing files", }, }, ```
Author
Owner

@lastzero commented on GitHub (Jan 20, 2020):

Make sure to run tests before pushing / committing code: make test-go

Should be described in our Developer Guide (see Wiki). If anything is unclear, let us know!

@lastzero commented on GitHub (Jan 20, 2020): Make sure to run tests before pushing / committing code: `make test-go` Should be described in our Developer Guide (see Wiki). If anything is unclear, let us know!
Author
Owner

@lastzero commented on GitHub (Jan 22, 2020):

Used the opportunity to improve our command help... will merge to master now.

If this solves your issue, you can close the ticket :)

@lastzero commented on GitHub (Jan 22, 2020): Used the opportunity to improve our command help... will merge to master now. If this solves your issue, you can close the ticket :)
Author
Owner

@lastzero commented on GitHub (Jan 22, 2020):

Build is running: https://travis-ci.org/photoprism/photoprism/builds/640370213

I'll also start a build for arm64 (using our own hardware)

@lastzero commented on GitHub (Jan 22, 2020): Build is running: https://travis-ci.org/photoprism/photoprism/builds/640370213 I'll also start a build for arm64 (using our own hardware)
Author
Owner

@linosgian commented on GitHub (Jan 22, 2020):

I've tested this one, it works perfectly! :)

@linosgian commented on GitHub (Jan 22, 2020): I've tested this one, it works perfectly! :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/photoprism#154
No description provided.