Hendrik Schroeter commited on
Commit
fe04ae7
1 Parent(s): 46414ac

try fix filtering

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -253,11 +253,13 @@ def spec_im(
253
 
254
  def cleanup_tmp(filter: List[str] = [], hours_keep=2):
255
  filter.append("p232")
 
256
  # Cleanup some old wav files
257
  if os.path.exists("/tmp"):
258
  for f in glob.glob("/tmp/*"):
259
  is_old = (time.time() - os.path.getmtime(f)) / 3600 > hours_keep
260
- if is_old and (filt not in f for filt in filter):
 
261
  try:
262
  os.remove(f)
263
  logger.info(f"Removed file {f}")
 
253
 
254
  def cleanup_tmp(filter: List[str] = [], hours_keep=2):
255
  filter.append("p232")
256
+ logger.info(f"{filter}")
257
  # Cleanup some old wav files
258
  if os.path.exists("/tmp"):
259
  for f in glob.glob("/tmp/*"):
260
  is_old = (time.time() - os.path.getmtime(f)) / 3600 > hours_keep
261
+ filtered = any(filt in f for filt in filter)
262
+ if is_old and not filtered:
263
  try:
264
  os.remove(f)
265
  logger.info(f"Removed file {f}")