-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_test_data.py
57 lines (34 loc) · 1.12 KB
/
generate_test_data.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
import shutil
import random
from pathlib import Path
def usecase1_test(show_name, episodes):
file_type = ".mkv"
p = Path(show_name)
if p.exists():
shutil.rmtree(show_name)
p.mkdir()
for i in range(1, episodes + 1):
episode = Path(show_name + str(i) + file_type)
path = Path.cwd() / p / episode
Path(path).touch()
def usecase2_test(show_name, episodes):
file_type = ".mkv"
seasons = 4
file_hierarchy = {}
for i in range(1, seasons):
file_hierarchy[str(i)] = episodes//seasons
file_hierarchy[str(seasons)] = (episodes//seasons) + (episodes%seasons)
p = Path(show_name)
if p.exists():
shutil.rmtree(show_name)
p.mkdir()
episode_list = []
for i in range(1, episodes + 1):
episode_list.append(Path(show_name + str(i) + file_type))
for k, v in file_hierarchy.items():
s = p / "Season {}".format(k)
s.mkdir()
for i in range(v):
path = Path.cwd() / s / episode_list[i]
Path(path).touch()
episode_list = episode_list[v:]