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.18k stars 35 forks source link

Fix time parsing from directory paths #318

Closed erkexzcx closed 2 days ago

erkexzcx commented 1 week ago

PR

Follow up on https://github.com/simulot/immich-go/pull/316

Basically I noticed that immich-go doesn't consider scenarios such as A/B/2022/2022.11/2022.11.09/IMG_1234.HEIC path as it has no way to access 2022.11.09 part when only a file's name is passed (instead of a full path). This PR fixes this and time from path is correctly parsed.

Issue

Also, I noticed strange behavior... I have these files: image

These are the dates I expect to see in immich:

I've used below script for them, so I can make sure timestamps are properly applied (no human error):

#!/bin/bash

# 2023-01 - using timestamp in multiple directories
exiftool -all= -overwrite_original ./uploadme/2023/01/01/* 
touch -a -m -t 201001011601.09 ./uploadme/2023/01/01/* 

# 2023-02 - using timestamp in directory
exiftool -all= -overwrite_original ./uploadme/2023.02.01/* 
touch -a -m -t 201001011601.09 ./uploadme/2023.02.01/* 

# 2023-03 - using exif data
exiftool -DateTimeOriginal="2023:03:01 01:01:01" -overwrite_original ./uploadme/exif/*
touch -a -m -t 201001011601.09 ./uploadme/exif/*

# 2023-04 - using modification timestamp
exiftool -all= -overwrite_original ./uploadme/modification_time/* 
touch -a -m -t 202304011601.09 ./uploadme/modification_time/*

So I run immich-go with upload, but immich shows then shows this: image

I am Lithuanian (Europe/Vilnius TZ), so I guess immich somewhere took UTC value and converted to LT time (or vice versa)? There is this bug somewhere which I cannot find.

Your help would be appreciated!

erkexzcx commented 1 week ago

I have a decade old collection of random folders with ~7500 random photos and ~500 videos. Kind of random mess of many years of random media of my relatives, so this is a really good test for both immich-go and immich itself.. :sweat_smile:

simulot commented 2 days ago

merged... even if not visible. Let me know if it not merged Thanks