-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Print path to each original photo in the library and whether it is referenced or not and if it is missing | ||
Run with: osxphotos run photo_paths.py | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
import osxphotos | ||
from osxphotos.cli import query_command, verbose | ||
|
||
|
||
@query_command | ||
def photo_paths(photos: list[osxphotos.PhotoInfo], **kwargs): | ||
"""Print path to each original photo in the library and whether it is referenced or not and if it is missing. | ||
This may be useful for finding missing referenced photos. | ||
""" | ||
print("uuid, original_filename, isreference, ismissing, path") | ||
for photo in photos: | ||
print( | ||
f"{photo.uuid}, {photo.original_filename}, " | ||
f"{'yes' if photo.isreference else 'no'}, " | ||
f"{'no' if photo.path else 'yes'}, " # don't look at ismissing for referenced which may be false but at whether path exists | ||
f"{photo._path_5()}" # this returns the candidate path for the photo wether or not it exists | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
photo_paths() |