@@ -371,8 +371,14 @@ def get_field_value(fields, field_name, default=""):
371371 start_timestamp = datetime .strptime (start_time , timestamp_format )
372372 conversation_id = file_name .split ('convo_' , 1 )[1 ].split ('_' )[0 ]
373373 conversationIds .append (conversation_id )
374+
374375 fields = result ['result' ]['contents' ][0 ]['fields' ]
375- duration = int (get_field_value (fields , 'Duration' , '0' ))
376+ duration_str = get_field_value (fields , 'Duration' , '0' )
377+ try :
378+ duration = int (duration_str )
379+ except (ValueError , TypeError ):
380+ duration = 0
381+
376382 end_timestamp = str (start_timestamp + timedelta (seconds = duration )).split ("." )[0 ]
377383 start_timestamp = str (start_timestamp ).split ("." )[0 ]
378384 summary = get_field_value (fields , 'summary' )
@@ -422,11 +428,15 @@ def get_field_value(fields, field_name, default=""):
422428 timestamp_format = "%Y-%m-%d %H_%M_%S" # Adjust format if necessary
423429 start_timestamp = datetime .strptime (start_time , timestamp_format )
424430
425- conversation_id = file_name .split ('convo_' , 1 )[1 ].split ('_' )[0 ]
426431 conversationIds .append (conversation_id )
427432
428433 fields = result ['result' ]['contents' ][0 ]['fields' ]
429- duration = int (get_field_value (fields , 'Duration' , '0' ))
434+ duration_str = get_field_value (fields , 'Duration' , '0' )
435+ try :
436+ duration = int (duration_str )
437+ except (ValueError , TypeError ):
438+ duration = 0
439+
430440 end_timestamp = str (start_timestamp + timedelta (seconds = duration ))
431441 end_timestamp = end_timestamp .split ("." )[0 ]
432442 start_timestamp = str (start_timestamp ).split ("." )[0 ]
0 commit comments