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

Rule ignoring «contains: screenshot» #176

Closed
iburunat opened this issue Feb 9, 2022 · 11 comments
Closed

Rule ignoring «contains: screenshot» #176

iburunat opened this issue Feb 9, 2022 · 11 comments

Comments

@iburunat
Copy link

iburunat commented Feb 9, 2022

This rule ignores any screenshot files in the pertinent folder.
Maybe somebody can see where the error is?
I need the rule to target any file whose filename contains screenshot.

  - name: "move screenshots to temp folder"
    locations: '~/OneDrive/Pictures/Camera Roll/'
    subfolders: false
    enabled: true
    filters:
      - extension:
        - png
        - jpg
        - jpeg
      - name:
          contains: screenshot
          case_sensitive: false
    actions:
      - move:
          dest: "~/Pictures/album/TEMP/"
          on_conflict: rename_new
          rename_template: "{name}_{counter}{extension}"
@tfeldmann
Copy link
Owner

tfeldmann commented Feb 9, 2022

Just tried it and cannot reproduce. Are you sure there are screenshot files in the given location?
Maybe you need to enable subfolders?

@iburunat
Copy link
Author

iburunat commented Feb 9, 2022

That's strange.
I have the following files in the origin folder:

image

And when I simulate or run organice, it spits Nothing to do.

@iburunat
Copy link
Author

iburunat commented Feb 9, 2022

I really don't wish to enable subfolders, because this would mean applying the rule on other screenshots located in subfolders (which I don't need to process).

Note: even enabling subfolders, it won't work either.

@tfeldmann
Copy link
Owner

tfeldmann commented Feb 9, 2022

What is the output of ls "~/OneDrive/Pictures/Camera Roll/" in your shell?

@iburunat
Copy link
Author

iburunat commented Feb 9, 2022

ls: ~/OneDrive/Pictures/Camera Roll/: No such file or directory

Of course if I do:

ls ~/OneDrive/Pictures/Camera\ Roll

It lists all the folders and files in there.

Note: I have other rules targetting other files in the same folder which work.

@tfeldmann
Copy link
Owner

This is very strange, works perfectly here. Really cannot explain it so far.

❯ tree ~/Desktop/issue-\#176 
/Users/tf/Desktop/issue-#176
├── Screenshot1.jpg
├── abcScreenshotabc.jpg
├── abcscreenshot.jpg
└── screenshot.jpg

0 directories, 4 files

❯ organize sim .configs/28-issue-176.yaml         
organize 2.0.8
Config: ".configs/28-issue-176.yaml"

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ SIMULATION                                                                                                                                                  │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

⚙ move screenshots to temp folder ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
/Users/tf/Desktop/issue-#176
  abcScreenshotabc.jpg 
    - (move) Move to /Users/tf/Pictures/album/TEMP/abcScreenshotabc.jpg
  screenshot.jpg 
    - (move) Move to /Users/tf/Pictures/album/TEMP/screenshot.jpg
  Screenshot1.jpg 
    - (move) Move to /Users/tf/Pictures/album/TEMP/Screenshot1.jpg
  abcscreenshot.jpg 
    - (move) Move to /Users/tf/Pictures/album/TEMP/abcscreenshot.jpg

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ SIMULATION                                                                                                                                                  │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

success 4 / fail 0

❯ cat .configs/28-issue-176.yaml 
rules:
  - name: "move screenshots to temp folder"
    locations: "~/Desktop/issue-#176"
    subfolders: false
    enabled: true
    filters:
      - extension:
          - png
          - jpg
          - jpeg
      - name:
          contains: screenshot
          case_sensitive: false
    actions:
      - move:
          dest: "~/Pictures/album/TEMP/"
          on_conflict: rename_new
          rename_template: "{name}_{counter}{extension}"

Which OS + version are you on?

@iburunat
Copy link
Author

iburunat commented Feb 9, 2022

Now I see the problem. This rule is conflicting with another one (which comes later in the YAML, which is strange, because I thought the processing was sequential). When I comment it out, it works fine. Otherwise, it returns nothing to do. Will inspect it later and come back with some insights :D

@iburunat
Copy link
Author

iburunat commented Feb 9, 2022

I forgot to answer the OS version earlier: MacOS Catalina 10.15.7
Found the line that is interfering but can't explain why:

rules:
  - name: "/CAMERAROLL > TEMP {SCREENSHOTS}"
    locations: '~/OneDrive/Pictures/Camera Roll/'
    subfolders: false
    enabled: true
    filters:
      - extension:
        - png
        - jpg
        - jpeg
      - name:
          contains: screenshot
          case_sensitive: false
    actions:
      - move:
          dest: "~/Pictures/album/TEMP/"
          on_conflict: rename_new
          rename_template: "{name}_{counter}{extension}"

# ----------------------------------------------------------------------------------|
  - name: "/CAMERAROLL > TEMP {IMAGES}"
    locations:
     - path: '~/OneDrive/Pictures/Camera Roll'
       exclude_files: ['*Screenshot*.*', '*screenshot*.*']  # <---- if commented, it works.
    subfolders: false
    enabled: true
    filters:
      - extension:
        - jpg
        - png
        - jpeg
    actions:
     - move:
         dest: "~/Pictures/album/TEMP/"
         on_conflict: rename_new
         rename_template: "{name}_{counter}{extension}"

If the line exclude_files: ['*Screenshot*.*', '*screenshot*.*'] is commented in the second rule, the first rule works. How can a distinct rule interfere like this as if if was ignoring screenshot for all rules?

@tfeldmann
Copy link
Owner

That's a bug! And a strange one. I'll look into this 👌👌

@tfeldmann
Copy link
Owner

tfeldmann commented Feb 10, 2022

Should be fixed in v2.0.9! Thanks for reporting and for the detective work!

@iburunat
Copy link
Author

Fantastic work, thanks. This issue is fixed. I have another one for which I will open a new issue.
Also congrats on the new look for the output, very pleasant to look at and visually parse.

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

No branches or pull requests

2 participants