music_cities
New Member
- Joined
- Nov 2, 2024
- Messages
- 6
- Lightroom Version Number
- 14.0.1
- Operating System
- macOS 13 Ventura
Hello everyone. I'm revisiting an old topic, and @John R Ellis has been helpful before but I can't find the thread so I'll just start a new one, since I also seem to have lost my previous LRQueen account login.
Anyway, I'm writing plugins now because I can now ask ChatGPT to write a plugin. ChatGPTs version won't usually work but at least there won't be any syntax errors, and you can tweak it, or ask ChatGPT for help on specific sections of code that didn't work as expected. It's kind of like having an experienced Lua Plugin programmer beside you who's a bit of a ditz, or maybe just confused or overly optimistic.
The Lua API won't allow moving of files. So, I've written a bash script that builds another bash script that moves the files into a date folder heirarchy, and it also outputs two text lists, one of the original file paths, and another of the eventual new file paths. It takes into account .xmp and .jpg sidecar files (for raw+jpeg)
My workflow is to
1) run the first bash script `move_photos_to_date_folder.sh` which doesn't actually move anything, but produces the output files
2) use the Plugin `PhotoCollectionCreator` (which chaptgpt wrote flawlessly first try) to create a collection of the files I'm going to move by parsing the text file output. The idea is that I can later 'select all' in this collection, to remove the orphans from my catalog interactively using the menu Photo -> Remove Photos From Catalog.
3) run the script `move_commands.sh` which actually moves the files to their new location YYYY/YYYY-MM-DD
4) use the Plugin `PhotoCollectionCreator` again to create a collection of the files in their new location, which will also (very slowly, one-by-one, overnight) import the new files into the catalog ( it took a second iteration with ChatGPT to change this plugin to import any photo listed that wasn't yet in the catalog).
I'm working on it in GitHub, here, but it's NOT FINISHED https://github.com/jeabraham/lightroom_utilities/. Maybe by the time you read this it will be done.
Anyway, I'd be interested in doing it all in a Plugin, without the bash scripts. I guess the plugin can move the file, and perhaps could move the .xmp and .jpg sidecar files too. And, I already know it can import the new file, and I'm pretty sure it would see the .xmp when it imports? Can we copy-and-paste settings from the old one to the new one programatically, instead of relying on the .xmp? I think I saw that @John R Ellis suggested stacking the new file with the old one, but I think that was for collection memberships not photo settings that get stored in the .xmp.
I imagine a plugin LUA program might be able to iterate over the selected photos and:
1) write the photo's .xmp file
2) add the origin photo to a collection called "moved from — to be deleted"
3) copy the photo, its .xmp file, and (if it's RAW+JPEG) its sidecar jpg file to a new folder.
4) import the copied photo to the catalog (slow, I know), which would hopefully get the metadata from the .xmp
5) add the new photo to a collection called "moved to"
If this works, I think the missing parts are only the collection memberships, including books. (?) I think the idea of stacking the photos in a stack, and then deleting the original, was to have the newly imported photos (in their new locations) inherit the originals collection membership through the stacking?
Anyway, I just thought I'd revisit this topic of moving photos programatically, now that we can all be more productive as programmers since we have AI to help us write code. Let me know what you think.
Anyway, I'm writing plugins now because I can now ask ChatGPT to write a plugin. ChatGPTs version won't usually work but at least there won't be any syntax errors, and you can tweak it, or ask ChatGPT for help on specific sections of code that didn't work as expected. It's kind of like having an experienced Lua Plugin programmer beside you who's a bit of a ditz, or maybe just confused or overly optimistic.
The Lua API won't allow moving of files. So, I've written a bash script that builds another bash script that moves the files into a date folder heirarchy, and it also outputs two text lists, one of the original file paths, and another of the eventual new file paths. It takes into account .xmp and .jpg sidecar files (for raw+jpeg)
My workflow is to
1) run the first bash script `move_photos_to_date_folder.sh` which doesn't actually move anything, but produces the output files
2) use the Plugin `PhotoCollectionCreator` (which chaptgpt wrote flawlessly first try) to create a collection of the files I'm going to move by parsing the text file output. The idea is that I can later 'select all' in this collection, to remove the orphans from my catalog interactively using the menu Photo -> Remove Photos From Catalog.
3) run the script `move_commands.sh` which actually moves the files to their new location YYYY/YYYY-MM-DD
4) use the Plugin `PhotoCollectionCreator` again to create a collection of the files in their new location, which will also (very slowly, one-by-one, overnight) import the new files into the catalog ( it took a second iteration with ChatGPT to change this plugin to import any photo listed that wasn't yet in the catalog).
I'm working on it in GitHub, here, but it's NOT FINISHED https://github.com/jeabraham/lightroom_utilities/. Maybe by the time you read this it will be done.
Anyway, I'd be interested in doing it all in a Plugin, without the bash scripts. I guess the plugin can move the file, and perhaps could move the .xmp and .jpg sidecar files too. And, I already know it can import the new file, and I'm pretty sure it would see the .xmp when it imports? Can we copy-and-paste settings from the old one to the new one programatically, instead of relying on the .xmp? I think I saw that @John R Ellis suggested stacking the new file with the old one, but I think that was for collection memberships not photo settings that get stored in the .xmp.
I imagine a plugin LUA program might be able to iterate over the selected photos and:
1) write the photo's .xmp file
2) add the origin photo to a collection called "moved from — to be deleted"
3) copy the photo, its .xmp file, and (if it's RAW+JPEG) its sidecar jpg file to a new folder.
4) import the copied photo to the catalog (slow, I know), which would hopefully get the metadata from the .xmp
5) add the new photo to a collection called "moved to"
If this works, I think the missing parts are only the collection memberships, including books. (?) I think the idea of stacking the photos in a stack, and then deleting the original, was to have the newly imported photos (in their new locations) inherit the originals collection membership through the stacking?
Anyway, I just thought I'd revisit this topic of moving photos programatically, now that we can all be more productive as programmers since we have AI to help us write code. Let me know what you think.