list_photo_libraries now searches entire disk
This commit is contained in:
@@ -141,7 +141,7 @@ Returns path to last opened Photo Library as string.
|
|||||||
|
|
||||||
#### ```list_photo_libraries()```
|
#### ```list_photo_libraries()```
|
||||||
|
|
||||||
Returns list of Photos libraries found in the user's Pictures folder.
|
Returns list of Photos libraries found on the system
|
||||||
|
|
||||||
### PhotosDB
|
### PhotosDB
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import glob
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
import platform
|
import platform
|
||||||
|
import subprocess
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -191,8 +191,16 @@ def get_last_library_path():
|
|||||||
|
|
||||||
|
|
||||||
def list_photo_libraries():
|
def list_photo_libraries():
|
||||||
""" returns list of Photos libraries found in the user's Pictures folder """
|
""" returns list of Photos libraries found on the system """
|
||||||
lib_list = glob.glob(f"{str(Path.home())}/Pictures/*.photoslibrary")
|
# lib_list = glob.glob(f"{str(Path.home())}/Pictures/*.photoslibrary")
|
||||||
|
# return lib_list
|
||||||
|
|
||||||
|
lib_list = []
|
||||||
|
output = subprocess.check_output(
|
||||||
|
["/usr/bin/mdfind", "-onlyin", "/", "-name", ".photoslibrary"]
|
||||||
|
).splitlines()
|
||||||
|
for lib in output:
|
||||||
|
lib_list.append(lib.decode("utf-8"))
|
||||||
return lib_list
|
return lib_list
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user