Updated photos_repl.py
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
# python3 -i examples/photos_repl.py
|
# python3 -i examples/photos_repl.py
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
# click needed since this uses a couple of functions from CLI (__main__.py)
|
# click needed since this uses a couple of functions from CLI (__main__.py)
|
||||||
import click
|
import click
|
||||||
@@ -25,13 +26,23 @@ def main():
|
|||||||
db = get_photos_db()
|
db = get_photos_db()
|
||||||
|
|
||||||
if 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:
|
else:
|
||||||
_list_libraries()
|
_list_libraries()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(f"Version: {osxphotos._version.__version__}")
|
print(f"osxphotos version: {osxphotos._version.__version__}")
|
||||||
photosdb = main()
|
photosdb = main()
|
||||||
|
print(f"database version: {photosdb.db_version}")
|
||||||
|
print("getting photos")
|
||||||
|
tic = time.perf_counter()
|
||||||
photos = photosdb.photos(images=True, movies=True)
|
photos = photosdb.photos(images=True, movies=True)
|
||||||
|
toc = time.perf_counter()
|
||||||
|
print(f"found {len(photos)} photos in {toc-tic} seconds")
|
||||||
|
|||||||
Reference in New Issue
Block a user