Closed selimovd closed 5 months ago
Hi,
I'm glad you find the script useful.
I think what you're trying to do is already possible with v0.4. It allows you to define negative --album-levels
values, enabling you to define the number of folder levels to use for album name creation from the bottom up.
So if your complete external library always has the folders you want to become albums at the bottom of your folder tree, simply setting --album-levels
to -1
should do the trick. Also take a look at the last example in How it works for an example of negative --album-levels
values as well as issue #7.
Let me know your use case is satisfied with this function.
Best Regards, Salvoxia
I checked the option, but I don't think it works for me. I have one more pattern, that I didn't mention on top and wouldn't work for this approach. For some trips I have different sub-folders, for example when I shared pictures with a few friends or took my DSLR and my phone. Then it would look like this:
/external_libs/photos/2020/2020 - 02 Skiing/Johns Pictures
/external_libs/photos/2020/2020 - 02 Skiing/my Phone
/external_libs/photos/2020/2020 - 02 Skiing/my DSLR
I think this option would destroy the approach with the -1 value. For that reason I think the only option is to name the album after a specific level. In my case it's always Level 2, here "2020 - 02 Skiing" with all the pictures in that album.
But when I think about it now, this would also mean I only want level 2 to be made into albums. Otherwise I get "my Phone" or "my DSLR" as own albums
I see, so the prerequisite for using this function does not hold.
I updated the script to now support arbitrary ranges in the folder structure for album name creation. You can either pass a number for --album-levels
as usual, or you can pass a range as a combination of startLevel
and endLevel
separated by a comma ,
like this: --album-levels 2,2
This translates to "take the second folder below root_path
until the second folder below root_path
". So it would only take the second sub-folder in the folder structure.
You could also go from the bottom of the folder structure like this --album-levels=-2,-2
, which translates to "take the second to last folder below root_path
until the second to last folder below root_path
".
Of course you could also specify any range like --album-levels 2,3
or --album-levels=-4,-2
, depending on how your external library looks like.
This change is only present in the dev branch for testing, as well as in the edge tagged Docker image. Please test if the new function works as intended and is suitable for your use case.
Best Regards, Salvoxia
I took some time to test the script. It works pretty well!
There is one thing I discovered, but I can live with it. Let's say I have a picture in the main folder, for example:
/external_libs/photos/2020/2020 - 02 Skiing/picture1.jpg
/external_libs/photos/2020/2020 - 02 Skiing/picture2.jpg
/external_libs/photos/2020/2020 - 02 Skiing/picture3.jpg
/external_libs/photos/2020/2020 - 08 Summer at the beach/beach1.jpg
/external_libs/photos/2020/2020 - 08 Summer at the beach/beach2.jpg
/external_libs/photos/2020/MyRandomPicture.jpg
At the moment when I have a picture in the main folder, like "MyRandomPicture.jpg" in 2020, then still an album "2020" is created. For that's fine as I had this case only once by accident. But I'm not sure if it should be like that. Except for that it works pretty solid.
By the way, I wrote a script to loop through all albums and delete them. Do you want me to add it to the repository? Otherwise I will publish it myself, but I think other people could use it as well.
Thanks for testing!
Yes, at the moment the behavior is to limit any --album-levels
setting to the available number of folder levels and include that as a fallback rather than ignore what doesn't fit.
As for the album delete script: I only use Immich with an external library and that's it. But I imagine other people out there use some kind of mix between automatically backing up pictures from their mobile devices to Immich as well as using external libraries. For these people, a script that simply deletes all albums might not be refined enough. I don't know how much work you'd be willing to put into it. I envision some kind of "rollback" functionality for the script, i.e. instead of adding images to albums removing images from the albums that would otherwise be created (that should be possible by simply using a different API call), and if the album is empty at the end, remove the album completely. That way the script would not interfere with albums that have nothing to do with external libraries. I would happily accept such a PR.
But I also understand if you don't want to put up that kind of effort. In that case I'd prefer you publishing it yourself, and I'd link your repo in this readme for anyone looking using this script and looking to easily get rid of all created albums.
Hello everyone,
first of all thank you for this great piece of software. I wouldn't be able to handle my pictures from a 15 years history without this script.
My problem is, that I sorted my pictures by year and then I included the year name in the folder. For example:
The script now always adds the first level folder name to the album. For example, my folders are now called:
I would appreciate it, if you could implement an option to only keep the naming of the actual folder without the inclusion of the parent, as I named them already properly. Still I want to be able to decide the level, but just for the naming I don't want to include the parent name.
Thank you and best regards