Fixed raw+jpeg for Monterey
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
""" version info """
|
""" version info """
|
||||||
|
|
||||||
__version__ = "0.42.49"
|
__version__ = "0.42.50"
|
||||||
|
|||||||
@@ -390,19 +390,19 @@ class PhotoInfo:
|
|||||||
photopath = None
|
photopath = None
|
||||||
else:
|
else:
|
||||||
filestem = pathlib.Path(self._info["filename"]).stem
|
filestem = pathlib.Path(self._info["filename"]).stem
|
||||||
raw_ext = get_preferred_uti_extension(self._info["UTI_raw"])
|
# raw_ext = get_preferred_uti_extension(self._info["UTI_raw"])
|
||||||
|
|
||||||
if self._info["directory"].startswith("/"):
|
if self._info["directory"].startswith("/"):
|
||||||
filepath = self._info["directory"]
|
filepath = self._info["directory"]
|
||||||
else:
|
else:
|
||||||
filepath = os.path.join(self._db._masters_path, self._info["directory"])
|
filepath = os.path.join(self._db._masters_path, self._info["directory"])
|
||||||
|
|
||||||
glob_str = f"{filestem}*.{raw_ext}"
|
# raw files have same name as original but with _4.raw_ext appended
|
||||||
|
# I believe the _4 maps to PHAssetResourceTypeAlternatePhoto = 4
|
||||||
|
# see: https://developer.apple.com/documentation/photokit/phassetresourcetype/phassetresourcetypealternatephoto?language=objc
|
||||||
|
glob_str = f"{filestem}_4*"
|
||||||
raw_file = findfiles(glob_str, filepath)
|
raw_file = findfiles(glob_str, filepath)
|
||||||
if len(raw_file) != 1:
|
if not raw_file:
|
||||||
# Note: In Photos Version 5.0 (141.19.150), images not copied to Photos Library
|
|
||||||
# that are missing do not always trigger is_missing = True as happens
|
|
||||||
# in earlier version so it's possible for this check to fail, if so, return None
|
|
||||||
photopath = None
|
photopath = None
|
||||||
else:
|
else:
|
||||||
photopath = os.path.join(filepath, raw_file[0])
|
photopath = os.path.join(filepath, raw_file[0])
|
||||||
@@ -693,8 +693,15 @@ class PhotoInfo:
|
|||||||
for example: com.canon.cr2-raw-image
|
for example: com.canon.cr2-raw-image
|
||||||
Returns None if no associated RAW image
|
Returns None if no associated RAW image
|
||||||
"""
|
"""
|
||||||
|
if self._db._photos_ver < 7:
|
||||||
return self._info["UTI_raw"]
|
return self._info["UTI_raw"]
|
||||||
|
|
||||||
|
rawpath = self.path_raw
|
||||||
|
if rawpath:
|
||||||
|
return get_uti_for_extension(pathlib.Path(rawpath).suffix)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ismovie(self):
|
def ismovie(self):
|
||||||
"""Returns True if file is a movie, otherwise False"""
|
"""Returns True if file is a movie, otherwise False"""
|
||||||
|
|||||||
@@ -1188,7 +1188,6 @@ def test_uti(photosdb):
|
|||||||
assert photo.uti_original == UTI_ORIGINAL_DICT[uuid]
|
assert photo.uti_original == UTI_ORIGINAL_DICT[uuid]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason="RAW+JPEG not yet working on Monterey")
|
|
||||||
def test_raw(photosdb):
|
def test_raw(photosdb):
|
||||||
"""Test various raw properties"""
|
"""Test various raw properties"""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user