mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
workaround python-issue2494 on windows
This commit is contained in:
parent
82441978c6
commit
9405597c15
|
@ -16,6 +16,7 @@ import errno
|
||||||
import struct
|
import struct
|
||||||
import builtins
|
import builtins
|
||||||
import threading
|
import threading
|
||||||
|
import traceback
|
||||||
import http.client # py2: httplib
|
import http.client # py2: httplib
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
@ -36,9 +37,13 @@ mount a copyparty server (local or remote) as a filesystem
|
||||||
usage:
|
usage:
|
||||||
python copyparty-fuse.py ./music http://192.168.1.69:3923/
|
python copyparty-fuse.py ./music http://192.168.1.69:3923/
|
||||||
|
|
||||||
dependencies:
|
dependencies (linux/macos):
|
||||||
sudo apk add fuse
|
sudo apk add fuse
|
||||||
python3 -m pip install --user fusepy
|
python3 -m pip install --user fusepy
|
||||||
|
|
||||||
|
dependencies (windows):
|
||||||
|
https://github.com/billziss-gh/winfsp/releases/latest
|
||||||
|
python3 -m pip install --user fusepy
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,6 +87,7 @@ def null_log(msg):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# set loglevel here
|
||||||
info = fancy_log
|
info = fancy_log
|
||||||
log = fancy_log
|
log = fancy_log
|
||||||
dbg = fancy_log
|
dbg = fancy_log
|
||||||
|
@ -172,7 +178,11 @@ class Gateway(object):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.parse_html(r)
|
try:
|
||||||
|
return self.parse_html(r)
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
raise
|
||||||
|
|
||||||
def download_file_range(self, path, ofs1, ofs2):
|
def download_file_range(self, path, ofs1, ofs2):
|
||||||
web_path = self.quotep("/" + "/".join([self.web_root, path])) + "?raw"
|
web_path = self.quotep("/" + "/".join([self.web_root, path])) + "?raw"
|
||||||
|
@ -218,8 +228,15 @@ class Gateway(object):
|
||||||
|
|
||||||
ftype, fname, fsize, fdate = m.groups()
|
ftype, fname, fsize, fdate = m.groups()
|
||||||
fname = html_dec(fname)
|
fname = html_dec(fname)
|
||||||
ts = datetime.strptime(fdate, "%Y-%m-%d %H:%M:%S").timestamp()
|
sz = 1
|
||||||
sz = int(fsize)
|
ts = 60 * 60 * 24 * 2
|
||||||
|
try:
|
||||||
|
sz = int(fsize)
|
||||||
|
ts = datetime.strptime(fdate, "%Y-%m-%d %H:%M:%S").timestamp()
|
||||||
|
except:
|
||||||
|
info("bad HTML or OS [{}] [{}]".format(fdate, fsize))
|
||||||
|
# python cannot strptime(1959-01-01) on windows
|
||||||
|
|
||||||
if ftype == "-":
|
if ftype == "-":
|
||||||
ret.append([fname, self.stat_file(ts, sz), 0])
|
ret.append([fname, self.stat_file(ts, sz), 0])
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue