initial thumbnail and icon stuff

This commit is contained in:
ed
2021-05-25 03:37:01 +02:00
parent cbc449036f
commit 4dff726310
16 changed files with 533 additions and 45 deletions

21
copyparty/th_cli.py Normal file
View File

@@ -0,0 +1,21 @@
import os
from .th_srv import thumb_path, THUMBABLE
class ThumbCli(object):
def __init__(self, broker):
self.broker = broker
self.args = broker.args
def get(self, ptop, rem, mtime):
ext = rem.rsplit(".")[-1].lower()
if ext not in THUMBABLE:
return None
tpath = thumb_path(ptop, rem, mtime)
if os.path.exists(tpath):
return tpath
x = self.broker.put(True, "thumbsrv.get", ptop, rem, mtime)
return x.get()