cc-4105: fixed bug with editing metadata id3v2

This commit is contained in:
Rudi Grinberg 2012-08-10 15:38:25 -04:00
parent 0e2d523bf6
commit ee1491a487
4 changed files with 19 additions and 16 deletions

View File

@ -91,9 +91,9 @@ class BaseEvent(Loggable):
class FakePyinotify(object): class FakePyinotify(object):
""" """
sometimes we must create our own pyinotify like objects to instantiate sometimes we must create our own pyinotify like objects to
objects from the classes below whenever we want to turn a single event into instantiate objects from the classes below whenever we want to turn
multiple events a single event into multiple events
""" """
def __init__(self, path): def __init__(self, path):
self.pathname = path self.pathname = path

View File

@ -125,14 +125,15 @@ class StoreWatchListener(BaseListener, Loggable, pyinotify.ProcessEvent):
def process_IN_MOVED_FROM(self, event): def process_IN_MOVED_FROM(self, event):
# Is either delete dir or delete file # Is either delete dir or delete file
evt = self.process_delete(event) 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_DELETE(self,event): self.process_delete(event)
def process_IN_MOVE_SELF(self, event): def process_IN_MOVE_SELF(self, event):
if '-unknown-path' in event.pathname: if '-unknown-path' in event.pathname:
event.pathname = event.pathname.replace('-unknown-path','') event.pathname = event.pathname.replace('-unknown-path','')
self.delete_watch_dir(event) 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): def delete_watch_dir(self, event):
e = DeleteDirWatch(event) e = DeleteDirWatch(event)

View File

@ -77,11 +77,12 @@ class Manager(Loggable):
""" """
creates an organizer at new destination path or modifies the old one creates an organizer at new destination path or modifies the old one
""" """
# We avoid creating new instances of organize because of the way it # TODO : find a proper fix for the following hack
# interacts with pydispatch. We must be careful to never have more than # We avoid creating new instances of organize because of the way
# one instance of OrganizeListener but this is not so easy. (The # it interacts with pydispatch. We must be careful to never have
# singleton hack in Organizer) doesn't work. This is the only thing # more than one instance of OrganizeListener but this is not so
# that seems to work. # easy. (The singleton hack in Organizer) doesn't work. This is
# the only thing that seems to work.
if self.organize['organizer']: if self.organize['organizer']:
o = self.organize['organizer'] o = self.organize['organizer']
o.channel = self.organize_channel o.channel = self.organize_channel

View File

@ -7,11 +7,12 @@ from media.monitor.exceptions import BadSongFile
class Organizer(ReportHandler,Loggable): class Organizer(ReportHandler,Loggable):
""" """
Organizer is responsible to to listening to OrganizeListener events and Organizer is responsible to to listening to OrganizeListener events
committing the appropriate changes to the filesystem. It does not in any and committing the appropriate changes to the filesystem. It does
interact with WatchSyncer's even when the the WatchSyncer is a "storage not in any interact with WatchSyncer's even when the the WatchSyncer
directory". The "storage" directory picks up all of its events through is a "storage directory". The "storage" directory picks up all of
pyinotify. (These events are fed to it through StoreWatchListener) its events through pyinotify. (These events are fed to it through
StoreWatchListener)
""" """
_instance = None _instance = None