diff --git a/README.md b/README.md index ab0e5a6..c4d4048 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,18 @@ PhotoScript provides a python wrapper around Apple Photos applescript interface. With PhotoScript you can interact with Photos using python. Runs only on MacOS. Tested on MacOS Catalina. +PhotosScript is limited by Photos' very limited AppleScript dictionary. + ## Installation PhotoScript uses setuptools, thus simply run: `python3 setup.py install` +Or you can install via pip: + +`pip install photoscript` + ## Example ```python diff --git a/photoscript.pdf b/photoscript.pdf index af29cb5..50001cd 100644 Binary files a/photoscript.pdf and b/photoscript.pdf differ diff --git a/photoscript/_version.py b/photoscript/_version.py index 521d731..60d34ab 100644 --- a/photoscript/_version.py +++ b/photoscript/_version.py @@ -1,3 +1,3 @@ """ version info """ -__version__ = "0.0.2" \ No newline at end of file +__version__ = "0.0.3" \ No newline at end of file diff --git a/photoscript/photoscript.applescript b/photoscript/photoscript.applescript index 8c1509c..e51766b 100644 --- a/photoscript/photoscript.applescript +++ b/photoscript/photoscript.applescript @@ -75,7 +75,7 @@ on _import(filenames, skip_duplicate_check) end tell end _import -on _import_to_album(filenames, album_name, skip_duplicate_check) +on _import_to_album(filenames, album_, skip_duplicate_check) (* import files into album Args: filenames: list of files in POSIX format to import @@ -88,7 +88,7 @@ on _import_to_album(filenames, album_name, skip_duplicate_check) copy fname to the end of file_list end repeat tell application "Photos" - import file_list into album album_name skip check duplicates skip_duplicate_check + import file_list into album id (album_) skip check duplicates skip_duplicate_check end tell end _import_to_album diff --git a/photoscript/photoscript.py b/photoscript/photoscript.py index f73290a..ba4c479 100644 --- a/photoscript/photoscript.py +++ b/photoscript/photoscript.py @@ -88,16 +88,14 @@ def import_photos(self, photo_paths, album=None, skip_duplicate_check=False): Args: photos: list of file paths to import - album: optional, name of album to import into (album must exist in Photos). May also be an Album object. + album: optional, Album object for album to import into skip_duplicate_check: if True, Photos will not check for duplicates on import, default is False """ if album is not None: - album = album.name if isinstance(album, Album) else album - run_script("_import_to_album", photo_paths, album, skip_duplicate_check) + run_script("_import_to_album", photo_paths, album.id, skip_duplicate_check) else: run_script("_import", photo_paths, skip_duplicate_check) - @property def album_names(self, top_level=False): """ List of album names in the Photos library @@ -106,7 +104,6 @@ def album_names(self, top_level=False): """ return run_script("_album_names", top_level) - @property def folder_names(self, top_level=False): """ List of folder names in the Photos library @@ -142,7 +139,6 @@ def album(self, *name, uuid=None): else: raise ValueError("Invalid name or uuid") - @property def albums(self, top_level=False): """ list of Album objects for all albums """ album_ids = run_script("_album_ids", top_level)