From cd8dd552a479905348555f5a17d2ad3a3f25ac69 Mon Sep 17 00:00:00 2001
From: Rhet Turnbull
Date: Sat, 1 May 2021 21:15:31 -0700
Subject: [PATCH] Add --add-exported-to-album, # 428
---
README.md | 30 +++++
docs/.buildinfo | 2 +-
docs/_modules/index.html | 2 +-
.../_modules/osxphotos/photosdb/photosdb.html | 2 +-
docs/_sources/tutorial.md.txt | 36 +++++-
docs/_static/documentation_options.js | 2 +-
docs/cli.html | 20 +++-
docs/genindex.html | 33 +++++-
docs/index.html | 2 +-
docs/modules.html | 2 +-
docs/objects.inv | Bin 3408 -> 3437 bytes
docs/osxphotos.pdf | Bin 265154 -> 264715 bytes
docs/reference.html | 4 +-
docs/search.html | 2 +-
docs/searchindex.js | 2 +-
docs/tutorial.html | 38 +++++-
osxphotos/_version.py | 2 +-
osxphotos/cli.py | 96 ++++++++++++++-
osxphotos/photoinfo/_photoinfo_export.py | 21 +++-
osxphotos/photosalbum.py | 74 ++++++++++++
requirements.txt | 2 +-
setup.py | 2 +-
tests/conftest.py | 109 +++++++++++++++++-
tests/search_info_test_data_10_15_7.json | 2 +-
tests/test_cli_add_to_album.py | 92 +++++++++++++++
tests/test_exportresults.py | 5 +-
26 files changed, 556 insertions(+), 26 deletions(-)
create mode 100644 osxphotos/photosalbum.py
create mode 100644 tests/test_cli_add_to_album.py
diff --git a/README.md b/README.md
index 6e27dc3b..e9db3179 100644
--- a/README.md
+++ b/README.md
@@ -1050,6 +1050,36 @@ Options:
run with --cleanup first if you're not
certain.
+ --add-exported-to-album ALBUM Add all exported photos to album ALBUM in
+ Photos. Album ALBUM will be created if it
+ doesn't exist. All exported photos will be
+ added to this album. This only works if the
+ Photos library being exported is the last-
+ opened (default) library in Photos. This
+ feature is currently experimental. I don't
+ know how well it will work on large export
+ sets.
+
+ --add-skipped-to-album ALBUM Add all skipped photos to album ALBUM in
+ Photos. Album ALBUM will be created if it
+ doesn't exist. All skipped photos will be
+ added to this album. This only works if the
+ Photos library being exported is the last-
+ opened (default) library in Photos. This
+ feature is currently experimental. I don't
+ know how well it will work on large export
+ sets.
+
+ --add-missing-to-album ALBUM Add all missing photos to album ALBUM in
+ Photos. Album ALBUM will be created if it
+ doesn't exist. All missing photos will be
+ added to this album. This only works if the
+ Photos library being exported is the last-
+ opened (default) library in Photos. This
+ feature is currently experimental. I don't
+ know how well it will work on large export
+ sets.
+
--exportdb EXPORTDB_FILE Specify alternate name for database file which
stores state information for export and
--update. If --exportdb is not specified,
diff --git a/docs/.buildinfo b/docs/.buildinfo
index fb905c3a..ff2165c0 100644
--- a/docs/.buildinfo
+++ b/docs/.buildinfo
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: 09f774bbf0a11a7f854d5b240879b3b4
+config: 5342827b9d06cfc608d1a286ed0f5c3f
tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/docs/_modules/index.html b/docs/_modules/index.html
index 5147faf8..3e2a3976 100644
--- a/docs/_modules/index.html
+++ b/docs/_modules/index.html
@@ -5,7 +5,7 @@
- Overview: module code — osxphotos 0.42.13 documentation
+ Overview: module code — osxphotos 0.42.14 documentation
diff --git a/docs/_modules/osxphotos/photosdb/photosdb.html b/docs/_modules/osxphotos/photosdb/photosdb.html
index 259a891c..c947cfb4 100644
--- a/docs/_modules/osxphotos/photosdb/photosdb.html
+++ b/docs/_modules/osxphotos/photosdb/photosdb.html
@@ -5,7 +5,7 @@
- osxphotos.photosdb.photosdb — osxphotos 0.42.11 documentation
+ osxphotos.photosdb.photosdb — osxphotos 0.42.14 documentation
diff --git a/docs/_sources/tutorial.md.txt b/docs/_sources/tutorial.md.txt
index e4ca1b69..fe2421ed 100644
--- a/docs/_sources/tutorial.md.txt
+++ b/docs/_sources/tutorial.md.txt
@@ -55,7 +55,7 @@ By default, osxphotos will use the original filename of the photo when exporting
`osxphotos export /path/to/export --filename "{title}"`
-The above command will export photos using the title. Note that you don't need to specify the extension as part of the `--filename` template as osxphotos will automatically add the correct fie extension. Some photos might not have a title so in this case, you could use the default value feature to specify a different name for these photos. For example, to use the title as the filename, but if no title is specified, use the original filename instead:
+The above command will export photos using the title. Note that you don't need to specify the extension as part of the `--filename` template as osxphotos will automatically add the correct file extension. Some photos might not have a title so in this case, you could use the default value feature to specify a different name for these photos. For example, to use the title as the filename, but if no title is specified, use the original filename instead:
```txt
osxphotos export /path/to/export --filename "{title,{original_name}}"
@@ -315,6 +315,40 @@ Then the next to you run osxphotos, you can simply do this:
The configuration file is a plain text file in [TOML](https://toml.io/en/) format so the `.toml` extension is standard but you can name the file anything you like.
+### An example from an actual osxphotos user
+
+Here's a comprehensive use case from an actual osxphotos user that integrates many of the concepts discussed in this tutorial (thank-you Philippe for contributing this!):
+
+ I usually import my iPhone’s photo roll on a more or less regular basis, and it
+ includes photos and videos. As a result, the size ot my Photos library may rise
+ very quickly. Nevertheless, I will tag and geolocate everything as Photos has a
+ quite good keyword management system.
+
+ After a while, I want to take most of the videos out of the library and move them
+ to a separate "videos" folder on a different folder / volume. As I might want to
+ use them in Final Cut Pro, and since Final Cut is able to import Finder tags into
+ its internal library tagging system, I will use osxphotos to do just this.
+
+ Picking the videos can be left to Photos, using a smart folder for instance. Then
+ just add a keyword to all videos to be processed. Here I chose "Quik" as I wanted
+ to spot all videos created on my iPhone using the Quik application (now part of
+ GoPro).
+
+ I want to retrieve my keywords only and make sure they populate the Finder tags, as
+ well as export all the persons identified in the videos by Photos. I also want to
+ merge any keywords or persons already in the video metadata with the exported
+ metadata.
+
+ Keeping Photo’s edited titles and descriptions and putting both in the Finder
+ comments field in a readable manner is also enabled.
+
+ And I want to keep the file’s creation date (using `--touch-file`).
+
+ Finally, use `--strip` to remove any leading or trailing whitespace from processed
+ template fields.
+
+`osxphotos export ~/Desktop/folder for exported videos/ --keyword Quik --only-movies --db /path to my.photoslibrary --touch-file --finder-tag-keywords --person-keyword --xattr-template findercomment "{title}{title?{descr?{newline},},}{descr}" --exiftool-merge-keywords --exiftool-merge-persons --exiftool --strip`
+
### Conclusion
osxphotos is very flexible. If you merely want to backup your Photos library, then spending a few minutes to understand the `--directory` option is likely all you need and you can be up and running in minutes. However, if you have a more complex workflow, osxphotos likely provides options to implement your workflow. This tutorial does not attempt to cover every option offered by osxphotos but hopefully it provides a good understanding of what kinds of things are possible and where to explore if you want to learn more.
\ No newline at end of file
diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js
index 7105d46b..38fecd0b 100644
--- a/docs/_static/documentation_options.js
+++ b/docs/_static/documentation_options.js
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
- VERSION: '0.42.13',
+ VERSION: '0.42.14',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
BUILDER: 'html',
diff --git a/docs/cli.html b/docs/cli.html
index 646e3c21..5a9e588d 100644
--- a/docs/cli.html
+++ b/docs/cli.html
@@ -5,7 +5,7 @@
- osxphotos command line interface (CLI) — osxphotos 0.42.13 documentation
+ osxphotos command line interface (CLI) — osxphotos 0.42.14 documentation
@@ -813,6 +813,24 @@ to modify this behavior.
Cleanup export directory by deleting any files which were not included in this export set. For example, photos which had previously been exported and were subsequently deleted in Photos. WARNING: –cleanup will delete any files in the export directory that were not exported by osxphotos, for example, your own scripts or other files. Be sure this is what you intend before using –cleanup. Use –dry-run with –cleanup first if you’re not certain.
Add all exported photos to album ALBUM in Photos. Album ALBUM will be created if it doesn’t exist. All exported photos will be added to this album. This only works if the Photos library being exported is the last-opened (default) library in Photos. This feature is currently experimental. I don’t know how well it will work on large export sets.
Add all skipped photos to album ALBUM in Photos. Album ALBUM will be created if it doesn’t exist. All skipped photos will be added to this album. This only works if the Photos library being exported is the last-opened (default) library in Photos. This feature is currently experimental. I don’t know how well it will work on large export sets.
Add all missing photos to album ALBUM in Photos. Album ALBUM will be created if it doesn’t exist. All missing photos will be added to this album. This only works if the Photos library being exported is the last-opened (default) library in Photos. This feature is currently experimental. I don’t know how well it will work on large export sets.