diff --git a/python_apps/media-monitor2/media/monitor/events.py b/python_apps/media-monitor2/media/monitor/events.py index 13e369c65..5169ba086 100644 --- a/python_apps/media-monitor2/media/monitor/events.py +++ b/python_apps/media-monitor2/media/monitor/events.py @@ -91,9 +91,9 @@ class BaseEvent(Loggable): class FakePyinotify(object): """ - sometimes we must create our own pyinotify like objects to instantiate - objects from the classes below whenever we want to turn a single event into - multiple events + sometimes we must create our own pyinotify like objects to + instantiate objects from the classes below whenever we want to turn + a single event into multiple events """ def __init__(self, path): self.pathname = path diff --git a/python_apps/media-monitor2/media/monitor/listeners.py b/python_apps/media-monitor2/media/monitor/listeners.py index ded376242..a0aecc443 100644 --- a/python_apps/media-monitor2/media/monitor/listeners.py +++ b/python_apps/media-monitor2/media/monitor/listeners.py @@ -125,14 +125,15 @@ class StoreWatchListener(BaseListener, Loggable, pyinotify.ProcessEvent): def process_IN_MOVED_FROM(self, event): # Is either delete dir or delete file evt = self.process_delete(event) - if hasattr(event,'cookie'): EventRegistry.register(evt) + # evt can be none whenever event points that a file that would be + # ignored by @IncludeOnly + if hasattr(event,'cookie') and (evt != None): + EventRegistry.register(evt) def process_IN_DELETE(self,event): self.process_delete(event) def process_IN_MOVE_SELF(self, event): if '-unknown-path' in event.pathname: event.pathname = event.pathname.replace('-unknown-path','') self.delete_watch_dir(event) - # Capturing modify events is too brittle and error prone - # def process_IN_MODIFY(self,event): self.process_modify(event) def delete_watch_dir(self, event): e = DeleteDirWatch(event) diff --git a/python_apps/media-monitor2/media/monitor/manager.py b/python_apps/media-monitor2/media/monitor/manager.py index 0772c653e..db222063e 100644 --- a/python_apps/media-monitor2/media/monitor/manager.py +++ b/python_apps/media-monitor2/media/monitor/manager.py @@ -77,11 +77,12 @@ class Manager(Loggable): """ creates an organizer at new destination path or modifies the old one """ - # We avoid creating new instances of organize because of the way it - # interacts with pydispatch. We must be careful to never have more than - # one instance of OrganizeListener but this is not so easy. (The - # singleton hack in Organizer) doesn't work. This is the only thing - # that seems to work. + # TODO : find a proper fix for the following hack + # We avoid creating new instances of organize because of the way + # it interacts with pydispatch. We must be careful to never have + # more than one instance of OrganizeListener but this is not so + # easy. (The singleton hack in Organizer) doesn't work. This is + # the only thing that seems to work. if self.organize['organizer']: o = self.organize['organizer'] o.channel = self.organize_channel diff --git a/python_apps/media-monitor2/media/monitor/organizer.py b/python_apps/media-monitor2/media/monitor/organizer.py index c901082f2..99302f171 100644 --- a/python_apps/media-monitor2/media/monitor/organizer.py +++ b/python_apps/media-monitor2/media/monitor/organizer.py @@ -7,11 +7,12 @@ from media.monitor.exceptions import BadSongFile class Organizer(ReportHandler,Loggable): """ - Organizer is responsible to to listening to OrganizeListener events and - committing the appropriate changes to the filesystem. It does not in any - interact with WatchSyncer's even when the the WatchSyncer is a "storage - directory". The "storage" directory picks up all of its events through - pyinotify. (These events are fed to it through StoreWatchListener) + Organizer is responsible to to listening to OrganizeListener events + and committing the appropriate changes to the filesystem. It does + not in any interact with WatchSyncer's even when the the WatchSyncer + is a "storage directory". The "storage" directory picks up all of + its events through pyinotify. (These events are fed to it through + StoreWatchListener) """ _instance = None