init
Browse files- download_audio.py +40 -2
download_audio.py
CHANGED
@@ -1,3 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import json
|
2 |
import os
|
3 |
import tarfile
|
@@ -32,7 +71,6 @@ line_no_end = int(os.getenv("LINE_NO_END", 10000))
|
|
32 |
|
33 |
def wget(url: str, output_file: Optional[str] = None):
|
34 |
os.makedirs(os.path.dirname(output_file), exist_ok=True)
|
35 |
-
filename = os.path.basename(url) if not output_file else output_file
|
36 |
subprocess.run(["wget", url, "-O", output_file, "--tries", wget_max_retry, "--timeout", wget_timeout])
|
37 |
if not os.path.exists(output_file):
|
38 |
return False
|
@@ -41,7 +79,7 @@ def wget(url: str, output_file: Optional[str] = None):
|
|
41 |
tar = tarfile.open(output_file)
|
42 |
else:
|
43 |
tar = tarfile.open(output_file, "r:gz")
|
44 |
-
tar.extractall(os.path.dirname(
|
45 |
tar.close()
|
46 |
os.remove(output_file)
|
47 |
elif output_file.endswith('.gz'):
|
|
|
1 |
+
"""
|
2 |
+
enA-jaA: 718_606
|
3 |
+
|
4 |
+
LINE_NO_START=10000
|
5 |
+
LINE_NO_END=20000
|
6 |
+
LINE_NO_START=20000
|
7 |
+
LINE_NO_END=30000
|
8 |
+
LINE_NO_START=30000
|
9 |
+
LINE_NO_END=40000
|
10 |
+
LINE_NO_START=40000
|
11 |
+
LINE_NO_END=50000
|
12 |
+
LINE_NO_START=50000
|
13 |
+
LINE_NO_END=60000
|
14 |
+
LINE_NO_START=60000
|
15 |
+
LINE_NO_END=70000
|
16 |
+
LINE_NO_START=70000
|
17 |
+
LINE_NO_END=80000
|
18 |
+
LINE_NO_START=80000
|
19 |
+
LINE_NO_END=90000
|
20 |
+
LINE_NO_START=90000
|
21 |
+
LINE_NO_END=100000
|
22 |
+
|
23 |
+
|
24 |
+
LINE_NO_START=100000
|
25 |
+
LINE_NO_END=120000
|
26 |
+
|
27 |
+
LINE_NO_START=120000
|
28 |
+
LINE_NO_END=140000
|
29 |
+
|
30 |
+
LINE_NO_START=140000
|
31 |
+
LINE_NO_END=160000
|
32 |
+
|
33 |
+
LINE_NO_START=160000
|
34 |
+
LINE_NO_END=180000
|
35 |
+
|
36 |
+
LINE_NO_START=180000
|
37 |
+
LINE_NO_END=200000
|
38 |
+
|
39 |
+
"""
|
40 |
import json
|
41 |
import os
|
42 |
import tarfile
|
|
|
71 |
|
72 |
def wget(url: str, output_file: Optional[str] = None):
|
73 |
os.makedirs(os.path.dirname(output_file), exist_ok=True)
|
|
|
74 |
subprocess.run(["wget", url, "-O", output_file, "--tries", wget_max_retry, "--timeout", wget_timeout])
|
75 |
if not os.path.exists(output_file):
|
76 |
return False
|
|
|
79 |
tar = tarfile.open(output_file)
|
80 |
else:
|
81 |
tar = tarfile.open(output_file, "r:gz")
|
82 |
+
tar.extractall(os.path.dirname(output_file))
|
83 |
tar.close()
|
84 |
os.remove(output_file)
|
85 |
elif output_file.endswith('.gz'):
|