-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmover.py
More file actions
38 lines (22 loc) · 1003 Bytes
/
mover.py
File metadata and controls
38 lines (22 loc) · 1003 Bytes
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
import os
import yaml
import sys
import shutil
# def move_screenshots_after_screengrab():
base_dir = sys.argv[1] if len(sys.argv) > 1 is not None else '.'
platform = sys.argv[2] if len(sys.argv) > 2 is not None else 'phone'
with open('config.yml', 'r') as config:
try:
config = yaml.load(config)
except yaml.YAMLError as exc:
print(exc)
for locale in config['locales']:
base_prefix = base_dir + '/' + locale + '/'
screengrab_dir = base_prefix + config['output_dir'][platform] + '/'
screenshots_dir = base_prefix + config['screenshots_dir'] + '/' + config['input_dir'][platform] + '/'
screenshots = [a for a in next(os.walk(screengrab_dir))[2] if not a.startswith('.')]
if not os.path.exists(screenshots_dir):
os.makedirs(screenshots_dir)
for screenshot in screenshots:
print('Move from ' + screengrab_dir + screenshot + ' to ' + screenshots_dir + screenshot)
shutil.move(screengrab_dir + screenshot, screenshots_dir + screenshot)