tfeldmann / organize

The file management automation tool.
http://organize.readthedocs.io
MIT License
2.29k stars 129 forks source link

Filter: Hashtags #1

Open xeor opened 6 years ago

xeor commented 6 years ago

I'm the author of another project (https://github.com/xeor/taggo), which aims to solve a problem where that ends up needing many of the same ideas as this one. In the middle of a little rewrite now, but you get the idea by looking at it.

The basics idea we are both solving:

organize are:

taggo are:

Would it be meaningful to try to join these two projects under the same umbrella? Maybe create a github org and make something that solves both problems..?

Feel free to say no, there are still a lot of ideas we can share..

A joint efford could:

What do you think? Feel free to contact me at: lars {dot} solberg at gmail

tfeldmann commented 6 years ago

Hi, really cool project you have there!

The django-style filter declarations are awesome and something I want to include into organize sometime. The exif support is really cool, too.

If I see this correctly, you could have the taggo functionality in organize with the following config:

# imaginary config. TaggoFile, Exif, MD5, FileSize, Symlink not yet implemented
rules:
  - folders: ~/Desktop
    filters:
      - TaggoFile
      - Exif:
          camera__contains: 'Nikon'
      - Extension
      - MD5
      - FileSize:
          bigger: 5 MB
    actions:
      # symlink into folders by tags and add md5 sum to filename
      - Symlink: '~/tags/{taggofile.tags.as_path}/{path.stem}.{md5}.{extension}'

Needed / enhancements:

Am I missing something else in terms of functionality? What do you think of this?

To be honest I'm still skeptical about adding hashtags to your filenames - I know of some cases where windows has problems with this. This is a very opinionated way of organizing files - as a filter for organize that's fine, but I do not want to make this a central assumption in the tool.

xeor commented 6 years ago

Yea, a config like that would probably do it. I'm actually thinking about just using jmespath on the metadata I collect for now. Confusing to have both filter-types, at least in the beginning. Will probably add it back later tho :)

Not sure what you saw, but some things that are important, at least for my use of this is:

I was sceptical at first as well, but I have had no problem having # in filenames, not on windows, linux or osx. I'm tagging a lot of files this way. Even for ignoring files in .gitignore.

After twitter and the "hashtag" term got here, it also feels natural to add them, not only for me, but for non-tech people as well. The only problems is in terminals, where you haveto put the filename in ticks, or escape the character.

What I ment wasnt it to be a "central assumption in the tool", but rather something to support. If this is worth looking into, I think it should:

I think it would be easier to start the project with the right assumptions tho. So if you are keen, we can create a new org on github and create this as a joint effort. Then, when it is ready, we can deprecate both projects and refer to the new one that supports it all 🥇

tfeldmann commented 6 years ago

I thought about this and I think it is possible to integrate this functionality into organize with only some small modifications to the core.

The only problem with the current core is the support for multiple hashtags in a name.

So my syntax proposal is:

rules:
  - folders: ~/Desktop
    filters:
      - Hashtags: 'people-john,stars>4,USA'
    actions:
      - Symlink: '~/tags/{item.as_path}/'
    with_items:
      - hashtags

I think this would be a really nice solution and I added it to the project's wishlist.

To your other points:

xeor commented 6 years ago

Cool.. Glad to see you saw this as something useful. :)

Not thinking about creating from scratch, most of whats needed is already in place. And I think your project is ahead of mine when it comes to structure. So organize should be the template.

I didn't reach out just to add hashtag support, I reached out to ask if you wanted to create an github org where the project can live in, and we can work on a single codebase. Since we already share the basic idea.

Currently, the CLI is most useful for testing, and one-off commands renaming a tag. But it gives enormous flexibilities when using the tool. Maybe someone wants to use it in a shell-script. Maybe someone wants to create an alias that is a shortcut to symlinking everything from . to a special folder. Maybe someone want's it as an easy thing to do in a container..

I'm almost done with a rewrite to further separate the logic even more, making it much easier to use it as a library, so people can use it in native python-code.

Let's think for a week or so :) Maybe it doesn't make sense after all.. It would however be nice to have 1 tool to rule them all, that it might end up being..