Compare commits
154 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62e932990e | ||
|
|
980fe3962c | ||
|
|
0043769946 | ||
|
|
0cb9a8872e | ||
|
|
5309ff1726 | ||
|
|
c6eee15d75 | ||
|
|
8c2d0ddf2e | ||
|
|
87d18549a6 | ||
|
|
6fdd78114f | ||
|
|
f20721373a | ||
|
|
9c0f8d63e6 | ||
|
|
ea2596ae13 | ||
|
|
a9191cf084 | ||
|
|
59b5039579 | ||
|
|
e070a1462c | ||
|
|
faa3302a37 | ||
|
|
115dbbec32 | ||
|
|
9bf7efe71f | ||
|
|
3ec9dc4963 | ||
|
|
cddb86ded0 | ||
|
|
2624338100 | ||
|
|
067fe29f76 | ||
|
|
926272b1cd | ||
|
|
363524fbaf | ||
|
|
edeceb268e | ||
|
|
252cbc96f2 | ||
|
|
96457bc598 | ||
|
|
cd31d18075 | ||
|
|
4e140f10d1 | ||
|
|
593f8049a0 | ||
|
|
89973b3f9a | ||
|
|
deca366ce4 | ||
|
|
914a17fb4e | ||
|
|
1e33ea4192 | ||
|
|
9f3fb16161 | ||
|
|
3f064783b7 | ||
|
|
0ab4b0cd6d | ||
|
|
e2f5c993b8 | ||
|
|
3def8b43d9 | ||
|
|
7b2942ca29 | ||
|
|
bfed38f1db | ||
|
|
6d16a8778b | ||
|
|
3c67c0c693 | ||
|
|
1ba488d073 | ||
|
|
3bdbfd12bf | ||
|
|
77c405882d | ||
|
|
ecc3fb29f5 | ||
|
|
a09140c03c | ||
|
|
95e2e4924e | ||
|
|
72ce0b0f93 | ||
|
|
e4da226661 | ||
|
|
a3404b64de | ||
|
|
13ae486ab3 | ||
|
|
268aa7df42 | ||
|
|
ea7ac8e474 | ||
|
|
2a4452cd20 | ||
|
|
749db97dd5 | ||
|
|
84a1c1ddfe | ||
|
|
3791b47914 | ||
|
|
f6a1d1c20b | ||
|
|
118bbad5cb | ||
|
|
44e442e7eb | ||
|
|
08726427aa | ||
|
|
39f63cc8c5 | ||
|
|
99c3548950 | ||
|
|
7e8340c526 | ||
|
|
2e95c4837b | ||
|
|
fe6d262d9b | ||
|
|
794b12305c | ||
|
|
1a3a7f17ff | ||
|
|
496f8e704d | ||
|
|
28f87566e1 | ||
|
|
865d29fb40 | ||
|
|
1986f4e148 | ||
|
|
b963eaa38c | ||
|
|
3b520d6291 | ||
|
|
87ca8bde27 | ||
|
|
d27df0c0ed | ||
|
|
9bceb79a15 | ||
|
|
ed9f2bb0d0 | ||
|
|
b5c93e55d1 | ||
|
|
9bfda93b51 | ||
|
|
daa0877b4c | ||
|
|
da275c2a66 | ||
|
|
3fa913d68a | ||
|
|
e4e194b0ec | ||
|
|
c70ebf4297 | ||
|
|
7e3c6471ff | ||
|
|
a39f6feba7 | ||
|
|
ee7e92019a | ||
|
|
96b7ba24bc | ||
|
|
8581af29d2 | ||
|
|
ab532a724c | ||
|
|
b1e6bb8daa | ||
|
|
26e797d5e5 | ||
|
|
3941c7ab52 | ||
|
|
b7c8759af3 | ||
|
|
c5711880d3 | ||
|
|
e7dbd6e369 | ||
|
|
1b5cb1ae6e | ||
|
|
2953cf7e91 | ||
|
|
5e4ba9da5e | ||
|
|
3a1f6bbc7a | ||
|
|
21ec2883fe | ||
|
|
a0af01884d | ||
|
|
8e129d3825 | ||
|
|
d123634679 | ||
|
|
13f210bec9 | ||
|
|
8e4767c42a | ||
|
|
300bb9d443 | ||
|
|
4f8df88fec | ||
|
|
44da339202 | ||
|
|
0e37a287ca | ||
|
|
2af2530e45 | ||
|
|
99eb595f4c | ||
|
|
31cdd3f24a | ||
|
|
631d89e581 | ||
|
|
526e97a4e1 | ||
|
|
a835ab89bc | ||
|
|
da7674ca51 | ||
|
|
0e535b850c | ||
|
|
64840089e9 | ||
|
|
d754e37cf4 | ||
|
|
f6cb8091e7 | ||
|
|
e359567620 | ||
|
|
36a6a54364 | ||
|
|
ecff920537 | ||
|
|
842f2fca66 | ||
|
|
ee9384b9a7 | ||
|
|
272c35499a | ||
|
|
4165d46b33 | ||
|
|
5bed7c914c | ||
|
|
684178b27e | ||
|
|
a72abe0ad0 | ||
|
|
8863f6ade7 | ||
|
|
e0463eba83 | ||
|
|
3a2ff7a7b9 | ||
|
|
ce7ddfa472 | ||
|
|
3fb00586c3 | ||
|
|
167620fadf | ||
|
|
f0bdc890c1 | ||
|
|
abdfc9de0b | ||
|
|
c65e070a76 | ||
|
|
05c57c0247 | ||
|
|
5be3d6986e | ||
|
|
f0e3627800 | ||
|
|
ea08557a0e | ||
|
|
ac43afd8c9 | ||
|
|
ee98f96a4f | ||
|
|
a33eeddbd6 | ||
|
|
746c6a07c4 | ||
|
|
96fee48ef2 | ||
|
|
6c686128d2 | ||
|
|
6ca8f0034e |
134
README.md
134
README.md
@@ -15,17 +15,17 @@ These scripts are written primarily by the darktable developers and maintained b
|
||||
|
||||
Name|Standalone|OS |Purpose
|
||||
----|:--------:|:---:|-------
|
||||
[check_for_updates](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/official/check_for_updates)|Yes|LMW|Check for updates to darktable
|
||||
[copy_paste_metadata](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/official/copy_paste_metadata)|Yes|LMW|Copy and paste metadata, tags, ratings, and color labels between images
|
||||
[delete_long_tags](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/official/delete_long_tags)|Yes|LMW|Delete all tags longer than a specified length
|
||||
[delete_unused_tags](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/official/delete_unused_tags)|Yes|LMW|Delete tags that have no associated images
|
||||
[enfuse](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/official/enfuse)|No|L|Exposure blend several images (HDR)
|
||||
[generate_image_txt](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/official/generate_image_txt)|No|L|Generate txt sidecar files to be overlaid on zoomed images
|
||||
[image_path_in_ui](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/official/image_path_in_ui)|Yes|LMW|Plugin to display selected image path
|
||||
[import_filter_manager](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/official/import_filter_manager)|Yes|LMW|Manager for import filters
|
||||
[import_filters](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/official/import_filters)|No|LMW|Two import filters for use with import_filter_manager
|
||||
[save_selection](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/official/save_selection)|Yes|LMW|Provide save and restore from multiple selection buffers
|
||||
[selection_to_pdf](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/official/selection_to_pdf)|No|L|Generate a PDF file from the selected images
|
||||
[check_for_updates](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/check_for_updates)|Yes|LMW|Check for updates to darktable
|
||||
[copy_paste_metadata](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/copy_paste_metadata)|Yes|LMW|Copy and paste metadata, tags, ratings, and color labels between images
|
||||
[delete_long_tags](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/delete_long_tags)|Yes|LMW|Delete all tags longer than a specified length
|
||||
[delete_unused_tags](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/delete_unused_tags)|Yes|LMW|Delete tags that have no associated images
|
||||
[enfuse](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/enfuse)|No|L|Exposure blend several images (HDR)
|
||||
[generate_image_txt](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/generate_image_txt)|No|L|Generate txt sidecar files to be overlaid on zoomed images
|
||||
[image_path_in_ui](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/image_path_in_ui)|Yes|LMW|Plugin to display selected image path
|
||||
[import_filter_manager](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/import_filter_manager)|Yes|LMW|Manager for import filters
|
||||
[import_filters](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/import_filters)|No|LMW|Two import filters for use with import_filter_manager
|
||||
[save_selection](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/save_selection)|Yes|LMW|Provide save and restore from multiple selection buffers
|
||||
[selection_to_pdf](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/selection_to_pdf)|No|L|Generate a PDF file from the selected images
|
||||
|
||||
|
||||
### Contributed Scripts
|
||||
@@ -34,50 +34,50 @@ These scripts are contributed by users. They are meant to have an "owner", i.e.
|
||||
|
||||
Name|Standalone|OS |Purpose
|
||||
----|:--------:|:---:|-------
|
||||
[AutoGrouper](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/autogrouper)|Yes|LMW|Group images together by time
|
||||
[autostyle](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/autostyle)|Yes|LMW|Automatically apply styles on import
|
||||
[AutoGrouper](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/autogrouper)|Yes|LMW|Group images together by time
|
||||
[autostyle](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/autostyle)|Yes|LMW|Automatically apply styles on import
|
||||
change_group_leader|Yes|LMW|Change which image leads group
|
||||
[clear_GPS](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/clear_gps)|Yes|LMW|Reset GPS information for selected images
|
||||
[CollectHelper](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/collecthelper)|Yes|LMW|Add buttons to selected images module to manipulate the collection
|
||||
[clear_GPS](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/clear_gps)|Yes|LMW|Reset GPS information for selected images
|
||||
[CollectHelper](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/collecthelper)|Yes|LMW|Add buttons to selected images module to manipulate the collection
|
||||
color_profile_manager|Yes|LMW|Manage darktable input and output color profiles
|
||||
[copy_attach_detach_tags](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/copy_attach_detach_tags)|Yes|LMW|Copy and paste tags from/to images
|
||||
[cr2hdr](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/cr2hdr)|Yes|L|Process image created with Magic Lantern Dual ISO
|
||||
[copy_attach_detach_tags](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/copy_attach_detach_tags)|Yes|LMW|Copy and paste tags from/to images
|
||||
[cr2hdr](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/cr2hdr)|Yes|L|Process image created with Magic Lantern Dual ISO
|
||||
cycle_group_leader|Yes|LMW|cycle through images of a group making each the group leader in turn
|
||||
dbmaint|Yes|LMW|find and remove database entries for missing film rolls and images
|
||||
[enfuseAdvanced](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/enfuseadvanced)|No|LMW|Merge multiple images into Dynamic Range Increase (DRI) or Depth From Focus (DFF) images
|
||||
[exportLUT](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/exportlut)|Yes|LMW|Create a LUT from a style and export it
|
||||
[ext_editor](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/ext_editor)|No|LW|Export pictures to collection and edit them with up to nine user-defined external editors
|
||||
[face_recognition](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/face_recognition)|No|LM|Identify and tag images using facial recognition
|
||||
[fujifilm_dynamic_range](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/fujifilm_dynamic_range)|No|LMW|Correct fujifilm exposure based on exposure bias camera setting
|
||||
[fujifilm_ratings](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/fujifilm_ratings)|No|LM|Support importing Fujifilm ratings
|
||||
[geoJSON_export](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/geojson_export)|No|L|Create a geo JSON script with thumbnails for use in ...
|
||||
[geoToolbox](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/geotoolbox)|No|LMW|A toolbox of geo functions
|
||||
[gimp](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/gimp)|No|LMW|Open an image in GIMP for editing and return the result
|
||||
[gpx_export](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/gpx_export)|No|LMW|Export a GPX track file from selected images GPS data
|
||||
[enfuseAdvanced](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/enfuseadvanced)|No|LMW|Merge multiple images into Dynamic Range Increase (DRI) or Depth From Focus (DFF) images
|
||||
[exportLUT](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/exportlut)|Yes|LMW|Create a LUT from a style and export it
|
||||
[ext_editor](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/ext_editor)|No|LW|Export pictures to collection and edit them with up to nine user-defined external editors
|
||||
[face_recognition](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/face_recognition)|No|LM|Identify and tag images using facial recognition
|
||||
[fujifilm_dynamic_range](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/fujifilm_dynamic_range)|No|LMW|Correct fujifilm exposure based on exposure bias camera setting
|
||||
[fujifilm_ratings](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/fujifilm_ratings)|No|LM|Support importing Fujifilm ratings
|
||||
[geoJSON_export](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/geojson_export)|No|L|Create a geo JSON script with thumbnails for use in ...
|
||||
[geoToolbox](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/geotoolbox)|No|LMW|A toolbox of geo functions
|
||||
[gimp](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/gimp)|No|LMW|Open an image in GIMP for editing and return the result
|
||||
[gpx_export](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/gpx_export)|No|LMW|Export a GPX track file from selected images GPS data
|
||||
harmonic_armature|Yes|LMW|provide a harmonic armature guide
|
||||
hif_group_leader|Yes|LMW|change the group leader in a raw+heif image pair to the heif image
|
||||
[HDRMerge](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/hdrmerge)|No|LMW|Combine the selected images into an HDR DNG and return the result
|
||||
[hugin](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/hugin)|No|LMW|Combine selected images into a panorama and return the result
|
||||
[image_stack](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/image_stack)|No|LMW|Combine a stack of images to remove noise or transient objects
|
||||
[image_time](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/image_time)|Yes|LMW|Adjust the EXIF image time
|
||||
[HDRMerge](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/hdrmerge)|No|LMW|Combine the selected images into an HDR DNG and return the result
|
||||
[hugin](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/hugin)|No|LMW|Combine selected images into a panorama and return the result
|
||||
[image_stack](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/image_stack)|No|LMW|Combine a stack of images to remove noise or transient objects
|
||||
[image_time](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/image_time)|Yes|LMW|Adjust the EXIF image time
|
||||
jpg_group_leader|Yes|LMW|change the group leader for a raw+jpg pair to the jpg image
|
||||
[kml_export](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/kml_export)|No|L|Export photos with a KML file for usage in Google Earth
|
||||
[LabelsToTags](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/labelstotags)|Yes|LMW|Apply tags based on color labels and ratings
|
||||
[OpenInExplorer](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/openinexplorer)|No|LMW|Open the selected images in the system file manager
|
||||
[passport_guide](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/passport_guide)|Yes|LMW|Add passport cropping guide to darkroom crop tool
|
||||
[kml_export](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/kml_export)|No|L|Export photos with a KML file for usage in Google Earth
|
||||
[LabelsToTags](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/labelstotags)|Yes|LMW|Apply tags based on color labels and ratings
|
||||
[OpenInExplorer](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/openinexplorer)|No|LMW|Open the selected images in the system file manager
|
||||
[passport_guide](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/passport_guide)|Yes|LMW|Add passport cropping guide to darkroom crop tool
|
||||
passport_guide_germany|Yes|LMW|Add passport cropping guide for German passports to darkroom crop tool
|
||||
[pdf_slideshow](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/pdf_slideshow)|No|LM|Export images to a PDF slideshow
|
||||
[photils](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/photils)|No|LM|Automatic tag suggestions for your images
|
||||
[quicktag](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/quicktag)|Yes|LMW|Create shortcuts for quickly applying tags
|
||||
[rate_group](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/rate_group)|Yes|LMW|Apply or remove a star rating from grouped images
|
||||
[rename_images](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/rename_images)|Yes|LMW|Rename single or multiple images
|
||||
[rename-tags](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/rename-tags)|Yes|LMW|Change a tag name
|
||||
[RL_out_sharp](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/rl_out_sharp)|No|LW|Output sharpening using GMic (Richardson-Lucy algorithm)
|
||||
[select_non_existing](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/select_non_existing)|Yes|LMW|Enable selection of non-existing images in the the currently worked on images
|
||||
[select_untagged](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/select_untagged)|Yes|LMW|Enable selection of untagged images
|
||||
[slideshowMusic](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/slideshowMusic)|No|L|Play music during a slideshow
|
||||
[transfer_hierarchy](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/transfer_hierarchy)|Yes|LMW|Image move/copy preserving directory hierarchy
|
||||
[video_ffmpeg](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/video_ffmpeg)|No|LMW|Export video from darktable
|
||||
[pdf_slideshow](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/pdf_slideshow)|No|LM|Export images to a PDF slideshow
|
||||
[photils](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/photils)|No|LM|Automatic tag suggestions for your images
|
||||
[quicktag](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/quicktag)|Yes|LMW|Create shortcuts for quickly applying tags
|
||||
[rate_group](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/rate_group)|Yes|LMW|Apply or remove a star rating from grouped images
|
||||
[rename_images](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/rename_images)|Yes|LMW|Rename single or multiple images
|
||||
[rename-tags](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/rename-tags)|Yes|LMW|Change a tag name
|
||||
[RL_out_sharp](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/rl_out_sharp)|No|LW|Output sharpening using GMic (Richardson-Lucy algorithm)
|
||||
[select_non_existing](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/select_non_existing)|Yes|LMW|Enable selection of non-existing images in the the currently worked on images
|
||||
[select_untagged](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/select_untagged)|Yes|LMW|Enable selection of untagged images
|
||||
[slideshowMusic](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/slideshowMusic)|No|L|Play music during a slideshow
|
||||
[transfer_hierarchy](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/transfer_hierarchy)|Yes|LMW|Image move/copy preserving directory hierarchy
|
||||
[video_ffmpeg](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/video_ffmpeg)|No|LMW|Export video from darktable
|
||||
|
||||
### Example Scripts
|
||||
|
||||
@@ -85,18 +85,18 @@ These scripts provide examples of how to use specific portions of the API. They
|
||||
|
||||
Name|Standalone|OS |Purpose
|
||||
----|:--------:|:---:|-------
|
||||
[api_version](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/api_version)|Yes|LMW|Print the current API version
|
||||
[darkroom_demo](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/darkroom_demo)|Yes|LMW|Demonstrate changing images in darkoom
|
||||
[gettextExample](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/gettextexample)|Yes|LM|How to use translation
|
||||
[api_version](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/api_version)|Yes|LMW|Print the current API version
|
||||
[darkroom_demo](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/darkroom_demo)|Yes|LMW|Demonstrate changing images in darkoom
|
||||
[gettextExample](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/gettextexample)|Yes|LM|How to use translation
|
||||
gui_actions|Yes|LMW|demonstrate controlling the GUI using darktable.gui.action calls
|
||||
[hello_world](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/hello_world)|Yes|LMW|Prints hello world when darktable starts
|
||||
[lighttable_demo](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/lighttable_demo)|Yes|LMW|Demonstrate controlling lighttable mode, zoom, sorting and filtering
|
||||
[moduleExample](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/moduleexample)|Yes|LMW|How to create a lighttable module
|
||||
[multi_os](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/multi_os)|No|LMW|How to create a cross platform script that calls an external executable
|
||||
[panels_demo](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/panels_demo)|Yes|LMW|Demonstrate hiding and showing darktable panels
|
||||
[preferenceExamples](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/preferenceexamples)|Yes|LMW|How to use preferences in a script
|
||||
[printExamples](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/printexamples)|Yes|LMW|How to use various print functions from a script
|
||||
[running_os](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/running_os)|Yes|LMW|Print out the running operating system
|
||||
[hello_world](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/hello_world)|Yes|LMW|Prints hello world when darktable starts
|
||||
[lighttable_demo](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/lighttable_demo)|Yes|LMW|Demonstrate controlling lighttable mode, zoom, sorting and filtering
|
||||
[moduleExample](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/moduleexample)|Yes|LMW|How to create a lighttable module
|
||||
[multi_os](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/multi_os)|No|LMW|How to create a cross platform script that calls an external executable
|
||||
[panels_demo](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/panels_demo)|Yes|LMW|Demonstrate hiding and showing darktable panels
|
||||
[preferenceExamples](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/preferenceexamples)|Yes|LMW|How to use preferences in a script
|
||||
[printExamples](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/printexamples)|Yes|LMW|How to use various print functions from a script
|
||||
[running_os](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/running_os)|Yes|LMW|Print out the running operating system
|
||||
x-touch|Yes|LMW|demonstrate how to use an x-touch mini MIDI controller to control the darktable GUI
|
||||
|
||||
### Tools
|
||||
@@ -105,11 +105,11 @@ Tool scripts perform functions relating to the repository, such as generating do
|
||||
|
||||
Name|Standalone|OS |Purpose
|
||||
----|:--------:|:---:|-------
|
||||
[executable_manager](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/tools/executable_manager)|Yes|LMW|Manage the external executables used by the lua scripts
|
||||
[gen_i18n_mo](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/tools/gen_i18n_mo)|No|LMW|Generate compiled translation files (.mo) from source files (.po)
|
||||
[get_lib_manpages](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/tools/get_lib_manpages)|No|LM|Retrieve the library documentation and output it in man page and PDF format
|
||||
[get_libdoc](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/tools/get_libdoc)|No|LMW|Retrieve the library documentation and output it as text
|
||||
[script_manager](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/tools/script_manager)|No|LMW|Manage (install, update, enable, disable) the lua scripts
|
||||
[executable_manager](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/tools/executable_manager)|Yes|LMW|Manage the external executables used by the lua scripts
|
||||
[gen_i18n_mo](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/tools/gen_i18n_mo)|No|LMW|Generate compiled translation files (.mo) from source files (.po)
|
||||
[get_lib_manpages](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/tools/get_lib_manpages)|No|LM|Retrieve the library documentation and output it in man page and PDF format
|
||||
[get_libdoc](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/tools/get_libdoc)|No|LMW|Retrieve the library documentation and output it as text
|
||||
[script_manager](https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/tools/script_manager)|No|LMW|Manage (install, update, enable, disable) the lua scripts
|
||||
|
||||
### Related third-party projects
|
||||
|
||||
@@ -237,18 +237,18 @@ To update the script repository, open a terminal or command prompt and do the fo
|
||||
|
||||
## Documentation
|
||||
|
||||
The [Lua Scripts Manual](https://darktable-org.github.io/luadocs/lua.scripts.manual/) provides documentation
|
||||
The [Lua Scripts Manual](https://docs.darktable.org/lua/stable/lua.scripts.manual/) provides documentation
|
||||
for the scripts transcribed from the header comments. Each script also contains comments and usage instructions
|
||||
in the header comments.
|
||||
|
||||
The [Lua Scripts Library API Manual](https://darktable-org.github.io/luadocs/lua.scripts.api.manual/) provides
|
||||
The [Lua Scripts Library API Manual](https://docs.darktable.org/lua/stable/lua.scripts.api.manual/) provides
|
||||
documentation of the libraries and functions. Lua-script libraries documentation may also be generated using
|
||||
the tools in the tools/ directory.
|
||||
|
||||
More information about the scripting with Lua can be found in the darktable user manual:
|
||||
[Scripting with Lua](https://darktable-org.github.io/dtdocs/lua/)
|
||||
[Scripting with Lua](https://darktable.org.github.io/dtdocs/lua/)
|
||||
|
||||
The [Lua API Manual](https://darktable-org.github.io/luadocs/lua.api.manual/) provides docuemntation of the
|
||||
The [Lua API Manual](https://docs.darktable.org/lua/stable/lua.api.manual/) provides docuemntation of the
|
||||
darktable Lua API.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@@ -43,11 +43,10 @@ du.check_min_api_version("7.0.0", "AutoGrouper")
|
||||
|
||||
local MOD = 'autogrouper'
|
||||
|
||||
local gettext = dt.gettext
|
||||
gettext.bindtextdomain(MOD, dt.configuration.config_dir .."/lua/locale/")
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
local function _(msgid)
|
||||
return gettext.gettext(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
|
||||
-- return data structure for script_manager
|
||||
@@ -55,7 +54,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "AutoGrouper",
|
||||
name = _("auto group"),
|
||||
purpose = _("automatically group images by time interval"),
|
||||
author = "Kevin Ertel",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/AutoGrouper/"
|
||||
@@ -133,10 +132,11 @@ local function main(on_collection)
|
||||
for i, image in ipairs(images) do
|
||||
if i == 1 then
|
||||
prev_image = image
|
||||
image:make_group_leader()
|
||||
elseif string.match(image.exif_datetime_taken, '[%d]') ~= nil then --make sure current image has a timestamp, if so check if it is within the user specified gap value and add to group
|
||||
local curr_image = image
|
||||
if GetTimeDiff(curr_image, prev_image) <= GUI.gap.value then
|
||||
images[i]:group_with(images[i-1])
|
||||
images[i]:group_with(images[i-1].group_leader)
|
||||
end
|
||||
prev_image = curr_image
|
||||
end
|
||||
|
||||
@@ -53,8 +53,6 @@ local all_active = false
|
||||
|
||||
du.check_min_api_version("7.0.0", "CollectHelper")
|
||||
|
||||
dt.gettext.bindtextdomain("CollectHelper", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -64,7 +62,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "CollectHelper",
|
||||
name = _("collection helper"),
|
||||
purpose = _("add collection helper buttons"),
|
||||
author = "Kevin Ertel",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/CollectHelper/"
|
||||
@@ -239,7 +237,7 @@ end
|
||||
dt.preferences.register("module_CollectHelper", "all_and", -- name
|
||||
"bool", -- type
|
||||
_('CollectHelper: all'), -- label
|
||||
_('will create a collect parameter set that utilizes all enabled CollectHelper types (and)'), -- tooltip
|
||||
_('creates a collect parameter set that utilizes all enabled CollectHelper types (and)'), -- tooltip
|
||||
true -- default
|
||||
)
|
||||
dt.preferences.register("module_CollectHelper", "colors", -- name
|
||||
|
||||
@@ -54,8 +54,6 @@ du.check_min_api_version("7.0.0", "HDRmerge")
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("HDRMerge", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -65,7 +63,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "HDRmerge",
|
||||
name = _("HDR merge"),
|
||||
purpose = _("merge bracketed images into an HDR DNG image"),
|
||||
author = "Kevin Ertel",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/HDRmerge"
|
||||
@@ -218,7 +216,7 @@ local function main()
|
||||
PreCall({HDRM}) --check if furst run then check if install OK
|
||||
if HDRM.install_error then
|
||||
dt.print_error('HDRMerge install issue')
|
||||
dt.print(_('HDRMerge install issue, please ensure the binary path is proper'))
|
||||
dt.print(_('HDRMerge install issue, please ensure the binary path is correct'))
|
||||
return
|
||||
end
|
||||
images = dt.gui.selection() --get selected images
|
||||
@@ -416,14 +414,14 @@ GUI.Target.copy_tags = dt.new_widget('check_button'){
|
||||
temp = dt.preferences.read(mod, 'active_add_tags', 'string')
|
||||
if temp == '' then temp = nil end
|
||||
GUI.Target.add_tags = dt.new_widget('entry'){
|
||||
tooltip = _('additional tags to be added on import, seperate with commas, all spaces will be removed'),
|
||||
tooltip = _('additional tags to be added on import, separate with commas, all spaces will be removed'),
|
||||
text = temp,
|
||||
placeholder = _('enter tags, seperated by commas'),
|
||||
placeholder = _('enter tags, separated by commas'),
|
||||
editable = true
|
||||
}
|
||||
GUI.run = dt.new_widget('button'){
|
||||
label = _('merge'),
|
||||
tooltip =_('run HDRMerge with the above specified settings'),
|
||||
tooltip =_('run HDRMerge with the above settings'),
|
||||
clicked_callback = function() main() end
|
||||
}
|
||||
GUI.exes.HDRMerge = dt.new_widget('file_chooser_button'){
|
||||
|
||||
@@ -54,8 +54,6 @@ du.check_min_api_version("7.0.0", "LabelsToTags")
|
||||
|
||||
local gettext = darktable.gettext.gettext
|
||||
|
||||
darktable.gettext.bindtextdomain("LabelsToTags", darktable.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -65,7 +63,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "LabelsToTags",
|
||||
name = _("labels to tags"),
|
||||
purpose = _("allows the mass-application of tags using color labels and ratings as a guide"),
|
||||
author = "August Schwerdfeger (august@schwerdfeger.name)",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/LabelsToTags"
|
||||
@@ -216,8 +214,8 @@ ltt.my_widget = darktable.new_widget("box") {
|
||||
orientation = "vertical",
|
||||
mappingComboBox,
|
||||
darktable.new_widget("button") {
|
||||
label = "start",
|
||||
tooltip = "Tag all selected images",
|
||||
label = _("start"),
|
||||
tooltip = _("tag all selected images"),
|
||||
clicked_callback = doTagging
|
||||
}
|
||||
}
|
||||
@@ -247,7 +245,7 @@ end
|
||||
|
||||
local function install_module()
|
||||
if not ltt.module_installed then
|
||||
darktable.register_lib(LIB_ID,"labels to tags",true,true,{
|
||||
darktable.register_lib(LIB_ID,_("labels to tags"),true,true,{
|
||||
[darktable.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER",20},
|
||||
},ltt.my_widget,nil,nil)
|
||||
ltt.module_installed = true
|
||||
|
||||
@@ -56,8 +56,6 @@ local gettext = dt.gettext.gettext
|
||||
--Check API version
|
||||
du.check_min_api_version("7.0.0", "OpenInExplorer")
|
||||
|
||||
dt.gettext.bindtextdomain("OpenInExplorer", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -67,7 +65,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "OpenInExplorer",
|
||||
name = _("open in explorer"),
|
||||
purpose = _("open a selected file in the system file manager"),
|
||||
author = "Kevin Ertel",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/OpenInExplorer"
|
||||
|
||||
@@ -68,8 +68,6 @@ du.check_min_api_version("7.0.0", MODULE_NAME)
|
||||
-- translation
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("RL_out_sharp", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -79,7 +77,7 @@ local function _(msgid)
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "RL_out_sharp",
|
||||
name = _("RL output sharpening"),
|
||||
purpose = _("Richardson-Lucy output sharpening using GMic"),
|
||||
author = "Marco Carrarini <marco.carrarini@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/RL_out_sharp"
|
||||
|
||||
@@ -59,10 +59,8 @@ du.check_min_api_version("7.0.0", MODULE) -- choose the minimum version that c
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain(MODULE , dt.configuration.config_dir .. "/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(MODULE, msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
|
||||
|
||||
@@ -78,10 +76,10 @@ script_data.restart = nil -- how to restart the (lib) script after it'
|
||||
script_data.show = nil -- only required for libs since the destroy_method only hides them
|
||||
|
||||
script_data.metadata = {
|
||||
name = "auto_snapshot", -- name of script
|
||||
name = _("auto snapshot"), -- name of script
|
||||
purpose = _("automatically take a snapshot when an image is loaded in darkroom"), -- purpose of script
|
||||
author = "Bill Ferguson <wpferguson@gamil.com>", -- your name and optionally e-mail address
|
||||
help = "" -- URL to help/documentation
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/auto_snapshot/" -- URL to help/documentation
|
||||
}
|
||||
|
||||
|
||||
@@ -101,8 +99,8 @@ local auto_snapshot = {}
|
||||
-- P R E F E R E N C E S
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
dt.preferences.register(MODULE, "always_create_snapshot", "bool", "always automatically create_snapshot",
|
||||
"auto_snapshot - create a snapshot even if the image is altered", false)
|
||||
dt.preferences.register(MODULE, "always_create_snapshot", "bool", "auto_snapshot - " .. _("always automatically create_snapshot"),
|
||||
_("create a snapshot even if the image is altered"), false)
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- D A R K T A B L E I N T E G R A T I O N
|
||||
|
||||
@@ -44,7 +44,6 @@ local syslib = require "lib/dtutils.system"
|
||||
du.check_min_api_version("7.0.0", "autostyle")
|
||||
|
||||
local gettext = darktable.gettext.gettext
|
||||
darktable.gettext.bindtextdomain("autostyle", darktable.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
@@ -54,8 +53,10 @@ end
|
||||
|
||||
local script_data = {}
|
||||
|
||||
local have_not_printed_config_message = true
|
||||
|
||||
script_data.metadata = {
|
||||
name = "autostyle",
|
||||
name = _("auto style"),
|
||||
purpose = _("automatically apply a style based on image EXIF tag"),
|
||||
author = "Marc Cousin <cousinmarc@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/autostyle/"
|
||||
@@ -102,56 +103,62 @@ end
|
||||
local function autostyle_apply_one_image (image)
|
||||
|
||||
local pref = darktable.preferences.read("autostyle", "exif_tag", "string")
|
||||
|
||||
if pref and string.len(pref) >= 6 then
|
||||
-- We need the tag, the value and the style_name provided from the configuration string
|
||||
local tag, value, style_name = string.match(pref, "(%g+)%s*=%s*(%g+)%s*=>%s*(%g+)")
|
||||
local tag, value, style_name = string.match(pref, "(%g+)%s*=%s*([%g ]-)%s*=>%s*(%g+)")
|
||||
|
||||
-- check they all exist (correct syntax)
|
||||
if (not tag) then
|
||||
darktable.print(string.format(_("EXIF tag not found in %s"), pref))
|
||||
return 0
|
||||
end
|
||||
if (not value) then
|
||||
darktable.print(string.format(_("value to match not found in %s"), pref))
|
||||
return 0
|
||||
end
|
||||
if (not style_name) then
|
||||
darktable.print(string.format(_("style name not found in %s"), pref))
|
||||
return 0
|
||||
end
|
||||
if not filelib.check_if_bin_exists("exiftool") then
|
||||
darktable.print(_("can't find exiftool"))
|
||||
return 0
|
||||
end
|
||||
-- check they all exist (correct syntax)
|
||||
if (not tag) then
|
||||
darktable.print(string.format(_("EXIF tag not found in %s"), pref))
|
||||
return 0
|
||||
end
|
||||
if (not value) then
|
||||
darktable.print(string.format(_("value to match not found in %s"), pref))
|
||||
return 0
|
||||
end
|
||||
if (not style_name) then
|
||||
darktable.print(string.format(_("style name not found in %s"), pref))
|
||||
return 0
|
||||
end
|
||||
if not filelib.check_if_bin_exists("exiftool") then
|
||||
darktable.print(_("can't find exiftool"))
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
-- First find the style (we have its name)
|
||||
local styles = darktable.styles
|
||||
local style
|
||||
for _, s in ipairs(styles) do
|
||||
if s.name == style_name then
|
||||
style = s
|
||||
end
|
||||
end
|
||||
if (not style) then
|
||||
darktable.print(string.format(_("style not found for autostyle: %s"), style_name))
|
||||
return 0
|
||||
end
|
||||
-- First find the style (we have its name)
|
||||
local styles = darktable.styles
|
||||
local style
|
||||
for _, s in ipairs(styles) do
|
||||
if s.name == style_name then
|
||||
style = s
|
||||
end
|
||||
end
|
||||
if (not style) then
|
||||
darktable.print(string.format(_("style not found for autostyle: %s"), style_name))
|
||||
return 0
|
||||
end
|
||||
|
||||
-- Apply the style to image, if it is tagged
|
||||
local ok, auto_dr_attr = pcall(exiftool_attribute, image.path .. '/' .. image.filename,tag)
|
||||
--darktable.print_error("dr_attr:" .. auto_dr_attr)
|
||||
-- If the lookup fails, stop here
|
||||
if (not ok) then
|
||||
darktable.print(string.format(_("couldn't get attribute %s from exiftool's output"), auto_dr_attr))
|
||||
return 0
|
||||
end
|
||||
if auto_dr_attr == value then
|
||||
darktable.print_log("Image " .. image.filename .. ": autostyle automatically applied " .. pref)
|
||||
darktable.styles.apply(style,image)
|
||||
return 1
|
||||
else
|
||||
darktable.print_log("Image " .. image.filename .. ": autostyle not applied, exif tag " .. pref .. " not matched: " .. auto_dr_attr)
|
||||
return 0
|
||||
-- Apply the style to image, if it is tagged
|
||||
local ok, auto_dr_attr = pcall(exiftool_attribute, image.path .. '/' .. image.filename,tag)
|
||||
--darktable.print_error("dr_attr:" .. auto_dr_attr)
|
||||
-- If the lookup fails, stop here
|
||||
if (not ok) then
|
||||
darktable.print(string.format(_("couldn't get attribute %s from exiftool's output"), auto_dr_attr))
|
||||
return 0
|
||||
end
|
||||
if auto_dr_attr == value then
|
||||
darktable.print_log("Image " .. image.filename .. ": autostyle automatically applied " .. pref)
|
||||
darktable.styles.apply(style,image)
|
||||
return 1
|
||||
else
|
||||
darktable.print_log("Image " .. image.filename .. ": autostyle not applied, exif tag " .. pref .. " not matched: " .. auto_dr_attr)
|
||||
return 0
|
||||
end
|
||||
elseif have_not_printed_config_message then
|
||||
have_not_printed_config_message = false
|
||||
darktable.print(string.format(_("%s is not configured, please configure the preference in Lua options"), script_data.metadata.name))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -181,7 +188,9 @@ end
|
||||
darktable.register_event("autostyle", "shortcut", autostyle_apply,
|
||||
_("apply your chosen style from exiftool tags"))
|
||||
|
||||
darktable.preferences.register("autostyle", "exif_tag", "string", "Autostyle: EXIF_tag=value=>style", _("apply a style automatically if an EXIF tag matches value, find the tag with exiftool"), "")
|
||||
darktable.preferences.register("autostyle", "exif_tag", "string",
|
||||
string.format("%s: EXIF_tag=value=>style", script_data.metadata.name),
|
||||
_("apply a style automatically if an EXIF tag matches value, find the tag with exiftool"), "")
|
||||
|
||||
darktable.register_event("autostyle", "post-import-image",
|
||||
autostyle_apply_one_image_event)
|
||||
|
||||
@@ -40,8 +40,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
local MODULE = "change_group_leader"
|
||||
|
||||
dt.gettext.bindtextdomain(MODULE, dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
du.check_min_api_version("3.0.0", MODULE)
|
||||
|
||||
local function _(msgid)
|
||||
@@ -53,7 +51,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "change_group_leader",
|
||||
name = _("change group leader"),
|
||||
purpose = _("automatically change the leader of raw+jpg paired image groups"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/change_group_leader"
|
||||
@@ -65,7 +63,7 @@ script_data.restart = nil -- how to restart the (lib) script after it's been hid
|
||||
script_data.show = nil -- only required for libs since the destroy_method only hides them
|
||||
|
||||
-- create a namespace to contain persistent data and widgets
|
||||
chg_grp_ldr = {}
|
||||
local chg_grp_ldr = {}
|
||||
|
||||
local cgl = chg_grp_ldr
|
||||
|
||||
@@ -82,7 +80,7 @@ local function install_module()
|
||||
if not cgl.module_installed then
|
||||
dt.register_lib(
|
||||
MODULE, -- Module name
|
||||
_("change_group_leader"), -- Visible name
|
||||
_("change group leader"), -- Visible name
|
||||
true, -- expandable
|
||||
false, -- resetable
|
||||
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 700}}, -- containers
|
||||
|
||||
@@ -40,7 +40,6 @@ local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
dt.gettext.bindtextdomain("clear_GPS", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
@@ -51,7 +50,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "clear_GPS",
|
||||
name = _("clear GPS info"),
|
||||
purpose = _("remove GPS data from selected image(s)"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/clear_gps/"
|
||||
@@ -92,7 +91,7 @@ dt.gui.libs.image.register_action(
|
||||
dt.register_event(
|
||||
"clear_GPS", "shortcut",
|
||||
function(event, shortcut) clear_GPS(dt.gui.action_images) end,
|
||||
_("clear GPS data")
|
||||
_("clear GPS data from selected images")
|
||||
)
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -55,8 +55,6 @@ du.check_min_api_version("7.0.0", "color_profile_manager")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("color_profile_manager", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -365,7 +363,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "color_profile_manager",
|
||||
name = _("color profile manager"),
|
||||
purpose = _("manage external darktable color profiles"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/color_profile_manager"
|
||||
|
||||
@@ -44,8 +44,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("7.0.0", "copy_attach_detach_tags")
|
||||
|
||||
dt.gettext.bindtextdomain("copy_attach_detach_tags", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -55,7 +53,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "copy_attach_detach_tags",
|
||||
name = _("copy attach detach tags"),
|
||||
purpose = _("shortcuts to copy, paste, replace, or remove tags from images"),
|
||||
author = "Christian Kanzian",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/copy_attach_detach_tags"
|
||||
|
||||
@@ -39,8 +39,6 @@ du.check_min_api_version("7.0.0", "cr2hdr")
|
||||
|
||||
local gettext = darktable.gettext.gettext
|
||||
|
||||
darktable.gettext.bindtextdomain("cr2hdr", darktable.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -50,7 +48,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "cr2hdr",
|
||||
name = _("cr2hdr"),
|
||||
purpose = _("process Magic Lantern dual ISO images"),
|
||||
author = "Till Theato <theato@ttill.de>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/cr2hdr"
|
||||
|
||||
@@ -60,8 +60,6 @@ du.check_min_api_version("7.0.0", MODULE)
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("cycle_group_leader", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -73,7 +71,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "cycle_group_leader",
|
||||
name = _("cycle group leader"),
|
||||
purpose = _("change image group leader"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/cycle_group_leader"
|
||||
@@ -106,7 +104,7 @@ end
|
||||
local function cycle_group_leader(image)
|
||||
local group_images = image:get_group_members()
|
||||
if #group_images < 2 then
|
||||
hinter_msg(_("no images to cycle to in group"))
|
||||
hinter_msg(_("no images to cycle through in group"))
|
||||
return
|
||||
else
|
||||
local position = nil
|
||||
|
||||
@@ -63,10 +63,8 @@ du.check_min_api_version("7.0.0", MODULE) -- choose the minimum version that c
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain(MODULE , dt.configuration.config_dir .. "/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(MODULE, msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
|
||||
|
||||
@@ -82,7 +80,7 @@ script_data.restart = nil -- how to restart the (lib) script after it'
|
||||
script_data.show = nil -- only required for libs since the destroy_method only hides them
|
||||
|
||||
script_data.metadata = {
|
||||
name = "dbmaint",
|
||||
name = _("db maintenance"),
|
||||
purpose = _("perform database maintenance"),
|
||||
author = "Bill Ferguson <wpferguson@gamil.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/dbmaint/"
|
||||
@@ -117,6 +115,20 @@ local namespace = dbmaint
|
||||
-- F U N C T I O N S
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
-------------------
|
||||
-- helper functions
|
||||
-------------------
|
||||
|
||||
local function set_log_level(level)
|
||||
local old_log_level = log.log_level()
|
||||
log.log_level(level)
|
||||
return old_log_level
|
||||
end
|
||||
|
||||
local function restore_log_level(level)
|
||||
log.log_level(level)
|
||||
end
|
||||
|
||||
local function scan_film_rolls()
|
||||
local missing_films = {}
|
||||
|
||||
@@ -130,19 +142,21 @@ local function scan_film_rolls()
|
||||
end
|
||||
|
||||
local function scan_images(film)
|
||||
local old_log_level = set_log_level(DEFAULT_LOG_LEVEL)
|
||||
local missing_images = {}
|
||||
|
||||
if film then
|
||||
for i = 1, #film do
|
||||
local image = film[i]
|
||||
log.log_msg(log.debug, "checking " .. image.filename)
|
||||
log.msg(log.debug, "checking " .. image.filename)
|
||||
if not df.check_if_file_exists(image.path .. PS .. image.filename) then
|
||||
log.log_msg(log.info, image.filename .. " not found")
|
||||
log.msg(log.info, image.filename .. " not found")
|
||||
table.insert(missing_images, image)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
restore_log_level(old_log_level)
|
||||
return missing_images
|
||||
end
|
||||
|
||||
@@ -195,21 +209,23 @@ dbmaint.list_widget = dt.new_widget("text_view"){
|
||||
}
|
||||
|
||||
dbmaint.chooser = dt.new_widget("combobox"){
|
||||
label = "scan for",
|
||||
label = _("scan for"),
|
||||
selected = 1,
|
||||
"film rolls", "images",
|
||||
_("film rolls"), _("images"),
|
||||
reset_callback = function(this)
|
||||
this.selected = 1
|
||||
end
|
||||
}
|
||||
|
||||
dbmaint.scan_button = dt.new_widget("button"){
|
||||
label = "scan",
|
||||
tooltip = "click to scan for missing film rolls/files",
|
||||
label = _("scan"),
|
||||
tooltip = _("click to scan for missing film rolls/files"),
|
||||
clicked_callback = function(this)
|
||||
local found = nil
|
||||
local found_text = ""
|
||||
if dbmaint.chooser.value == "film rolls" then
|
||||
local old_log_level = set_log_level(DEFAULT_LOG_LEVEL)
|
||||
log.msg(log.debug, "Button clicked")
|
||||
if dbmaint.chooser.selected == 1 then -- film rolls
|
||||
found = scan_film_rolls()
|
||||
if #found > 0 then
|
||||
for _, film in ipairs(found) do
|
||||
@@ -218,7 +234,7 @@ dbmaint.scan_button = dt.new_widget("button"){
|
||||
end
|
||||
end
|
||||
else
|
||||
log.log_msg(log.debug, "checking path " .. dt.collection[1].path .. " for missing files")
|
||||
log.msg(log.debug, "checking path " .. dt.collection[1].path .. " for missing files")
|
||||
found = scan_images(dt.collection[1].film)
|
||||
if #found > 0 then
|
||||
for _, image in ipairs(found) do
|
||||
@@ -227,10 +243,14 @@ dbmaint.scan_button = dt.new_widget("button"){
|
||||
end
|
||||
end
|
||||
if #found > 0 then
|
||||
log.msg(log.debug, "found " .. #found .. " missing items")
|
||||
dbmaint.list_widget.text = found_text
|
||||
dbmaint.found = found
|
||||
dbmaint.remove_button.sensitive = true
|
||||
else
|
||||
log.msg(log.debug, "no missing items found")
|
||||
end
|
||||
restore_log_level(old_log_level)
|
||||
end,
|
||||
reset_callback = function(this)
|
||||
dbmaint.found = nil
|
||||
@@ -238,11 +258,11 @@ dbmaint.scan_button = dt.new_widget("button"){
|
||||
}
|
||||
|
||||
dbmaint.remove_button = dt.new_widget("button"){
|
||||
label = "remove",
|
||||
tooltip = "remove missing film rolls/images",
|
||||
label = _("remove"),
|
||||
tooltip = _("remove missing film rolls/images"),
|
||||
sensitive = false,
|
||||
clicked_callback = function(this)
|
||||
if dbmaint.chooser.value == "film rolls" then
|
||||
if dbmaint.chooser.selected == 1 then -- film rolls
|
||||
remove_missing_film_rolls(dbmaint.found)
|
||||
else
|
||||
remove_missing_images(dbmaint.found)
|
||||
@@ -258,7 +278,7 @@ dbmaint.remove_button = dt.new_widget("button"){
|
||||
|
||||
dbmaint.main_widget = dt.new_widget("box"){
|
||||
orientation = "vertical",
|
||||
dt.new_widget("section_label"){label = "missing items"},
|
||||
dt.new_widget("section_label"){label = _("missing items")},
|
||||
dbmaint.list_widget,
|
||||
dt.new_widget("label"){label = ""},
|
||||
dbmaint.chooser,
|
||||
|
||||
@@ -70,8 +70,6 @@ du.check_min_api_version("7.0.0", "enfuseAdvanced")
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("enfuseAdvanced", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -81,7 +79,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "enfuseAdvanced",
|
||||
name = _("enfuse advanced"),
|
||||
purpose = _("focus stack or exposure blend images"),
|
||||
author = "Kevin Ertel",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/enfuseAdvanced"
|
||||
@@ -445,7 +443,7 @@ local function main(storage, image_table, extra_data)
|
||||
dt.print(_('too few images selected, please select at least 2 images'))
|
||||
return
|
||||
elseif extra_data[1] == 2 then
|
||||
dt.print(_('installation error, please verify binary paths are proper'))
|
||||
dt.print(_('installation error, please verify binary paths are correct'))
|
||||
return
|
||||
end
|
||||
local images_to_remove = ''
|
||||
@@ -956,7 +954,7 @@ if temp == '' then temp = nil end
|
||||
GUI.Target.add_tags = dt.new_widget('entry'){
|
||||
tooltip = _('additional tags to be added on import, seperate with commas, all spaces will be removed'),
|
||||
text = temp,
|
||||
placeholder = _('enter tags, seperated by commas'),
|
||||
placeholder = _('enter tags, separated by commas'),
|
||||
editable = true
|
||||
}
|
||||
temp = dt.preferences.read(mod, 'active_current_preset_ind', 'integer')
|
||||
@@ -1023,7 +1021,7 @@ GUI.Presets.variants_type = dt.new_widget('combobox'){
|
||||
GUI.Presets.variants_type.sensitive = GUI.Presets.variants.value
|
||||
temp = df.get_executable_path_preference(AIS.name)
|
||||
GUI.exes.align_image_stack = dt.new_widget('file_chooser_button'){
|
||||
title = 'AIS binary path',
|
||||
title = 'align_image_stack ' .. _('binary path'),
|
||||
value = temp,
|
||||
tooltip = temp,
|
||||
is_directory = false,
|
||||
@@ -1031,7 +1029,7 @@ GUI.exes.align_image_stack = dt.new_widget('file_chooser_button'){
|
||||
}
|
||||
temp = df.get_executable_path_preference(ENF.name)
|
||||
GUI.exes.enfuse = dt.new_widget('file_chooser_button'){
|
||||
title = 'enfuse binary path',
|
||||
title = 'enfuse ' .. _('binary path'),
|
||||
value = temp,
|
||||
tooltip = temp,
|
||||
is_directory = false,
|
||||
@@ -1039,7 +1037,7 @@ GUI.exes.enfuse = dt.new_widget('file_chooser_button'){
|
||||
}
|
||||
temp = df.get_executable_path_preference(EXF.name)
|
||||
GUI.exes.exiftool = dt.new_widget('file_chooser_button'){
|
||||
title = 'Exiftool binary path',
|
||||
title = 'exiftool ' .. _('binary path'),
|
||||
value = temp,
|
||||
tooltip = temp,
|
||||
is_directory = false,
|
||||
|
||||
@@ -35,8 +35,6 @@ du.check_min_api_version("7.0.0", "exportLUT")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("exportLUT", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -46,7 +44,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "exportLUT",
|
||||
name = _("export LUT"),
|
||||
purpose = _("export a style as a LUT"),
|
||||
author = "Noah Clarke",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/exportLUT"
|
||||
@@ -71,13 +69,13 @@ local mkdir_command = 'mkdir -p '
|
||||
if dt.configuration.running_os == 'windows' then mkdir_command = 'mkdir ' end
|
||||
|
||||
local file_chooser_button = dt.new_widget("file_chooser_button"){
|
||||
title = _("identity_file_chooser"),
|
||||
title = _("choose the identity file"),
|
||||
value = "",
|
||||
is_directory = false
|
||||
}
|
||||
|
||||
local export_chooser_button = dt.new_widget("file_chooser_button"){
|
||||
title = _("export_location_chooser"),
|
||||
title = _("choose the export location"),
|
||||
value = "",
|
||||
is_directory = true
|
||||
}
|
||||
|
||||
@@ -78,8 +78,6 @@ du.check_min_api_version("7.0.0", MODULE_NAME)
|
||||
-- translation
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("ext_editor", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -89,7 +87,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "ext_editor",
|
||||
name = _("external editors"),
|
||||
purpose = _("edit images with external editors"),
|
||||
author = "Marco Carrarini, marco.carrarini@gmail.com",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/ext_editor"
|
||||
|
||||
@@ -54,8 +54,6 @@ local OUTPUT = dt.configuration.tmp_dir .. PS .. "facerecognition.txt"
|
||||
|
||||
du.check_min_api_version("7.0.0", MODULE)
|
||||
|
||||
dt.gettext.bindtextdomain("face_recognition", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -65,7 +63,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "face_recognition",
|
||||
name = _("face recognition"),
|
||||
purpose = _("use facial recognition to tag images"),
|
||||
author = "Sebastian Witt",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/face_recognition"
|
||||
|
||||
@@ -65,8 +65,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("7.0.0", "fujifilm_dynamic_range")
|
||||
|
||||
dt.gettext.bindtextdomain("fujifilm_dynamic_range", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -76,7 +74,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "fujifilm_dynamic_range",
|
||||
name = _("fujifilm dynamic range"),
|
||||
purpose = _("compensate for Fujifilm raw files made using \"dynamic range\""),
|
||||
author = "Dan Torop <dant@pnym.net>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/fujifilm_dynamic_range"
|
||||
|
||||
@@ -31,8 +31,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("7.0.0", "fujifilm_ratings")
|
||||
|
||||
dt.gettext.bindtextdomain("fujifilm_ratings", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -42,7 +40,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "fujifilm_ratings",
|
||||
name = _("fujifilm ratings"),
|
||||
purpose = _("import Fujifilm in-camera ratings"),
|
||||
author = "Ben Mendis <ben.mendis@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/fujifilm_ratings"
|
||||
@@ -58,7 +56,7 @@ local function detect_rating(event, image)
|
||||
return
|
||||
end
|
||||
if not df.check_if_bin_exists("exiftool") then
|
||||
dt.print_error(_("exiftool not found"))
|
||||
dt.print_error("exiftool not found")
|
||||
return
|
||||
end
|
||||
local RAF_filename = df.sanitize_filename(tostring(image))
|
||||
|
||||
@@ -40,8 +40,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("7.0.0", "geoJSON_export")
|
||||
|
||||
dt.gettext.bindtextdomain("geoJSON_export", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -51,7 +49,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "geoJSON_export",
|
||||
name = _("geoJSON export"),
|
||||
purpose = _("export a geoJSON file from geo data"),
|
||||
author = "Tobias Jakobs",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/geoJSON_export"
|
||||
@@ -92,19 +90,19 @@ end
|
||||
|
||||
local function create_geoJSON_file(storage, image_table, extra_data)
|
||||
if not df.check_if_bin_exists("mkdir") then
|
||||
dt.print_error(_("mkdir not found"))
|
||||
dt.print_error("mkdir not found")
|
||||
return
|
||||
end
|
||||
if not df.check_if_bin_exists("convert") then
|
||||
dt.print_error(_("convert not found"))
|
||||
dt.print_error("convert not found")
|
||||
return
|
||||
end
|
||||
if not df.check_if_bin_exists("xdg-open") then
|
||||
dt.print_error(_("xdg-open not found"))
|
||||
dt.print_error("xdg-open not found")
|
||||
return
|
||||
end
|
||||
if not df.check_if_bin_exists("xdg-user-dir") then
|
||||
dt.print_error(_("xdg-user-dir not found"))
|
||||
dt.print_error("xdg-user-dir not found")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -295,7 +293,7 @@ local function create_geoJSON_file(storage, image_table, extra_data)
|
||||
file:write(geoJSON_file)
|
||||
file:close()
|
||||
|
||||
dt.print("geoJSON file created in "..exportDirectory)
|
||||
dt.print(string.format(_("%s file created in %s"), "geoJSON", exportDirectory))
|
||||
|
||||
-- Open the file with the standard programm
|
||||
if ( dt.preferences.read("geoJSON_export","OpengeoJSONFile","bool") == true ) then
|
||||
@@ -315,19 +313,19 @@ end
|
||||
dt.preferences.register("geoJSON_export",
|
||||
"CreateMapBoxHTMLFile",
|
||||
"bool",
|
||||
_("geoJSON export: Create an additional HTML file"),
|
||||
"geoJSON export: ".._("Create an additional HTML file"),
|
||||
_("creates an HTML file that loads the geoJSON file. (needs a MapBox key"),
|
||||
false )
|
||||
dt.preferences.register("geoJSON_export",
|
||||
"mapBoxKey",
|
||||
"string",
|
||||
_("geoJSON export: MapBox key"),
|
||||
"geoJSON export: MapBox " .. _("key"),
|
||||
"https://www.mapbox.com/studio/account/tokens",
|
||||
'' )
|
||||
dt.preferences.register("geoJSON_export",
|
||||
"OpengeoJSONFile",
|
||||
"bool",
|
||||
_("geoJSON export: open geoJSON file after export"),
|
||||
"geoJSON export: " .. _("open geoJSON file after export"),
|
||||
_("opens the geoJSON file after the export with the standard program for geoJSON files"),
|
||||
false )
|
||||
|
||||
|
||||
@@ -33,8 +33,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("7.0.0", "geoToolbox")
|
||||
|
||||
dt.gettext.bindtextdomain("geoToolbox", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -44,7 +42,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "geoToolbox",
|
||||
name = _("geo toolbox"),
|
||||
purpose = _("geodata tools"),
|
||||
author = "Tobias Jakobs",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/geoToolbox"
|
||||
@@ -67,17 +65,17 @@ labelDistance.label = _("distance:")
|
||||
|
||||
local label_copy_gps_lat = dt.new_widget("check_button")
|
||||
{
|
||||
label = _("latitude:"),
|
||||
label = _("latitude: "),
|
||||
value = true
|
||||
}
|
||||
local label_copy_gps_lon = dt.new_widget("check_button")
|
||||
{
|
||||
label = _("longitude:"),
|
||||
label = _("longitude: "),
|
||||
value = true
|
||||
}
|
||||
local label_copy_gps_ele = dt.new_widget("check_button")
|
||||
{
|
||||
label = _("elevation:"),
|
||||
label = _("elevation: "),
|
||||
value = true
|
||||
}
|
||||
-- </GUI>
|
||||
@@ -169,7 +167,7 @@ local function get_first_coordinate()
|
||||
first_elevation = ''
|
||||
first_image_date = 0
|
||||
|
||||
for _,image in ipairs(sel_images) do
|
||||
for jj,image in ipairs(sel_images) do
|
||||
if not image then
|
||||
first_have_data = false
|
||||
else
|
||||
@@ -208,7 +206,7 @@ local function get_second_coordinate()
|
||||
second_elevation = ''
|
||||
second_image_date = 0
|
||||
|
||||
for _,image in ipairs(sel_images) do
|
||||
for jj,image in ipairs(sel_images) do
|
||||
if not image then
|
||||
second_have_data = false
|
||||
else
|
||||
@@ -244,7 +242,7 @@ local calc_in_between_slider = dt.new_widget("slider")
|
||||
--ToDo: this needs more love
|
||||
local function calc_in_between()
|
||||
local sel_images = dt.gui.action_images
|
||||
for _,image in ipairs(sel_images) do
|
||||
for jj,image in ipairs(sel_images) do
|
||||
if image then
|
||||
image_date = make_time_stamp(image.exif_datetime_taken)
|
||||
if (first_have_data and second_have_data) then
|
||||
@@ -291,7 +289,7 @@ local function copy_gps()
|
||||
copy_gps_longitude = ''
|
||||
copy_gps_elevation = ''
|
||||
|
||||
for _,image in ipairs(sel_images) do
|
||||
for jj,image in ipairs(sel_images) do
|
||||
if not image then
|
||||
copy_gps_have_data = false
|
||||
else
|
||||
@@ -307,9 +305,9 @@ local function copy_gps()
|
||||
end
|
||||
end
|
||||
|
||||
label_copy_gps_lat.label = string.format(_("latitude: "), copy_gps_latitude)
|
||||
label_copy_gps_lon.label = string.format(_("longitude: "),copy_gps_longitude)
|
||||
label_copy_gps_ele.label = string.format(_("elevation: "), copy_gps_elevation)
|
||||
label_copy_gps_lat.label = _("latitude: ") .. copy_gps_latitude
|
||||
label_copy_gps_lon.label = _("longitude: ") .. copy_gps_longitude
|
||||
label_copy_gps_ele.label = _("elevation: ") .. copy_gps_elevation
|
||||
|
||||
return
|
||||
end
|
||||
@@ -318,7 +316,7 @@ end
|
||||
local function paste_gps(image)
|
||||
local sel_images = dt.gui.action_images
|
||||
|
||||
for _,image in ipairs(sel_images) do
|
||||
for jj,image in ipairs(sel_images) do
|
||||
if (label_copy_gps_lat.value) then
|
||||
image.latitude = copy_gps_latitude
|
||||
end
|
||||
@@ -345,7 +343,7 @@ local function open_location_in_gnome_maps()
|
||||
local i = 0;
|
||||
|
||||
-- Use the first image with geo information
|
||||
for _,image in ipairs(sel_images) do
|
||||
for jj,image in ipairs(sel_images) do
|
||||
if ((image.longitude and image.latitude) and
|
||||
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
|
||||
) then
|
||||
@@ -372,12 +370,12 @@ end
|
||||
local function reverse_geocode()
|
||||
|
||||
if not df.check_if_bin_exists("curl") then
|
||||
dt.print_error(_("curl not found"))
|
||||
dt.print_error("curl not found")
|
||||
return
|
||||
end
|
||||
|
||||
if not df.check_if_bin_exists("jq") then
|
||||
dt.print_error(_("jq not found"))
|
||||
dt.print_error("jq not found")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -388,7 +386,7 @@ local function reverse_geocode()
|
||||
local i = 0;
|
||||
|
||||
-- Use the first image with geo information
|
||||
for _,image in ipairs(sel_images) do
|
||||
for jj,image in ipairs(sel_images) do
|
||||
if ((image.longitude and image.latitude) and
|
||||
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
|
||||
) then
|
||||
@@ -463,7 +461,7 @@ local function calc_distance()
|
||||
|
||||
local sel_images = dt.gui.selection()
|
||||
|
||||
for _,image in ipairs(sel_images) do
|
||||
for jj,image in ipairs(sel_images) do
|
||||
if ((image.longitude and image.latitude) and
|
||||
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
|
||||
) then
|
||||
@@ -547,7 +545,7 @@ local function altitude_profile()
|
||||
local elevationAdd = 0;
|
||||
|
||||
local sel_images = dt.gui.action_images
|
||||
for _,image in ipairs(sel_images) do
|
||||
for jj,image in ipairs(sel_images) do
|
||||
if ((not isnan(image.longitude) and not isnan(image.latitude) and not isnan(image.elevation) and image.elevation) and
|
||||
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
|
||||
) then
|
||||
@@ -597,7 +595,7 @@ local function install_module()
|
||||
if not gT.module_installed then
|
||||
dt.register_lib(
|
||||
"geoToolbox", -- Module name
|
||||
"geo toolbox", -- name
|
||||
_("geo toolbox"), -- name
|
||||
true, -- expandable
|
||||
false, -- resetable
|
||||
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 100}}, -- containers
|
||||
|
||||
@@ -74,8 +74,6 @@ local gimp_widget = nil
|
||||
|
||||
du.check_min_api_version("7.0.0", "gimp")
|
||||
|
||||
dt.gettext.bindtextdomain("gimp", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -85,7 +83,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "gimp",
|
||||
name = _("edit with GIMP"),
|
||||
purpose = _("export and edit with GIMP"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/gimp"
|
||||
|
||||
@@ -25,14 +25,12 @@ For each source folder, a separate <trk> is generated in the gpx file.
|
||||
local dt = require "darktable"
|
||||
local df = require "lib/dtutils.file"
|
||||
local dl = require "lib/dtutils"
|
||||
local gettext = dt.gettext
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dl.check_min_api_version("7.0.0", "gpx_export")
|
||||
|
||||
gettext.bindtextdomain("gpx_export", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext.dgettext("gpx_export", msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
|
||||
-- return data structure for script_manager
|
||||
@@ -40,7 +38,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "gpx_export",
|
||||
name = _("gpx export"),
|
||||
purpose = _("export gpx information to a file"),
|
||||
author = "Jannis_V",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/gpx_export"
|
||||
@@ -150,7 +148,7 @@ local function install_module()
|
||||
if not gpx.module_installed then
|
||||
dt.register_lib(
|
||||
"gpx_exporter",
|
||||
"gpx export",
|
||||
_("gpx export"),
|
||||
true, -- expandable
|
||||
true, -- resetable
|
||||
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 100}}, -- containers
|
||||
|
||||
@@ -36,8 +36,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("2.0.0", "harmonic_armature_guide")
|
||||
|
||||
dt.gettext.bindtextdomain("harmonic_armature_guide", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -45,7 +43,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "harmonic_armature_guide",
|
||||
name = _("harmonic armature guide"),
|
||||
purpose = _("harmonic artmature guide"),
|
||||
author = "Hubert Kowalski",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/harmonic_armature_guide"
|
||||
|
||||
@@ -64,8 +64,6 @@ du.check_min_api_version("7.0.0", MODULE)
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("hif_group_leader", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -77,7 +75,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "hif_group_leader",
|
||||
name = _("HIF group leader"),
|
||||
purpose = _("make hif image group leader"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/hif_group_leader"
|
||||
|
||||
@@ -56,8 +56,6 @@ local PQ = dt.configuration.running_os == "windows" and '"' or "'"
|
||||
-- works with darktable API version from 5.0.0 on
|
||||
du.check_min_api_version("7.0.0", "hugin")
|
||||
|
||||
dt.gettext.bindtextdomain("hugin", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -67,7 +65,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "hugin",
|
||||
name = _("hugin"),
|
||||
purpose = _("stitch images into a panorama"),
|
||||
author = "Wolfgang Goetz",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/hugin"
|
||||
@@ -85,7 +83,7 @@ end
|
||||
|
||||
local function show_status(storage, image, format, filename,
|
||||
number, total, high_quality, extra_data)
|
||||
dt.print("exporting to hugin: "..tostring(number).."/"..tostring(total))
|
||||
dt.print(string.format(_("exporting to hugin: %d / %d"), number, total))
|
||||
end
|
||||
|
||||
local function create_panorama(storage, image_table, extra_data) --finalize
|
||||
@@ -146,7 +144,7 @@ local function create_panorama(storage, image_table, extra_data) --finalize
|
||||
end
|
||||
|
||||
if first_file == nil then
|
||||
dt.print("no file selected")
|
||||
dt.print(_("no file selected"))
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -73,8 +73,6 @@ local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
-- works with LUA API version 5.0.0
|
||||
du.check_min_api_version("7.0.0", "image_stack")
|
||||
|
||||
dt.gettext.bindtextdomain("image_stack", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -84,7 +82,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "image_stack",
|
||||
name = _("image stack"),
|
||||
purpose = _("process a stack of images"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/image_stack"
|
||||
@@ -141,19 +139,19 @@ local chkbtn_will_align = dt.new_widget("check_button"){
|
||||
local chkbtn_radial_distortion = dt.new_widget("check_button"){
|
||||
label = _('optimize radial distortion for all images'),
|
||||
value = dt.preferences.read("align_image_stack", "def_radial_distortion", "bool"),
|
||||
tooltip = _('optimize radial distortion for all images, \nexcept for first'),
|
||||
tooltip = _('optimize radial distortion for all images, \nexcept the first'),
|
||||
}
|
||||
|
||||
local chkbtn_optimize_field = dt.new_widget("check_button"){
|
||||
label = _('optimize field of view for all images'),
|
||||
value = dt.preferences.read("align_image_stack", "def_optimize_field", "bool"),
|
||||
tooltip =_('optimize field of view for all images, except for first. \nUseful for aligning focus stacks (DFF) with slightly \ndifferent magnification.'),
|
||||
tooltip =_('optimize field of view for all images, except the first. \nUseful for aligning focus stacks (DFF) with slightly \ndifferent magnification.'),
|
||||
}
|
||||
|
||||
local chkbtn_optimize_image_center = dt.new_widget("check_button"){
|
||||
label = _('optimize image center shift for all images'),
|
||||
value = dt.preferences.read("align_image_stack", "def_optimize_image_center", "bool"),
|
||||
tooltip =_('optimize image center shift for all images, \nexcept for first.'),
|
||||
tooltip =_('optimize image center shift for all images, \nexcept the first.'),
|
||||
}
|
||||
|
||||
local chkbtn_auto_crop = dt.new_widget("check_button"){
|
||||
@@ -506,7 +504,7 @@ local function image_stack(storage, image_table, extra_data)
|
||||
return
|
||||
end
|
||||
|
||||
job = dt.gui.create_job("image stack", true, stop_job)
|
||||
job = dt.gui.create_job(_("image stack"), true, stop_job)
|
||||
job.percent = job.percent + percent_step
|
||||
|
||||
-- align images if requested
|
||||
|
||||
@@ -116,8 +116,6 @@ img_time.event_registered = false
|
||||
|
||||
du.check_min_api_version("7.0.0", "image_time")
|
||||
|
||||
dt.gettext.bindtextdomain("image_time", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -127,7 +125,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "image_time",
|
||||
name = _("image time"),
|
||||
purpose = _("synchronize image time for images shot with different cameras or adjust or set image time"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/image_time"
|
||||
@@ -156,12 +154,12 @@ local function systime2exiftime(systime)
|
||||
end
|
||||
|
||||
local function vars2exiftime(year, month, day, hour, min, sec)
|
||||
local y = tonumber(year) and string.format("%4d", year) or " "
|
||||
local mo = tonumber(month) and string.format("%02d", month) or " "
|
||||
local d = tonumber(day) and string.format("%02d", day) or " "
|
||||
local h = tonumber(hour) and string.format("%02d", hour) or " "
|
||||
local m = tonumber(min) and string.format("%02d", min) or " "
|
||||
local s = tonumber(sec) and string.format("%02d", sec) or " "
|
||||
local y = tonumber(year) and string.format("%4d", year) or "0000"
|
||||
local mo = tonumber(month) and string.format("%02d", month) or "00"
|
||||
local d = tonumber(day) and string.format("%02d", day) or "00"
|
||||
local h = tonumber(hour) and string.format("%02d", hour) or "00"
|
||||
local m = tonumber(min) and string.format("%02d", min) or "00"
|
||||
local s = tonumber(sec) and string.format("%02d", sec) or "00"
|
||||
return(y .. ":" .. mo .. ":" .. d .. " " .. h .. ":" .. m .. ":" .. s)
|
||||
end
|
||||
|
||||
@@ -195,7 +193,7 @@ end
|
||||
|
||||
local function synchronize_time(images)
|
||||
local sign = 1
|
||||
if img_time.sdir.value == "subtract" then
|
||||
if img_time.sdir.value == _("subtract") then
|
||||
sign = -1
|
||||
end
|
||||
synchronize_times(images, tonumber(img_time.diff_entry.text) * sign)
|
||||
@@ -511,7 +509,7 @@ img_time.stack = dt.new_widget("stack"){
|
||||
dt.new_widget("box"){
|
||||
orientation = "vertical",
|
||||
dt.new_widget("label"){label = _("set time")},
|
||||
dt.new_widget("section_label"){label = _("date: ")},
|
||||
dt.new_widget("section_label"){label = _("date:")},
|
||||
img_time.sdy,
|
||||
img_time.smo,
|
||||
img_time.syr,
|
||||
|
||||
@@ -64,8 +64,6 @@ du.check_min_api_version("7.0.0", MODULE)
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("jpg_group_leader", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -77,7 +75,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "jpg_group_leader",
|
||||
name = _("JPG group leader"),
|
||||
purpose = _("make jpg image group leader"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/jpg_group_leader"
|
||||
|
||||
@@ -45,8 +45,6 @@ local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
|
||||
du.check_min_api_version("7.0.0", "kml_export")
|
||||
|
||||
dt.gettext.bindtextdomain("kml_export", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -56,7 +54,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "kml_export",
|
||||
name = _("kml export"),
|
||||
purpose = _("export KML/KMZ data to a file"),
|
||||
author = "Tobias Jakobs",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/kml_export"
|
||||
@@ -95,12 +93,12 @@ local function create_kml_file(storage, image_table, extra_data)
|
||||
end
|
||||
|
||||
if not df.check_if_bin_exists(magickPath) then
|
||||
dt.print_error(_("magick not found"))
|
||||
dt.print_error("magick not found")
|
||||
return
|
||||
end
|
||||
if dt.configuration.running_os == "linux" then
|
||||
if not df.check_if_bin_exists("xdg-user-dir") then
|
||||
dt.print_error(_("xdg-user-dir not found"))
|
||||
dt.print_error("xdg-user-dir not found")
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -110,7 +108,7 @@ local function create_kml_file(storage, image_table, extra_data)
|
||||
if ( dt.preferences.read("kml_export","CreateKMZ","bool") == true
|
||||
and dt.configuration.running_os == "linux") then
|
||||
if not df.check_if_bin_exists("zip") then
|
||||
dt.print_error(_("zip not found"))
|
||||
dt.print_error("zip not found")
|
||||
return
|
||||
end
|
||||
exportDirectory = dt.configuration.tmp_dir
|
||||
|
||||
@@ -41,8 +41,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("2.0.0", "passport_guide")
|
||||
|
||||
dt.gettext.bindtextdomain("passport_guide", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -50,7 +48,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "passport_guide",
|
||||
name = _("passport guide"),
|
||||
purpose = _("guides for cropping passport photos"),
|
||||
author = "Kåre Hampf",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/passport_guide"
|
||||
|
||||
@@ -40,21 +40,19 @@ USAGE
|
||||
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local gettext = dt.gettext
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("2.0.0", "passport_guide_germany")
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
dt.gettext.bindtextdomain("passport_guide_germany",dt.configuration.config_dir.."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext.dgettext("passport_guide_germany", msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "passport_guide_germany",
|
||||
name = _("passport guide Germany"),
|
||||
purpose = _("guides for cropping passport and ID card (\"Personalausweis\") photos based on the \"Passbild-Schablone\" from the German Federal Ministry of the Interior and Community"),
|
||||
author = "menschmachine",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/passport_guide_germany"
|
||||
|
||||
@@ -44,8 +44,6 @@ local df = require "lib/dtutils.file"
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("pdf_slideshow", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -62,7 +60,7 @@ du.check_min_api_version("7.0.0", "pdf_slideshow")
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "pdf_slideshow",
|
||||
name = _("PDF slideshow"),
|
||||
purpose = _("generates a PDF slideshow (via Latex) containing all selected images one per slide"),
|
||||
author = "Pascal Obry",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/pdf_slideshow"
|
||||
|
||||
@@ -45,7 +45,6 @@ local MODULE_NAME = "photils"
|
||||
du.check_min_api_version("7.0.0", MODULE_NAME)
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
dt.gettext.bindtextdomain("photils", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
@@ -56,7 +55,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "photils",
|
||||
name = _("photils"),
|
||||
purpose = _("suggest tags based on image classification"),
|
||||
author = "Tobias Scheck",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/photils"
|
||||
@@ -339,7 +338,7 @@ function PHOTILS.on_tags_clicked()
|
||||
end
|
||||
|
||||
if #PHOTILS.tags == 0 then
|
||||
local msg = string.format(_("no tags where found"), MODULE_NAME)
|
||||
local msg = string.format(_("no tags were found"), MODULE_NAME)
|
||||
GUI.warning_label.label = msg
|
||||
GUI.stack.active = GUI.error_view
|
||||
return
|
||||
@@ -394,7 +393,7 @@ end
|
||||
local function install_module()
|
||||
if not PHOTILS.module_installed then
|
||||
dt.register_lib(MODULE_NAME,
|
||||
"photils autotagger",
|
||||
_("photils auto-tagger"),
|
||||
true,
|
||||
true,
|
||||
PHOTILS.plugin_display_views,
|
||||
|
||||
@@ -51,8 +51,6 @@ du.check_min_api_version("7.0.0", "quicktag")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("quicktag", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -62,7 +60,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "quicktag",
|
||||
name = _("quick tag"),
|
||||
purpose = _("use buttons to quickly apply tags assigned to them"),
|
||||
author = "Christian Kanzian",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/quicktag"
|
||||
@@ -199,7 +197,7 @@ local function install_module()
|
||||
if not qt.module_installed then
|
||||
dt.register_lib(
|
||||
"quicktag", -- Module name
|
||||
"quicktag", -- name
|
||||
_("quick tag"), -- name
|
||||
true, -- expandable
|
||||
false, -- resetable
|
||||
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 490}},
|
||||
@@ -306,7 +304,7 @@ end
|
||||
for i=1,qnr do
|
||||
dt.register_event("quicktag " .. tostring(i), "shortcut",
|
||||
function(event, shortcut) tagattach(tostring(quicktag_table[i])) end,
|
||||
string.format(_("quicktag %i"),i))
|
||||
string.format(_("quick tag %i"),i))
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
@@ -46,8 +46,6 @@ du.check_min_api_version("7.0.0", "rate_group")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("rate_group", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -57,7 +55,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "rate_group",
|
||||
name = _("rate group"),
|
||||
purpose = _("rate all images in a group"),
|
||||
author = "Dom H (dom@hxy.io)",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/rate_group"
|
||||
|
||||
@@ -38,8 +38,6 @@ du.deprecated("contrib/rename-tags.lua","darktable release 4.0")
|
||||
|
||||
local gettext = darktable.gettext.gettext
|
||||
|
||||
darktable.gettext.bindtextdomain("rename-tags", darktable.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -49,7 +47,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "rename-tags",
|
||||
name = _("rename tags"),
|
||||
purpose = _("rename an existing tag"),
|
||||
author = "Sebastian Witt (se.witt@gmx.net)",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/rename-tags"
|
||||
|
||||
@@ -43,13 +43,12 @@
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local df = require "lib/dtutils.file"
|
||||
local ds = require "lib/dtutils.string"
|
||||
|
||||
du.check_min_api_version("7.0.0", "rename_images")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("rename_images", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -57,12 +56,6 @@ end
|
||||
-- namespace variable
|
||||
local rename = {
|
||||
presets = {},
|
||||
substitutes = {},
|
||||
placeholders = {"ROLL_NAME","FILE_FOLDER","FILE_NAME","FILE_EXTENSION","ID","VERSION","SEQUENCE","YEAR","MONTH","DAY",
|
||||
"HOUR","MINUTE","SECOND","EXIF_YEAR","EXIF_MONTH","EXIF_DAY","EXIF_HOUR","EXIF_MINUTE","EXIF_SECOND",
|
||||
"STARS","LABELS","MAKER","MODEL","TITLE","CREATOR","PUBLISHER","RIGHTS","USERNAME","PICTURES_FOLDER",
|
||||
"HOME","DESKTOP","EXIF_ISO","EXIF_EXPOSURE","EXIF_EXPOSURE_BIAS","EXIF_APERTURE","EXIF_FOCUS_DISTANCE",
|
||||
"EXIF_FOCAL_LENGTH","LONGITUDE","LATITUDE","ELEVATION","LENS","DESCRIPTION","EXIF_CROP"},
|
||||
widgets = {},
|
||||
}
|
||||
rename.module_installed = false
|
||||
@@ -72,7 +65,7 @@ rename.event_registered = false
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "rename_images",
|
||||
name = _("rename images"),
|
||||
purpose = _("rename an image file or files"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/rename_images"
|
||||
@@ -99,83 +92,6 @@ local DESKTOP = HOME .. PS .. "Desktop"
|
||||
-- F U N C T I O N S
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
local function build_substitution_list(image, sequence, datetime, username, pic_folder, home, desktop)
|
||||
-- build the argument substitution list from each image
|
||||
-- local datetime = os.date("*t")
|
||||
local colorlabels = {}
|
||||
if image.red then table.insert(colorlabels, "red") end
|
||||
if image.yellow then table.insert(colorlabels, "yellow") end
|
||||
if image.green then table.insert(colorlabels, "green") end
|
||||
if image.blue then table.insert(colorlabels, "blue") end
|
||||
if image.purple then table.insert(colorlabels, "purple") end
|
||||
local labels = #colorlabels == 1 and colorlabels[1] or du.join(colorlabels, ",")
|
||||
local eyear,emon,eday,ehour,emin,esec = string.match(image.exif_datetime_taken, "(%d-):(%d-):(%d-) (%d-):(%d-):(%d-)$")
|
||||
local replacements = {image.film,
|
||||
image.path,
|
||||
df.get_filename(image.filename),
|
||||
string.upper(df.get_filetype(image.filename)),
|
||||
image.id,image.duplicate_index,
|
||||
string.format("%04d", sequence),
|
||||
datetime.year,
|
||||
string.format("%02d", datetime.month),
|
||||
string.format("%02d", datetime.day),
|
||||
string.format("%02d", datetime.hour),
|
||||
string.format("%02d", datetime.min),
|
||||
string.format("%02d", datetime.sec),
|
||||
eyear,
|
||||
emon,
|
||||
eday,
|
||||
ehour,
|
||||
emin,
|
||||
esec,
|
||||
image.rating,
|
||||
labels,
|
||||
image.exif_maker,
|
||||
image.exif_model,
|
||||
image.title,
|
||||
image.creator,
|
||||
image.publisher,
|
||||
image.rights,
|
||||
username,
|
||||
pic_folder,
|
||||
home,
|
||||
desktop,
|
||||
image.exif_iso,
|
||||
image.exif_exposure,
|
||||
image.exif_exposure_bias,
|
||||
image.exif_aperture,
|
||||
image.exif_focus_distance,
|
||||
image.exif_focal_length,
|
||||
image.longitude,
|
||||
image.latitude,
|
||||
image.elevation,
|
||||
image.exif_lens,
|
||||
image.description,
|
||||
image.exif_crop
|
||||
}
|
||||
|
||||
for i=1,#rename.placeholders,1 do rename.substitutes[rename.placeholders[i]] = replacements[i] end
|
||||
end
|
||||
|
||||
local function substitute_list(str)
|
||||
-- replace the substitution variables in a string
|
||||
for match in string.gmatch(str, "%$%(.-%)") do
|
||||
local var = string.match(match, "%$%((.-)%)")
|
||||
if rename.substitutes[var] then
|
||||
str = string.gsub(str, "%$%("..var.."%)", rename.substitutes[var])
|
||||
else
|
||||
dt.print_error("unrecognized variable " .. var)
|
||||
dt.print(string.format(_("unknown variable %s, aborting..."), var))
|
||||
return -1
|
||||
end
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
local function clear_substitute_list()
|
||||
for i=1,#rename.placeholders,1 do rename.substitutes[rename.placeholders[i]] = nil end
|
||||
end
|
||||
|
||||
local function stop_job(job)
|
||||
job.valid = false
|
||||
end
|
||||
@@ -225,14 +141,14 @@ local function do_rename(images)
|
||||
for i, image in ipairs(images) do
|
||||
if job.valid then
|
||||
job.percent = i / #images
|
||||
build_substitution_list(image, i, datetime, USER, PICTURES, HOME, DESKTOP)
|
||||
local new_name = substitute_list(pattern)
|
||||
ds.build_substitute_list(image, i, pattern, USER, PICTURES, HOME, DESKTOP)
|
||||
local new_name = ds.substitute_list(pattern)
|
||||
if new_name == -1 then
|
||||
dt.print(_("unable to do variable substitution, exiting..."))
|
||||
stop_job(job)
|
||||
return
|
||||
end
|
||||
clear_substitute_list()
|
||||
ds.clear_substitute_list()
|
||||
local args = {}
|
||||
local path = string.sub(df.get_path(new_name), 1, -2)
|
||||
if string.len(path) == 0 then
|
||||
@@ -278,50 +194,8 @@ end
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
rename.widgets.pattern = dt.new_widget("entry"){
|
||||
tooltip = _("$(ROLL_NAME) - film roll name\n") ..
|
||||
_("$(FILE_FOLDER) - image file folder\n") ..
|
||||
_("$(FILE_NAME) - image file name\n") ..
|
||||
_("$(FILE_EXTENSION) - image file extension\n") ..
|
||||
_("$(ID) - image id\n") ..
|
||||
_("$(VERSION) - version number\n") ..
|
||||
_("$(SEQUENCE) - sequence number of selection\n") ..
|
||||
_("$(YEAR) - current year\n") ..
|
||||
_("$(MONTH) - current month\n") ..
|
||||
_("$(DAY) - current day\n") ..
|
||||
_("$(HOUR) - current hour\n") ..
|
||||
_("$(MINUTE) - current minute\n") ..
|
||||
_("$(SECOND) - current second\n") ..
|
||||
_("$(EXIF_YEAR) - EXIF year\n") ..
|
||||
_("$(EXIF_MONTH) - EXIF month\n") ..
|
||||
_("$(EXIF_DAY) - EXIF day\n") ..
|
||||
_("$(EXIF_HOUR) - EXIF hour\n") ..
|
||||
_("$(EXIF_MINUTE) - EXIF minute\n") ..
|
||||
_("$(EXIF_SECOND) - EXIF seconds\n") ..
|
||||
_("$(EXIF_ISO) - EXIF ISO\n") ..
|
||||
_("$(EXIF_EXPOSURE) - EXIF exposure\n") ..
|
||||
_("$(EXIF_EXPOSURE_BIAS) - EXIF exposure bias\n") ..
|
||||
_("$(EXIF_APERTURE) - EXIF aperture\n") ..
|
||||
_("$(EXIF_FOCAL_LENGTH) - EXIF focal length\n") ..
|
||||
_("$(EXIF_FOCUS_DISTANCE) - EXIF focus distance\n") ..
|
||||
_("$(EXIF_CROP) - EXIF crop\n") ..
|
||||
_("$(LONGITUDE) - longitude\n") ..
|
||||
_("$(LATITUDE) - latitude\n") ..
|
||||
_("$(ELEVATION) - elevation\n") ..
|
||||
_("$(STARS) - star rating\n") ..
|
||||
_("$(LABELS) - color labels\n") ..
|
||||
_("$(MAKER) - camera maker\n") ..
|
||||
_("$(MODEL) - camera model\n") ..
|
||||
_("$(LENS) - lens\n") ..
|
||||
_("$(TITLE) - title from metadata\n") ..
|
||||
_("$(DESCRIPTION) - description from metadata\n") ..
|
||||
_("$(CREATOR) - creator from metadata\n") ..
|
||||
_("$(PUBLISHER) - publisher from metadata\n") ..
|
||||
_("$(RIGHTS) - rights from metadata\n") ..
|
||||
_("$(USERNAME) - username\n") ..
|
||||
_("$(PICTURES_FOLDER) - pictures folder\n") ..
|
||||
_("$(HOME) - user's home directory\n") ..
|
||||
_("$(DESKTOP) - desktop directory"),
|
||||
placeholder = _("enter pattern $(FILE_FOLDER)/$(FILE_NAME)"),
|
||||
tooltip = ds.get_substitution_tooltip(),
|
||||
placeholder = _("enter pattern") .. "$(FILE_FOLDER)/$(FILE_NAME)",
|
||||
text = ""
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@ local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("select_non_existing", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -76,7 +74,7 @@ dt.gui.libs.select.register_selection(
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "select_non_existing",
|
||||
name = _("select non existing"),
|
||||
purpose = _("enable selection of non-existing images"),
|
||||
author = "Dirk Dittmar",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/select_non_existing"
|
||||
|
||||
@@ -24,8 +24,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("7.0.0", "select_untagged")
|
||||
|
||||
dt.gettext.bindtextdomain("select_untagged", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -35,7 +33,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "select_untagged",
|
||||
name = _("select untagged"),
|
||||
purpose = _("enable selection of untagged images"),
|
||||
author = "Jannis_V",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/select_untagged"
|
||||
|
||||
@@ -31,8 +31,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("7.0.0", "slideshowMusic")
|
||||
|
||||
dt.gettext.bindtextdomain("slideshowMusic", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -42,7 +40,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "slideshowMusic",
|
||||
name = _("slideshow music"),
|
||||
purpose = _("play music during a slideshow"),
|
||||
author = "Tobias Jakobs",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/slideshowMusic"
|
||||
|
||||
@@ -76,14 +76,13 @@ local darktable = require("darktable")
|
||||
local dtutils = require("lib/dtutils")
|
||||
local dtutils_file = require("lib/dtutils.file")
|
||||
local dtutils_system = require("lib/dtutils.system")
|
||||
local gettext = darktable.gettext.gettext
|
||||
|
||||
local LIB_ID = "transfer_hierarchy"
|
||||
dtutils.check_min_api_version("7.0.0", LIB_ID)
|
||||
|
||||
darktable.gettext.bindtextdomain("transfer_hierarchy", darktable.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return darktable.gettext.gettext(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
|
||||
-- return data structure for script_manager
|
||||
@@ -91,7 +90,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "transfer_hierarchy",
|
||||
name = _("transfer hierarchy"),
|
||||
purpose = _("allows the moving or copying of images from one directory tree to another, while preserving the existing hierarchy"),
|
||||
author = "August Schwerdfeger (august@schwerdfeger.name)",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/transfer_hierarchy"
|
||||
@@ -145,7 +144,7 @@ end
|
||||
local function install_module()
|
||||
if not th.module_installed then
|
||||
darktable.register_lib(LIB_ID,
|
||||
"transfer hierarchy", true, true, {
|
||||
_("transfer hierarchy"), true, true, {
|
||||
[darktable.gui.views.lighttable] = { "DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 700 }
|
||||
}, th.transfer_widget, nil, nil)
|
||||
th.module_installed = true
|
||||
|
||||
1066
contrib/ultrahdr.lua
Normal file
1066
contrib/ultrahdr.lua
Normal file
File diff suppressed because it is too large
Load Diff
@@ -41,8 +41,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("7.0.0", "video_ffmpeg")
|
||||
|
||||
dt.gettext.bindtextdomain("video_ffmpeg", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -52,7 +50,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "video_ffmpeg",
|
||||
name = _("video ffmpeg"),
|
||||
purpose = _("timelapse video plugin based on ffmpeg"),
|
||||
author = "Dominik Markiewicz",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contib/video_ffmpeg"
|
||||
@@ -248,8 +246,8 @@ local function string_pref_write(name, widget_attribute)
|
||||
end
|
||||
|
||||
local framerates_selector = dt.new_widget("combobox"){
|
||||
label = _("framerate"),
|
||||
tooltip = _("select framerate of output video"),
|
||||
label = _("frame rate"),
|
||||
tooltip = _("select frame rate of output video"),
|
||||
value = combobox_pref_read("framerate", framerates),
|
||||
changed_callback = combobox_pref_write("framerate"),
|
||||
table.unpack(framerates)
|
||||
@@ -418,7 +416,7 @@ local function export(extra_data)
|
||||
local ffmpeg_path = df.check_if_bin_exists("ffmpeg")
|
||||
if not ffmpeg_path then
|
||||
dt.print_error("ffmpeg not found")
|
||||
dt.print("ERROR - ffmpeg not found")
|
||||
dt.print(_("ERROR - ffmpeg not found"))
|
||||
return
|
||||
end
|
||||
local dir = extra_data["tmp_dir"]
|
||||
@@ -450,7 +448,7 @@ local function finalize_export(storage, images_table, extra_data)
|
||||
dt.print_error(filename, file.filename)
|
||||
df.file_move(filename, tmp_dir .. PS .. i .. extra_data["img_ext"])
|
||||
end
|
||||
dt.print("Start video building...")
|
||||
dt.print(_("start video building..."))
|
||||
local result, path = export(extra_data)
|
||||
if result ~= 0 then
|
||||
dt.print(_("ERROR: cannot build image, see console for more info"))
|
||||
|
||||
@@ -27,8 +27,6 @@ local dt = require "darktable"
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("api_version", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -41,7 +39,7 @@ end
|
||||
|
||||
local result = dt.configuration.api_version_string
|
||||
dt.print_log("API Version: " .. result)
|
||||
dt.print(string.format(_("API version: %s"), result))
|
||||
dt.print("API " .. _("version") .. ": " .. result)
|
||||
|
||||
-- set the destroy routine so that script_manager can call it when
|
||||
-- it's time to destroy the script and then return the data to
|
||||
@@ -49,7 +47,7 @@ dt.print(string.format(_("API version: %s"), result))
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "api_version",
|
||||
name = _("APIversion"),
|
||||
purpose = _("display api_version example"),
|
||||
author = "Tobias Jakobs",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/api_version"
|
||||
|
||||
@@ -60,8 +60,6 @@ local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("darkroom_demo", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -93,7 +91,7 @@ dt.gui.current_view(dt.gui.views.darkroom)
|
||||
|
||||
local max_images = 10
|
||||
|
||||
dt.print(_("showing images, with a pause in between each"))
|
||||
dt.print(_("showing images, with a pause between each"))
|
||||
sleep(1500)
|
||||
|
||||
-- display first 10 images of collection pausing for a second between each
|
||||
@@ -119,7 +117,7 @@ dt.gui.current_view(current_view)
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "darkroom_demo",
|
||||
name = _("darkroom demo"),
|
||||
purpose = _("example demonstrating how to control image display in darkroom mode"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/darkroom_demo"
|
||||
|
||||
@@ -69,8 +69,6 @@ dt.print_error("Hello World!")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("gettextExample", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
-- Translate a string using the darktable textdomain
|
||||
dt.print_error(gettext("image"))
|
||||
|
||||
@@ -88,7 +86,7 @@ dt.print_error(_("hello world!"))
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "gettextExample",
|
||||
name = _("gettext example"),
|
||||
purpose = _("example of how translations works"),
|
||||
author = "Tobias Jakobs",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/gettextExample"
|
||||
|
||||
@@ -5,7 +5,6 @@ local NaN = 0/0
|
||||
local wg = {}
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
dt.gettext.bindtextdomain("gui_action", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
@@ -16,7 +15,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "gui_action",
|
||||
name = _("gui action"),
|
||||
purpose = _("example of how to use darktable.gui.action() calls"),
|
||||
author = "Diederik ter Rahe",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/gui_action"
|
||||
@@ -29,37 +28,37 @@ script_data.show = nil -- only required for libs since the destroy_method only h
|
||||
|
||||
wg.action = dt.new_widget("entry"){
|
||||
text = "lib/filter/view",
|
||||
placeholder = "action path",
|
||||
tooltip = "enter the full path of an action, for example 'lib/filter/view'"
|
||||
placeholder = _("action path"),
|
||||
tooltip = _("enter the full path of an action, for example 'lib/filter/view'")
|
||||
}
|
||||
|
||||
wg.instance = dt.new_widget("combobox"){
|
||||
label = "instance",
|
||||
tooltip = "the instance of an image processing module to execute action on",
|
||||
label = _("instance"),
|
||||
tooltip = _("the instance of an image processing module to execute action on"),
|
||||
"0", "+1", "-1", "+2", "-2", "+3", "-3", "+4", "-4", "+5", "-5", "+6", "-6", "+7", "-7", "+8", "-8", "+9", "-9"
|
||||
}
|
||||
|
||||
wg.element = dt.new_widget("entry"){
|
||||
text = "",
|
||||
placeholder = "action element",
|
||||
tooltip = "enter the element of an action, for example 'selection', or leave empty for default"
|
||||
placeholder = _("action element"),
|
||||
tooltip = _("enter the element of an action, for example 'selection', or leave empty for default")
|
||||
}
|
||||
|
||||
wg.effect = dt.new_widget("entry"){
|
||||
text = "next",
|
||||
placeholder = "action effect",
|
||||
tooltip = "enter the effect of an action, for example 'next', or leave empty for default"
|
||||
placeholder = _("action effect"),
|
||||
tooltip = _("enter the effect of an action, for example 'next', or leave empty for default")
|
||||
}
|
||||
|
||||
wg.speed = dt.new_widget("entry"){
|
||||
text = "1",
|
||||
placeholder = "action speed",
|
||||
tooltip = "enter the speed to use in action execution, or leave empty to only read state"
|
||||
placeholder = _("action speed"),
|
||||
tooltip = _("enter the speed to use in action execution, or leave empty to only read state")
|
||||
}
|
||||
|
||||
wg.check = dt.new_widget("check_button"){
|
||||
label = 'perform action',
|
||||
tooltip = 'perform action or only read return',
|
||||
label = _('perform action'),
|
||||
tooltip = _('perform action or only read return'),
|
||||
clicked_callback = function()
|
||||
wg.speed.sensitive = wg.check.value
|
||||
end,
|
||||
@@ -73,7 +72,7 @@ wg.return_value = dt.new_widget("entry"){
|
||||
|
||||
dt.register_lib(
|
||||
"execute_action", -- Module name
|
||||
"execute gui actions", -- name
|
||||
_("execute gui actions"), -- name
|
||||
true, -- expandable
|
||||
false, -- resetable
|
||||
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_LEFT_CENTER", 100},
|
||||
@@ -85,37 +84,37 @@ dt.register_lib(
|
||||
dt.new_widget("box")
|
||||
{
|
||||
orientation = "horizontal",
|
||||
dt.new_widget("label"){label = "action path", halign = "start"},
|
||||
dt.new_widget("label"){label = _("action path"), halign = "start"},
|
||||
wg.action
|
||||
},
|
||||
wg.instance,
|
||||
dt.new_widget("box")
|
||||
{
|
||||
orientation = "horizontal",
|
||||
dt.new_widget("label"){label = "element", halign = "start"},
|
||||
dt.new_widget("label"){label = _("element"), halign = "start"},
|
||||
wg.element
|
||||
},
|
||||
dt.new_widget("box")
|
||||
{
|
||||
orientation = "horizontal",
|
||||
dt.new_widget("label"){label = "effect", halign = "start"},
|
||||
dt.new_widget("label"){label = _("effect"), halign = "start"},
|
||||
wg.effect
|
||||
},
|
||||
wg.check,
|
||||
dt.new_widget("box")
|
||||
{
|
||||
orientation = "horizontal",
|
||||
dt.new_widget("label"){label = "speed", halign = "start"},
|
||||
dt.new_widget("label"){label = _("speed"), halign = "start"},
|
||||
wg.speed
|
||||
},
|
||||
dt.new_widget("button")
|
||||
{
|
||||
label = "execute action",
|
||||
tooltip = "execute the action specified in the fields above",
|
||||
label = _("execute action"),
|
||||
tooltip = _("execute the action specified in the fields above"),
|
||||
clicked_callback = function(_)
|
||||
local sp = NaN
|
||||
if wg.check.value then sp = wg.speed.text end
|
||||
wg.return_value.text = dt.gui.action(wg.action.text, wg.instance.value, wg.element.text, wg.effect.text, sp)
|
||||
wg.return_value.text = dt.gui.action(wg.action.text, tonumber(wg.instance.value), wg.element.text, wg.effect.text, tonumber(sp))
|
||||
end
|
||||
},
|
||||
dt.new_widget("box")
|
||||
|
||||
@@ -35,8 +35,6 @@ du.check_min_api_version("2.0.0", "hello_world")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("hello_world", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -55,7 +53,7 @@ dt.print(_("hello, world"))
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "hello_world",
|
||||
name = _("hello world"),
|
||||
purpose = _("example of how to print a message to the screen"),
|
||||
author = "Tobias Ellinghaus",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/hello_world"
|
||||
|
||||
@@ -218,7 +218,7 @@ current_sort_order = dt.gui.libs.filter.sort_order(current_sort_order)
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "lighttable_demo",
|
||||
name = _("lighttable demo"),
|
||||
purpose = _("example demonstrating how to control lighttable display modes"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/lighttable_demo"
|
||||
|
||||
@@ -38,8 +38,6 @@ du.check_min_api_version("7.0.0", "moduleExample")
|
||||
-- https://www.darktable.org/lua-api/index.html#darktable_gettext
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("moduleExample", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -49,7 +47,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "moduleExample",
|
||||
name = ("module example"),
|
||||
purpose = _("example of how to create a lighttable module"),
|
||||
author = "Tobias Jakobs",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/moduleExample"
|
||||
@@ -77,7 +75,7 @@ local function install_module()
|
||||
-- https://www.darktable.org/lua-api/index.html#darktable_register_lib
|
||||
dt.register_lib(
|
||||
"exampleModule", -- Module name
|
||||
"exampleModule", -- name
|
||||
_("example module"), -- name
|
||||
true, -- expandable
|
||||
false, -- resetable
|
||||
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 100}}, -- containers
|
||||
@@ -87,7 +85,7 @@ local function install_module()
|
||||
orientation = "vertical",
|
||||
dt.new_widget("button")
|
||||
{
|
||||
label = _("my button"),
|
||||
label = _("my ") .. "button",
|
||||
clicked_callback = function (_)
|
||||
dt.print(_("button clicked"))
|
||||
end
|
||||
@@ -112,10 +110,10 @@ local function restart()
|
||||
end
|
||||
|
||||
-- https://www.darktable.org/lua-api/types_lua_check_button.html
|
||||
local check_button = dt.new_widget("check_button"){label = _("my check_button"), value = true}
|
||||
local check_button = dt.new_widget("check_button"){label = _("my ") .. "check_button", value = true}
|
||||
|
||||
-- https://www.darktable.org/lua-api/types_lua_combobox.html
|
||||
local combobox = dt.new_widget("combobox"){label = _("my combobox"), value = 2, "8", "16", "32"}
|
||||
local combobox = dt.new_widget("combobox"){label = _("my ") .. "combobox", value = 2, "8", "16", "32"}
|
||||
|
||||
-- https://www.darktable.org/lua-api/types_lua_entry.html
|
||||
local entry = dt.new_widget("entry")
|
||||
@@ -131,14 +129,14 @@ local entry = dt.new_widget("entry")
|
||||
-- https://www.darktable.org/lua-api/types_lua_file_chooser_button.html
|
||||
local file_chooser_button = dt.new_widget("file_chooser_button")
|
||||
{
|
||||
title = _("my file_chooser_button"), -- The title of the window when choosing a file
|
||||
title = _("my ") .. "file_chooser_button", -- The title of the window when choosing a file
|
||||
value = "", -- The currently selected file
|
||||
is_directory = false -- True if the file chooser button only allows directories to be selecte
|
||||
}
|
||||
|
||||
-- https://www.darktable.org/lua-api/types_lua_label.html
|
||||
local label = dt.new_widget("label")
|
||||
label.label = _("my label") -- This is an alternative way to the "{}" syntax to set a property
|
||||
label.label = _("my ") .. "label" -- This is an alternative way to the "{}" syntax to set a property
|
||||
|
||||
-- https://www.darktable.org/lua-api/types_lua_separator.html
|
||||
local separator = dt.new_widget("separator"){}
|
||||
@@ -146,7 +144,7 @@ local separator = dt.new_widget("separator"){}
|
||||
-- https://www.darktable.org/lua-api/types_lua_slider.html
|
||||
local slider = dt.new_widget("slider")
|
||||
{
|
||||
label = _("my slider"),
|
||||
label = _("my ") .. "slider",
|
||||
soft_min = 10, -- The soft minimum value for the slider, the slider can't go beyond this point
|
||||
soft_max = 100, -- The soft maximum value for the slider, the slider can't go beyond this point
|
||||
hard_min = 0, -- The hard minimum value for the slider, the user can't manually enter a value beyond this point
|
||||
|
||||
@@ -72,8 +72,6 @@ local dtsys = require "lib/dtutils.system" -- system utilities
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("multi_os", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -215,7 +213,7 @@ end
|
||||
if dt.configuration.running_os ~= "linux" then
|
||||
local executable = "ufraw-batch"
|
||||
local ufraw_batch_path_widget = dt.new_widget("file_chooser_button"){
|
||||
title = _("select ufraw-batch[.exe] executable"),
|
||||
title = string.format(_("select %s executable"), "ufraw-batch[.exe]"),
|
||||
value = df.get_executable_path_preference(executable),
|
||||
is_directory = false,
|
||||
changed_callback = function(self)
|
||||
@@ -226,7 +224,7 @@ if dt.configuration.running_os ~= "linux" then
|
||||
}
|
||||
dt.preferences.register("executable_paths", "ufraw-batch", -- name
|
||||
"file", -- type
|
||||
_('multi_os: ufraw-batch location'), -- label
|
||||
'multi_os: ufraw-batch ' .. _('location'), -- label
|
||||
_('installed location of ufraw-batch, requires restart to take effect.'), -- tooltip
|
||||
"ufraw-batch", -- default
|
||||
ufraw_batch_path_widget
|
||||
@@ -262,7 +260,7 @@ dt.register_event(
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "multi_os",
|
||||
name = _("multi OS"),
|
||||
purpose = _("example module thet runs on different operating systems"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/multi_os"
|
||||
|
||||
@@ -61,8 +61,6 @@ local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("panels_demo", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -95,11 +93,11 @@ dt.gui.panel_show_all()
|
||||
|
||||
-- hide center_top, center_bottom, left, top, right, bottom in order
|
||||
|
||||
dt.print(_("hiding all panels, one at a tme"))
|
||||
dt.print(_("hiding all panels, one at a time"))
|
||||
sleep(1500)
|
||||
|
||||
for i = 1, #panels do
|
||||
dt.print(_("hiding " .. panels[i]))
|
||||
dt.print(string.format(_("hiding %s"), panels[i]))
|
||||
dt.gui.panel_hide(panels[i])
|
||||
sleep(1500)
|
||||
end
|
||||
@@ -110,7 +108,7 @@ end
|
||||
sleep(1500)
|
||||
|
||||
for i = #panels, 1, -1 do
|
||||
dt.print(_("showing " .. panels[i]))
|
||||
dt.print(string.format(_("showing %s"), panels[i]))
|
||||
dt.gui.panel_show(panels[i])
|
||||
sleep(1500)
|
||||
end
|
||||
@@ -148,7 +146,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "panels_demo",
|
||||
name = _("panels demo"),
|
||||
purpose = _("example demonstrating how to contol panel visibility"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/panels_demo"
|
||||
|
||||
@@ -28,8 +28,6 @@ local du = require "lib/dtutils"
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("preferenceExamples", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -37,7 +35,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "preferenceExamples",
|
||||
name = _("preference examples"),
|
||||
purpose = _("example to show the different preference types that are possible"),
|
||||
author = "Tobias Jakobs",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/preferenceExamples"
|
||||
@@ -49,22 +47,22 @@ du.check_min_api_version("2.0.1", "preferenceExamples")
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesString", -- name
|
||||
"string", -- type
|
||||
_("example string"), -- label
|
||||
_("example string tooltip"), -- tooltip
|
||||
_("example") .. " string", -- label
|
||||
_("example") .. " string " .. _("tooltip"), -- tooltip
|
||||
"String") -- default
|
||||
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesBool", -- name
|
||||
"bool", -- type
|
||||
_("example boolean"), -- label
|
||||
_("example boolean tooltip"), -- tooltip
|
||||
_("example") .. " boolean", -- label
|
||||
_("example") .. " boolean " .. _("tooltip"), -- tooltip
|
||||
true) -- default
|
||||
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesInteger", -- name
|
||||
"integer", -- type
|
||||
_("example integer"), -- label
|
||||
_("example integer tooltip"), -- tooltip
|
||||
_("example") .. " integer", -- label
|
||||
_("example") .. " integer " .. _("tooltip"), -- tooltip
|
||||
2, -- default
|
||||
1, -- min
|
||||
99) -- max
|
||||
@@ -72,8 +70,8 @@ dt.preferences.register("preferenceExamples", -- script: This is a string
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesFloat", -- name
|
||||
"float", -- type
|
||||
_("example float"), -- label
|
||||
_("example float tooltip"), -- tooltip
|
||||
_("example") .. " float", -- label
|
||||
_("example") .. " float " .. _("tooltip"), -- tooltip
|
||||
1.3, -- default
|
||||
1, -- min
|
||||
99, -- max
|
||||
@@ -82,22 +80,22 @@ dt.preferences.register("preferenceExamples", -- script: This is a string
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesFile", -- name
|
||||
"file", -- type
|
||||
_("example file"), -- label
|
||||
_("example file tooltip"), -- tooltip
|
||||
_("example") .. " file", -- label
|
||||
_("example") .. " file " .. _("tooltip"), -- tooltip
|
||||
"") -- default
|
||||
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesDirectory", -- name
|
||||
"directory", -- type
|
||||
_("example directory"), -- label
|
||||
_("example directory tooltip"), -- tooltip
|
||||
_("example") .. " directory", -- label
|
||||
_("example") .. " directory " .. _("tooltip"), -- tooltip
|
||||
"") -- default
|
||||
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesEnum", -- name
|
||||
"enum", -- type
|
||||
_("example enum"), -- label
|
||||
_("example enum tooltip"), -- tooltip
|
||||
_("example") .. " enum", -- label
|
||||
_("example") .. " enum " .. _("tooltip"), -- tooltip
|
||||
"Enum 1", -- default
|
||||
"Enum 1", "Enum 2") -- values
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@ du.check_min_api_version("5.0.0", "printExamples")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("printExamples", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -60,7 +58,7 @@ dt.print_log("print log")
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "printExamples",
|
||||
name = _("print examples"),
|
||||
purpose = _("example showing the different types of printing messages"),
|
||||
author = "Tobias Jakobs",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/printExamples"
|
||||
|
||||
@@ -34,8 +34,6 @@ du.check_min_api_version("5.0.0", "running_os")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("running_os", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -54,7 +52,7 @@ dt.print(string.format(_("you are running: %s"), dt.configuration.running_os))
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "running_os",
|
||||
name = _("running OS"),
|
||||
purpose = _("example of how to determine the operating system being used"),
|
||||
author = "Tobias Jakobs",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/running_os"
|
||||
|
||||
@@ -48,6 +48,9 @@ midi:A-1=iop/colorzones;focus
|
||||
midi:A#-1=iop/toneequal;focus
|
||||
midi:B-1=iop/colorbalancergb;focus
|
||||
midi:C0=iop/channelmixerrgb;focus
|
||||
midi:C#0=iop/colorequal;focus
|
||||
midi:D0=iop/colorequal/page;previous
|
||||
midi:D#0=iop/colorequal/page;next
|
||||
]]
|
||||
|
||||
local dt = require "darktable"
|
||||
@@ -56,7 +59,6 @@ local du = require "lib/dtutils"
|
||||
du.check_min_api_version("9.2.0", "x-touch")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
dt.gettext.bindtextdomain("gui_action", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
@@ -67,7 +69,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "x-touch",
|
||||
name = _("x-touch"),
|
||||
purpose = _("example of how to control an x-touch midi device"),
|
||||
author = "Diederik ter Rahe",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/examples/x-touch"
|
||||
@@ -120,6 +122,18 @@ for k = 1,8 do
|
||||
"magenta" }
|
||||
element = e[k]
|
||||
|
||||
-- try if colorequalizer module is focused; if so select element of graph
|
||||
elseif dt.gui.action("iop/colorequal", "focus") ~= 0 then
|
||||
local e = { "red",
|
||||
"orange",
|
||||
"yellow",
|
||||
"green",
|
||||
"cyan",
|
||||
"blue",
|
||||
"lavender",
|
||||
"magenta" }
|
||||
which = "iop/colorequal/graph"
|
||||
element = e[k]
|
||||
|
||||
-- if the sigmoid rgb primaries is focused,
|
||||
-- check sliders
|
||||
|
||||
@@ -61,7 +61,7 @@ dtutils.libdoc.functions["check_min_api_version"] = {
|
||||
|
||||
function dtutils.check_min_api_version(min_api, script_name)
|
||||
local current_api = dt.configuration.api_version_string
|
||||
if min_api > current_api then
|
||||
if dtutils.compare_api_versions(min_api, current_api) > 0 then
|
||||
dt.print_error("This application is written for lua api version " .. min_api .. " or later.")
|
||||
dt.print_error("The current lua api version is " .. current_api)
|
||||
dt.print("ERROR: " .. script_name .. " failed to load. Lua API version " .. min_api .. " or later required.")
|
||||
@@ -96,7 +96,7 @@ dtutils.libdoc.functions["check_max_api_version"] = {
|
||||
|
||||
function dtutils.check_max_api_version(max_api, script_name)
|
||||
local current_api = dt.configuration.api_version_string
|
||||
if current_api > max_api then
|
||||
if dtutils.compare_api_versions(current_api, max_api) > 0 then
|
||||
dt.print_error("This application is written for lua api version " .. max_api .. " or earlier.")
|
||||
dt.print_error("The current lua api version is " .. current_api)
|
||||
dt.print("ERROR: " .. script_name .. " failed to load. Lua API version " .. max_api .. " or earlier required.")
|
||||
@@ -374,7 +374,7 @@ dtutils.libdoc.functions["deprecated"] = {
|
||||
|
||||
du.deprecated(script_name, removal_string)
|
||||
script_name - name of the script being deprecated
|
||||
removal_strubg - a string explaining when the script will be removed]],
|
||||
removal_string - a string explaining when the script will be removed]],
|
||||
Description = [[deprecated prints an error message saying the script is deprecated and when it will be removed]],
|
||||
Return_Value = [[]],
|
||||
Limitations = [[]],
|
||||
@@ -391,5 +391,77 @@ function dtutils.deprecated(script_name, removal_string)
|
||||
dt.print_error("WARNING: " .. script_name .. " is deprecated and will be removed in " .. removal_string)
|
||||
end
|
||||
|
||||
dtutils.libdoc.functions["gen_uuid"] = {
|
||||
Name = [[gen_uuid]],
|
||||
Synopsis = [[generate a UUID string]],
|
||||
Usage = [[local du = require "lib/dtutils"
|
||||
|
||||
uuid = du.gen_uuid(case)
|
||||
case - "upper" or "lower" to specify the case of the UUID string]],
|
||||
Description = [[gen_uuid prints an error message saying the script is gen_uuid and when it will be removed]],
|
||||
Return_Value = [[uuid - string - a hexidecimal string representing the UUID in the requested case]],
|
||||
Limitations = [[]],
|
||||
Example = [[]],
|
||||
See_Also = [[]],
|
||||
Reference = [[https://gist.github.com/jrus/3197011]],
|
||||
License = [[]],
|
||||
Copyright = [[]],
|
||||
}
|
||||
|
||||
function dtutils.gen_uuid(case)
|
||||
local template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
||||
|
||||
-- seed with os.time in seconds and add an extra degree of random for multiple calls in the same second
|
||||
math.randomseed(os.time(), math.random(0, 65536))
|
||||
|
||||
local uuid = string.gsub(template, '[xy]', function (c)
|
||||
local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb)
|
||||
return string.format('%x', v)
|
||||
end
|
||||
)
|
||||
|
||||
if case and case == "upper" then
|
||||
uuid = string.upper(uuid)
|
||||
end
|
||||
|
||||
return uuid
|
||||
end
|
||||
|
||||
dtutils.libdoc.functions["compare_api_versions"] = {
|
||||
Name = [[compare_api_versions]],
|
||||
Synopsis = [[compare two API version strings]],
|
||||
Usage = [[local du = require "lib/dtutils"
|
||||
|
||||
local result = du.compare_api_versions(version1, version2)
|
||||
version1 - string - the first version string to compare (example: "5.0.0")
|
||||
version2 - string - the second version string to compare (example: "5.1.0")]],
|
||||
Description = [[compare_api_versions compares two version strings and returns 1 if version1 is greater,
|
||||
-1 if version2 is greater, and 0 if they are equal.]],
|
||||
Return_Value = [[result - 1 if version1 is greater, -1 if version2 is greater, 0 if they are equal.]],
|
||||
Limitations = [[]],
|
||||
Example = [[compare_api_versions("5.0.0", "5.1.0") returns -1]],
|
||||
See_Also = [[]],
|
||||
Reference = [[]],
|
||||
License = [[]],
|
||||
Copyright = [[]],
|
||||
}
|
||||
|
||||
function dtutils.compare_api_versions(version1, version2)
|
||||
local v1 = {}
|
||||
for num in version1:gmatch("%d+") do table.insert(v1, tonumber(num)) end
|
||||
local v2 = {}
|
||||
for num in version2:gmatch("%d+") do table.insert(v2, tonumber(num)) end
|
||||
|
||||
for i = 1, math.max(#v1, #v2) do
|
||||
local num1 = v1[i] or 0
|
||||
local num2 = v2[i] or 0
|
||||
if num1 > num2 then
|
||||
return 1
|
||||
elseif num1 < num2 then
|
||||
return -1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
return dtutils
|
||||
|
||||
@@ -24,15 +24,12 @@ dtutils_file.libdoc = {
|
||||
functions = {}
|
||||
}
|
||||
|
||||
local gettext = dt.gettext
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("5.0.0", "dtutils.file")
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("dtutils.file",dt.configuration.config_dir.."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext.dgettext("dtutils.file", msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
|
||||
--[[
|
||||
@@ -522,9 +519,9 @@ function dtutils_file.file_copy(fromFile, toFile)
|
||||
local result = nil
|
||||
-- if cp exists, use it
|
||||
if dt.configuration.running_os == "windows" then
|
||||
result = os.execute('copy "' .. fromFile .. '" "' .. toFile .. '"')
|
||||
result = os.execute('copy ' .. dtutils_file.sanitize_filename(fromFile) .. ' ' .. dtutils_file.sanitize_filename(toFile))
|
||||
elseif dtutils_file.check_if_bin_exists("cp") then
|
||||
result = os.execute("cp '" .. fromFile .. "' '" .. toFile .. "'")
|
||||
result = os.execute("cp " .. dtutils_file.sanitize_filename(fromFile) .. ' ' .. dtutils_file.sanitize_filename(toFile))
|
||||
end
|
||||
|
||||
-- if cp was not present, or if cp failed, then a pure lua solution
|
||||
@@ -575,7 +572,7 @@ function dtutils_file.file_move(fromFile, toFile)
|
||||
if not success then
|
||||
-- an error occurred, so let's try using the operating system function
|
||||
if dtutils_file.check_if_bin_exists("mv") then
|
||||
success = os.execute("mv '" .. fromFile .. "' '" .. toFile .. "'")
|
||||
success = os.execute("mv " .. dtutils_file.sanitize_filename(fromFile) .. ' ' .. dtutils_file.sanitize_filename(toFile))
|
||||
end
|
||||
-- if the mv didn't exist or succeed, then...
|
||||
if not success then
|
||||
@@ -815,7 +812,7 @@ dtutils_file.libdoc.functions["mkdir"] = {
|
||||
function dtutils_file.mkdir(path)
|
||||
if not dtutils_file.check_if_file_exists(path) then
|
||||
local mkdir_cmd = dt.configuration.running_os == "windows" and "mkdir" or "mkdir -p"
|
||||
return dsys.external_command(mkdir_cmd.." "..path)
|
||||
return dsys.external_command(mkdir_cmd.." "..dtutils_file.sanitize_filename(path))
|
||||
else
|
||||
return 0
|
||||
end
|
||||
@@ -840,7 +837,7 @@ dtutils_file.libdoc.functions["rmdir"] = {
|
||||
|
||||
function dtutils_file.rmdir(path)
|
||||
local rm_cmd = dt.configuration.running_os == "windows" and "rmdir /S /Q" or "rm -r"
|
||||
return dsys.external_command(rm_cmd.." "..path)
|
||||
return dsys.external_command(rm_cmd.." "..dtutils_file.sanitize_filename(path))
|
||||
end
|
||||
|
||||
dtutils_file.libdoc.functions["create_tmp_file"] = {
|
||||
|
||||
@@ -3,9 +3,14 @@ local dtutils_string = {}
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local log = require "lib/dtutils.log"
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
local DEFAULT_LOG_LEVEL = log.error
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
|
||||
dtutils_string.log_level = DEFAULT_LOG_LEVEL
|
||||
|
||||
dtutils_string.libdoc = {
|
||||
@@ -301,8 +306,16 @@ end
|
||||
local function _should_be_sanitized(str)
|
||||
local old_log_level = log.log_level()
|
||||
local result = false
|
||||
local UNSAFE_POSIX_FILENAME_CHARS <const> = "[^%w/._%-]+"
|
||||
local UNSAFE_WIN_FILENAME_CHARS <const> = "[^%w\\._%-:]+"
|
||||
|
||||
local pattern = UNSAFE_POSIX_FILENAME_CHARS
|
||||
if dt.configuration.running_os == "windows" then
|
||||
pattern = UNSAFE_WIN_FILENAME_CHARS
|
||||
end
|
||||
|
||||
log.log_level(dtutils_string.log_level)
|
||||
if string.match(str, "[^%g]") then
|
||||
if string.match(str, pattern) then
|
||||
result = true
|
||||
end
|
||||
log.log_level(old_log_level)
|
||||
@@ -553,6 +566,7 @@ local PLACEHOLDERS = {"ROLL.NAME",
|
||||
"MONTH.SHORT",
|
||||
"DAY",
|
||||
"HOUR",
|
||||
"HOUR.AMPM", -- Not Implemented
|
||||
"MINUTE",
|
||||
"SECOND",
|
||||
"MSEC",
|
||||
@@ -563,6 +577,7 @@ local PLACEHOLDERS = {"ROLL.NAME",
|
||||
"EXIF.MONTH.SHORT",
|
||||
"EXIF.DAY",
|
||||
"EXIF.HOUR",
|
||||
"EXIF.HOUR.AMPM", -- Not Implemented
|
||||
"EXIF.MINUTE",
|
||||
"EXIF.SECOND",
|
||||
"EXIF.MSEC",
|
||||
@@ -571,12 +586,23 @@ local PLACEHOLDERS = {"ROLL.NAME",
|
||||
"EXIF.ISO",
|
||||
"EXIF.EXPOSURE",
|
||||
"EXIF.EXPOSURE.BIAS",
|
||||
"EXIF.EXPOSURE.PROGRAM", -- Not Implemented
|
||||
"EXIF.APERTURE",
|
||||
"EXIF.CROP.FACTOR",
|
||||
"EXIF.FOCAL.LENGTH",
|
||||
"EXIF.FOCAL.LENGTH.EQUIV", -- Not Implemented
|
||||
"EXIF.FOCUS.DISTANCE",
|
||||
"IMAGE.EXIF", -- Not Implemented
|
||||
"EXIF.MAKER",
|
||||
"EXIF.MODEL",
|
||||
"EXIF.WHTIEBALANCE", -- Not Implemented
|
||||
"EXIF.METERING", -- Not Implemented
|
||||
"EXIF.LENS",
|
||||
"EXIF.FLASH.ICON", -- Not Implemented
|
||||
"EXIF.FLASH", -- Not Implemented
|
||||
"GPS.LONGITUDE", -- Not Implemented
|
||||
"GPS.LATITUDE", -- Not Implemented
|
||||
"GPS.ELEVATION", -- Not Implemented
|
||||
"GPS.LOCATION.ICON", -- Not Implemented
|
||||
"LONGITUDE",
|
||||
"LATITUDE",
|
||||
"ELEVATION",
|
||||
@@ -585,9 +611,6 @@ local PLACEHOLDERS = {"ROLL.NAME",
|
||||
"RATING.ICONS", -- Not Implemented
|
||||
"LABELS",
|
||||
"LABELS.ICONS", -- Not Implemented
|
||||
"MAKER",
|
||||
"MODEL",
|
||||
"LENS",
|
||||
"TITLE",
|
||||
"DESCRIPTION",
|
||||
"CREATOR",
|
||||
@@ -688,7 +711,7 @@ end
|
||||
|
||||
-- build the argument substitution list from each image
|
||||
|
||||
function dtutils_string.build_substition_list(image, sequence, variable_string, username, pic_folder, home, desktop)
|
||||
function dtutils_string.build_substitute_list(image, sequence, variable_string, username, pic_folder, home, desktop)
|
||||
local old_log_level = log.log_level()
|
||||
log.log_level(dtutils_string.log_level)
|
||||
|
||||
@@ -699,6 +722,8 @@ function dtutils_string.build_substition_list(image, sequence, variable_string,
|
||||
is_api_9_1 = false
|
||||
end
|
||||
|
||||
local is_api_9_4 = dt.configuration.api_version_string >= "9.4.0" and true or false
|
||||
|
||||
local datetime = os.date("*t")
|
||||
local long_month = os.date("%B")
|
||||
local short_month = os.date("%b")
|
||||
@@ -719,11 +744,11 @@ function dtutils_string.build_substition_list(image, sequence, variable_string,
|
||||
string.match(image.exif_datetime_taken, "(%d+):(%d+):(%d+) (%d+):(%d+):(%d+)$")
|
||||
end
|
||||
|
||||
local version_multi = #image:get_group_members() > 1 and image.version or ""
|
||||
local version_multi = #image:get_group_members() > 1 and image.duplicate_index or ""
|
||||
|
||||
local replacements = {image.film.path, -- ROLL.NAME
|
||||
local replacements = {dtutils_string.get_basename(image.film.path),-- ROLL.NAME
|
||||
image.path, -- FILE.FOLDER
|
||||
image.filename, -- FILE.NAME
|
||||
dtutils_string.get_basename(image.filename),-- FILE.NAME
|
||||
dtutils_string.get_filetype(image.filename),-- FILE.EXTENSION
|
||||
image.id, -- ID
|
||||
image.duplicate_index, -- VERSION
|
||||
@@ -749,6 +774,7 @@ function dtutils_string.build_substition_list(image, sequence, variable_string,
|
||||
short_month, -- MONTH.SHORT
|
||||
string.format("%02d", datetime.day), -- DAY
|
||||
string.format("%02d", datetime.hour), -- HOUR
|
||||
"", -- HOUR.AMPM
|
||||
string.format("%02d", datetime.min), -- MINUTE
|
||||
string.format("%02d", datetime.sec), -- SECOND
|
||||
0, -- MSEC
|
||||
@@ -759,6 +785,7 @@ function dtutils_string.build_substition_list(image, sequence, variable_string,
|
||||
os.date("%b", exiftime2systime(image.exif_datetime_taken)), -- EXIF.MONTH.SHORT
|
||||
eday, -- EXIF.DAY
|
||||
ehour, -- EXIF.HOUR
|
||||
"", -- EXIF.HOUR.AMPM
|
||||
emin, -- EXIF.MINUTE
|
||||
esec, -- EXIF.SECOND
|
||||
emsec, -- EXIF.MSEC
|
||||
@@ -767,12 +794,23 @@ function dtutils_string.build_substition_list(image, sequence, variable_string,
|
||||
string.format("%d", image.exif_iso), -- EXIF.ISO
|
||||
string.format("%.0f", 1./image.exif_exposure), -- EXIF.EXPOSURE
|
||||
image.exif_exposure_bias, -- EXIF.EXPOSURE.BIAS
|
||||
"", -- EXIF.EXPOSURE.PROGRAM
|
||||
string.format("%.01f", image.exif_aperture), -- EXIF.APERTURE
|
||||
string.format("%.01f", image.exif_crop),-- EXIF.CROP_FACTOR
|
||||
string.format("%.0f", image.exif_focal_length), -- EXIF.FOCAL.LENGTH
|
||||
string.format("%.0f", image.exif_focal_length * image.exif_crop), -- EXIF.FOCAL.LENGTH.EQUIV
|
||||
image.exif_focus_distance, -- EXIF.FOCUS.DISTANCE
|
||||
"", -- IMAGE.EXIF
|
||||
image.exif_maker, -- EXIF.MAKER
|
||||
image.exif_model, -- EXIF.MODEL
|
||||
is_api_9_4 and image.exif_whitebalance or "", -- EXIF.WHITEBALANCE
|
||||
is_api_9_4 and image.exif_metering_mode or "", -- EXIF.METERING
|
||||
image.exif_lens, -- LENS
|
||||
"", -- EXIF.FLASH.ICON
|
||||
is_api_9_4 and image.exif_flash or "", -- EXIF.FLASH
|
||||
"", -- GPS.LONGITUDE
|
||||
"", -- GPS.LATITUDE
|
||||
"", -- GPS.ELEVATION
|
||||
"", -- GPS.LOCATION.ICON
|
||||
image.longitude or "", -- LONGITUDE
|
||||
image.latitude or "", -- LATITUDE
|
||||
image.elevation or "", -- ELEVATION
|
||||
@@ -781,9 +819,6 @@ function dtutils_string.build_substition_list(image, sequence, variable_string,
|
||||
"", -- RATING.ICONS - wont be implemented
|
||||
labels, -- LABELS
|
||||
"", -- LABELS.ICONS - wont be implemented
|
||||
image.exif_maker, -- MAKER
|
||||
image.exif_model, -- MODEL
|
||||
image.exif_lens, -- LENS
|
||||
image.title, -- TITLE
|
||||
image.description, -- DESCRIPTION
|
||||
image.creator, -- CREATOR
|
||||
@@ -814,6 +849,114 @@ function dtutils_string.build_substition_list(image, sequence, variable_string,
|
||||
log.log_level(old_log_level)
|
||||
end
|
||||
|
||||
dtutils_string.libdoc.functions["get_substitution_tooltip"] = {
|
||||
Name = [[get_substitution_tooltip]],
|
||||
Synopsis = [[get a tooltip that lists the substitution variables]],
|
||||
Usage = [[local ds = require "lib/dtutils.string"
|
||||
ds.get_substitution_tooltip()
|
||||
Description = [[get_substitution_tooltip lists the variables with brief explanations]],
|
||||
Return_Value = [[string - the tooltip]],
|
||||
Limitations = [[]],
|
||||
Example = [[]],
|
||||
See_Also = [[https://docs.darktable.org/usermanual/4.6/en/special-topics/variables/]],
|
||||
Reference = [[]],
|
||||
License = [[]],
|
||||
Copyright = [[]],
|
||||
}
|
||||
|
||||
function dtutils_string.get_substitution_tooltip()
|
||||
|
||||
return table.concat({
|
||||
_("$(ROLL.NAME) - roll of the input image"),
|
||||
_("$(FILE.FOLDER) - folder containing the input image"),
|
||||
_("$(FILE.NAME) - basename of the input image"),
|
||||
_("$(FILE.EXTENSION) - extension of the input image"),
|
||||
_("$(ID) - image ID"),
|
||||
_("$(VERSION) - duplicate version"),
|
||||
_("$(VERSION.IF_MULTI) - same as $(VERSION) but null string if only one version exists"),
|
||||
_("$(VERSION.NAME) - version name from metadata"),
|
||||
_("$(DARKTABLE.VERSION) - current darktable version"),
|
||||
-- _("$(DARKTABLE.NAME) - darktable name"), -- not implemented
|
||||
_("$(SEQUENCE[n,m]) - sequence number, n: number of digits, m: start number"),
|
||||
_("$(WIDTH.SENSOR) - image sensor width"),
|
||||
_("$(HEIGHT.SENSOR) - image sensor height"),
|
||||
_("$(WIDTH.RAW) - RAW image width"),
|
||||
_("$(HEIGHT.RAW) - RAW image height"),
|
||||
_("$(WIDTH.CROP) - image width after crop"),
|
||||
_("$(HEIGHT.CROP) - image height after crop"),
|
||||
_("$(WIDTH.EXPORT) - exported image width"),
|
||||
_("$(HEIGHT.EXPORT) - exported image height"),
|
||||
-- _("$(WIDTH.MAX) - maximum image export width"), -- not implemented
|
||||
-- _("$(HEIGHT.MAX) - maximum image export height"), -- not implemented
|
||||
_("$(YEAR) - year"),
|
||||
_("$(YEAR.SHORT) - year without century"),
|
||||
_("$(MONTH) - month"),
|
||||
_("$(MONTH.LONG) - full month name according to the current locale"),
|
||||
_("$(MONTH.SHORT) - abbreviated month name according to the current locale"),
|
||||
_("$(DAY) - day"),
|
||||
_("$(HOUR) - hour"),
|
||||
-- _("$(HOUR.AMPM) - hour, 12-hour clock"), -- not implemented
|
||||
_("$(MINUTE) - minute"),
|
||||
_("$(SECOND) - second"),
|
||||
_("$(MSEC) - millisecond"),
|
||||
_("$(EXIF.YEAR) - EXIF year"),
|
||||
_("$(EXIF.YEAR.SHORT) - EXIF year without century"),
|
||||
_("$(EXIF.MONTH) - EXIF month"),
|
||||
_("$(EXIF.MONTH.LONG) - full EXIF month name according to the current locale"),
|
||||
_("$(EXIF.MONTH.SHORT) - abbreviated EXIF month name according to the current locale"),
|
||||
_("$(EXIF.DAY) - EXIF day"),
|
||||
_("$(EXIF.HOUR) - EXIF hour"),
|
||||
-- _("$(EXIF.HOUR.AMPM) - EXIF hour, 12-hour clock") .. "\n" .. -- not implemented
|
||||
_("$(EXIF.MINUTE) - EXIF minute"),
|
||||
_("$(EXIF.SECOND) - EXIF second"),
|
||||
_("$(EXIF.MSEC) - EXIF millisecond"),
|
||||
-- _("$(EXIF.DATE.REGIONAL) - localized EXIF date"), -- not implemented
|
||||
-- _("$(EXIF.TIME.REGIONAL) - localized EXIF time"), -- not implemented
|
||||
_("$(EXIF.ISO) - ISO value"),
|
||||
_("$(EXIF.EXPOSURE) - EXIF exposure"),
|
||||
_("$(EXIF.EXPOSURE.BIAS) - EXIF exposure bias"),
|
||||
-- _("$(EXIF.EXPOSURE.PROGRAM) - EXIF exposure program"), -- not implemented
|
||||
_("$(EXIF.APERTURE) - EXIF aperture"),
|
||||
_("$(EXIF.CROP_FACTOR) - EXIF crop factor"),
|
||||
_("$(EXIF.FOCAL.LENGTH) - EXIF focal length"),
|
||||
_("$(EXIF.FOCAL.LENGTH.EQUIV) - EXIF 35 mm equivalent focal length"),
|
||||
_("$(EXIF.FOCUS.DISTANCE) - EXIF focal distance"),
|
||||
_("$(EXIF.MAKER) - camera maker") ..
|
||||
_("$(EXIF.MODEL) - camera model") ..
|
||||
_("$(EXIF.WHITEBALANCE) - EXIF selected white balance") .. -- not implemented
|
||||
_("$(EXIF.METERING) - EXIF exposure metering mode") .. -- not implemented
|
||||
_("$(EXIF.LENS) - lens") ..
|
||||
-- _("$(EXIF.FLASH.ICON) - icon indicating whether flash was used") .. -- not implemented
|
||||
_("$(EXIF.FLASH) - was flash used (yes/no/--)") .. -- not implemented
|
||||
-- _("$(GPS.LONGITUDE) - longitude"),-- not implemented
|
||||
-- _("$(GPS.LATITUDE) - latitude"),-- not implemented
|
||||
-- _("$(GPS.ELEVATION) - elevation"),-- not implemented
|
||||
-- _("$(GPS.LOCATION.ICON) - icon indicating whether GPS location is known"),-- not implemented
|
||||
_("$(LONGITUDE) - longitude"),
|
||||
_("$(LATITUDE) - latitude"),
|
||||
_("$(ELEVATION) - elevation"),
|
||||
_("$(STARS) - star rating as number (-1 for rejected)"),
|
||||
-- _("$(RATING.ICONS) - star/reject rating in icon form"),-- not implemented
|
||||
_("$(LABELS) - color labels as text"),
|
||||
-- _("$(LABELS.ICONS) - color labels as icons"),-- not implemented
|
||||
_("$(TITLE) - title from metadata"),
|
||||
_("$(DESCRIPTION) - description from metadata"),
|
||||
_("$(CREATOR) - creator from metadata"),
|
||||
_("$(PUBLISHER) - publisher from metadata"),
|
||||
_("$(RIGHTS) - rights from metadata"),
|
||||
--_("$(TAGS) - tags as set in metadata settings"),
|
||||
_("$(CATEGORY[n,category]) - subtag of level n in hierarchical tags"),
|
||||
_("$(SIDECAR_TXT) - contents of .txt sidecar file, if present"),
|
||||
_("$(FOLDER.PICTURES) - pictures folder"),
|
||||
_("$(FOLDER.HOME) - home folder"),
|
||||
_("$(FOLDER.DESKTOP) - desktop folder"),
|
||||
-- _("$(OPENCL.ACTIVATED) - whether OpenCL is activated"),
|
||||
_("$(USERNAME) - login name"),
|
||||
-- _("$(NL) - newline"),
|
||||
-- _("$(JOBCODE) - job code for import"),
|
||||
""}, "\n")
|
||||
end
|
||||
|
||||
-- handle different versions of names
|
||||
|
||||
local function check_legacy_vars(var_name)
|
||||
@@ -847,10 +990,11 @@ local function treat(var_string)
|
||||
if string.match(var_string, "CATEGORY%d") or string.match(var_string, "CATEGORY%[") then
|
||||
log.msg(log.info, "substituting for " .. var_string)
|
||||
ret_val = substitutes[var_string]
|
||||
if not ret_val then ret_val = "" end
|
||||
log.msg(log.info, "ret_val is " .. ret_val)
|
||||
|
||||
elseif string.match(var_string, "SEQUENCE%[") then
|
||||
local start, width = string.match(var_string, "(%d+),(%d)")
|
||||
local width, start = string.match(var_string, "(%d+),(%d)")
|
||||
local seq_val = tonumber(substitutes[var])
|
||||
local pat = "%0" .. width .. "d"
|
||||
substitutes[var_string] = string.format(pat, start + (seq_val - 1))
|
||||
|
||||
@@ -86,8 +86,13 @@ function dtutils_system.windows_command(command)
|
||||
local file = io.open(fname, "w")
|
||||
if file then
|
||||
dt.print_log("opened file")
|
||||
command = string.gsub(command, "%%", "%%%%") -- escape % from windows shell
|
||||
file:write(command)
|
||||
file:write("@echo off\n")
|
||||
file:write('for /f "tokens=2 delims=:." %%x in (\'chcp\') do set cp=%%x\n')
|
||||
file:write("chcp 65001>nul\n") -- change the encoding of the terminal to handle non-english characters in path
|
||||
file:write("\n")
|
||||
file:write(command .. "\n")
|
||||
file:write("\n")
|
||||
file:write("chcp %cp%>nul\n")
|
||||
file:close()
|
||||
|
||||
result = dt.control.execute(fname)
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.5.4\n"
|
||||
"Language: de_DE\n"
|
||||
|
||||
494
official/apply_camera_style.lua
Normal file
494
official/apply_camera_style.lua
Normal file
@@ -0,0 +1,494 @@
|
||||
--[[
|
||||
|
||||
apply_camera_style.lua - apply camera style to matching images
|
||||
|
||||
Copyright (C) 2024 Bill Ferguson <wpferguson@gmail.com>.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
]]
|
||||
--[[
|
||||
apply_camera_style - apply darktable camera style to matching images
|
||||
|
||||
apply a camera style corresponding to the camera used to
|
||||
take the image to provide a starting point for editing that
|
||||
is similar to the SOOC jpeg.
|
||||
|
||||
ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT
|
||||
none
|
||||
|
||||
USAGE
|
||||
start the script from script_manager
|
||||
|
||||
BUGS, COMMENTS, SUGGESTIONS
|
||||
Bill Ferguson <wpferguson@gmail.com>
|
||||
|
||||
CHANGES
|
||||
]]
|
||||
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
-- local df = require "lib/dtutils.file"
|
||||
-- local ds = require "lib/dtutils.string"
|
||||
-- local dtsys = require "lib/dtutils.system"
|
||||
local log = require "lib/dtutils.log"
|
||||
-- local debug = require "darktable.debug"
|
||||
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- C O N S T A N T S
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
local MODULE <const> = "apply_camera_style"
|
||||
local DEFAULT_LOG_LEVEL <const> = log.info
|
||||
local TMP_DIR <const> = dt.configuration.tmp_dir
|
||||
local STYLE_PREFIX <const> = "_l10n_darktable camera styles|"
|
||||
|
||||
-- path separator
|
||||
local PS <const> = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
|
||||
-- command separator
|
||||
local CS <const> = dt.configuration.running_os == "windows" and "&" or ";"
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- A P I C H E C K
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
du.check_min_api_version("9.4.0", MODULE) -- camera styles added to darktable 5.0
|
||||
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- I 1 8 N
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- S C R I P T M A N A G E R I N T E G R A T I O N
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
script_data.show = nil -- only required for libs since the destroy_method only hides them
|
||||
|
||||
script_data.metadata = {
|
||||
name = _("apply camera style"), -- name of script
|
||||
purpose = _("apply darktable camera style to matching images"), -- purpose of script
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>", -- your name and optionally e-mail address
|
||||
help = "https://docs.darktable.org/lua/development/lua.scripts.manual/scripts/official/apply_camera_style/" -- URL to help/documentation
|
||||
}
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- L O G L E V E L
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
log.log_level(DEFAULT_LOG_LEVEL)
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- N A M E S P A C E
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
local apply_camera_style = {}
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- G L O B A L V A R I A B L E S
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
apply_camera_style.imported_images = {}
|
||||
apply_camera_style.styles = {}
|
||||
apply_camera_style.log_level = DEFAULT_LOG_LEVEL
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- P R E F E R E N C E S
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- A L I A S E S
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
local namespace = apply_camera_style
|
||||
local acs = apply_camera_style
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- F U N C T I O N S
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
-------------------
|
||||
-- helper functions
|
||||
-------------------
|
||||
|
||||
local function set_log_level(level)
|
||||
local old_log_level = log.log_level()
|
||||
log.log_level(level)
|
||||
return old_log_level
|
||||
end
|
||||
|
||||
local function restore_log_level(level)
|
||||
log.log_level(level)
|
||||
end
|
||||
|
||||
-------------------
|
||||
-- script functions
|
||||
-------------------
|
||||
|
||||
local function process_pattern(pattern)
|
||||
|
||||
local log_level = set_log_level(acs.log_level)
|
||||
|
||||
pattern = string.lower(pattern)
|
||||
-- strip off series
|
||||
pattern = string.gsub(pattern, " series$", "?")
|
||||
-- match a character
|
||||
if string.match(pattern, "?$") then
|
||||
-- handle EOS R case
|
||||
pattern = string.gsub(pattern, "?", ".?")
|
||||
else
|
||||
pattern = string.gsub(pattern, "?", ".")
|
||||
end
|
||||
pattern = string.gsub(pattern, " ", " ?")
|
||||
-- escape dashes
|
||||
pattern = string.gsub(pattern, "%-", "%%-")
|
||||
-- until we end up with a set, I'll defer set processing, i.e. [...]
|
||||
-- anchor the pattern to ensure we don't short match
|
||||
pattern = "^" .. pattern .. "$"
|
||||
|
||||
restore_log_level(log_level)
|
||||
|
||||
return pattern
|
||||
end
|
||||
|
||||
local function process_set(pattern_set)
|
||||
|
||||
local log_level = set_log_level(acs.log_level)
|
||||
|
||||
local to_process = {}
|
||||
local processed = {}
|
||||
|
||||
local base, set, tail
|
||||
|
||||
if string.match(pattern_set, "]$") then
|
||||
base, set = string.match(pattern_set, "(.+)%[(.+)%]")
|
||||
else
|
||||
base, set, tail = string.match(pattern_set, "(.+)%[(.+)%](.+)")
|
||||
end
|
||||
|
||||
log.msg(log.debug, "base is " .. base .. " and set is " .. set)
|
||||
|
||||
to_process = du.split(set, ",")
|
||||
|
||||
for _, item in ipairs(to_process) do
|
||||
local pat = base .. item
|
||||
if tail then
|
||||
pat = pat .. tail
|
||||
end
|
||||
table.insert(processed, process_pattern(pat))
|
||||
end
|
||||
|
||||
restore_log_level(log_level)
|
||||
|
||||
return processed
|
||||
end
|
||||
|
||||
local function get_camera_styles()
|
||||
|
||||
local log_level = set_log_level(acs.log_level)
|
||||
|
||||
-- separate the styles into
|
||||
--
|
||||
-- acs.styles -
|
||||
-- maker -
|
||||
-- styles {}
|
||||
-- patterns {}
|
||||
|
||||
for _, style in ipairs(dt.styles) do
|
||||
|
||||
if string.match(style.name, STYLE_PREFIX) then
|
||||
log.msg(log.debug, "got " .. style.name)
|
||||
|
||||
local parts = du.split(style.name, "|")
|
||||
parts[2] = string.lower(parts[2])
|
||||
log.msg(log.debug, "maker is " .. parts[2])
|
||||
|
||||
if not acs.styles[parts[2]] then
|
||||
acs.styles[parts[2]] = {}
|
||||
acs.styles[parts[2]]["styles"] = {}
|
||||
acs.styles[parts[2]]["patterns"] = {}
|
||||
end
|
||||
if parts[3] then
|
||||
if not string.match(parts[3], "]") then
|
||||
table.insert(acs.styles[parts[2]].styles, style)
|
||||
local processed_pattern = process_pattern(parts[#parts])
|
||||
table.insert(acs.styles[parts[2]].patterns, processed_pattern)
|
||||
log.msg(log.debug, "pattern for " .. style.name .. " is " .. processed_pattern)
|
||||
else
|
||||
local processed_patterns = process_set(parts[3])
|
||||
for _, pat in ipairs(processed_patterns) do
|
||||
table.insert(acs.styles[parts[2]].styles, style)
|
||||
table.insert(acs.styles[parts[2]].patterns, pat)
|
||||
log.msg(log.debug, "pattern for " .. style.name .. " is " .. pat)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
restore_log_level(log_level)
|
||||
|
||||
end
|
||||
|
||||
local function normalize_model(maker, model)
|
||||
|
||||
local log_level = set_log_level(acs.log_level)
|
||||
|
||||
model = string.lower(model)
|
||||
|
||||
-- strip off the maker name
|
||||
if maker == "canon" then
|
||||
model = string.gsub(model, "canon ", "")
|
||||
elseif maker == "hasselblad" then
|
||||
model = string.gsub(model, "hasselblad ", "")
|
||||
elseif maker == "leica" then
|
||||
model = string.gsub(model, "leica ", "")
|
||||
elseif maker == "lg" then
|
||||
model = string.gsub(model, "lg ", "")
|
||||
elseif maker == "nikon" then
|
||||
model = string.gsub(model, "nikon ", "")
|
||||
elseif maker == "nokia" then
|
||||
model = string.gsub(model, "nokia ", "")
|
||||
elseif maker == "oneplus" then
|
||||
model = string.gsub(model, "oneplus ", "")
|
||||
elseif maker == "pentax" then
|
||||
model = string.gsub(model, "pentax ", "")
|
||||
model = string.gsub(model, "ricoh ", "")
|
||||
end
|
||||
|
||||
restore_log_level(log_level)
|
||||
|
||||
return model
|
||||
end
|
||||
|
||||
local function normalize_maker(maker)
|
||||
|
||||
local log_level = set_log_level(acs.log_level)
|
||||
|
||||
maker = string.lower(maker)
|
||||
|
||||
if string.match(maker, "^fujifilm") then
|
||||
maker = "fujifilm"
|
||||
elseif string.match(maker, "^hmd ") then
|
||||
maker = "nokia"
|
||||
elseif string.match(maker, "^leica") then
|
||||
maker = "leica"
|
||||
elseif string.match(maker, "^minolta") then
|
||||
maker = "minolta"
|
||||
elseif string.match(maker, "^nikon") then
|
||||
maker = "nikon"
|
||||
elseif string.match(maker, "^om ") then
|
||||
maker = "om system"
|
||||
elseif string.match(maker, "^olympus") then
|
||||
maker = "olympus"
|
||||
elseif string.match(maker, "^pentax") or string.match(maker, "^ricoh") then
|
||||
maker = "pentax"
|
||||
end
|
||||
|
||||
restore_log_level(log_level)
|
||||
|
||||
return maker
|
||||
end
|
||||
|
||||
local function has_style_tag(image, tag_name)
|
||||
|
||||
local log_level = set_log_level(acs.log_level)
|
||||
|
||||
local result = false
|
||||
|
||||
log.msg(log.debug, "looking for tag " .. tag_name)
|
||||
|
||||
for _, tag in ipairs(image:get_tags()) do
|
||||
log.msg(log.debug, "checking against " .. tag.name)
|
||||
if tag.name == tag_name then
|
||||
log.msg(log.debug, "matched tag " .. tag_name)
|
||||
result = true
|
||||
end
|
||||
end
|
||||
|
||||
restore_log_level(log_level)
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
local function mangle_model(model)
|
||||
|
||||
local log_level = set_log_level(acs.log_level)
|
||||
|
||||
if string.match(model, "eos") then
|
||||
log.msg(log.debug, "mangle model got " .. model)
|
||||
model = string.gsub(model, "r6m2", "r6 mark ii")
|
||||
model = string.gsub(model, "eos 350d digital", "eos kiss digital n")
|
||||
model = string.gsub(model, "eos 500d", "eos rebel t1")
|
||||
model = string.gsub(model, "eos 550d", "eos rebel t2")
|
||||
model = string.gsub(model, "eos 600d", "eos rebel t3i")
|
||||
model = string.gsub(model, "eos 650d", "eos rebel t4i")
|
||||
model = string.gsub(model, "eos 700d", "eos rebel t5")
|
||||
model = string.gsub(model, "eos 750d", "eos rebel t6i")
|
||||
model = string.gsub(model, "eos 760d", "eos rebel t6s")
|
||||
model = string.gsub(model, "eos 100d", "eos rebel t6")
|
||||
model = string.gsub(model, "eos 1100d", "eos rebel t3")
|
||||
model = string.gsub(model, "eos 1200d", "eos rebel t5")
|
||||
model = string.gsub(model, "eos 1300d", "eos rebel t6")
|
||||
model = string.gsub(model, "eos 2000d", "eos rebel t7")
|
||||
log.msg(log.debug, "mandle model returning " .. model)
|
||||
end
|
||||
|
||||
restore_log_level(log_level)
|
||||
|
||||
return model
|
||||
end
|
||||
|
||||
local function stop_job()
|
||||
if acs.job then
|
||||
if acs.job.valid then
|
||||
acs.job.valid = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function apply_style_to_images(images)
|
||||
|
||||
local log_level = set_log_level(acs.log_level)
|
||||
|
||||
acs.job = dt.gui.create_job(_("applying camera styles to images"), true, stop_job)
|
||||
|
||||
for count, image in ipairs(images) do
|
||||
local maker = normalize_maker(image.exif_maker)
|
||||
local model = normalize_model(maker, image.exif_model)
|
||||
model = mangle_model(model)
|
||||
log.msg(log.debug, "got maker " .. maker .. " and model " .. model .. " from image " .. image.filename)
|
||||
|
||||
if acs.styles[maker] then
|
||||
local no_match = true
|
||||
for i, pattern in ipairs(acs.styles[maker].patterns) do
|
||||
if string.match(model, pattern) or
|
||||
(i == #acs.styles[maker].patterns and string.match(pattern, "generic")) then
|
||||
local tag_name = "darktable|style|" .. acs.styles[maker].styles[i].name
|
||||
if not has_style_tag(image, tag_name) then
|
||||
image:apply_style(acs.styles[maker].styles[i])
|
||||
no_match = false
|
||||
log.msg(log.info, "applied style " .. acs.styles[maker].styles[i].name .. " to " .. image.filename)
|
||||
end
|
||||
log.log_level(loglevel)
|
||||
break
|
||||
end
|
||||
end
|
||||
if no_match then
|
||||
log.msg(log.info, "no style found for " .. maker .. " " .. model)
|
||||
end
|
||||
else
|
||||
log.msg(log.info, "no maker found for " .. image.filename)
|
||||
end
|
||||
if count % 10 == 0 then
|
||||
acs.job.percent = count / #images
|
||||
end
|
||||
if dt.control.ending then
|
||||
stop_job()
|
||||
end
|
||||
end
|
||||
|
||||
stop_job()
|
||||
|
||||
restore_log_level(log_level)
|
||||
|
||||
end
|
||||
|
||||
local function apply_camera_style(collection)
|
||||
|
||||
local log_level = set_log_level(acs.log_level)
|
||||
|
||||
local images = nil
|
||||
|
||||
if collection == true then
|
||||
images = dt.collection
|
||||
log.msg(log.info, "applying camera styles to collection")
|
||||
elseif collection == false then
|
||||
images = dt.gui.selection()
|
||||
if #images == 0 then
|
||||
images = dt.gui.action_images
|
||||
end
|
||||
log.msg(log.info, "applying camera styles to selection")
|
||||
end
|
||||
apply_style_to_images(images)
|
||||
|
||||
restore_log_level(log_level)
|
||||
|
||||
end
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- M A I N P R O G R A M
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
get_camera_styles()
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- U S E R I N T E R F A C E
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- D A R K T A B L E I N T E G R A T I O N
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_event(MODULE, "post-import-image")
|
||||
dt.destroy_event(MODULE, "post-import-film")
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- E V E N T S
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
dt.register_event(MODULE, "shortcut",
|
||||
function(event, shortcut)
|
||||
apply_camera_style(true)
|
||||
end, _("apply darktable camera styles to collection")
|
||||
)
|
||||
|
||||
dt.register_event(MODULE, "shortcut",
|
||||
function(event, shortcut)
|
||||
apply_camera_style(false)
|
||||
end, _("apply darktable camera styles to selection")
|
||||
)
|
||||
|
||||
dt.register_event(MODULE, "post-import-image",
|
||||
function(event, image)
|
||||
if image.is_raw then
|
||||
table.insert(acs.imported_images, image)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
dt.register_event(MODULE, "post-import-film",
|
||||
function(event, film)
|
||||
apply_style_to_images(acs.imported_images)
|
||||
acs.imported_images = {}
|
||||
end
|
||||
)
|
||||
|
||||
return script_data
|
||||
@@ -36,8 +36,6 @@ du.check_min_api_version("2.0.0", "check_for_updates")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("check_for_updates", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -47,7 +45,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "check_for_updates",
|
||||
name = _("check for updates"),
|
||||
purpose = _("check for newer darktable releases"),
|
||||
author = "Tobias Ellinghaus",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/check_for_updates"
|
||||
|
||||
@@ -31,8 +31,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("7.0.0", "copy_paste_metadata")
|
||||
|
||||
dt.gettext.bindtextdomain("copy_paste_metadata", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -42,7 +40,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "copy_paste_metadata",
|
||||
name = _("copy paste metadata"),
|
||||
purpose = _("adds keyboard shortcuts and buttons to copy/paste metadata between images"),
|
||||
author = "Tobias Ellinghaus",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/copy_paste_metadata"
|
||||
|
||||
@@ -35,8 +35,6 @@ du.check_min_api_version("2.0.0", "delete_long_tags")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("delete_long_tags", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -46,7 +44,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "delete_long_tags",
|
||||
name = _("delete long tags"),
|
||||
purpose = _("delete all tags longer than a set length"),
|
||||
author = "Tobias Ellinghaus",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/delete_long_tags"
|
||||
|
||||
@@ -39,8 +39,6 @@ end
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("delete_unused_tags", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -50,7 +48,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "delete_unused_tags",
|
||||
name = _("delete unused tags"),
|
||||
purpose = _("delete unused tags"),
|
||||
author = "Tobias Ellinghaus",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/delete_unused_tags"
|
||||
|
||||
@@ -43,8 +43,6 @@ local gettext = dt.gettext.gettext
|
||||
|
||||
du.check_min_api_version("7.0.0", "enfuse")
|
||||
|
||||
dt.gettext.bindtextdomain("enfuse", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -54,7 +52,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "enfuse",
|
||||
name = _("enfuse"),
|
||||
purpose = _("exposure blend images"),
|
||||
author = "Tobias Ellinghaus",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/enfuse"
|
||||
@@ -74,7 +72,7 @@ local function install_module()
|
||||
if not enf.module_installed then
|
||||
dt.register_lib(
|
||||
"enfuse", -- plugin name
|
||||
"enfuse", -- name
|
||||
_("enfuse"), -- name
|
||||
true, -- expandable
|
||||
false, -- resetable
|
||||
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 100}}, -- containers
|
||||
@@ -137,7 +135,7 @@ if enfuse_installed then
|
||||
if version < "4.2" then
|
||||
exposure_mu = dt.new_widget("slider")
|
||||
{
|
||||
label = "exposure mu",
|
||||
label = _("exposure mu"),
|
||||
tooltip = _("center also known as mean of gaussian weighting function (0 <= mean <= 1); default: 0.5"),
|
||||
hard_min = 0,
|
||||
hard_max = 1,
|
||||
@@ -146,7 +144,7 @@ if enfuse_installed then
|
||||
else
|
||||
exposure_mu = dt.new_widget("slider")
|
||||
{
|
||||
label = "exposure optimum",
|
||||
label = _("exposure optimum"),
|
||||
tooltip = _("optimum exposure value, usually the maximum of the weighting function (0 <= optimum <=1); default 0.5"),
|
||||
hard_min = 0,
|
||||
hard_max = 1,
|
||||
@@ -156,7 +154,7 @@ if enfuse_installed then
|
||||
|
||||
local depth = dt.new_widget("combobox")
|
||||
{
|
||||
label = "depth",
|
||||
label = _("depth"),
|
||||
tooltip = _("the number of bits per channel of the output image"),
|
||||
value = dt.preferences.read("enfuse", "depth", "integer"),
|
||||
changed_callback = function(w) dt.preferences.write("enfuse", "depth", "integer", w.selected) end,
|
||||
@@ -165,7 +163,7 @@ if enfuse_installed then
|
||||
|
||||
local blend_colorspace = dt.new_widget("combobox")
|
||||
{
|
||||
label = "blend colorspace",
|
||||
label = _("blend colorspace"),
|
||||
tooltip = _("force blending in selected colorspace"),
|
||||
changed_callback = function(w) dt.preferences.write("enfuse", "blend_colorspace", "string", w.selected) end,
|
||||
"", "identity", "ciecam"
|
||||
|
||||
@@ -40,8 +40,6 @@ require "darktable.debug"
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("generate_image_txt", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -53,7 +51,7 @@ du.check_min_api_version("7.0.0", "generate_image_txt")
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "generate_image_txt",
|
||||
name = _("generate image text"),
|
||||
purpose = _("overlay metadata on the selected image(s)"),
|
||||
author = "Tobias Ellinghaus",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/generate_image_txt"
|
||||
|
||||
@@ -35,8 +35,6 @@ du.check_min_api_version("7.0.0", "image_path_in_ui")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("image_path_in_ui", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
@@ -46,7 +44,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "image_path_in_ui",
|
||||
name = _("image path in UI"),
|
||||
purpose = _("print the image path in the UI"),
|
||||
author = "Jérémy Rosen",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/image_path_in_ui"
|
||||
@@ -65,7 +63,7 @@ local main_label = dt.new_widget("label"){selectable = true, ellipsize = "middle
|
||||
|
||||
local function install_module()
|
||||
if not ipiu.module_installed then
|
||||
dt.register_lib("image_path_no_ui","selected images path",true,false,{
|
||||
dt.register_lib("image_path_no_ui",_("selected images path"),true,false,{
|
||||
[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_LEFT_CENTER",300}
|
||||
}, main_label
|
||||
)
|
||||
|
||||
@@ -34,8 +34,6 @@ local dt = require "darktable"
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("import_filter_manager", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -43,7 +41,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "import_filter_manager",
|
||||
name = _("import filter manager"),
|
||||
purpose = _("manage import filters"),
|
||||
author = "Tobias Ellinghaus",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/import_filter_manager"
|
||||
|
||||
@@ -32,8 +32,6 @@ local dt = require "darktable"
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("import_filters", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -41,7 +39,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "import_filters",
|
||||
name = _("import filters"),
|
||||
purpose = _("import filtering"),
|
||||
author = "Tobias Ellinghaus & Christian Mandel",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/import_filters"
|
||||
|
||||
@@ -40,8 +40,6 @@ du.check_min_api_version("7.0.0", "save_selection")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("save_selection", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -51,7 +49,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "save_selection",
|
||||
name = _("save selection"),
|
||||
purpose = _("shortcuts providing multiple selection buffers"),
|
||||
author = "Jérémy Rosen",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/save_selection"
|
||||
|
||||
@@ -40,8 +40,6 @@ du.check_min_api_version("7.0.0", "selection_to_pdf")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("selection_to_pdf", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -51,7 +49,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "selection_to_pdf",
|
||||
name = _("selection to PDF"),
|
||||
purpose = _("generate a pdf file of selected images"),
|
||||
author = "Jérémy Rosen & Pascal Obry",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/official/selection_to_pdf"
|
||||
@@ -131,7 +129,7 @@ local function destroy()
|
||||
dt.print_log("done destroying")
|
||||
end
|
||||
|
||||
dt.register_storage(_("export_pdf"),_("export thumbnails to pdf"),
|
||||
dt.register_storage("export_pdf", _("export thumbnails to pdf"),
|
||||
nil,
|
||||
function(storage,image_table)
|
||||
local my_title = title_widget.text
|
||||
|
||||
@@ -37,8 +37,6 @@ du.check_min_api_version("7.0.0", "executable_manager")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("executable_manager", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -48,7 +46,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "executable_manager",
|
||||
name = _("executable manager"),
|
||||
purpose = _("manage the list of external executables used by the lua scripts"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/tools/executable_manager"
|
||||
@@ -117,7 +115,7 @@ local function install_module()
|
||||
if not exec_man.module_installed then
|
||||
dt.register_lib(
|
||||
"executable_manager", -- Module name
|
||||
"executable manager", -- Visible name
|
||||
_("executables"), -- Visible name
|
||||
true, -- expandable
|
||||
false, -- resetable
|
||||
{[dt.gui.views.lighttable] = {panel, panel_pos}}, -- containers
|
||||
@@ -201,7 +199,7 @@ exec_man.stack = dt.new_widget("stack"){}
|
||||
-- create a combobox to for indexing into the stack of widgets
|
||||
|
||||
exec_man.selector = dt.new_widget("combobox"){
|
||||
label = "executable",
|
||||
label = _("executable"),
|
||||
tooltip = _("select executable to modify"),
|
||||
value = 1, "placeholder",
|
||||
changed_callback = function(self)
|
||||
|
||||
@@ -15,8 +15,6 @@ du.check_min_api_version("3.0.0", "get_lib_manpages")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("get_lib_manpages", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -90,7 +88,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "get_lib_manpages",
|
||||
name = _("get library man pages"),
|
||||
purpose = _("output the internal library documentation as man pages"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/tools/get_lib_manpages"
|
||||
|
||||
@@ -12,8 +12,6 @@ du.check_min_api_version("3.0.0", "get_libdoc")
|
||||
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
dt.gettext.bindtextdomain("get_libdoc", dt.configuration.config_dir .."/lua/locale/")
|
||||
|
||||
local function _(msg)
|
||||
return gettext(msg)
|
||||
end
|
||||
@@ -64,7 +62,7 @@ end
|
||||
local script_data = {}
|
||||
|
||||
script_data.metadata = {
|
||||
name = "get_libdoc",
|
||||
name = _("get library docs"),
|
||||
purpose = _("retrieve and print the documentation to the console"),
|
||||
author = "Bill Ferguson <wpferguson@gmail.com>",
|
||||
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/tools/get_libdoc"
|
||||
|
||||
@@ -56,14 +56,10 @@ local dtsys = require "lib/dtutils.system"
|
||||
local log = require "lib/dtutils.log"
|
||||
local debug = require "darktable.debug"
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
dt.gettext.bindtextdomain("script_manager", dt.configuration.config_dir .. "/lua/locale/")
|
||||
local gettext = dt.gettext.gettext
|
||||
|
||||
local function _(msgid)
|
||||
return gettext.dgettext("script_manager", msgid)
|
||||
return gettext(msgid)
|
||||
end
|
||||
|
||||
-- api check
|
||||
@@ -136,6 +132,7 @@ sm.event_registered = false
|
||||
|
||||
sm.widgets = {}
|
||||
sm.folders = {}
|
||||
sm.translated_folders = {}
|
||||
|
||||
-- set log level for functions
|
||||
|
||||
@@ -181,6 +178,7 @@ sm.log_level = DEFAULT_LOG_LEVEL
|
||||
]]
|
||||
|
||||
sm.scripts = {}
|
||||
sm.start_queue = {}
|
||||
sm.page_status = {}
|
||||
sm.page_status.num_buttons = DEFAULT_BUTTONS_PER_PAGE
|
||||
sm.page_status.buttons_created = 0
|
||||
@@ -368,8 +366,9 @@ end
|
||||
local function string_trim(str)
|
||||
local old_log_level = set_log_level(sm.log_level)
|
||||
|
||||
local result = string.gsub(str, "^%s+", "")
|
||||
result = string.gsub(result, "%s+$", "")
|
||||
local result = string.gsub(str, "^%s+", "") -- trim leading spaces
|
||||
result = string.gsub(result, "%s+$", "") -- trim trailing spaces
|
||||
result = string.gsub(result, ",?%s+%-%-.+$", "") -- trim trailing comma and comments
|
||||
|
||||
restore_log_level(old_log_level)
|
||||
return result
|
||||
@@ -391,11 +390,42 @@ end
|
||||
-- script handling
|
||||
------------------
|
||||
|
||||
local function is_folder_known(folder_table, name)
|
||||
local match = false
|
||||
|
||||
for _, folder_name in ipairs(folder_table) do
|
||||
if name == folder_name then
|
||||
match = true
|
||||
end
|
||||
end
|
||||
|
||||
return match
|
||||
end
|
||||
|
||||
local function find_translated_name(folder)
|
||||
local translated_name = nil
|
||||
|
||||
if folder == "contrib" then
|
||||
translated_name = _("contributed")
|
||||
elseif folder == "examples" then
|
||||
translated_name = _("examples")
|
||||
elseif folder == "official" then
|
||||
translated_name = _("official")
|
||||
elseif folder == "tools" then
|
||||
translated_name = _("tools")
|
||||
else
|
||||
translated_name = _(folder) -- in case we get lucky and the string got translated elsewhere
|
||||
end
|
||||
|
||||
return translated_name
|
||||
end
|
||||
|
||||
local function add_script_folder(folder)
|
||||
local old_log_level = set_log_level(sm.log_level)
|
||||
|
||||
if #sm.folders == 0 or not string.match(du.join(sm.folders, " "), ds.sanitize_lua(folder)) then
|
||||
if #sm.folders == 0 or not is_folder_known(sm.folders, folder) then
|
||||
table.insert(sm.folders, folder)
|
||||
table.insert(sm.translated_folders, find_translated_name(folder))
|
||||
sm.scripts[folder] = {}
|
||||
log.msg(log.debug, "created folder " .. folder)
|
||||
end
|
||||
@@ -409,8 +439,8 @@ local function get_script_metadata(script)
|
||||
|
||||
log.msg(log.debug, "processing metatdata for " .. script)
|
||||
|
||||
local description = nil
|
||||
local metadata = nil
|
||||
local metadata_block = nil
|
||||
local metadata = {}
|
||||
|
||||
f = io.open(LUA_DIR .. PS .. script .. ".lua")
|
||||
if f then
|
||||
@@ -418,20 +448,20 @@ local function get_script_metadata(script)
|
||||
local content = f:read("*all")
|
||||
f:close()
|
||||
-- grab the script_data.metadata table
|
||||
description = string.match(content, "script_data%.metadata = %{\r?\n(.-)\r?\n%}")
|
||||
metadata_block = string.match(content, "script_data%.metadata = %{\r?\n(.-)\r?\n%}")
|
||||
else
|
||||
log.msg(log.error, "cant read from " .. script)
|
||||
end
|
||||
|
||||
if description then
|
||||
metadata = ""
|
||||
-- format it into a string block for display
|
||||
local lines = du.split(description, "\n")
|
||||
if metadata_block then
|
||||
-- break up the lines into key value pairs
|
||||
local lines = du.split(metadata_block, "\n")
|
||||
log.msg(log.debug, "got " .. #lines .. " lines")
|
||||
local first = 1
|
||||
for i = 1, #lines do
|
||||
log.msg(log.debug, "splitting line " .. lines[i])
|
||||
local parts = du.split(lines[i], " = ")
|
||||
parts[1] = string_trim(parts[1])
|
||||
parts[2] = string_trim(parts[2])
|
||||
log.msg(log.debug, "got value " .. parts[1] .. " and data " .. parts[2])
|
||||
if string.match(parts[2], "%_%(") then
|
||||
parts[2] = _(string_dequote(string_dei18n(parts[2])))
|
||||
@@ -441,14 +471,15 @@ local function get_script_metadata(script)
|
||||
if string.match(parts[2], ",$") then
|
||||
parts[2] = string_chop(parts[2])
|
||||
end
|
||||
metadata = metadata .. string.format("%s%-10s\t%s", first and "" or "\n", parts[1], parts[2])
|
||||
first = nil
|
||||
log.msg(log.debug, "parts 1 is " .. parts[1] .. " and parts 2 is " .. parts[2])
|
||||
metadata[parts[1]] = parts[2]
|
||||
log.msg(log.debug, "metadata " .. parts[1] .. " is " .. metadata[parts[1]])
|
||||
end
|
||||
log.msg(log.debug, "script data is \n" .. metadata)
|
||||
log.msg(log.debug, "script data found for " .. metadata["name"])
|
||||
end
|
||||
|
||||
restore_log_level(old_log_level)
|
||||
return metadata
|
||||
return metadata_block and metadata or nil
|
||||
end
|
||||
|
||||
local function get_script_doc(script)
|
||||
@@ -469,7 +500,7 @@ local function get_script_doc(script)
|
||||
return description
|
||||
else
|
||||
restore_log_level(old_log_level)
|
||||
return "No documentation available"
|
||||
return _("no documentation available")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -517,6 +548,7 @@ local function activate(script)
|
||||
status = true
|
||||
pref_write(script.script_name, "bool", true)
|
||||
end
|
||||
script_manager_running_script = "script_manager"
|
||||
|
||||
restore_log_level(old_log_level)
|
||||
return status
|
||||
@@ -564,6 +596,24 @@ local function deactivate(script)
|
||||
restore_log_level(old_log_level)
|
||||
end
|
||||
|
||||
local function start_scripts()
|
||||
for _, script in ipairs(sm.start_queue) do
|
||||
activate(script)
|
||||
for i = 1, sm.page_status.num_buttons do
|
||||
local name = script.metadata and script.metadata.name or script.name
|
||||
if sm.widgets.labels[i].label == name then
|
||||
sm.widgets.buttons[i].name = "pb_on"
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
sm.start_queue = {}
|
||||
end
|
||||
|
||||
local function queue_script_to_start(script)
|
||||
table.insert(sm.start_queue, script)
|
||||
end
|
||||
|
||||
local function add_script_name(name, path, folder)
|
||||
local old_log_level = set_log_level(sm.log_level)
|
||||
|
||||
@@ -583,7 +633,7 @@ local function add_script_name(name, path, folder)
|
||||
table.insert(sm.scripts[folder], script)
|
||||
|
||||
if pref_read(script.script_name, "bool") then
|
||||
activate(script)
|
||||
queue_script_to_start(script)
|
||||
else
|
||||
pref_write(script.script_name, "bool", false)
|
||||
end
|
||||
@@ -834,7 +884,7 @@ local function install_scripts()
|
||||
|
||||
if count > 0 then
|
||||
update_combobox_choices(sm.widgets.folder_selector, sm.folders, sm.widgets.folder_selector.selected)
|
||||
dt.print(_("scripts successfully installed into folder ") .. folder)
|
||||
dt.print(_(string.format("scripts successfully installed into folder %s"), folder))
|
||||
table.insert(sm.installed_repositories, {name = folder, directory = LUA_DIR .. PS .. folder})
|
||||
update_script_update_choices()
|
||||
|
||||
@@ -913,11 +963,11 @@ local function populate_buttons(folder, first, last)
|
||||
end
|
||||
|
||||
button.image = POWER_ICON
|
||||
label.label = script.name
|
||||
label.label = script.metadata and script.metadata.name or script.name
|
||||
label.name = "pb_label"
|
||||
button.ellipsize = "end"
|
||||
button.sensitive = true
|
||||
label.tooltip = script.metadata and script.metadata or script.doc
|
||||
label.tooltip = script.metadata and script.metadata.purpose or script.doc
|
||||
|
||||
button.clicked_callback = function (this)
|
||||
local cb_script = script
|
||||
@@ -1009,7 +1059,7 @@ local function paginate(direction)
|
||||
last = first + sm.page_status.num_buttons - 1
|
||||
end
|
||||
|
||||
sm.widgets.page_status.label = _(string.format("page %d of %d", cur_page, max_pages))
|
||||
sm.widgets.page_status.label = string.format(_("page %d of %d"), cur_page, max_pages)
|
||||
|
||||
populate_buttons(folder, first, last)
|
||||
|
||||
@@ -1164,7 +1214,7 @@ local function install_module()
|
||||
if not sm.module_installed then
|
||||
dt.register_lib(
|
||||
"script_manager", -- Module name
|
||||
"script manager", -- Visible name
|
||||
_("scripts"), -- Visible name
|
||||
true, -- expandable
|
||||
false, -- resetable
|
||||
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_LEFT_BOTTOM", 100}}, -- containers
|
||||
@@ -1180,6 +1230,7 @@ local function install_module()
|
||||
log.msg(log.debug, "set run to true, loading preferences")
|
||||
load_preferences()
|
||||
scan_repositories()
|
||||
start_scripts()
|
||||
|
||||
restore_log_level(old_log_level)
|
||||
end
|
||||
@@ -1352,7 +1403,7 @@ sm.widgets.disable_scripts = dt.new_widget("button"){
|
||||
|
||||
sm.widgets.install_update = dt.new_widget("box"){
|
||||
orientation = "vertical",
|
||||
dt.new_widget("section_label"){label = _(" ")},
|
||||
dt.new_widget("section_label"){label = " "},
|
||||
dt.new_widget("label"){label = " "},
|
||||
dt.new_widget("label"){label = _("update scripts")},
|
||||
dt.new_widget("label"){label = " "},
|
||||
@@ -1381,10 +1432,10 @@ sm.widgets.folder_selector = dt.new_widget("combobox"){
|
||||
changed_callback = function(self)
|
||||
if sm.run then
|
||||
pref_write("folder_selector", "integer", self.selected)
|
||||
change_folder(self.value)
|
||||
change_folder(sm.folders[self.selected])
|
||||
end
|
||||
end,
|
||||
table.unpack(sm.folders),
|
||||
table.unpack(sm.translated_folders),
|
||||
}
|
||||
|
||||
-- a script "button" consists of:
|
||||
@@ -1407,7 +1458,7 @@ end
|
||||
local page_back = "<"
|
||||
local page_forward = ">"
|
||||
|
||||
sm.widgets.page_status = dt.new_widget("label"){label = _("page:")}
|
||||
sm.widgets.page_status = dt.new_widget("label"){label = _("page") .. ":"}
|
||||
|
||||
sm.widgets.page_back = dt.new_widget("button"){
|
||||
label = page_back,
|
||||
|
||||
Reference in New Issue
Block a user