From 62fedc7fbf1bced7062147333df6e13cbf8fc2c3 Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Sun, 8 Dec 2019 00:24:34 -0800 Subject: [PATCH] added list_photo_libraries --- README.md | 4 ++++ osxphotos/__init__.py | 7 +++++++ osxphotos/_version.py | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 30646d9e..7940c167 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,10 @@ if __name__ == "__main__": Returns path to last opened Photo Library as string. +#### ```list_photo_libraries()``` + +Returns list of Photos libraries found in the user's Pictures folder. + ### PhotosDB #### Open the default Photos library diff --git a/osxphotos/__init__.py b/osxphotos/__init__.py index 61749b71..e80dc06a 100644 --- a/osxphotos/__init__.py +++ b/osxphotos/__init__.py @@ -1,3 +1,4 @@ +import glob import json import logging import os.path @@ -189,6 +190,12 @@ def get_last_library_path(): return None +def list_photo_libraries(): + """ returns list of Photos libraries found in the user's Pictures folder """ + lib_list = glob.glob(f"{str(Path.home())}/Pictures/*.photoslibrary") + return lib_list + + class PhotosDB: def __init__(self, dbfile=None): """ create a new PhotosDB object """ diff --git a/osxphotos/_version.py b/osxphotos/_version.py index 9e8894a1..092eabbb 100644 --- a/osxphotos/_version.py +++ b/osxphotos/_version.py @@ -1,4 +1,4 @@ """ version info """ -__version__ = "0.14.18" +__version__ = "0.14.19"