-
Notifications
You must be signed in to change notification settings - Fork 4
/
createFolder.py
37 lines (36 loc) · 1.11 KB
/
createFolder.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
import os
import pickle
import network
from multiprocessing import Pool
def creater(courseName, courseDict):
p = Pool(4)
try:
os.mkdir(courseName)
except:
pass
for week, sections in courseDict.items():
try:
os.mkdir(courseName+'\\'+week)
except:
pass
for section, videos in sections.items():
try:
os.mkdir(courseName+'\\'+week+'\\'+section)
except:
pass
for video, info in videos.items():
fileName = video+'.'+info['format']
url = info['url']
path = courseName+'\\'+week+'\\'+section
#network.ariaDown(url, fileName, path)
if (fileName[-4:]=='m3u8' or info['format']=='pdf'):
network.urllibDown(url, fileName, path)
else:
p.apply_async(network.ariaDown, args=(url, fileName, path))
p.close()
p.join()
'''
with open('tempDict.pck', 'rb') as f:
courseDict = pickle.load(f)
creater('fuck', courseDict)
'''