@@ -130,15 +130,14 @@ def rm(self, meta, folder_type, path):
130130 del (self .indices [folder_type ][index ])
131131 self ._save_indices ()
132132
133- def get_item_mtime (self ,folder ):
134- # logger.info (f"Getting latest modified time for folder : {folder }")
133+ def get_item_mtime (self ,file ):
134+ # logger.debug (f"Getting latest modified time for file : {file }")
135135 latest = 0
136- for root , _ , files in os .walk (folder ):
137- for f in files :
138- fp = os .path .join (root , f )
139- t = os .path .getmtime (fp )
140- if t > latest :
141- latest = t
136+ t = os .path .getmtime (file )
137+ if t > latest :
138+ latest = t
139+ logger .debug (f"Latest modified time updated to: { latest } " )
140+ # logger.debug("No changes in modified time detected.")
142141 return latest
143142
144143 def build_index (self ):
@@ -196,7 +195,7 @@ def build_index(self):
196195
197196 # Process each automation directory
198197 for automation_dir in os .listdir (folder_path ):
199- logger .debug (f"Checking automation directory: { automation_dir } " )
198+ # logger.debug(f"Checking automation directory: {automation_dir}")
200199 automation_path = os .path .join (folder_path , automation_dir )
201200 if not os .path .isdir (automation_path ):
202201 logger .debug (f"Skipping non-directory automation path: { automation_path } " )
@@ -206,33 +205,33 @@ def build_index(self):
206205 json_path = os .path .join (automation_path , "meta.json" )
207206
208207 if os .path .isfile (yaml_path ):
208+ # logger.debug(f"Found YAML config file: {yaml_path}")
209209 config_path = yaml_path
210210 elif os .path .isfile (json_path ):
211+ # logger.debug(f"Found JSON config file: {json_path}")
211212 config_path = json_path
212213 else :
214+ logger .debug (f"No config file found in { automation_path } , skipping" )
213215 continue
214- logger .debug (f"Processing config file: { config_path } " )
215-
216- key = f"{ repo_path } /{ folder_type } /{ automation_dir } "
217- current_item_keys .add (key )
218- mtime = self .get_item_mtime (automation_path )
216+ current_item_keys .add (config_path )
217+ mtime = self .get_item_mtime (config_path )
219218
220- old = self .modified_times .get (key )
219+ old = self .modified_times .get (config_path )
221220 old_mtime = old ["mtime" ] if isinstance (old , dict ) else old
222221
223222 # skip if unchanged
224223 if old_mtime == mtime and repos_changed != 1 :
225224 continue
226225
227226 # update mtime
228- logger .debug (f"{ key } is modified, index getting updated" )
227+ logger .debug (f"{ config_path } is modified, index getting updated" )
229228
230- self .modified_times [key ] = {
229+ self .modified_times [config_path ] = {
231230 "mtime" : mtime ,
232231 "date_time" : datetime .fromtimestamp (mtime ).strftime ("%Y-%m-%d %H:%M:%S" )
233232 }
234233 changed = True
235- # script changed, so reindex
234+ # meta file changed, so reindex
236235 self ._process_config_file (config_path , folder_type , automation_path , repo )
237236
238237 # remove deleted scripts
0 commit comments