dsoprea / PyInotify

An efficient and elegant inotify (Linux filesystem activity monitor) library for Python. Python 2 and 3 compatible.
GNU General Public License v2.0
246 stars 74 forks source link

Recursively watch a list of paths/trees #17

Closed cbalfour closed 8 years ago

cbalfour commented 8 years ago

I needed to be able to recursively monitor a few paths which are not located off a common root. InotifyTree can only take a single path.

Added InotifyTrees class with new constructor and __load_trees() method to add a list of paths to be monitored.

dsoprea commented 8 years ago

I'd like you to adjust your implementation. Please move all original functionality to a class called BaseTree. The InotifyTree and InotifyTrees classes should inherit from this. Move __load_tree into InotifyTree and your __load_trees into InotifyTrees. They'll both share the event_gen method in the base-class.

One class should not inherit another just to mask the constructor with another version (which is never a good idea, nor is changing the method signature) as well as to replace most of the functionality. We're just moving what little is shared into a base-class. The whole thing is much more simpler/intuitive that way.

Thanks for submitting the PR. It was an insightful add.

cbalfour commented 8 years ago

Thanks for the constructive feedback. I'll implement your suggestions and do a new PR.

smd1000 commented 8 years ago

Any chances of this getting merged? I could actually use this feature.

dsoprea commented 8 years ago

See #18.