ibombonato commited on
Commit
b1e98dc
·
1 Parent(s): 2337adf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -8,6 +8,7 @@ import numpy as np
8
  import matplotlib
9
  import scipy.io
10
  import scipy.io.wavfile
 
11
 
12
  matplotlib.use('Agg')
13
 
@@ -19,9 +20,13 @@ def get_chunk_times(in_filename, silence_threshold, silence_duration=1):
19
  silence_duration_re = re.compile('silence_duration: (\d+.\d+)')
20
  silence_end_re = re.compile('silence_end: (\d+.\d+)\s')
21
 
22
- logging.info(f"File {in_filename} exists? = {os.path.exists(in_filename)}")
 
 
23
 
24
- command = f"ffmpeg -i {in_filename} -af silencedetect=n=-{silence_threshold}dB:d={silence_duration} -f null - "
 
 
25
  out = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
26
 
27
  stdout, stderr = out.communicate()
 
8
  import matplotlib
9
  import scipy.io
10
  import scipy.io.wavfile
11
+ from pathlib import Path
12
 
13
  matplotlib.use('Agg')
14
 
 
20
  silence_duration_re = re.compile('silence_duration: (\d+.\d+)')
21
  silence_end_re = re.compile('silence_end: (\d+.\d+)\s')
22
 
23
+ logging.info(f"File {in_filename} exists? = {os.path.exists(in_filename)}")
24
+
25
+ fpath = Path(in_filename).absolute()
26
 
27
+ logging.info(f"Absolue path: {fpath}")
28
+
29
+ command = f"ffmpeg -i {fpath} -af silencedetect=n=-{silence_threshold}dB:d={silence_duration} -f null - "
30
  out = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
31
 
32
  stdout, stderr = out.communicate()