Refactor verbose 931 (#960)
* Began refactoring verbose code for #931 * Fixed tests for timewarp due to verbose refactor * Updated test data * More refactoring for #931 * Refactored queryoptions.py * Refactored queryoptions.py * Refactored queryoptions.py * Refactored echo_error * Refactored debug * Refactored debug * Refactored use of verbose in export * Refactored use of verbose in export * Refactred --verbose in add-locations and debug-dump * Refactored --verbose for * Refactored --verbose for osxphotos exportdb * Refactored --verbose for osxphotos import * Refactored --verbose for osxphotos orphans * Refactored --verbose for osxphotos snap-diff * Refactored --verbose for osxphotos sync * Refactored --verbose for osxphotos timewarp * Added default verbose() function to verbose
This commit is contained in:
@@ -2,12 +2,18 @@
|
||||
|
||||
import datetime
|
||||
import pathlib
|
||||
import time
|
||||
|
||||
from tests.parse_timewarp_output import CompareValues, InspectValues
|
||||
|
||||
TEST_LIBRARY_TIMEWARP = "tests/TestTimeWarp-10.15.7.photoslibrary"
|
||||
|
||||
|
||||
def is_dst() -> bool:
|
||||
"""Return True if daylight savings time is in effect"""
|
||||
return bool(time.localtime().tm_isdst)
|
||||
|
||||
|
||||
def get_file_timestamp(file: str) -> str:
|
||||
"""Get timestamp of file"""
|
||||
return datetime.datetime.fromtimestamp(pathlib.Path(file).stat().st_mtime).strftime(
|
||||
@@ -24,6 +30,7 @@ CATALINA_PHOTOS_5 = {
|
||||
"marigold flowers": "IMG_6517.jpeg",
|
||||
"multi-colored zinnia flowers": "IMG_6506.jpeg",
|
||||
"sunset": "IMG_6551.mov",
|
||||
"palm tree": "20230120_010203-0400.jpg",
|
||||
},
|
||||
"inspect": {
|
||||
# IMG_6501.jpeg
|
||||
@@ -362,4 +369,28 @@ CATALINA_PHOTOS_5 = {
|
||||
"GMT-0700",
|
||||
),
|
||||
},
|
||||
"parse_date": {
|
||||
# 20230120_010203-0400.jpg
|
||||
"uuid": "5285C4E2-BB1A-49DF-AEF5-246AA337ACAB",
|
||||
"expected": InspectValues(
|
||||
"20230120_010203-0400.jpg",
|
||||
"5285C4E2-BB1A-49DF-AEF5-246AA337ACAB",
|
||||
"2023-01-20 01:02:03-0800" if not is_dst() else "2023-01-20 00:02:03-0700",
|
||||
"2023-01-20 01:02:03-0800" if not is_dst() else "2023-01-20 00:02:03-0700",
|
||||
"-0800",
|
||||
"GMT-0800",
|
||||
),
|
||||
},
|
||||
"parse_date_tz": {
|
||||
# 20230120_010203-0400.jpg
|
||||
"uuid": "5285C4E2-BB1A-49DF-AEF5-246AA337ACAB",
|
||||
"expected": InspectValues(
|
||||
"20230120_010203-0400.jpg",
|
||||
"5285C4E2-BB1A-49DF-AEF5-246AA337ACAB",
|
||||
"2023-01-19 21:02:03-0800" if not is_dst() else "2023-01-19 20:02:03-0700",
|
||||
"2023-01-20 01:02:03-0400",
|
||||
"-0400",
|
||||
"GMT-0400",
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user