Valet is an automation system for macOS that runs predefined rules when content of given directory changes.
To create rule you need to subclass valet.Rule
and implement two methods:
when
should return True if rule should be appliedthen
should define actions that rule executes
import valet
class Movies(valet.Rule):
def when(self):
return self.is_movie()
def then(self):
self.move('~/Movies')
valet.run('~/Downloads')
At the end of the file that defines rule for given directory you should run valet pointing to that directory.
Available checks to use in when
method:
name_contains(word)
name_contains_all(*args)
name_contains_any(*args)
extension_in(*args)
is_movie()
is_book()
is_image()
is_comic()
is_dir()
has_tag(tag)
Available actions to use in then
method:
move(to_path)
tag(tag)
open()
add_ctimestamp()
trash()
notify(msg, title='Valet')
rename(new_name)
Just run python <path_to_rule> load
.