From 6b0b0bd4a476223875fed04783decf99fa0c3a48 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 4 Sep 2012 09:16:32 -0400 Subject: [PATCH] MM2: Removed useless code. --- .../media-monitor2/media/monitor/listeners.py | 22 +------------------ .../media-monitor2/media/monitor/organizer.py | 5 +---- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/python_apps/media-monitor2/media/monitor/listeners.py b/python_apps/media-monitor2/media/monitor/listeners.py index d3824a43c..74fea899a 100644 --- a/python_apps/media-monitor2/media/monitor/listeners.py +++ b/python_apps/media-monitor2/media/monitor/listeners.py @@ -9,27 +9,6 @@ from media.monitor.events import OrganizeFile, NewFile, MoveFile, DeleteFile, \ DeleteDirWatch from media.monitor.log import Loggable, get_logger -# We attempt to document a list of all special cases and hacks that the -# following classes should be able to handle. TODO : implement all of -# the following special cases -# -# properly as they only send a request for the dir and not for every -# file. Also more hacks are needed to check that the directory finished -# moving/copying? -# -# - In the case when a 'watched' directory's subdirectory is delete we -# should send a special request telling ApiController to delete a whole -# dir. This is done becasue pyinotify will not send an individual file -# delete event for every file in that directory -# -# - Special move events are required whenever a file is moved -# from a 'watched' directory into another 'watched' directory (or -# subdirectory). In this case we must identify the file by its md5 -# signature instead of it's filepath like we usually do. Maybe it's -# best to always identify a file based on its md5 signature?. Of course -# that's not possible for some modification events because the md5 -# signature will change... - # Note: Because of the way classes that inherit from pyinotify.ProcessEvent # interact with constructors. you should only instantiate objects from them # using keyword arguments. For example: @@ -126,6 +105,7 @@ class StoreWatchListener(BaseListener, Loggable, pyinotify.ProcessEvent): @mediate_ignored @IncludeOnly(mmp.supported_extensions) def process_create(self, event): + self.logger.info("PYINOTIFY") evt = NewFile(event) dispatcher.send(signal=self.signal, sender=self, event=evt) return evt diff --git a/python_apps/media-monitor2/media/monitor/organizer.py b/python_apps/media-monitor2/media/monitor/organizer.py index c632c0bb2..449a44d97 100644 --- a/python_apps/media-monitor2/media/monitor/organizer.py +++ b/python_apps/media-monitor2/media/monitor/organizer.py @@ -6,7 +6,6 @@ from media.monitor.handler import ReportHandler from media.monitor.log import Loggable from media.monitor.exceptions import BadSongFile from media.monitor.events import OrganizeFile -from media.monitor.metadata import Metadata from pydispatch import dispatcher from os.path import dirname @@ -59,15 +58,13 @@ class Organizer(ReportHandler,Loggable): new_path = mmp.organized_path(event.path, target_path, event.metadata.extract()) - # disgusting stuff... See hack in mmp.magic_move + # See hack in mmp.magic_move def new_dir_watch(d): def cb(): dispatcher.send(signal="add_subwatch", sender=self, directory=d) return cb - # TODO : Workaround doesn't work. Fix later - #Metadata.fix_title(event.path) mmp.magic_move(event.path, new_path, after_dir_make=new_dir_watch(dirname(new_path)))