-
Notifications
You must be signed in to change notification settings - Fork 0
/
launcher.py
34 lines (29 loc) · 858 Bytes
/
launcher.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
import socket
print('Your IP address: %s'%' '.join(socket.gethostbyname_ex(socket.gethostname())[2]))
print('='*79)
print('== Loading modules...')
import ezshare
import sys
import os
print('== Uploading files...')
website=ezshare.Website()
def _walk(dn):
if os.path.isfile(dn):
yield dn
else:
for path,_dirs,files in os.walk(dn):
for file in files:
yield os.path.join(path,file)
for dn in sys.argv[1:]:
for fn in _walk(dn):
print(' ->',fn)
with open(fn,'rb') as f:
file=ezshare.File(
filename=os.path.basename(fn),
content=f.read(),
uploader=[fn,'ezShare launcher'],
)
website.FS[file.uuid]=file
print('== Starting server...')
os.chdir(os.path.split(sys.argv[0])[0])
ezshare.run(website)