-
Notifications
You must be signed in to change notification settings - Fork 0
/
crawler.py
executable file
·41 lines (34 loc) · 1.03 KB
/
crawler.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
#!/usr/bin/env python3
import sys
import os
import os.path
import json
import getIds
import downloader
faces = []
apps = []
if os.path.isfile("watchfaces.json"):
f = open("watchfaces.json")
try:
faces = json.loads(f.read())
f.close()
except:
print("Could not read from watchfaces.json. Make sure the file is valid, otherwise delete it. Aborting...")
sys.exit()
else:
faces = getIds.getIds("watchfaces", "watchfaces.json")
if os.path.isfile("watchapps.json"):
f = open("watchapps.json")
try:
apps = json.loads(f.read())
f.close()
except:
print("Could not read from watchapps.json. Make sure the file is valid, otherwise delete it. Aborting...")
sys.exit()
else:
apps = getIds.getIds("watchapps", "watchapps.json")
if not downloader.tryMkdir("PebbleAppStore"):
print("Aborting...")
sys.exit()
print("Starting threaded download with a maximum of " + str(downloader.N_THREADS) + " threads.")
downloader.threaded_download(list(set(apps + faces)))