|
@@ -0,0 +1,32 @@
|
|
1
|
+import subprocess
|
|
2
|
+from io import TextIOWrapper
|
|
3
|
+import fs
|
|
4
|
+from networkx.generators.small import desargues_graph
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+class AudioSlicer:
|
|
8
|
+
|
|
9
|
+ destinationDirectory = ""
|
|
10
|
+
|
|
11
|
+ def __init__(self, destinationDirectory):
|
|
12
|
+ self.destinationDirectory = destinationDirectory
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+ def slice(self, audioFilePath, start, duration):
|
|
16
|
+ ' invokes external process'
|
|
17
|
+
|
|
18
|
+ print self.destinationDirectory + " = " + audioFilePath + " - " + start + " - " + duration
|
|
19
|
+
|
|
20
|
+ destinationFile = fs.join(self.destinationDirectory, fs.filename(audioFilePath))
|
|
21
|
+
|
|
22
|
+ command = ['ffmpeg', audioFilePath, '-t', duration, '-ss', start, '-acodec', 'copy', destinationFile]
|
|
23
|
+
|
|
24
|
+ for c in command:
|
|
25
|
+ print c
|
|
26
|
+
|
|
27
|
+ p = subprocess.Popen(['ls', '-l'], stdout=subprocess.PIPE)
|
|
28
|
+
|
|
29
|
+ for line in p.stdout.readlines():
|
|
30
|
+ print line
|
|
31
|
+
|
|
32
|
+
|