Skip to content

Commit c2fed45

Browse files
committed
Refactored. Moved session dir scanning into a dedicated function.
1 parent 233d6ac commit c2fed45

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

PostProcessing/PostProcessVideos.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,9 @@ def extract(input_dir, output_dir):
6666
# Release the video file
6767
cap.release()
6868

69-
70-
#
7169
#
7270
#
73-
def main(input_dir: Path, output_dir: Path):
74-
75-
# input_dir = Path("/Users/tbc/Desktop/videos/")
76-
# output_dir = Path("/Users/tbc/Desktop/output_videos/")
77-
78-
print(f"Scanning dir {str(input_dir)}...")
79-
71+
def scan_session_dir(input_dir: Path) -> Tuple[List[str], List[pd.DataFrame], List[str]]:
8072
#
8173
# Find all CSV files in the directory and read it into a data frame
8274
# Use the following regular expression to check of the client ID is a 16-digit hexadecimal.
@@ -94,8 +86,6 @@ def main(input_dir: Path, output_dir: Path):
9486
else:
9587
print("Discarding ", p.stem)
9688

97-
n_clients = len(clientIDs)
98-
9989
#
10090
# Accumulates the list of dataframes and mp4 files in the same order of the client IDs.
10191
df_list: List[pd.DataFrame] = []
@@ -121,6 +111,19 @@ def main(input_dir: Path, output_dir: Path):
121111
df_list.append(df)
122112
mp4_list.append(str(mp4_file))
123113

114+
return clientIDs, df_list, mp4_list
115+
116+
#
117+
#
118+
#
119+
def main(input_dir: Path, output_dir: Path):
120+
121+
print(f"Scanning dir {str(input_dir)}...")
122+
clientIDs, df_list, mp4_list = scan_session_dir(input_dir)
123+
124+
n_clients = len(clientIDs)
125+
126+
124127
#
125128
# Print collected info
126129
for i in range(n_clients):

0 commit comments

Comments
 (0)