From af63fc026af3c5fe7df661da804c799d07fbc8c5 Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Wed, 18 Sep 2024 22:07:32 -0400 Subject: [PATCH] Fix for #1670 --- osxphotos/cli/import_cli.py | 2 +- osxphotos/image_file_utils.py | 4 +++- tests/README.md | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/osxphotos/cli/import_cli.py b/osxphotos/cli/import_cli.py index f6ba42c2..9fe1be86 100644 --- a/osxphotos/cli/import_cli.py +++ b/osxphotos/cli/import_cli.py @@ -2830,7 +2830,7 @@ def sort_paths(paths: Iterable[pathlib.Path]) -> tuple[pathlib.Path, ...]: def path_key(path: pathlib.Path) -> tuple[str, int, int, int, int]: extension = path.suffix.lower() is_aae = extension == ".aae" - is_mov = extension == ".mov" + is_mov = extension in (".mov", ".mp4") base_name = path.stem.split("_")[0] # Extract the base name without suffixes return (base_name, len(path.stem), is_aae, is_mov) diff --git a/osxphotos/image_file_utils.py b/osxphotos/image_file_utils.py index c5c05411..ace970f7 100644 --- a/osxphotos/image_file_utils.py +++ b/osxphotos/image_file_utils.py @@ -99,7 +99,9 @@ def is_possible_live_pair( filepath1: str | os.PathLike, filepath2: str | os.PathLike ) -> bool: """Return True if photos could be a live photo pair (even if files lack the Content ID metadata""" - if is_image_file(filepath1) and is_video_file(filepath2): + if (is_image_file(filepath1) and is_video_file(filepath2)) or ( + is_video_file(filepath1) and is_image_file(filepath2) + ): return True return False diff --git a/tests/README.md b/tests/README.md index a5b0eab5..d79d0766 100644 --- a/tests/README.md +++ b/tests/README.md @@ -33,8 +33,7 @@ A couple of tests require interaction with Photos and configuring a specific tes - --timewarp: test `osxphotos timewarp` (pytest -vv --timewarp tests/test_cli_timewarp.py) - --test-import: test `osxphotos import` (pytest -vv --test-import tests/test_cli_import.py) - --test-sync: test `osxphotos sync` (pytest -vv --test-sync tests/test_cli_sync.py) -- --test-add-locations: test `osxphotos add-locations` (pytest -vv ---test-add-locations tests/test_cli_add_locations.py) +- --test-add-locations: test `osxphotos add-locations` (pytest -vv --test-add-locations tests/test_cli_add_locations.py) - --test-batch-edit: test `osxphotos batch-edit` (pytest -vv --test-batch-edit -k batch) ## Test Photo Libraries