From 906b6c0911a0a263f4e45a7d59ddc838bb964816 Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Sat, 7 Dec 2019 20:32:23 -0800 Subject: [PATCH] added edited and external_edit to cmd_line and __str__, to_json; closes #12 --- osxphotos/__init__.py | 2 ++ osxphotos/_version.py | 2 +- osxphotos/cmd_line.py | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/osxphotos/__init__.py b/osxphotos/__init__.py index 02865c3d..310e22ae 100644 --- a/osxphotos/__init__.py +++ b/osxphotos/__init__.py @@ -1393,6 +1393,7 @@ class PhotoInfo: "path": self.path(), "ismissing": self.ismissing(), "hasadjustments": self.hasadjustments(), + "external_edit": self.external_edit(), "favorite": self.favorite(), "hidden": self.hidden(), "latitude": self._latitude(), @@ -1417,6 +1418,7 @@ class PhotoInfo: "path": self.path(), "ismissing": self.ismissing(), "hasadjustments": self.hasadjustments(), + "external_edit": self.external_edit(), "favorite": self.favorite(), "hidden": self.hidden(), "latitude": self._latitude(), diff --git a/osxphotos/_version.py b/osxphotos/_version.py index fd60968e..15d0a96c 100644 --- a/osxphotos/_version.py +++ b/osxphotos/_version.py @@ -1,4 +1,4 @@ """ version info """ -__version__ = "0.14.15" +__version__ = "0.14.16" diff --git a/osxphotos/cmd_line.py b/osxphotos/cmd_line.py index fc98ee7b..d05ab468 100644 --- a/osxphotos/cmd_line.py +++ b/osxphotos/cmd_line.py @@ -150,6 +150,8 @@ def dump(cli_obj): is_flag=True, help="case insensitive search for name or description. Does not apply to keyword, person, or album", ) +@click.option("--edited", is_flag=True, help="search for photos that have been edited") +@click.option("--external-edit", is_flag=True, help="search for photos edited in external editor") @click.option("--favorite", is_flag=True, help="search for photos marked favorite") @click.option( "--not-favorite", is_flag=True, help="search for photos not marked favorite" @@ -184,6 +186,8 @@ def query( no_description, ignore_case, json, + edited, + external_edit, favorite, not_favorite, hidden, @@ -207,6 +211,8 @@ def query( no_name, description, no_description, + edited, + external_edit, favorite, not_favorite, hidden, @@ -276,6 +282,12 @@ def query( elif no_description: photos = [p for p in photos if not p.description()] + if edited: + photos = [p for p in photos if p.hasadjustments()] + + if external_edit: + photos = [p for p in photos if p.external_edit()] + if favorite: photos = [p for p in photos if p.favorite()] elif not_favorite: @@ -332,6 +344,7 @@ def print_photo_info(photos, json=False): "path", "ismissing", "hasadjustments", + "external_edit", "favorite", "hidden", "latitude", @@ -354,6 +367,7 @@ def print_photo_info(photos, json=False): p.path(), p.ismissing(), p.hasadjustments(), + p.external_edit(), p.favorite(), p.hidden(), p._latitude(),