Feature not reference 738 (#744)

* Added --not-reference, 738

* Release files for #738
This commit is contained in:
Rhet Turnbull
2022-07-28 06:24:58 -07:00
committed by GitHub
parent b4c4d9fb90
commit f4154e8691
29 changed files with 122 additions and 292 deletions

View File

@@ -1,3 +1,3 @@
""" version info """
__version__ = "0.50.10"
__version__ = "0.50.11"

View File

@@ -420,6 +420,12 @@ def QUERY_OPTIONS(f):
is_flag=True,
help="Search for photos that were imported as referenced files (not copied into Photos library).",
),
o(
"--not-reference",
is_flag=True,
help="Search for photos that are not references, that is, they were copied into the Photos library "
"and are managed by Photos.",
),
o(
"--in-album",
is_flag=True,

View File

@@ -805,6 +805,7 @@ def export(
not_live,
not_panorama,
not_portrait,
not_reference,
not_screenshot,
not_selfie,
not_shared,
@@ -995,6 +996,7 @@ def export(
ignore_date_modified = cfg.ignore_date_modified
ignore_signature = cfg.ignore_signature
in_album = cfg.in_album
is_reference = cfg.is_reference
jpeg_ext = cfg.jpeg_ext
jpeg_quality = cfg.jpeg_quality
keep = (cfg.keep,)
@@ -1024,6 +1026,7 @@ def export(
not_live = cfg.not_live
not_panorama = cfg.not_panorama
not_portrait = cfg.not_portrait
not_reference = cfg.not_reference
not_screenshot = cfg.not_screenshot
not_selfie = cfg.not_selfie
not_shared = cfg.not_shared
@@ -1129,6 +1132,7 @@ def export(
("slow_mo", "not_slow_mo"),
("time_lapse", "not_time_lapse"),
("title", "no_title"),
("is_reference", "not_reference"),
]
dependent_options = [
("exiftool_merge_keywords", ("exiftool", "sidecar")),
@@ -1391,6 +1395,7 @@ def export(
not_missing=None,
not_panorama=not_panorama,
not_portrait=not_portrait,
not_reference=not_reference,
not_screenshot=not_screenshot,
not_selfie=not_selfie,
not_shared=not_shared,

View File

@@ -127,6 +127,7 @@ def query(
not_missing,
not_panorama,
not_portrait,
not_reference,
not_screenshot,
not_selfie,
not_shared,
@@ -176,7 +177,6 @@ def query(
from_date,
from_time,
has_raw,
is_reference,
keyword,
label,
max_size,
@@ -220,6 +220,7 @@ def query(
(shared, not_shared),
(slow_mo, not_slow_mo),
(time_lapse, not_time_lapse),
(is_reference, not_reference),
]
# print help if no non-exclusive term or a double exclusive term is given
if any(all(bb) for bb in exclusive) or not any(
@@ -309,6 +310,7 @@ def query(
not_missing=not_missing,
not_panorama=not_panorama,
not_portrait=not_portrait,
not_reference=not_reference,
not_screenshot=not_screenshot,
not_selfie=not_selfie,
not_shared=not_shared,

View File

@@ -253,7 +253,6 @@ def _query_options_from_kwargs(**kwargs) -> QueryOptions:
"from_date",
"from_time",
"has_raw",
"is_reference",
"keyword",
"label",
"max_size",
@@ -294,6 +293,7 @@ def _query_options_from_kwargs(**kwargs) -> QueryOptions:
("shared", "not_shared"),
("slow_mo", "not_slow_mo"),
("time_lapse", "not_time_lapse"),
("is_reference", "not_reference"),
]
# print help if no non-exclusive term or a double exclusive term is given
# TODO: add option to validate requiring at least one query arg

Binary file not shown.

View File

@@ -3286,6 +3286,8 @@ class PhotosDB:
if options.is_reference:
photos = [p for p in photos if p.isreference]
elif options.not_reference:
photos = [p for p in photos if not p.isreference]
if options.in_album:
photos = [p for p in photos if p.albums]

View File

@@ -70,6 +70,7 @@ class QueryOptions:
not_missing: search for non-missing photos
not_panorama: search for non-panorama photos
not_portrait: search for non-portrait photos
not_reference: search for photos not stored by reference (that is, they are managed by Photos)
not_screenshot: search for non-screenshot photos
not_selfie: search for non-selfie photos
not_shared: search for non-shared photos
@@ -151,6 +152,7 @@ class QueryOptions:
not_missing: Optional[bool] = None
not_panorama: Optional[bool] = None
not_portrait: Optional[bool] = None
not_reference: Optional[bool] = None
not_screenshot: Optional[bool] = None
not_selfie: Optional[bool] = None
not_shared: Optional[bool] = None