* Add --delete-duplicates option to delete local assets that already exist on the server, fixes#12181
* Update docs
* Fix `--delete-duplicates` implying `--delete`
* fix the test, break the english
* format
* also ran the formatter on the e2e folder :)
* early return, fewer allocations
* add back log
---------
Co-authored-by: Robin Jacobs <robin.jacobs@beeline.com>
Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
* fix(docs): update the cli upload usage
The cli upload usage is missing some options compared to what is the current
output of `immich upload --help`. Update the docs accordingly.
Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
* feat(cli): add --json-output option to upload command
Add an option that allows retrieving per-file information about the
upload process. The output includes the newFiles, duplicates and
newAssets lists, but could accommodate more information later if needed.
One use case this allows for is using --dry-run to get a list of all the
files that would be uploaded, and checking them manually before an
upload. This can be particularly useful when a curated subset of images
have already been uploaded to immich and we want to double check for
some stragglers without uploading everything to immich.
The upload command has a few lines of logging, so to get an actually
parsable json one needs to strip those lines:
immich upload --dry-run * | tail -n +4 | jq .newFiles[]
Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
---------
Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
* feat(cli): watch paths for auto uploading daemon
* chore: update package-lock
* test(cli): Batcher util calss
* feat(cli): expose batcher params from startWatch()
* test(cli): startWatch() for `--watch`
* refactor(cli): more reliable watcher
* feat(cli): disable progress bar on --no-progress or --watch
* fix(cli): extensions match when upload with watch
* feat(cli): basic logs without progress on upload
* feat(cli): hide progress in uploadFiles()
* refactor(cli): use promise-based setTimeout() instead of hand crafted sleep()
* refactor(cli): unexport UPLOAD_WATCH consts
* refactor(cli): rename fsWatchListener() to onFile()
* test(cli): prefix dot to mocked getSupportedMediaTypes()
* test(cli): add tests for ignored patterns/ unsupported exts
* refactor(cli): minor changes for code reviews
* feat(cli): disable onFile logs when progress bar is enabled
* feat(cli): use a queue for duplicate and upload
Using a queue to process the files makes the file duplicate detection and asset upload more stable and tolerant of network errors. If an error occurs, the whole command will not stop; the task will be retried (3 times) before logging the error and moving to the next step.
The new queue abstraction is using [fastq](https://www.npmjs.com/package/fastq) internally.
* chore(cli): queue.push return promise which resolve with task
* test(cli): add spec for uploadFiles and checkForDuplicates
* refactor: asset media endpoints
* refactor: mobile upload livePhoto as separate request
* refactor: change mobile backup flow to use new asset upload endpoints
* chore: format and analyze dart code
* feat: mark motion as hidden when linked
* feat: upload video portion of live photo before image portion
* fix: incorrect assetApi calls in mobile code
* fix: download asset
---------
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
Co-authored-by: Zack Pollard <zackpollard@ymail.com>