def check_permissions(self): if not Prefs["subtitles.save.filesystem"] or not Prefs[ "check_permissions"]: return True self.missing_permissions = [] use_ignore_fs = Prefs["subtitles.ignore_fs"] all_permissions_ok = True for section in self.sections: if section.key not in self.enabled_sections: continue title = section.title for location in section: path_str = location.path if isinstance(path_str, unicode): path_str = path_str.encode(self.fs_encoding) if use_ignore_fs: # check whether we've got an ignore file inside the section path if self.is_physically_ignored(path_str): continue if self.is_path_ignored(path_str): # is the path in our ignored paths setting? continue # section not ignored, check for write permissions if not check_write_permissions(path_str): # not enough permissions self.missing_permissions.append((title, location.path)) all_permissions_ok = False return all_permissions_ok
def check_permissions(self): if not cast_bool(Prefs["subtitles.save.filesystem"]) or not cast_bool(Prefs["check_permissions"]): return True self.missing_permissions = [] use_include_exclude_fs = self.include_exclude_sz_files all_permissions_ok = True for section in self.sections: if section.key not in self.enabled_sections: continue title = section.title for location in section: path_str = location.path if isinstance(path_str, unicode): path_str = path_str.encode(self.fs_encoding) if not os.path.exists(path_str): continue if use_include_exclude_fs: # check whether we've got an ignore file inside the section path if not self.is_physically_wanted(path_str): continue if not self.is_path_wanted(path_str): # is the path in our ignored paths setting? continue # section not ignored, check for write permissions if not check_write_permissions(path_str): # not enough permissions self.missing_permissions.append((title, location.path)) all_permissions_ok = False return all_permissions_ok