CC-3299: Media monitor should not change the owner of watched files
- Media Monitor will try to set files to world readable upon adding
This commit is contained in:
parent
33fcbddcb9
commit
9ae0bed01a
|
@ -192,7 +192,7 @@ class AirtimeNotifier(Notifier):
|
|||
full_filepath = path+"/"+filename
|
||||
|
||||
if self.mmc.is_audio_file(full_filepath):
|
||||
if self.mmc.has_correct_permissions(full_filepath):
|
||||
if self.mmc.set_needed_file_permissions(full_filepath, False):
|
||||
self.logger.info("importing %s", full_filepath)
|
||||
event = {'filepath': full_filepath, 'mode': self.config.MODE_CREATE, 'is_recorded_show': False}
|
||||
mm.multi_queue.put(event)
|
||||
|
|
|
@ -80,7 +80,7 @@ class MediaMonitorCommon:
|
|||
# stat.S_IROTH - readable by all permission
|
||||
# stat.S_IXOTH - excutable by all permission
|
||||
# try to set permission
|
||||
if self.is_parent_directory(item, self.config.storage_directory) or self.is_parent_directory(item, self.config.imported_directory) or (item, self.config.organize_directory):
|
||||
if self.is_parent_directory(item, self.config.storage_directory) or self.is_parent_directory(item, self.config.imported_directory) or self.is_parent_directory(item, self.config.organize_directory):
|
||||
if is_dir is True:
|
||||
os.chmod(item, 02777)
|
||||
else:
|
||||
|
@ -89,14 +89,16 @@ class MediaMonitorCommon:
|
|||
# add world readable permission
|
||||
stats = os.stat(item)
|
||||
if is_dir is True:
|
||||
os.chmod(item, stats.st_mode | stat.S_IROTH | stat.S_IXOTH)
|
||||
bitor = stats.st_mode | stat.S_IROTH | stat.S_IXOTH
|
||||
else:
|
||||
os.chmod(item, stats.st_mode | stat.S_IROTH)
|
||||
|
||||
bitor = stats.st_mode | stat.S_IROTH
|
||||
os.chmod(item, bitor)
|
||||
except Exception, e:
|
||||
self.logger.error("Failed to change file's owner/group/permissions. %s", e)
|
||||
return False;
|
||||
finally:
|
||||
os.umask(omask)
|
||||
return True;
|
||||
|
||||
|
||||
#checks if path is a directory, and if it doesnt exist, then creates it.
|
||||
|
|
Loading…
Reference in New Issue