This repository has been archived by the owner on Jul 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
prepare_ramdisk.py
58 lines (48 loc) · 1.44 KB
/
prepare_ramdisk.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import settings
import os
import shutil
from distutils import dir_util
if not settings.USE_RAM_DISK:
raise Exception('You should set USE_RAM_DISK to True in settings.py first')
all_paths = [
settings.CSD_DIRECTORY,
settings.INPUT_DIRECTORY,
settings.OUTPUT_DIRECTORY,
settings.STATS_DATA_DIRECTORY,
settings.INDIVIDUAL_DATA_DIRECTORY,
settings.EFFECT_DIRECTORY,
settings.TEMP_DIRECTORY
]
input_dir_not_ramdisk = os.path.join('.', 'input')
effects_dir_not_ramdisk = os.path.join('.', 'effects')
web_client_dir_name = 'web_client'
node_server_dir_name = 'node_server'
for path in all_paths:
if not os.path.exists(path):
print('Creating directory {}'.format(path))
os.makedirs(path)
print('Copying input audio files to input folder in RAM disk...')
dir_util.copy_tree(
input_dir_not_ramdisk,
settings.INPUT_DIRECTORY
)
print('Copying effects to RAM disk...')
dir_util.copy_tree(
effects_dir_not_ramdisk,
settings.EFFECT_DIRECTORY
)
print('Copying web client files to RAM disk...')
dir_util.copy_tree(
os.path.join('.', web_client_dir_name),
os.path.join(settings.BASE_DIR, web_client_dir_name)
)
shutil.copyfile(
os.path.join('.', 'index.html'),
os.path.join(settings.BASE_DIR, 'index.html')
)
print('Copying node server files to RAM disk...')
dir_util.copy_tree(
os.path.join('.', node_server_dir_name),
os.path.join(settings.BASE_DIR, node_server_dir_name)
)
print('Done')