Skip to content
This repository has been archived by the owner on Mar 14, 2020. It is now read-only.

Commit

Permalink
Fixed bug: invalid folders/archives were being picked up by the monitor;
Browse files Browse the repository at this point in the history
Resolves #139
  • Loading branch information
twiddli committed Mar 11, 2016
1 parent 4d90a31 commit 3de9cdc
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions version/io_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,17 +567,24 @@ def file_filter(self, event):
def on_created(self, event):
if not app_constants.OVERRIDE_MONITOR:
if self.file_filter(event):
t = Timer(8, self.CREATE_SIGNAL.emit, args=(event.src_path,))
t.start()
gs = 0
if event.src_path.endswith(utils.ARCHIVE_FILES):
gs = len(utils.check_archive(event.src_path))
elif event.is_directory:
g_dirs, g_archs = utils.recursive_gallery_check(event.src_path)
gs = len(g_dirs) + len(g_archs)
if gs:
self.CREATE_SIGNAL.emit(event.src_path)
else:
app_constants.OVERRIDE_MONITOR = False

def on_deleted(self, event):
if not app_constants.OVERRIDE_MONITOR:
path = event.src_path
gallery = gallerydb.GalleryDB.get_gallery_by_path(path)
if gallery:
self.DELETED_SIGNAL.emit(path, gallery)
if self.file_filter(event):
path = event.src_path
gallery = gallerydb.GalleryDB.get_gallery_by_path(path)
if gallery:
self.DELETED_SIGNAL.emit(path, gallery)
else:
app_constants.OVERRIDE_MONITOR = False

Expand Down

0 comments on commit 3de9cdc

Please sign in to comment.