Ejemplo n.º 1
0
 def _check():
     _current_key = 0
     if os.path.exists(path):
         _current_key = file_md5(path) if content else int(os.path.getmtime(path))
             
     if _key['key'] != _current_key:
         _logger.debug('file is change, path: %s', path)
         _key['key'] = _current_key
         callback(*args, **kwargs)
Ejemplo n.º 2
0
 def _check():
     _has_changed = False
     _files = get_all_files(path, filter)
     _delete_files = []
     
     for _file in _files:
         _key = _file_list.get(_file, 0)
         _current_key = file_md5(_file) if content else int(os.path.getmtime(_file))
         if _key != _current_key:
             _file_list[_file] = _current_key
             _has_changed = True
         
         
     for _file in _file_list:
         if _file not in _files:
             _has_changed = True 
             _delete_files.append(_file)
             
     for _file in _delete_files:
         del _file_list[_file]
     
     if _has_changed:
         _logger.debug(_file_list)
         callback(*args, **kwargs)