CC-2743: Import fails on certain files with
'Exception can't sync to an MPEG frame' - fixed by handling IN_CLOSE_WRITE instead of IN_CREATE
This commit is contained in:
parent
9366938240
commit
f670158c6d
|
@ -86,16 +86,19 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
self.logger.info("%s removed from watch folder list successfully.", path)
|
self.logger.info("%s removed from watch folder list successfully.", path)
|
||||||
else:
|
else:
|
||||||
self.logger.info("Removing the watch folder failed: %s", res['msg']['error'])
|
self.logger.info("Removing the watch folder failed: %s", res['msg']['error'])
|
||||||
|
|
||||||
#event.dir: True if the event was raised against a directory.
|
#event.dir: True if the event was raised against a directory.
|
||||||
#event.name: filename
|
#event.name: filename
|
||||||
#event.pathname: pathname (str): Concatenation of 'path' and 'name'.
|
#event.pathname: pathname (str): Concatenation of 'path' and 'name'.
|
||||||
def process_IN_CREATE(self, event):
|
# we used to use IN_CREATE event, but the IN_CREATE event gets fired before the
|
||||||
|
# copy was done. Hence, IN_CLOSE_WRITE is the correct one to handle.
|
||||||
|
def process_IN_CLOSE_WRITE(self, event):
|
||||||
|
self.logger.info("event: %s", event)
|
||||||
self.handle_created_file(event.dir, event.pathname, event.name)
|
self.handle_created_file(event.dir, event.pathname, event.name)
|
||||||
|
|
||||||
def handle_created_file(self, dir, pathname, name):
|
def handle_created_file(self, dir, pathname, name):
|
||||||
if not dir:
|
if not dir:
|
||||||
self.logger.debug("PROCESS_IN_CREATE: %s, name: %s, pathname: %s ", dir, name, pathname)
|
self.logger.debug("PROCESS_IN_CLOSE_WRITE: %s, name: %s, pathname: %s ", dir, name, pathname)
|
||||||
#event is because of a created file
|
#event is because of a created file
|
||||||
|
|
||||||
if self.mmc.is_temp_file(name) :
|
if self.mmc.is_temp_file(name) :
|
||||||
|
|
Loading…
Reference in New Issue