Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RhetTbull committed Aug 16, 2020
1 parent 352dc19 commit aa88df3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified photoscript.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion photoscript/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
""" version info """

__version__ = "0.0.2"
__version__ = "0.0.3"
4 changes: 2 additions & 2 deletions photoscript/photoscript.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
8 changes: 2 additions & 6 deletions photoscript/photoscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit aa88df3

Please sign in to comment.