🤬
  • ■ ■ ■ ■ ■ ■
    changedetectionio/fetch_processor/__init__.py
    1 1  class fetch_processor():
    2 2   contents = b''
    3 3   screenshot = None
     4 + history_artifact_suffix = 'txt'
    4 5   
    5 6   """
    6 7   base class for all fetch processors
    skipped 31 lines
    38 39   proxy_args = self.datastore.proxy_list[0][0]
    39 40   
    40 41   return proxy_args
     42 + 
  • ■ ■ ■ ■ ■ ■
    changedetectionio/model/Watch.py
    skipped 147 lines
    148 148   bump = self.history
    149 149   return self.__newest_history_key
    150 150   
    151  - # Save some text file to the appropriate path and bump the history
    152  - # result_obj from fetch_site_status.run()
    153  - def save_history_text(self, contents, timestamp):
     151 + def save_history_artifact(self, contents: bytes, timestamp, suffix='txt'):
    154 152   import uuid
    155 153   import logging
    156 154   
    skipped 1 lines
    158 156   
    159 157   self.ensure_data_dir_exists()
    160 158   
    161  - snapshot_fname = "{}/{}.stripped.txt".format(output_path, uuid.uuid4())
    162  - logging.debug("Saving history text {}".format(snapshot_fname))
     159 + snapshot_fname = "{}/{}.{}".format(output_path, uuid.uuid4(), suffix)
     160 + logging.debug("Saving history artifact {}".format(snapshot_fname))
    163 161   
    164 162   with open(snapshot_fname, 'wb') as f:
    165 163   f.write(contents)
    skipped 92 lines
  • ■ ■ ■ ■ ■
    changedetectionio/update_worker.py
    skipped 249 lines
    250 250   if process_changedetection_results:
    251 251   try:
    252 252   watch = self.datastore.data['watching'][uuid]
    253  - fname = "" # Saved history text filename
    254 253   
    255 254   # For the FIRST time we check a site, or a change detected, save the snapshot.
    256 255   if changed_detected or not watch['last_checked']:
    257 256   # A change was detected
    258  - watch.save_history_text(contents=update_handler.contents, timestamp=str(round(time.time())))
     257 + watch.save_history_artifact(contents=update_handler.contents, timestamp=str(round(time.time())), suffix=update_handler.history_artifact_suffix)
    259 258   
    260 259   self.datastore.update_watch(uuid=uuid, update_obj=update_obj)
    261 260   
    skipped 36 lines
Please wait...
Page is in error, reload to recover