From fdf636ac8864ebb2cc324b1f9d3c6c82ee3910f9 Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Sat, 1 Feb 2020 07:09:36 -0800 Subject: [PATCH] Updated photos_repl.py --- examples/photos_repl.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/examples/photos_repl.py b/examples/photos_repl.py index f50931e0..3245b599 100755 --- a/examples/photos_repl.py +++ b/examples/photos_repl.py @@ -8,6 +8,7 @@ # python3 -i examples/photos_repl.py import sys +import time # click needed since this uses a couple of functions from CLI (__main__.py) import click @@ -25,13 +26,23 @@ def main(): db = get_photos_db() if db: - return osxphotos.PhotosDB(dbfile=db) + print("loading database") + tic = time.perf_counter() + photosdb = osxphotos.PhotosDB(dbfile=db) + toc = time.perf_counter() + print(f"done: took {toc-tic} seconds") + return photosdb else: _list_libraries() sys.exit() if __name__ == "__main__": - print(f"Version: {osxphotos._version.__version__}") + print(f"osxphotos version: {osxphotos._version.__version__}") photosdb = main() + print(f"database version: {photosdb.db_version}") + print("getting photos") + tic = time.perf_counter() photos = photosdb.photos(images=True, movies=True) + toc = time.perf_counter() + print(f"found {len(photos)} photos in {toc-tic} seconds")