CC-3630 : Deleting files from organize folder if they don't have correct Meta data
This commit is contained in:
parent
adddd1085c
commit
e2adaff5cf
1 changed files with 18 additions and 2 deletions
|
@ -137,8 +137,13 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
if self.mmc.is_parent_directory(pathname, self.config.organize_directory):
|
if self.mmc.is_parent_directory(pathname, self.config.organize_directory):
|
||||||
#file was created in /srv/airtime/stor/organize. Need to process and move
|
#file was created in /srv/airtime/stor/organize. Need to process and move
|
||||||
#to /srv/airtime/stor/imported
|
#to /srv/airtime/stor/imported
|
||||||
|
oldPath = pathname
|
||||||
pathname = self.mmc.organize_new_file(pathname)
|
pathname = self.mmc.organize_new_file(pathname)
|
||||||
name = os.path.basename(pathname)
|
|
||||||
|
#delete files from organize if they can not be read properly.
|
||||||
|
if pathname is None:
|
||||||
|
os.remove(oldPath)
|
||||||
|
return
|
||||||
|
|
||||||
self.mmc.set_needed_file_permissions(pathname, dir)
|
self.mmc.set_needed_file_permissions(pathname, dir)
|
||||||
is_recorded = self.mmc.is_parent_directory(pathname, self.config.recorded_directory)
|
is_recorded = self.mmc.is_parent_directory(pathname, self.config.recorded_directory)
|
||||||
|
@ -237,6 +242,11 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
del self.cookies_IN_MOVED_FROM[event.cookie]
|
del self.cookies_IN_MOVED_FROM[event.cookie]
|
||||||
if self.mmc.is_parent_directory(event.pathname, self.config.organize_directory):
|
if self.mmc.is_parent_directory(event.pathname, self.config.organize_directory):
|
||||||
filepath = self.mmc.organize_new_file(event.pathname)
|
filepath = self.mmc.organize_new_file(event.pathname)
|
||||||
|
|
||||||
|
#delete files from organize if they can not be read properly.
|
||||||
|
if filepath is None:
|
||||||
|
os.remove(event.pathname)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
filepath = event.pathname
|
filepath = event.pathname
|
||||||
|
|
||||||
|
@ -244,7 +254,11 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
self.file_events.append({'filepath': filepath, 'mode': self.config.MODE_MOVED})
|
self.file_events.append({'filepath': filepath, 'mode': self.config.MODE_MOVED})
|
||||||
else:
|
else:
|
||||||
if self.mmc.is_parent_directory(event.pathname, self.config.organize_directory):
|
if self.mmc.is_parent_directory(event.pathname, self.config.organize_directory):
|
||||||
self.mmc.organize_new_file(event.pathname)
|
filepath = self.mmc.organize_new_file(event.pathname)
|
||||||
|
|
||||||
|
#delete files from organize if they can not be read properly.
|
||||||
|
if filepath is None:
|
||||||
|
os.remove(event.pathname)
|
||||||
else:
|
else:
|
||||||
#show dragged from unwatched folder into a watched folder. Do not "organize".:q!
|
#show dragged from unwatched folder into a watched folder. Do not "organize".:q!
|
||||||
if self.mmc.is_parent_directory(event.pathname, self.config.recorded_directory):
|
if self.mmc.is_parent_directory(event.pathname, self.config.recorded_directory):
|
||||||
|
@ -285,8 +299,10 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
if not dir:
|
if not dir:
|
||||||
if self.mmc.is_audio_file(pathname):
|
if self.mmc.is_audio_file(pathname):
|
||||||
if pathname in self.ignore_event:
|
if pathname in self.ignore_event:
|
||||||
|
self.logger.info("pathname in ignore event")
|
||||||
self.ignore_event.remove(pathname)
|
self.ignore_event.remove(pathname)
|
||||||
elif not self.mmc.is_parent_directory(pathname, self.config.organize_directory):
|
elif not self.mmc.is_parent_directory(pathname, self.config.organize_directory):
|
||||||
|
self.logger.info("deleting a file not in organize")
|
||||||
#we don't care if a file was deleted from the organize directory.
|
#we don't care if a file was deleted from the organize directory.
|
||||||
self.file_events.append({'filepath': pathname, 'mode': self.config.MODE_DELETE})
|
self.file_events.append({'filepath': pathname, 'mode': self.config.MODE_DELETE})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue