-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for live photo path in referenced libraries, #1459
- Loading branch information
Showing
11 changed files
with
105 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""Work with macOS CFURL Bookmarks""" | ||
|
||
import os | ||
import pathlib | ||
|
||
from .platform import assert_macos, is_macos | ||
|
||
if is_macos: | ||
import mac_alias | ||
|
||
|
||
def resolve_bookmark_path(bookmark_data: bytes) -> pathlib.Path | None: | ||
"""Get the path from a CFURL file bookmark | ||
This works without calling CFURLCreateByResolvingBookmarkData | ||
which fails if the target file does not exist | ||
""" | ||
assert_macos() | ||
try: | ||
bookmark = mac_alias.Bookmark.from_bytes(bookmark_data) | ||
except Exception as e: | ||
raise ValueError(f"Invalid bookmark: {e}") from e | ||
path_components = bookmark.get(mac_alias.kBookmarkPath, None) | ||
if not path_components: | ||
return None | ||
return pathlib.Path(f"/{os.path.join(*path_components)}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- Get the path data for a referenced Live Photo | ||
SELECT | ||
${asset_table}.ZUUID, | ||
ZFILESYSTEMVOLUME.ZNAME, | ||
ZFILESYSTEMBOOKMARK.ZPATHRELATIVETOVOLUME, | ||
ZFILESYSTEMBOOKMARK.ZBOOKMARKDATA | ||
FROM | ||
${asset_table} | ||
JOIN ZINTERNALRESOURCE ON ZINTERNALRESOURCE.ZASSET = ${asset_table}.Z_PK | ||
JOIN ZFILESYSTEMBOOKMARK ON ZFILESYSTEMBOOKMARK.ZRESOURCE = ZINTERNALRESOURCE.Z_PK | ||
JOIN ZFILESYSTEMVOLUME ON ZFILESYSTEMVOLUME.Z_PK = ZINTERNALRESOURCE.ZFILESYSTEMVOLUME | ||
WHERE | ||
ZINTERNALRESOURCE.ZDATASTORESUBTYPE = 18 -- Live video component | ||
AND ${asset_table}.ZUUID = '${uuid}'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters