File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
external_plugins/image_detecting_plugin Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -81,17 +81,24 @@ class NewFileHandler(FileSystemEventHandler):
8181 on_create.
8282 """
8383
84+ def __init__ (self ):
85+ super ().__init__ ()
86+ self .last_image_time = 0
87+
8488 def extract_timestamp (self , file_path ):
8589 basename = os .path .basename (file_path )
8690 try :
87- # Expected format: 20250714-21:51:49-00.jpeg
91+ # Expected format: 20250714-21:51:49-00.jpg
8892 if "-" in basename and ":" in basename :
89- # Splitting to get date and time parts
90- date_part , time_part = basename .split ("-" )[0 ], basename .split ("-" )[1 ]
91- datetime_str = date_part + time_part .replace (":" , "" )
92- if len (datetime_str ) == 14 :
93- ts = time .strptime (datetime_str , "%Y%m%d%H%M%S" )
94- return time .mktime (ts )
93+ # Splitting logic
94+ parts = basename .split ("-" )
95+ if len (parts ) >= 2 and ":" in parts [1 ]:
96+ date_part = parts [0 ]
97+ time_part = parts [1 ].replace (":" , "" )
98+ datetime_str = date_part + time_part
99+ if len (datetime_str ) == 14 :
100+ ts = time .strptime (datetime_str , "%Y%m%d%H%M%S" )
101+ return time .mktime (ts )
95102 except Exception as e :
96103 logging .warning (f"Filename parsing failed: { basename } — { e } " )
97104
You can’t perform that action at this time.
0 commit comments