@@ -1194,12 +1194,23 @@ def cluster_these_layers_update():
11941194 cluster_these_layers .options = []
11951195
11961196def recordings_update ():
1197- if M .dfs :
1197+ M .used_sounds = []
1198+ if kinds_touse .value == "" or labels_touse .value == "" :
1199+ wavfiles = []
1200+ for ext in M .audio_read_exts ():
1201+ wavfiles .extend (glob .glob ("**/*" + ext ,
1202+ root_dir = groundtruth_folder .value , recursive = True ))
1203+ wavfiles = list (filter (lambda x : 'oldfiles-' not in x and \
1204+ 'congruence-' not in x , wavfiles ))
1205+ if len (M .audio_read_rec2ch ()) > 1 :
1206+ wavfiles = [w + '-' + k for w in wavfiles for k in M .audio_read_rec2ch ().keys ()]
1207+ for wavfile in wavfiles :
1208+ M .used_sounds .append ({'file' : list (os .path .split (wavfile )),
1209+ 'ticks' : [1 , 1 ], 'kind' : '' , 'label' : ' ' })
1210+ elif M .dfs :
1211+ wavfiles = set ()
11981212 kinds = kinds_touse .value .split (',' )
11991213 labels = labels_touse .value .split (',' )
1200- wavfiles = set ()
1201- M .used_sounds = []
1202- M .used_recording2firstsound = {}
12031214 for df ,subdir in zip (M .dfs , M .subdirs ):
12041215 bidx = np .logical_and (np .array (df [3 ].apply (lambda x : x in kinds )),
12051216 np .array (df [4 ].apply (lambda x : x in labels )))
@@ -1212,6 +1223,7 @@ def recordings_update():
12121223 1 )))
12131224 wavfiles |= set (df [bidx ].apply (lambda x : os .path .join (subdir ,x [0 ]), 1 ))
12141225
1226+ if M .used_sounds :
12151227 M .used_starts_sorted = [x ['ticks' ][0 ] for x in M .used_sounds ]
12161228 isort = np .argsort (M .used_starts_sorted )
12171229 M .used_sounds = [M .used_sounds [x ] for x in isort ]
@@ -1220,6 +1232,7 @@ def recordings_update():
12201232 M .iused_stops_sorted = np .argsort (M .used_stops )
12211233
12221234 recordings .options = sorted (list (wavfiles ))
1235+ M .used_recording2firstsound = {}
12231236 for recording in recordings .options :
12241237 M .used_recording2firstsound [recording ] = \
12251238 next (filter (lambda x : os .path .join (* x [1 ]['file' ])== recording ,
0 commit comments