tfeldmann / organize

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

can't filter by multiple extensions #149

Closed zany130 closed 2 years ago

zany130 commented 3 years ago

filtering with multiple extensions gives this

organize run
ERROR: 'sh'
Full traceback at: /home/zany130/.cache/organize/log/organize.log

 ╭─zany130@Kiseki in ~ took 132ms
[🔴] × cat /home/zany130/.cache/organize/log/organize.log
File: /home/zany130/.cache/organize/log/organize.log
2021-10-11 22:17:34,799 - organize - ERROR - 'sh'
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/organize/cli.py", line 77, in main
    execute_rules(config.rules, simulate=args["sim"])
  File "/usr/lib/python3.9/site-packages/organize/config.py", line 160, in rules
    rule_filters = list(self.instantiate_filters(rule_item))
  File "/usr/lib/python3.9/site-packages/organize/config.py", line 125, in instantiate_filters
    filter_class = self._get_filter_class_by_name(name)
  File "/usr/lib/python3.9/site-packages/organize/config.py", line 81, in _get_filter_class_by_name
    return self.filter_by_name[self.sanitize_key(name)]
KeyError: 'sh'

 ╭─zany130@Kiseki in ~ took 45ms
 ╰─λ organize config --debug
/home/zany130/.config/organize/config.yaml
Your configuration as seen by the parser:
'rules':
- 'actions':
  - 'move': '~/Scripts'
  'filters':
  - 'extension': !!null 'null'
  - 'sh'
  - 'bat'
  - 'vbs'
  'folders':
  - '~/Downloads'
  - '~/'

Traceback (most recent call last):
  File "/usr/bin/organize", line 33, in <module>
    sys.exit(load_entry_point('organize-tool==1.10.1', 'console_scripts', 'organize')())
  File "/usr/lib/python3.9/site-packages/organize/cli.py", line 65, in main
    config_debug(config_path)
  File "/usr/lib/python3.9/site-packages/organize/cli.py", line 123, in config_debug
    rules = config.rules
  File "/usr/lib/python3.9/site-packages/organize/config.py", line 160, in rules
    rule_filters = list(self.instantiate_filters(rule_item))
  File "/usr/lib/python3.9/site-packages/organize/config.py", line 125, in instantiate_filters
    filter_class = self._get_filter_class_by_name(name)
  File "/usr/lib/python3.9/site-packages/organize/config.py", line 81, in _get_filter_class_by_name
    return self.filter_by_name[self.sanitize_key(name)]
KeyError: 'sh'
zany130 commented 2 years ago

Fixed it by adding spacing to before the - after extensions