From b9f4b2cf389a42f3381600466a4ce9b2e2ca2860 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 28 Sep 2020 14:25:10 -0700 Subject: [PATCH] Pull out search_by_argparse into own function. --- frontends/etiquette_cli.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/frontends/etiquette_cli.py b/frontends/etiquette_cli.py index 1b6ea4b..2e30fe5 100644 --- a/frontends/etiquette_cli.py +++ b/frontends/etiquette_cli.py @@ -27,10 +27,12 @@ def find_photodb(): photodbs[path] = photodb return photodb -def search_argparse(args): +#################################################################################################### + +def search_by_argparse(args, yield_albums=False, yield_photos=False): photodb = find_photodb() cwd = pathclass.cwd() - photos = photodb.search( + results = photodb.search( area=args.area, width=args.width, height=args.height, @@ -54,12 +56,15 @@ def search_argparse(args): limit=args.limit, offset=args.offset, orderby=args.orderby, - yield_albums=False, + yield_albums=yield_albums, + yield_photos=yield_photos, ) + return results + +def search_argparse(args): + photos = search_by_argparse(args, yield_photos=True) photos = sorted(photos, key=lambda p: p.real_path) for photo in photos: - if photo.real_path not in cwd: - continue print(photo.real_path.absolute_path) def main(argv):