Sign in to follow this  
Followers 0
queensoft

Extract intervals

1 post in this topic

#1 ·  Posted (edited)

I have a log file - attached.
It looks like this:

D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000001.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000002.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000003.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000004.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000005.jpg - Fail=False
...........
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000328.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000329.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000330.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000331.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000332.jpg - Fail=False
...........
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000744.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000745.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000746.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000747.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000748.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000749.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000750.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000751.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000752.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000753.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000754.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000755.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000756.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000757.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000758.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000759.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000760.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000761.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000762.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000763.jpg - Fail=True

I want to extract like this - first and last number (interval) for each True / False:
 

D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000001.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000328.jpg - Fail=False

D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000329.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000330.jpg - Fail=True

D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000331.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000745.jpg - Fail=False

D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000746.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000749.jpg - Fail=True

D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000750.jpg - Fail=False
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000753.jpg - Fail=False

D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000754.jpg - Fail=True
D:\Diverse\c70 video error analyse\001\20060413--#Hi8#\image000763.jpg - Fail=True

[sOLVED] Looks like I solved it (3rd time lucky) - compare each value True / False with it's neighbours (before and after value).

If it's the same, just delete that record from the array.

Go backwards in the array (from UBound to 1) because when deleting it screws up the total number and the index, if you were going from 0 to maximum.

Also, use UBound($logvideo02)-2 to 1 step -1 because forst alt last values are always kept. And you cannot compare last value to the next value (there is no next after last one). Nor first value with previous value.

#include <Array.au3>
$logvideo02 = FileReadToArray("logfile.txt")
For $i03 = UBound($logvideo02)-2 to 1 step -1
If (StringInStr($logvideo02[$i03], "True")>0) and (StringInStr($logvideo02[$i03+1], "True")>0) and (StringInStr($logvideo02[$i03-1], "True")>0) Then
_ArrayDelete($logvideo02,$i03)
EndIf
If (StringInStr($logvideo02[$i03], "False")>0) and (StringInStr($logvideo02[$i03+1], "False")>0) and (StringInStr($logvideo02[$i03-1], "False")>0) Then
_ArrayDelete($logvideo02,$i03)
EndIf
Next

frames_log_20060413--#Hi8#2.txt

Edited by queensoft

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0