forked from rc/aircox
SoundAdmin.add_view fix
This commit is contained in:
@ -114,16 +114,16 @@ class MonitorHandler(PatternMatchingEventHandler):
|
||||
pool = None
|
||||
jobs = {}
|
||||
|
||||
def __init__(self, subdir, pool):
|
||||
def __init__(self, subdir, pool, **sync_kw):
|
||||
"""
|
||||
subdir: AIRCOX_SOUND_ARCHIVES_SUBDIR or AIRCOX_SOUND_EXCERPTS_SUBDIR
|
||||
:param str subdir: sub-directory in program dirs to monitor \
|
||||
(AIRCOX_SOUND_ARCHIVES_SUBDIR or AIRCOX_SOUND_EXCERPTS_SUBDIR);
|
||||
:param concurrent.futures.Executor pool: pool executing jobs on file change;
|
||||
:param **sync_kw: kwargs passed to `SoundFile.sync`;
|
||||
"""
|
||||
self.subdir = subdir
|
||||
self.pool = pool
|
||||
if self.subdir == settings.AIRCOX_SOUND_ARCHIVES_SUBDIR:
|
||||
self.sync_kw = {'type': Sound.TYPE_ARCHIVE}
|
||||
else:
|
||||
self.sync_kw = {'type': Sound.TYPE_EXCERPT}
|
||||
self.sync_kw = sync_kw
|
||||
|
||||
patterns = ['*/{}/*{}'.format(self.subdir, ext)
|
||||
for ext in settings.AIRCOX_SOUND_FILE_EXT]
|
||||
@ -156,7 +156,6 @@ class MonitorHandler(PatternMatchingEventHandler):
|
||||
self.jobs[key] = handler
|
||||
|
||||
def done(r):
|
||||
print(':::: job done', key)
|
||||
if self.jobs.get(key) is handler:
|
||||
del self.jobs[key]
|
||||
handler.future.add_done_callback(done)
|
||||
|
Reference in New Issue
Block a user