Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent chronological order Issue in File Renaming #354

Closed
iburunat opened this issue Feb 15, 2024 · 6 comments
Closed

Consistent chronological order Issue in File Renaming #354

iburunat opened this issue Feb 15, 2024 · 6 comments
Labels

Comments

@iburunat
Copy link

iburunat commented Feb 15, 2024

Describe the bug
I consistently face an issue where file renaming with counter (on_conflict: rename_new) results in an order that doesn't align with the original chronological sequence, but a random order, of the files.

Environment

  • OS: MacOs 14.1.1
  • Output of organize --version: organize v3.1.1

Your config file
The first rule involves resizing an image with the "_r" suffix, transferring metadata from the original file to the newly resized file, synchronizing the timestamp of the resized file with the original file's, moving the original file to the Trash, and ultimately removing the "_r" suffix from the preprocessed file, thereby replacing the original image with the resized version.

The second rule renames the preprocessed photos with year-month-day_counter and sorts them in date folders. Here the counter seems to be random.

# ----------------------------------------------------------------------------------|
  - name: "{IMAGES} {processing + moves to folder2}"
    locations:
      - path: '~/Pictures/album/folder1/'
    subfolders: false
    enabled: true
    filters:
      - extension:
          - jpg
          - png
          - jpeg
          - heic
    actions:
      - shell: |
          magick "{path}" -resize '1440x1440>' "{path.parent}/{path.stem}_r.{extension.lower()}"
          exiftool -tagsFromFile "{path}" "{path.parent}/{path.stem}_r.{extension.lower()}"
          touch -r "{path}" "{path.parent}/{path.stem}_r.{extension.lower()}"
          mv "{path.parent}/{path.stem}_r.{extension.lower()}_original" ~/.Trash
          mv "{path}" ~/.Trash
          mv "{path.parent}/{path.stem}_r.{extension.lower()}" "{path.parent}/{path.stem}.{extension.lower()}"
      - move:
          dest: "~/Pictures/album/folder2/"
          on_conflict: rename_new
          rename_template: "{name}_{counter}{extension}"
# ----------------------------------------------------------------------------------|
  - name: "{IMAGES} {renames & moves to specific date folder}"
    locations:
      - path: '~/Pictures/album/folder2/'
    subfolders: false
    enabled: true
    filters:
      - created
      - extension:
          - jpg
          - png
          - jpeg
          - heic
    actions:
      - move: # and rename
          dest: "~/Pictures/album/{created.strftime('%Y-%m-%d')}/{created.strftime('%Y-%m-%d')}.{extension.lower()}"
          on_conflict: rename_new
          rename_template: "{name}_{counter}{extension}"
@iburunat iburunat added the bug label Feb 15, 2024
@tfeldmann
Copy link
Owner

Thanks for the detailed report. What do you mean by the counter being "random"? The files are handled in the order they are visited, which depends on the filesystem and is not always alphabetically correct.

@iburunat
Copy link
Author

Exactly. So for instance, my list of photos is this one:

Screenshot 2024-02-18 at 20 50 42

Which after the processing gets converted into this:

Screenshot 2024-02-18 at 20 50 55

However, the rearranged photos deviate from the original sequential (chronological) order. Consequently, when navigating through the converted photos, they exhibit time jumps, creating a rather frustrating browsing experience.

Is there a way to tell Organize to follow a strict handling order?

@tfeldmann
Copy link
Owner

I see the problem. This should really be handled in alphabetical order. I'm on it.

@iburunat
Copy link
Author

Thank you! I intended to mean alphabetical order, as the photo file names naturally align with the chronological order.

@tfeldmann
Copy link
Owner

I decided to use natsort for this, so the files are sorted just like in the system file explorer. The fix is already on the main branch and will be released soon. Thanks again for the issue!

@tfeldmann
Copy link
Owner

Just released the fixed version in v3.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants