-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat 1524 list methods photosalbum (#1562)
* Add list and set methods to PhotosAlbum, #1524 * Added example * Fixed example
- Loading branch information
Showing
8 changed files
with
101 additions
and
44 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"""Example that shows how to add PhotoInfo objects to an album in Photos""" | ||
|
||
from osxphotos import PhotosDB | ||
from osxphotos.photosalbum import PhotosAlbum | ||
|
||
# If album exists it will be used, otherwise it will be created | ||
album = PhotosAlbum("Best Photos") | ||
best_photos = [p for p in PhotosDB(verbose=print).photos() if p.score.overall > 0.9] | ||
|
||
# use album.add() or album.append() to add a single photo | ||
# use album.update() or album.extend() to add an iterable of photos | ||
album.extend(best_photos) | ||
print(f"Added {len(best_photos)} photos to album {album.name}") | ||
print(f"Album contains {len(album.photos())} photos") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters