simulot / immich-go

An alternative to the immich-CLI command that doesn't depend on nodejs installation. It tries its best for importing google photos takeout archives.
GNU Affero General Public License v3.0
1.2k stars 36 forks source link

Ignore extension when deduplicating option #192

Closed matthewkeller36 closed 3 months ago

matthewkeller36 commented 3 months ago

Implements duplication checking while ignoring file extensions. Addresses feature request I had mentioned in #191. Uses a.Type to add an extra layer of security when determining if files are duplicates. Feature can be invoked using -ignore-extension in the command line

matthewkeller36 commented 3 months ago

One issue I am seeing with using strings.TrimSuffix is the OriginalFileName already contains the extension and the duplicateKey is appending a second extension. Example: a.OriginalFileName: IMG_0394.HEIC a.OriginalFileName + path.Ext(a.OriginalPath): IMG_0394.HEIC.HEIC

This was why I was originally using strings.Cut as TrimSuffix will only remove one of the extensions. I believe this issue could be avoided by not appending path.Ext(a.OriginalPath) to the duplicateKey.