forked from ThirteenAG/EA-Art-Collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dl.py
54 lines (46 loc) · 1.46 KB
/
dl.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
#!/usr/bin/python3.3
import errno
import os
import urllib.request
try:
os.mkdir('artwork')
os.mkdir('logo-mono')
os.mkdir('logo-color')
except OSError as exc:
if exc.errno != errno.EEXIST:
raise
pass
artwork = open('artwork.txt', 'r')
for link in artwork:
link = link.strip()
name = link.rsplit('/', 1)[-1]
filename = os.path.join('artwork', name)
if not os.path.isfile(filename):
print('Downloading: ' + filename)
try:
urllib.request.urlretrieve(link, filename)
except Exception as inst:
print(inst)
print(' Encountered unknown error. Continuing.')
artwork.close()
logos = open('logo-mono.txt', 'r')
for link in logos:
link = link.strip()
name = link.rsplit('/', 1)[-1]
filename = os.path.join('logo-mono', name)
filename2 = os.path.join('logo-color', name.replace("-mono-", "-"))
if not os.path.isfile(filename):
print('Downloading: ' + filename)
try:
urllib.request.urlretrieve(link, filename)
except Exception as inst:
print(inst)
print(' Encountered unknown error. Continuing.')
if not os.path.isfile(filename2):
print('Downloading: ' + filename2)
try:
urllib.request.urlretrieve(link.replace("-mono-", "-"), filename2)
except Exception as inst:
print(inst)
print(' Encountered unknown error. Continuing.')
logos.close();