diff --git a/API_README.md b/API_README.md index 907fff78..6e896d33 100644 --- a/API_README.md +++ b/API_README.md @@ -2008,7 +2008,7 @@ cog.out(get_template_field_table()) |{lf}|A line feed: '\n', alias for {newline}| |{cr}|A carriage return: '\r'| |{crlf}|a carriage return + line feed: '\r\n'| -|{osxphotos_version}|The osxphotos version, e.g. '0.51.2'| +|{osxphotos_version}|The osxphotos version, e.g. '0.51.3'| |{osxphotos_cmd_line}|The full command line used to run osxphotos| |{album}|Album(s) photo is contained in| |{folder_album}|Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder| diff --git a/README.md b/README.md index b62b3c89..156181ae 100644 --- a/README.md +++ b/README.md @@ -266,6 +266,22 @@ the exported files would be: /path/to/export/Travel/IMG_1234.JPG /path/to/export/Vacation/IMG_1234.JPG +If your photos are organized in folders and albums in Photos you can preserve this structure on export by using the `{folder_album}` template field with the `--directory` option. For example, if you have a photo in the album `Vacation` which is in the `Travel` folder, the following command would export the photo to the `Travel/Vacation` directory: + +`osxphotos export /path/to/export --directory "{folder_album}"` + +Photos can belong to more than one album. In this case, the template field `{folder_album}` will expand to all the album names that the photo belongs to. For example, if a photo belongs to the albums `Vacation` and `Travel`, the template field `{folder_album}` would expand to `Vacation`, `Travel`. If the photo belongs to no albums, the template field `{folder_album}` would expand to "_" (the default value). + +All template fields including `{folder_album}` can be further filtered using a number of different filters. To convert all directory names to lower case for example, use the `lower` filter: + +`osxphotos export /path/to/export --directory "{folder_album|lower}"` + +If all your photos were organized into various albums under a folder named `Events` but some where also included in other top-level albums and you wanted to export only the `Events` folder, you could use the `filter` option to filter out the other top-level albums by selecting only those folder/album paths that start with `Events`: + +`osxphotos export /path/to/export --directory "{folder_album|filter(startswith Events)}"` + +You can learn more about the other filters using `osxphotos help export`. + #### Specify exported filename By default, osxphotos will use the original filename of the photo when exporting. That is, the filename the photo had when it was taken or imported into Photos. This is often something like `IMG_1234.JPG` or `DSC05678.dng`. osxphotos allows you to specify a custom filename template using the `--filename` option in the same way as `--directory` allows you to specify a custom directory name. For example, Photos allows you specify a title or caption for a photo and you can use this in place of the original filename: @@ -445,6 +461,14 @@ You can use the `--report` option to create a report, in comma-separated values `osxphotos export /path/to/export --report export.csv` +You can also create reports in JSON or SQLite format by changing the extension of the report filename. For example, to create a JSON report: + +`osxphotos export /path/to/export --report export.json` + +And to create a SQLite report: + +`osxphotos export /path/to/export --report export.sqlite` + #### Exporting only certain photos By default, osxphotos will export your entire Photos library. If you want to export only certain photos, osxphotos provides a rich set of "query options" that allow you to query the Photos database to filter out only certain photos that match your query criteria. The tutorial does not cover all the query options as there are over 50 of them--read the help text (`osxphotos help export`) to better understand the available query options. No matter which subset of photos you would like to export, there is almost certainly a way for osxphotos to filter these. For example, you can filter for only images that contain certain keywords or images without a title, images from a specific time of day or specific date range, images contained in specific albums, etc. @@ -1317,6 +1341,13 @@ Options: --config-only If specified, saves the config file but does not export any files; must be used with --save-config. + --print TEMPLATE Render TEMPLATE string for each photo being + exported and print to stdout. TEMPLATE is an + osxphotos template string. This may be useful + for creating custom reports, etc. TEMPLATE + will be printed after the photo is exported or + skipped. May be repeated to print multiple + template strings. --theme THEME Specify the color theme to use for --verbose output. Valid themes are 'dark', 'light', 'mono', and 'plain'. Defaults to 'dark' or @@ -1964,7 +1995,7 @@ Substitution Description {lf} A line feed: '\n', alias for {newline} {cr} A carriage return: '\r' {crlf} a carriage return + line feed: '\r\n' -{osxphotos_version} The osxphotos version, e.g. '0.51.2' +{osxphotos_version} The osxphotos version, e.g. '0.51.3' {osxphotos_cmd_line} The full command line used to run osxphotos The following substitutions may result in multiple values. Thus if specified @@ -2444,7 +2475,7 @@ The following template field substitutions are availabe for use the templating s |{lf}|A line feed: '\n', alias for {newline}| |{cr}|A carriage return: '\r'| |{crlf}|a carriage return + line feed: '\r\n'| -|{osxphotos_version}|The osxphotos version, e.g. '0.51.2'| +|{osxphotos_version}|The osxphotos version, e.g. '0.51.3'| |{osxphotos_cmd_line}|The full command line used to run osxphotos| |{album}|Album(s) photo is contained in| |{folder_album}|Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder| diff --git a/docs/.buildinfo b/docs/.buildinfo index d9b73ff0..57fbaaef 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: 18c2b25ef56807d10442ba0ee766ff2f +config: 8455ff18437720babe61cdb4fe34401d tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_modules/index.html b/docs/_modules/index.html index 1d810cfe..1743a229 100644 --- a/docs/_modules/index.html +++ b/docs/_modules/index.html @@ -5,7 +5,7 @@ - Overview: module code - osxphotos 0.51.2 documentation + Overview: module code - osxphotos 0.51.3 documentation @@ -123,7 +123,7 @@
-
osxphotos 0.51.2 documentation
+
osxphotos 0.51.3 documentation
@@ -146,7 +146,7 @@
@@ -147,7 +147,7 @@
@@ -145,7 +145,7 @@
@@ -147,7 +147,7 @@
@@ -147,7 +147,7 @@
@@ -147,7 +147,7 @@
@@ -145,7 +145,7 @@
@@ -147,7 +147,7 @@
@@ -144,7 +144,7 @@
@@ -147,7 +147,7 @@
@@ -147,7 +147,7 @@
+

If your photos are organized in folders and albums in Photos you can preserve this structure on export by using the {folder_album} template field with the --directory option. For example, if you have a photo in the album Vacation which is in the Travel folder, the following command would export the photo to the Travel/Vacation directory:

+

osxphotos export /path/to/export --directory "{folder_album}"

+

Photos can belong to more than one album. In this case, the template field {folder_album} will expand to all the album names that the photo belongs to. For example, if a photo belongs to the albums Vacation and Travel, the template field {folder_album} would expand to Vacation, Travel. If the photo belongs to no albums, the template field {folder_album} would expand to “_” (the default value).

+

All template fields including {folder_album} can be further filtered using a number of different filters. To convert all directory names to lower case for example, use the lower filter:

+

osxphotos export /path/to/export --directory "{folder_album|lower}"

+

If all your photos were organized into various albums under a folder named Events but some where also included in other top-level albums and you wanted to export only the Events folder, you could use the filter option to filter out the other top-level albums by selecting only those folder/album paths that start with Events:

+

osxphotos export /path/to/export --directory "{folder_album|filter(startswith Events)}"

+

You can learn more about the other filters using osxphotos help export.

Specify exported filename#

@@ -367,6 +375,10 @@

Creating a report of all exported files#

You can use the --report option to create a report, in comma-separated values (CSV) format that will list the details of all files that were exported, skipped, missing, etc. This file format is compatible with programs such as Microsoft Excel. Provide the name of the report after the --report option:

osxphotos export /path/to/export --report export.csv

+

You can also create reports in JSON or SQLite format by changing the extension of the report filename. For example, to create a JSON report:

+

osxphotos export /path/to/export --report export.json

+

And to create a SQLite report:

+

osxphotos export /path/to/export --report export.sqlite

Exporting only certain photos#

diff --git a/docsrc/source/template_help.rst b/docsrc/source/template_help.rst index ba0c0a65..8a8f19a9 100644 --- a/docsrc/source/template_help.rst +++ b/docsrc/source/template_help.rst @@ -349,7 +349,7 @@ Template Substitutions * - {crlf} - a carriage return + line feed: '\r\n' * - {osxphotos_version} - - The osxphotos version, e.g. '0.51.2' + - The osxphotos version, e.g. '0.51.3' * - {osxphotos_cmd_line} - The full command line used to run osxphotos * - {album} diff --git a/docsrc/source/tutorial.rst b/docsrc/source/tutorial.rst index 1a1b25b1..55d5da28 100644 --- a/docsrc/source/tutorial.rst +++ b/docsrc/source/tutorial.rst @@ -73,6 +73,22 @@ the exported files would be: /path/to/export/Vacation/IMG_1234.JPG +If your photos are organized in folders and albums in Photos you can preserve this structure on export by using the ``{folder_album}`` template field with the ``--directory`` option. For example, if you have a photo in the album ``Vacation`` which is in the ``Travel`` folder, the following command would export the photo to the ``Travel/Vacation`` directory: + +``osxphotos export /path/to/export --directory "{folder_album}"`` + +Photos can belong to more than one album. In this case, the template field ``{folder_album}`` will expand to all the album names that the photo belongs to. For example, if a photo belongs to the albums ``Vacation`` and ``Travel``\ , the template field ``{folder_album}`` would expand to ``Vacation``\ , ``Travel``. If the photo belongs to no albums, the template field ``{folder_album}`` would expand to "_" (the default value). + +All template fields including ``{folder_album}`` can be further filtered using a number of different filters. To convert all directory names to lower case for example, use the ``lower`` filter: + +``osxphotos export /path/to/export --directory "{folder_album|lower}"`` + +If all your photos were organized into various albums under a folder named ``Events`` but some where also included in other top-level albums and you wanted to export only the ``Events`` folder, you could use the ``filter`` option to filter out the other top-level albums by selecting only those folder/album paths that start with ``Events``\ : + +``osxphotos export /path/to/export --directory "{folder_album|filter(startswith Events)}"`` + +You can learn more about the other filters using ``osxphotos help export``. + Specify exported filename ------------------------- @@ -275,6 +291,14 @@ You can use the ``--report`` option to create a report, in comma-separated value ``osxphotos export /path/to/export --report export.csv`` +You can also create reports in JSON or SQLite format by changing the extension of the report filename. For example, to create a JSON report: + +``osxphotos export /path/to/export --report export.json`` + +And to create a SQLite report: + +``osxphotos export /path/to/export --report export.sqlite`` + Exporting only certain photos ----------------------------- diff --git a/osxphotos/_version.py b/osxphotos/_version.py index 9152d3ad..5e1d7457 100644 --- a/osxphotos/_version.py +++ b/osxphotos/_version.py @@ -1,3 +1,3 @@ """ version info """ -__version__ = "0.51.2" +__version__ = "0.51.3" diff --git a/osxphotos/docs/docs.zip b/osxphotos/docs/docs.zip index 2f2db3cc..0058653f 100644 Binary files a/osxphotos/docs/docs.zip and b/osxphotos/docs/docs.zip differ diff --git a/osxphotos/tutorial.md b/osxphotos/tutorial.md index 7b03678f..9f2c156c 100644 --- a/osxphotos/tutorial.md +++ b/osxphotos/tutorial.md @@ -51,6 +51,22 @@ the exported files would be: /path/to/export/Travel/IMG_1234.JPG /path/to/export/Vacation/IMG_1234.JPG +If your photos are organized in folders and albums in Photos you can preserve this structure on export by using the `{folder_album}` template field with the `--directory` option. For example, if you have a photo in the album `Vacation` which is in the `Travel` folder, the following command would export the photo to the `Travel/Vacation` directory: + +`osxphotos export /path/to/export --directory "{folder_album}"` + +Photos can belong to more than one album. In this case, the template field `{folder_album}` will expand to all the album names that the photo belongs to. For example, if a photo belongs to the albums `Vacation` and `Travel`, the template field `{folder_album}` would expand to `Vacation`, `Travel`. If the photo belongs to no albums, the template field `{folder_album}` would expand to "_" (the default value). + +All template fields including `{folder_album}` can be further filtered using a number of different filters. To convert all directory names to lower case for example, use the `lower` filter: + +`osxphotos export /path/to/export --directory "{folder_album|lower}"` + +If all your photos were organized into various albums under a folder named `Events` but some where also included in other top-level albums and you wanted to export only the `Events` folder, you could use the `filter` option to filter out the other top-level albums by selecting only those folder/album paths that start with `Events`: + +`osxphotos export /path/to/export --directory "{folder_album|filter(startswith Events)}"` + +You can learn more about the other filters using `osxphotos help export`. + ## Specify exported filename By default, osxphotos will use the original filename of the photo when exporting. That is, the filename the photo had when it was taken or imported into Photos. This is often something like `IMG_1234.JPG` or `DSC05678.dng`. osxphotos allows you to specify a custom filename template using the `--filename` option in the same way as `--directory` allows you to specify a custom directory name. For example, Photos allows you specify a title or caption for a photo and you can use this in place of the original filename: @@ -230,6 +246,14 @@ You can use the `--report` option to create a report, in comma-separated values `osxphotos export /path/to/export --report export.csv` +You can also create reports in JSON or SQLite format by changing the extension of the report filename. For example, to create a JSON report: + +`osxphotos export /path/to/export --report export.json` + +And to create a SQLite report: + +`osxphotos export /path/to/export --report export.sqlite` + ## Exporting only certain photos By default, osxphotos will export your entire Photos library. If you want to export only certain photos, osxphotos provides a rich set of "query options" that allow you to query the Photos database to filter out only certain photos that match your query criteria. The tutorial does not cover all the query options as there are over 50 of them--read the help text (`osxphotos help export`) to better understand the available query options. No matter which subset of photos you would like to export, there is almost certainly a way for osxphotos to filter these. For example, you can filter for only images that contain certain keywords or images without a title, images from a specific time of day or specific date range, images contained in specific albums, etc.