-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·56 lines (44 loc) · 1.64 KB
/
main.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
#!/usr/bin/env python
import os.path
import sys
import urllib.request
from PySide6.QtWidgets import QApplication
from PySide6 import QtGui
from social_distance.core.processing import NETWORK_FILENAMES
from social_distance.widgets.main_window import MainWindow
import resources
def download_file(url, filename):
if os.path.exists(filename):
print("File already exists: {}".format(filename))
return
print("Downloading {} to {}".format(url, filename))
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
urllib.request.install_opener(opener)
urllib.request.urlretrieve(url, filename)
def download_large_files():
nextcloud_folder = "https://nextcloud.pischulenok.xyz/s/iTpNXgwZbfEA4Ws/download?path=&files="
files = [
('data', 'video', 'VID_20220506_123738_720p.mp4'),
# ('data', 'video', 'VID_20220506_123738_1080.mp4'),
# ('data', 'video', 'VID_20220506_124411_720.mp4'),
# ('data', 'video', 'VID_20220506_124411_1080.mp4'),
*[('data', 'models', f'{fn}.weights') for fn in NETWORK_FILENAMES],
*[('data', 'models', f'{fn}.cfg') for fn in NETWORK_FILENAMES],
]
for path in files:
try:
os.makedirs(os.path.join(*path[:-1]))
except FileExistsError:
pass
download_file(nextcloud_folder + path[-1], os.path.join(*path))
def main():
# if getattr(sys, 'frozen', False):
download_large_files()
app = QApplication(sys.argv)
app.setWindowIcon(QtGui.QIcon(':/icon.png'))
window = MainWindow()
window.show()
sys.exit(app.exec())
if __name__ == '__main__':
main()