Bug timewarp sync 946 (#947)

* Fix --timezone iCloud sync, #946

* ADded tests for timezone fix #946
This commit is contained in:
Rhet Turnbull
2023-01-21 14:48:56 -08:00
committed by GitHub
parent 32b23a09cb
commit bd01e41714
123 changed files with 856 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
# Ensure you have a backup before using!
# You have been warned.
import datetime
import pathlib
import sqlite3
from typing import Callable, Optional, Tuple
@@ -147,6 +148,12 @@ class PhotoTimeZoneUpdater:
c = conn.cursor()
c.execute(sql_update)
conn.commit()
# now need to update some other property in the photo via Photos API or
# changes won't be synced to the cloud (#946)
photo.date = photo.date + datetime.timedelta(seconds=1)
photo.date = photo.date - datetime.timedelta(seconds=1)
self.verbose(
f"Updated timezone for photo [filename]{photo.filename}[/filename] ([uuid]{photo.uuid}[/uuid]) "
+ f"from [tz]{tz_name}[/tz], offset=[tz]{tz_offset}[/tz] "