alvistar / immich-albums

Create immich albums from folder structure
MIT License
38 stars 7 forks source link

fix: recursion visiting sub folders more than once #16

Closed fvdnabee closed 4 weeks ago

fvdnabee commented 1 month ago

Prior to the fix, sub folders are visited multiple times when recursion is enabled. In the added test each first level folder is visited twice and each second level folder is visited four times.

test_recursion output prior to fix

```Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/A Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/A/1 Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/A/2 Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/A/1 Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/A/2 Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/B Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/B/3 Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/B/3 Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/A Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/A/1 Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/A/2 Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/A/1 Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/A/2 Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/B Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/B/3 Processing folder: /tmp/pytest-of-fvdnabee/pytest-0/test_recursion_v20/albums/B/3 ```

alvistar commented 4 weeks ago

This is in as well, I messed a little with merging and remerged now