mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
cleanup + readme
This commit is contained in:
parent
b2b083fd0a
commit
e0e6291bdb
16
bin/README.md
Normal file
16
bin/README.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# copyparty-fuse.py
|
||||||
|
* mount a copyparty server as a local filesystem (read-only)
|
||||||
|
* **supports Linux** -- expect `117 MiB/s` sequential read over wifi
|
||||||
|
* **supports Windows!** -- expect `87 MiB/s` sequential read over wifi
|
||||||
|
* **supports macos** -- expect `17 MiB/s` sequential read over wifi
|
||||||
|
|
||||||
|
to run this on windows you
|
||||||
|
* definitely need `msys2`
|
||||||
|
* probably need `dokany` or `winfsp`, not sure which #todo
|
||||||
|
* should do this `/mingw64/bin/python3 ./copyparty-fuse.py n: http://192.168.1.69:3923/`
|
||||||
|
|
||||||
|
# copyparty-fuse🅱️.py
|
||||||
|
* mount a copyparty server as a local filesystem (read-only)
|
||||||
|
* does the same thing except more correct, `samba` approves
|
||||||
|
* **supports Linux** -- expect `18 MiB/s` (wait what)
|
||||||
|
* **supports Macos** -- probably
|
33
bin/copyparty-fuse.py
Normal file → Executable file
33
bin/copyparty-fuse.py
Normal file → Executable file
|
@ -36,7 +36,7 @@ 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:
|
||||||
sudo apk add fuse-dev
|
sudo apk add fuse
|
||||||
python3 -m pip install --user fusepy
|
python3 -m pip install --user fusepy
|
||||||
|
|
||||||
|
|
||||||
|
@ -474,7 +474,7 @@ class CPPF(Operations):
|
||||||
|
|
||||||
def readdir(self, path, fh=None):
|
def readdir(self, path, fh=None):
|
||||||
path = path.strip("/")
|
path = path.strip("/")
|
||||||
log("readdir {}".format(path))
|
log("readdir [{}] [{}]".format(path, fh))
|
||||||
|
|
||||||
ret = self.gw.listdir(path)
|
ret = self.gw.listdir(path)
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ class CPPF(Operations):
|
||||||
dbg("=" + repr(cache_stat))
|
dbg("=" + repr(cache_stat))
|
||||||
return cache_stat
|
return cache_stat
|
||||||
|
|
||||||
log("=404")
|
log("=404 ({})".format(path))
|
||||||
raise FuseOSError(errno.ENOENT)
|
raise FuseOSError(errno.ENOENT)
|
||||||
|
|
||||||
access = None
|
access = None
|
||||||
|
@ -585,8 +585,7 @@ class CPPF(Operations):
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
# quick compat for /mingw64/bin/python3 (msys2)
|
# quick compat for /mingw64/bin/python3 (msys2)
|
||||||
def open(self, path, flags):
|
def _open(self, path):
|
||||||
log("open [{}] [{}]".format(path, flags))
|
|
||||||
try:
|
try:
|
||||||
x = self.getattr(path)
|
x = self.getattr(path)
|
||||||
if x["st_mode"] <= 0:
|
if x["st_mode"] <= 0:
|
||||||
|
@ -594,7 +593,7 @@ class CPPF(Operations):
|
||||||
|
|
||||||
self.junk_fh_ctr += 1
|
self.junk_fh_ctr += 1
|
||||||
if self.junk_fh_ctr > 32000: # TODO untested
|
if self.junk_fh_ctr > 32000: # TODO untested
|
||||||
self.junk_fh_ctr = 4
|
self.junk_fh_ctr = 4
|
||||||
|
|
||||||
return self.junk_fh_ctr
|
return self.junk_fh_ctr
|
||||||
|
|
||||||
|
@ -602,13 +601,31 @@ class CPPF(Operations):
|
||||||
log("open ERR {}".format(repr(ex)))
|
log("open ERR {}".format(repr(ex)))
|
||||||
raise FuseOSError(errno.ENOENT)
|
raise FuseOSError(errno.ENOENT)
|
||||||
|
|
||||||
|
def open(self, path, flags):
|
||||||
|
log("open [{}] [{}]".format(path, flags))
|
||||||
|
return self._open(path)
|
||||||
|
|
||||||
|
def opendir(self, path):
|
||||||
|
log("opendir [{}]".format(path))
|
||||||
|
return self._open(path)
|
||||||
|
|
||||||
def flush(self, path, fh):
|
def flush(self, path, fh):
|
||||||
log("flush [{}] [{}]".format(path, fh))
|
log("flush [{}] [{}]".format(path, fh))
|
||||||
return True
|
|
||||||
|
|
||||||
def release(self, ino, fi):
|
def release(self, ino, fi):
|
||||||
log("release [{}] [{}]".format(ino, fi))
|
log("release [{}] [{}]".format(ino, fi))
|
||||||
return True
|
|
||||||
|
def releasedir(self, ino, fi):
|
||||||
|
log("releasedir [{}] [{}]".format(ino, fi))
|
||||||
|
|
||||||
|
def access(self, path, mode):
|
||||||
|
log("access [{}] [{}]".format(path, mode))
|
||||||
|
try:
|
||||||
|
x = self.getattr(path)
|
||||||
|
if x["st_mode"] <= 0:
|
||||||
|
raise Exception()
|
||||||
|
except:
|
||||||
|
raise FuseOSError(errno.ENOENT)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
22
bin/copyparty-fuseb.py
Normal file → Executable file
22
bin/copyparty-fuseb.py
Normal file → Executable file
|
@ -37,10 +37,10 @@ except:
|
||||||
mount a copyparty server (local or remote) as a filesystem
|
mount a copyparty server (local or remote) as a filesystem
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
python ./copyparty-fuseb.py -f -o allow_other,auto_unmount,nonempty,url=http://192.168.1.69:3923 /export/ro
|
python ./copyparty-fuseb.py -f -o allow_other,auto_unmount,nonempty,url=http://192.168.1.69:3923 /mnt/nas
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
sudo apk add fuse-dev
|
sudo apk add fuse-dev python3-dev
|
||||||
python3 -m pip install --user fuse-python
|
python3 -m pip install --user fuse-python
|
||||||
|
|
||||||
fork of copyparty-fuse.py based on fuse-python which
|
fork of copyparty-fuse.py based on fuse-python which
|
||||||
|
@ -540,7 +540,7 @@ class CPPF(Fuse):
|
||||||
|
|
||||||
if not path:
|
if not path:
|
||||||
ret = self.gw.stat_dir(time.time())
|
ret = self.gw.stat_dir(time.time())
|
||||||
log("=root")
|
dbg("=root")
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
cn = self.get_cached_dir(dirpath)
|
cn = self.get_cached_dir(dirpath)
|
||||||
|
@ -553,7 +553,7 @@ class CPPF(Fuse):
|
||||||
|
|
||||||
for cache_name, cache_stat, _ in dents:
|
for cache_name, cache_stat, _ in dents:
|
||||||
if cache_name == fname:
|
if cache_name == fname:
|
||||||
log("=file")
|
dbg("=file")
|
||||||
return cache_stat
|
return cache_stat
|
||||||
|
|
||||||
log("=404")
|
log("=404")
|
||||||
|
@ -562,10 +562,20 @@ class CPPF(Fuse):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
server = CPPF()
|
server = CPPF()
|
||||||
server.parser.add_option(mountopt="url", metavar="BASE_URL", default='http://127.0.0.1:3923/')
|
server.parser.add_option(mountopt="url", metavar="BASE_URL", default=None)
|
||||||
server.parse(values=server, errex=1)
|
server.parse(values=server, errex=1)
|
||||||
|
if not server.url or not str(server.url).startswith('http'):
|
||||||
|
print('\nerror:')
|
||||||
|
print(' need argument: -o url=<...>')
|
||||||
|
print(' need argument: mount-path')
|
||||||
|
print('example:')
|
||||||
|
print(' ./copyparty-fuseb.py -f -o allow_other,auto_unmount,nonempty,url=http://192.168.1.69:3923 /mnt/nas')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
server.init2()
|
server.init2()
|
||||||
server.main()
|
threading.Thread(target=server.main, daemon=True).start()
|
||||||
|
while True:
|
||||||
|
time.sleep(9001)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue